Skip to content

Instantly share code, notes, and snippets.

@egocarib
Created July 6, 2019 17:14
Show Gist options
  • Save egocarib/c9356f12015075c3ca6b569316156875 to your computer and use it in GitHub Desktop.
Save egocarib/c9356f12015075c3ca6b569316156875 to your computer and use it in GitHub Desktop.
sValue calc
string a2 = "NPC";
if (this.Property.ContainsKey("Role"))
{
a2 = this.Property["Role"];
}
if (a2 == "Minion" && (statistic.Name == "Strength" || statistic.Name == "Agility" || statistic.Name == "Toughness" || statistic.Name == "Willpower" || statistic.Name == "Intelligence" || statistic.Name == "Ego"))
{
statistic.Boost--;
}
int num2 = 0;
int num3 = 0;
if (this.Statistics.ContainsKey("Level"))
{
num3 = this.Statistics["Level"].Value / 5 + 1;
}
if (statistic.sValue.Contains(","))
{
string[] array = statistic.sValue.Split(new char[]
{
','
});
for (int i = 0; i < array.Length; i++)
{
if (array[i].Contains("(t"))
{
if (array[i].Contains("(t)"))
{
array[i] = array[i].Replace("(t)", num3.ToString());
}
if (array[i].Contains("(t-1)"))
{
array[i] = array[i].Replace("(t-1)", (num3 - 1).ToString());
}
if (array[i].Contains("(t+1)"))
{
array[i] = array[i].Replace("(t+1)", (num3 + 1).ToString());
}
}
}
for (int j = 0; j < array.Length; j++)
{
num2 += array[j].RollCached();
}
}
else
{
string text = statistic.sValue;
if (text.Contains("(t"))
{
if (text.Contains("(t)"))
{
text = text.Replace("(t)", num3.ToString());
}
if (text.Contains("(t-1)"))
{
text = text.Replace("(t-1)", (num3 - 1).ToString());
}
if (text.Contains("(t+1)"))
{
text = text.Replace("(t+1)", (num3 + 1).ToString());
}
}
num2 += text.RollCached();
}
statistic.BaseValue = num2;
if (statistic.Boost > 0)
{
statistic.BaseValue += (int)Math.Ceiling((double)((float)num2 * 0.25f * (float)statistic.Boost));
}
else
{
statistic.BaseValue += (int)Math.Ceiling((double)((float)num2 * 0.2f * (float)statistic.Boost));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment