void OnAttackEnd() { if (_enemy) { _enemy.TakeDamage(); } }
public void RunLuckPhase() { UpdateButtonState(true); int attackerBonus = GetLuckBonus(); int defenderBonus = GetLuckBonus(); int attackerSum = attackerBonus + DataController.Instance.GetWeaponStatValue(attacker, attackerWeaponType); int defenderSum = defenderBonus + DataController.Instance.GetWeaponStatValue(defender, defenderWeaponType); int delta = attackerSum - defenderSum; string BaskName = ""; if (delta > 0) { BaskName = defender.name; BaskIsKil = defender.TakeDamage(delta); if (BaskIsKil) { attacker.LevelUp(); } } else if (delta < 0 && attackerWeaponType == WeaponType.MAGIC) { BaskName = attacker.name; BaskIsKil = attacker.TakeDamage(-delta); if (BaskIsKil) { defender.LevelUp(); } } attackLuckText.text = attackerBonus.ToString(); defenceLuckText.text = defenderBonus.ToString(); attackSumText.text = attackerSum.ToString(); defenceSumText.text = defenderSum.ToString(); if (BaskName.Equals("")) { message.text = "Nobody got hurt"; } else { string lethal = BaskIsKil ? "lethal" : ""; message.text = $"{BaskName} takes {Mathf.Abs(delta)} damage{lethal}"; } attackerHealth.text = attacker.HP.ToString(); defenderHealth.text = defender.HP.ToString(); }