public bool ContainsStat(CoreStats stat) { if (GetModType() == ItemModType.Status) { return(false); } return(data.isStatType(ItemModEffects.Core) && data.isStat(stat)); }
public float GetValue(CoreStats stat, float ilvl, int seed) { if (!ContainsStat(stat)) { return(0); } return(data.GetModEffect(ilvl, seed)); }
public override int GetStatValue(CoreStats stat, float ilvl) { if (stat == CoreStats.Defense) { return(Defense + UnityEngine.Mathf.FloorToInt(Multiplier * ilvl)); } return(base.GetStatValue(stat, ilvl)); }
void UpdateStatValue(CoreStats stat, int difference) { //print(stat.ToString() + " [" + difference + "]"); if (!CoreStatsUpdates.ContainsKey(stat)) { print("Error: No UI Text Element for stat: " + stat); return; } UpdateStatValue(CoreStatsUpdates[stat], difference); }
public bool isStat(CoreStats stat) { if (CoreStat == null) { return(false); } if (CoreStat == stat) { return(true); } return(false); }
public int GetStatDifference(CoreStats stat, Item data, Hero hero) { // Get the base hero stats without the item // Get the (original % effect) then remove the item stats after the multi float heroBaseStat = (hero.GetCoreStat(stat) / hero.GetStatMultiplier(stat)) - GetStats(stat); float baseMulti = hero.GetStatMultiplier(stat) - GetMultiplier(stat); // Get the hero stats with the new item // Add the item stats before the multi then scale by the % effect, finish by subtracting the original value to get the difference float diffValue = ((heroBaseStat + data.GetStats(stat)) * (baseMulti + data.GetMultiplier(stat))) - hero.GetCoreStat(stat); return(Mathf.RoundToInt(diffValue)); // return data.GetStats(stat) - GetStats(stat); }
public float GetStatMultiplier(CoreStats stat) { float multiplier = 1f; foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { multiplier += EquipedItems[type].GetMultiplier(stat); } } return(multiplier); }
public string GetDisplayValue(CoreStats stat, float ilvl, int seed) { if (!ContainsStat(stat)) { return(""); } string result = ""; switch (data.ModType) { case ItemModType.Add: result = "+" + Mathf.RoundToInt(data.GetModEffect(ilvl, seed)) + " " + stat.ToString(); break; case ItemModType.Multi: default: Debug.Log("[Display Stat] " + stat + ": " + (data.GetModEffect(ilvl, seed))); result = "+" + Mathf.RoundToInt(data.GetModEffect(ilvl, seed) * 100f) + "% " + stat.ToString(); break; } return(result); }
public int GetStats(CoreStats stat) { int total = 0; if (data.Type == ItemType.Weapon) { total = ((ItemWeapon)data).GetStatValue(stat, ItemLevel); } else if (data.Type == ItemType.Armor) { total = ((ItemArmor)data).GetStatValue(stat, ItemLevel); } else { total = data.GetStatValue(stat, ItemLevel); } Random.InitState(_VarianceSeed); foreach (ItemAffix affix in Affixes) { if (affix.isStatType(ItemModEffects.Core)) { switch (affix.GetModType()) { case ItemModType.Add: total += Mathf.RoundToInt(affix.GetValue(stat, ItemLevel, _VarianceSeed)); break; default: break; } } } return(total); }
public float GetMultiplier(CoreStats stat) { float multiplier = 0f; Random.InitState(_VarianceSeed); foreach (ItemAffix affix in Affixes) { if (affix.isStatType(ItemModEffects.Core)) { switch (affix.GetModType()) { case ItemModType.Multi: multiplier += affix.GetValue(stat, ItemLevel, _VarianceSeed); break; default: break; } } } return(multiplier); }
public bool isStat(CoreStats stat) { return(data.isStat(stat)); }
List <AffixDisplayInformation> AddToAffixList(List <AffixDisplayInformation> list, CoreStats stat, ItemAffix affix) { bool existsInList = false; foreach (AffixDisplayInformation info in list) { if (info.core != null && info.core == stat && info.type == affix.GetModType()) { info.value += affix.GetValue(stat, item.ItemLevel, item.VarianceSeed); existsInList = true; } } if (!existsInList) { AffixDisplayInformation info = new AffixDisplayInformation(); info.core = stat; info.value = affix.GetValue(stat, item.ItemLevel, item.VarianceSeed); info.type = affix.GetModType(); list.Add(info); } return(list); }
public virtual int GetStatValue(CoreStats stat, float ilvl) { return(0); }
public int StatDifference(CoreStats stat, ItemData data, float ilvl) { int results = GetStatValue(stat, ilvl) - data.GetStatValue(stat, ilvl); return(results); }
// Use this for initialization protected override void Start() { motor = GetComponent <CoreMotor>(); stats = GetComponent <CoreStats>(); base.Start(); }
public int GetCoreStat(CoreStats stat) { int results = 0; int vitality = 0; float multiplier = 1f; float altmultiplier = 1f; LeaderSkill LeadershipSkill = PlayerManager.Instance.CurrentLeaderSkill; switch (stat) { case CoreStats.Health: // Calculate health vitality = (GetPrimaryStat(PrimaryStats.Vitality)); foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { vitality += EquipedItems[type].GetStats(PrimaryStats.Vitality); altmultiplier += EquipedItems[type].GetMultiplier(PrimaryStats.Vitality); multiplier += EquipedItems[type].GetMultiplier(stat); } } results = Mathf.RoundToInt(43 + (Level * 7) + (vitality * altmultiplier) * 10); foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { results += EquipedItems[type].GetStats(stat); } } //Debug.Log(stat + " calc: " + results + " * " + (multiplier * 100f).ToString("0") + "%"); if (LeadershipSkill != null && LeadershipSkill.type == LeadershipSkillType.CoreStatBoost && LeadershipSkill.coreStat == CoreStats.Health) { return(Mathf.RoundToInt(results * multiplier * LeadershipSkill.Multiplier)); } else { return(Mathf.RoundToInt(results * multiplier)); } case CoreStats.Damage: // Calculate the damage switch (data.Class) { case HeroClass.Bruiser: case HeroClass.Tank: // Attackers use strength for their attack int strength = GetPrimaryStat(PrimaryStats.Strength); foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { strength += EquipedItems[type].GetStats(PrimaryStats.Strength); altmultiplier += EquipedItems[type].GetMultiplier(PrimaryStats.Strength); } } // Hero Damage based on class results = Mathf.RoundToInt(strength * altmultiplier * 1.5f); break; case HeroClass.Mage: // Mages use Int for their attack int intelligence = GetPrimaryStat(PrimaryStats.Intelligence); foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { intelligence += EquipedItems[type].GetStats(PrimaryStats.Intelligence); altmultiplier += EquipedItems[type].GetMultiplier(PrimaryStats.Intelligence); } } // Hero Damage based on class results = Mathf.RoundToInt(intelligence * altmultiplier * 2f); break; case HeroClass.Assassin: // Mages use Int for their attack int speed = GetPrimaryStat(PrimaryStats.Speed); foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { speed += EquipedItems[type].GetStats(PrimaryStats.Speed); altmultiplier += EquipedItems[type].GetMultiplier(PrimaryStats.Speed); } } // Hero Damage based on class results = Mathf.RoundToInt(speed * altmultiplier); break; } // Get Weapon Damage if (EquipedItems.ContainsKey(EquipmentType.Weapon) && EquipedItems[EquipmentType.Weapon] != null) { results += ((ItemWeapon)EquipedItems[EquipmentType.Weapon].data).Damage; } // Get added damage from Affixes foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type].Affixes.Count > 0 && type != EquipmentType.Weapon) { results += EquipedItems[type].GetStats(stat); multiplier += EquipedItems[type].GetMultiplier(stat); } } //Debug.Log(stat + " calc: " + results + " * " + (multiplier * 100f).ToString("0") + "%"); if (LeadershipSkill != null && LeadershipSkill.type == LeadershipSkillType.CoreStatBoost && LeadershipSkill.coreStat == CoreStats.Damage) { return(Mathf.RoundToInt(results * multiplier * LeadershipSkill.Multiplier)); } else { return(Mathf.RoundToInt(results * multiplier)); } case CoreStats.Defense: vitality = GetPrimaryStat(PrimaryStats.Vitality); foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { vitality += EquipedItems[type].GetStats(PrimaryStats.Vitality); altmultiplier += EquipedItems[type].GetMultiplier(PrimaryStats.Vitality); } } // Hero Defense results = Mathf.RoundToInt(vitality * altmultiplier * 3.5f); // Item Defense foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { results += EquipedItems[type].GetStats(stat); multiplier += EquipedItems[type].GetMultiplier(stat); } } // Hero Strength switch (data.Class) { case HeroClass.Tank: int additionalDefense = GetPrimaryStat(PrimaryStats.Strength); altmultiplier = 1f; // Item Strength foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { additionalDefense += EquipedItems[type].GetStats(PrimaryStats.Strength); altmultiplier += EquipedItems[type].GetMultiplier(PrimaryStats.Strength); } } // Strength added to defense results += Mathf.RoundToInt(additionalDefense * altmultiplier); break; } //Debug.Log(stat + " calc: " + results + " * " + (multiplier * 100f).ToString("0") + "%"); if (LeadershipSkill != null && LeadershipSkill.type == LeadershipSkillType.CoreStatBoost && LeadershipSkill.coreStat == CoreStats.Damage) { return(Mathf.CeilToInt(results * multiplier * DefenseEffectModifier * LeadershipSkill.Multiplier)); } else { return(Mathf.CeilToInt(results * multiplier * DefenseEffectModifier)); } } foreach (EquipmentType type in EquipedItems.Keys) { if (EquipedItems[type] != null) { results += EquipedItems[type].GetStats(stat); multiplier += EquipedItems[type].GetMultiplier(stat); } } return(Mathf.RoundToInt(results * multiplier)); }