Exemplo n.º 1
0
    /// <summary> Not Badland-aware </summary>
    /// <returns>(damage inflicted,damagedInvader)</returns>
    public async Task <(int, Token)> ApplyDamageTo1(int availableDamage, HealthToken invaderToken, bool fromRavage = false)       // !! change Token to HealthToken
    {
        var damagedInvader = invaderToken.AddDamage(availableDamage);

        if (!damagedInvader.IsDestroyed)
        {
            Tokens.Adjust(invaderToken, -1);
            Tokens.Adjust(damagedInvader, 1);
        }
        else
        {
            await DestroyStrategy.OnInvaderDestroyed(Space, invaderToken, fromRavage);
        }

        int damageInflicted = invaderToken.RemainingHealth - damagedInvader.RemainingHealth;

        return(damageInflicted, damagedInvader);         // damage inflicted
    }