Example #1
0
    public void attack(SpawnableObject target)
    {
        HashSet <CreatureEffect> eff = new HashSet <CreatureEffect>(effects);

        foreach (CreatureEffect ef in eff)
        {
            ef.onAttack(this, target);
        }
        target.onBeingAttacked(this);
        target.dealDamage(stats.attack, this);
        attacksLeft--;
        if (!swiftness && target is Creature && !target.isDestroyed())
        {
            if (GameEngine.validateAttackPath(target.field, field, (Creature)target))
            {
                ((Creature)target).counterAttack(this);
            }
        }
    }