public override void OnTargetPlay(GameObject target)
    {
        IHealth          targetHealth     = target.GetComponent <IHealth>();
        IModifiersHolder targetModifiers  = target.GetComponent <IModifiersHolder>();
        IModifiersHolder damagerModifiers = GameObject.FindObjectOfType <PlayerEntity>().ModifiersHolder;

        Damage damage = DamageCalculator.DealDamage(_damage, damagerModifiers, targetHealth, targetModifiers);

        targetHealth.DealDamage(damage);
    }
Example #2
0
    public override bool ExecutePerTarget(GameObject target)
    {
        Entity entityTarget = target.GetComponent <Entity>();

        IHealth          targetHealth    = entityTarget.Health;
        IModifiersHolder targetModifiers = entityTarget.ModifiersHolder;
        IModifiersHolder selfModifiers   = _self.GetComponent <IModifiersHolder>();

        Damage damage = DamageCalculator.DealDamage(_damage, selfModifiers, targetHealth, targetModifiers);

        targetHealth.DealDamage(damage);
        return(true);
    }
Example #3
0
    public void Attack(UnitScript Attacker, UnitScript Defender, bool retaliatable, int damage, int hits)
    {
        if (Attacker.GetComponent <ShootingScript>() != null)
        {
            Attacker.GetComponent <ShootingScript>().myTarget = Defender.transform.position;
            // this is mostly done HERE for melee attacks of Ravens...
        }
        if (AttackEvent != null)
        {
            AttackEvent(Attacker, Defender, damage);
        }
        AttackingUnit = Attacker;
        AttackTarget  = Defender;
        DamageCalculator dc = new DamageCalculator();

        dc.DealDamage(Attacker, Defender, damage, Attacker.isPoisonous, retaliatable, hits);
        CheckIfLastAttacker();
    }