Esempio n. 1
0
    public bool DealDamage(UnitScript attacker, UnitScript target, int damage, bool isPoisoned, bool Retaliatable, int hits)
    {
        if (CheckIfDamageBlocked(attacker, target))
        {
            PopupTextController.AddPopupText("Blocked!", PopupTypes.Damage);
            Log.SpawnLog(attacker.name + " attacks " + target.name + " but the attack gets blocked!");
        }

        if (hits >= 2)
        {
            Log.SpawnLog(attacker.name + " attacks " + target.name + "! " + damage + " point(s) of damage is dealt.");
            PopupTextController.AddParalelPopupText("-" + damage.ToString(), PopupTypes.Damage);
        }
        if (hits <= 1)
        {
            Log.SpawnLog(attacker.name + " attacks " + target.name + ", but only reduces their Defence by 1!");
            // PopupTextController.AddParalelPopupText("Hit!", PopupTypes.Info);
            PopupTextController.AddParalelPopupText("-1 Defence", PopupTypes.Stats);
        }

        /*if (hits == 0)
         * {
         *  Log.SpawnLog(attacker.name + " attacks " + target.name + ", but misses completely.");
         *  PopupTextController.AddPopupText("Miss!", PopupTypes.Info);
         * }*/
        bool isShot = attacker.isRanged && (GameStateManager.Instance.GameState != GameStates.RetaliationState && GameStateManager.Instance.GameState != GameStates.AttackState) == false;

        bool didDie = target.DealDamage(damage, hits > 0, isPoisoned, isShot);

        if (target.CanCurrentlyRetaliate && target.CurrentHP > 0 && Retaliatable && Player.IsPlayerLocal(target.PlayerID))
        {
            GameStateManager.Instance.StartRetaliationChoice();
        }

        return(didDie);
    }
Esempio n. 2
0
 void HitForSwing(UnitScript target)
 {
     target.DealDamage(Damage - target.CurrentDefence, true, false, false);
     PopupTextController.AddParalelPopupText("-" + (Damage - target.CurrentDefence), PopupTypes.Damage);
 }