public static int CalculateElementDamageOTToMonster(Damage_OT dot, Monster y) { int d = 0; Damage_OT.Damage_OTType otype = dot.GetDamage_OTType(); Damage_OT.Damage_OTType poi = Damage_OT.Damage_OTType.Poison; //Damage_OT.Damage_OTType ble = Damage_OT.Damage_OTType.Bleeding; Damage_OT.Damage_OTType fir = Damage_OT.Damage_OTType.Fire; Damage.DamageType m = y.mobElement; if (otype == poi && m == Damage.DamageType.Poison) { d = (int)((dot.GetDamage_OTAmount() / 2f)) * -1; } else if (otype == fir && m == Damage.DamageType.Fire) { d = (int)((dot.GetDamage_OTAmount() / 2f)) * -1; } else { d = dot.GetDamage_OTAmount(); } return(d); }
public void Attack() { var m = GetComponentInParent <Monster>(); var p = GetComponentInParent <Player_Main>(); if (dot.GetDamage_OTAmount() <= 0) { dot.SetDamage_OTAmount(1); } if (m != null) { int x = Damage_Calculator.CalculateElementDamageOTToMonster(dot, m); m.TakeDamageOT(dot, x); } else if (p != null) { int x = Damage_Calculator.CalculateElementDamageOTToPlayer(level, dot, p.pS.GetResistanceForType(dot.GetDamage_OTType())); var dui = GameObject.FindGameObjectWithTag("DamageText"); GameObject dtui = Instantiate(dui, dui.transform.parent.parent) as GameObject; Vector2 cam = Camera.main.WorldToScreenPoint(transform.position); dtui.transform.position = cam; dtui.AddComponent <DamageText_UI>().SetDamage(dot, x, true); p.TakeDamage(x, true); } else { } }
public static int CalculateElementDamageOTToPlayer(int level, Damage_OT dot, Resistance y) { var ps = GameObject.Find("Player").GetComponent <Player_Stats>(); int d = 0; if (dot.GetDamage_OTType() != Damage_OT.Damage_OTType.Normal) { if (dot.GetDamage_OTType() == y.GetResistanceOTType()) { int r = y.GetResistanceAmount(); if (r > 100) { d = (int)((((r - 100f) / 100f) + 1f) * -1f); } else if (r == 0) { d = (int)(dot.GetDamage_OTAmount() / (y.GetResistanceAmount() + 1f)); } else if (r != 0) { d = (dot.GetDamage_OTAmount() / (y.GetResistanceAmount())); } } } else { if (level >= (ps.playerLevel - 10)) { d = ((dot.GetDamage_OTAmount() - (ps.armor / ps.playerLevel))); } else { d = ((dot.GetDamage_OTAmount() - (int)(ps.armor / (ps.playerLevel / (25f * ps.playerLevel))))); } if (d < 0) { d = 0; } } return(d); }