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); } }
void DamageReceived(UnitEffect_Damage dmg) { if (m_unit.Config.GetHitSound != null) { SoundManager.PlaySFX(m_unit.Config.GetHitSound, m_unit.transform); } }
public void ReceiveDamage(UnitEffect_Damage dmg) { Stats.ReceiveDamage(dmg); if (OnDamageReceived != null) { OnDamageReceived(dmg); } }
/// <summary> /// clones itself to the target /// </summary> /// <param name="target"></param> public override UnitEffect MakeCopy(UnitEffect origin, Unit host) { UnitEffect_Damage _cc = base.MakeCopy(origin, host) as UnitEffect_Damage; _cc.baked_damage = UnityEngine.Random.Range(GetMin(), GetMax() + 1); return(_cc); }
public override UnitEffect GetEffectForInstigator(int _int) { //copies the effect UnitEffect_Damage dmg = (UnitEffect_Damage)Effect.MakeCopy(Effect, null); //modifies the ranges dmg.DamageRange = new M_Math.R_Range(dmg.DamageRange.min + int_to_damage_min * _int, dmg.DamageRange.max + int_to_damage_max * _int); // MDebug.Log("INTBONUS " + dmg.DamageRange.min+ " - "+ dmg.DamageRange.max); return(dmg); }
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); }
void OnDmgReceived(UnitEffect_Damage dmg) { if (dmg.Instigator == null) { return; } if (!_triggered) { MDebug.Log(dmg.Instigator.ToString()); Trigger(dmg.Instigator as Unit); } else { if (M_Math.Roll(Constants.GetAggroChance(m_unit, dmg))) { SetPreferredTarget((dmg.Instigator as Unit)); } } }