IEnumerator Damage(UnitInfo attacker, List <UnitInfo> defenders, string attackStat, List <string> tags) { if (tags.Contains("replenish")) { int num = attacker.currMP; attacker.SpendMP(num); defenders[0].SpendMP(-num); } float multi = attacker.weaponMod; float levelMod = (1 + (float)(attacker.level - 1) / 3); float offVal = 10; foreach (UnitInfo defender in defenders) { float damageNum = 0; if (tags.Contains("spell")) { if (tags.Contains("area")) { multi = 3 / (float)(defender.pentacles); if (tags.Contains("healing")) { multi = .3f; } } else { multi = 5 / (float)(defender.pentacles); if (tags.Contains("healing")) { multi = .5f; } } } else if (attacker.status.ContainsKey("rage")) { multi *= 1.25f; } if (attacker.status.ContainsKey("bloodinversion")) { if (attacker.maxHP / attacker.currHP > 2) { multi *= attacker.maxHP / attacker.currHP; } else { multi *= 2; } } if (attackStat == "swords") { offVal = attacker.Swords(); } if (attackStat == "cups") { offVal = attacker.Cups(); } if (attackStat == "wands") { offVal = attacker.Wands(); } if (attackStat == "pentacles") { offVal = attacker.Pentacles(); } damageNum = multi * levelMod * offVal / 3; if (attacker.elevation > defender.elevation) { damageNum *= 1.25f; } if (defender.elevation > attacker.elevation) { damageNum *= .75f; } if (attacker.status.ContainsKey("combo")) { damageNum *= 1.3f; } if (tags.Contains("melee")) { if (defender.currentTile.tag == "Forest") { damageNum *= .75f; } if (defender.passives.Contains("Parry")) { damageNum *= .75f; } if (defender.passives.Contains("Counterblow") && !attacker.passives.Contains("Counterblow")) { List <UnitInfo> att = new List <UnitInfo>(); att.Add(attacker); List <string> blank = new List <string>(); StartCoroutine(Damage(defender, att, "swords", blank)); } } if (tags.Contains("area")) { if (defender.currentTile.tag == "Water") { damageNum *= .75f; } if (defender.passives.Contains("Evade")) { damageNum *= .75f; } } if (!tags.Contains("spell") && defender.status.ContainsKey("physBlock")) { damageNum -= (defender.level) / 3; } if (defender.status.ContainsKey("careful") && damageNum > 0) { defender.status.Remove("careful"); damageNum -= defender.level; } if (tags.Contains("spell") && defender.status.ContainsKey("shield")) { defender.status.Remove("shield"); damageNum = 0; } Debug.Log("Damage number: " + damageNum); if ((damageNum < 0)) { damageNum = 0; } if (tags.Contains("healing")) { int heal = defender.Heal(damageNum); turnHist.AddMessage(attacker.name + " heals " + heal + " damage to " + defender.name); } else { if (tags.Contains("MPDam")) { defender.SpendMP((int)damageNum); if (tags.Contains("Siphon")) { attacker.SpendMP((int)-damageNum); } turnHist.AddMessage(attacker.name + " drains " + damageNum + " MP from " + defender.name); } else { int dam = defender.TakeDamage(damageNum); turnHist.AddMessage(attacker.name + " deals " + dam + " damage to " + defender.name); if (tags.Contains("drain")) { attacker.Heal(dam / 2); turnHist.AddMessage(attacker.name + " drained " + dam / 2 + " damage"); } } } } yield return(new WaitForSeconds(0.0f)); }