public void ReceiveDamage(UnitEffect_Damage dmg) { if (GetStatAmount(StatType.oxygen) <= 0) { return; } int dmg_received = (-(dmg.GetDamage())); int int_received = Constants.GetGainedAdrenaline(this, Mathf.Abs(dmg_received)); MDebug.Log("^effects " + this.name + " rcv damge " + dmg_received + " rcvd multiplier:" + "WTF" + " +int=" + int_received); AddOxygen(dmg_received, true); if (dmg_received < 0 && OnDmgReceived != null) { OnDmgReceived(); } int x, y = 0; if (GetStatAmount(StatType.oxygen) > 0) { AddAdrenaline(int_received, true, out x, out y); } }
public static float GetAggroChance(Unit target, UnitEffect_Damage _damage) { Unit instigator = (_damage.Instigator as Unit); float distance = (target.currentTile.GetPosition() - instigator.currentTile.GetPosition()).magnitude; int damage = _damage.GetDamage(); float aggroChance = Mathf.Clamp(0.5f + damage * 0.1f - distance * 0.05f, 0.1f, 1f); MDebug.Log("^units AggroChance: " + aggroChance); return(aggroChance); }