public override bool TriggersFrom(TriggerInfo info)
    {
        if (info.type != TriggerType.after_attack)
        {
            return(false);
        }
        AfterAttackTriggerInfo attack_info = (AfterAttackTriggerInfo)info;

        if (need_to_kill_attacked && !attack_info.attacked.dead)
        {
            return(false);
        }
        if (!creature && (attack_info.attacker as Creature != null))
        {
            return(false);
        }
        if (!hero && (attack_info.attacker.entity_type == EntityType.player))
        {
            return(false);
        }
        return(damage_needed <= attack_info.damage_dealt);
    }
Ejemplo n.º 2
0
    public void Attack(ICombatant attacker, ICombatant defender)
    {
        if (CanAttack(attacker, defender))
        {
            attack_happening = true;
            attacker.NoteAttack();
            int dealt = attacker.DealDamage(defender, attacker.attack);
            if (defender.retaliate)
            {
                defender.DealDamage(attacker, defender.attack);
            }
            attack_happening = false;

            AfterAttackTriggerInfo info = new AfterAttackTriggerInfo(attacker, defender, dealt);

            Creature creature = attacker as Creature;
            if (creature != null)
            {
                AddTriggersToStack(creature.abilities.GetLocalTriggers(info));
            }
            AddTriggersToStack(trigger_manager.GetTriggers(info));
        }
        ResolveStack();
    }