public void ChangeItemStats(Equipment item, StatChangeType type) { if (type == StatChangeType.ADD && addedStats) { return; } if (type == StatChangeType.REMOVE && !addedStats) { return; } Affix affix = GetAffix(); if (affix != null) { affix.GetVanillaStatMods().ForEach(x => x.ApplyToItem(percent, item, type)); } if (type == StatChangeType.ADD) { addedStats = true; } if (type == StatChangeType.REMOVE) { addedStats = false; } }
public void ChangeItemStats(Equipment item, StatChangeType type) { if (type == StatChangeType.ADD && addedStats) { return; } if (type == StatChangeType.REMOVE && !addedStats) { return; } Equipment def = (Equipment)Cached.GetDefaultItemPrefab(item); int index = 0; var stats = VanillaStats.Instance.GetAllStatsItemHasOrderedByIndex(item); while (percents.Count < stats.Count) { percents.Add(RollPercent(item)); } foreach (VanillaStat stat in stats) { float defaultVal = stat.GetStat(def); if (defaultVal != 0) { float currentVal = stat.GetStat(item); float shouldBe = percents[index] * defaultVal / 100F; int diff = (int)(shouldBe - defaultVal); // we want pretty numbers if (type == StatChangeType.REMOVE) { diff *= -1; } stat.SetStat(item, currentVal + diff); } index++; } if (type == StatChangeType.ADD) { addedStats = true; } if (type == StatChangeType.REMOVE) { addedStats = false; } }
public bool Matches( string statName, StatChangeType change, string[] reactableTypes ) { return(Matches( new string[] { statName }, new StatChangeType[] { change }, reactableTypes )); }
public void ApplyToItem(int percent, Equipment item, StatChangeType type = StatChangeType.ADD) { int val = (int)GetValue(percent); if (item.TwoHanded) { val *= 2; // if it's 2 handed weapon, make the stat boost double. } if (type == StatChangeType.REMOVE) { val *= -1; // reverse to remove the stats } stat.SetStat(item, stat.GetStat(item) + val); }
public StatChange(string stat, StatChangeType change) { statName = stat; changeType = change; }
public bool Matches( string statName, StatChangeType change, string[] reactableTypes ) { return Matches( new string[]{statName}, new StatChangeType[]{change}, reactableTypes ); }
public bool Matches( string[] statNames, StatChangeType[] changes, string[] reactableTypes ) { bool statNameOK = statNames == null || statNames.Length == 0 || statNames.Contains(effect.statName); bool changeOK = changes == null || changes.Length == 0 || changes.Any(delegate(StatChangeType c) { switch(c) { case StatChangeType.Any: return true; case StatChangeType.NoChange: return value == initialValue; case StatChangeType.Change: return value != initialValue; case StatChangeType.Increase: return value > initialValue; case StatChangeType.Decrease: return value < initialValue; } return false; }); bool typesOK = reactableTypes == null || reactableTypes.Length == 0 || reactableTypes.All(t => effect.reactableTypes.Contains(t)); return statNameOK && changeOK && typesOK; }
public GameEffectStat(GameCharacter inputAffectedCharacter, StatChangeType inputChangedStatType, int inputStatChangeMagnitude) { affectedCharacter = inputAffectedCharacter; ChangedStatType = inputChangedStatType; StatChangeMagnitude = inputStatChangeMagnitude; }