public ElementalEffect(float duration, StatSystem.DamageType damageType, int damage, float speed = 1.0f) : base(duration) { m_Damage = damage; m_DamageType = damageType; m_DamageSpeed = speed; }
/// <summary> /// Add an amount of damage given in the given type. The source (if non null, see class documentation for /// info) boost will be applied and the target defense will be removed from that amount. /// </summary> /// <param name="damageType">The type of damage</param> /// <param name="amount">The amount of damage</param> /// <returns></returns> public int AddDamage(StatSystem.DamageType damageType, int amount) { int addedAmount = amount; //Physical damage are increase by 1% for each point of strength if (damageType == StatSystem.DamageType.Physical) { //source can be null when it's elemental or effect damage if (m_Source != null) { addedAmount += Mathf.FloorToInt(addedAmount * m_Source.Stats.stats.strength * 0.01f); //each poitn of defense remove 1 damage, with a minimum of 1 damage addedAmount = Mathf.Max(addedAmount - m_Target.Stats.stats.defense, 1); } } //we then add boost per damage type. Not this is called elementalBoost, but physical can also be boosted if (m_Source != null) { addedAmount += addedAmount * Mathf.FloorToInt(m_Source.Stats.stats.elementalBoosts[(int)damageType] / 100.0f); } //Then the elemental protection that is a percentage addedAmount -= addedAmount * Mathf.FloorToInt(m_Target.Stats.stats.elementalProtection[(int)damageType] / 100.0f); m_Damages[(int)damageType] += addedAmount; return(addedAmount); }
public int AddDamage(StatSystem.DamageType damageType, int amount) { int addedAmount = amount; if (damageType == StatSystem.DamageType.Physical) { if (m_Source != null) { addedAmount += Mathf.FloorToInt(addedAmount * m_Source.Stats.stats.strength * 0.01f); } addedAmount = Mathf.Max(addedAmount - m_Target.Stats.stats.defense, 1); } m_Damages[(int)damageType] += addedAmount; return(addedAmount); }
public int GetDamage(StatSystem.DamageType damageType) { return(m_Damages[(int)damageType]); }
/// <summary> /// Add an amount of damage given in the given type. The source (if non null, see class documentation for /// info) boost will be applied and the target defense will be removed from that amount. /// </summary> /// <param name="damageType">The type of damage</param> /// <param name="amount">The amount of damage</param> /// <returns>The amount of *effective* damage</returns> public int AddDamage(StatSystem.DamageType damageType, int amount) { ref var targetStatSystem = ref _target.ComponentStats().statSystem;