Example #1
0
	internal DamageReport ApplyDamage(AttackWrapper a_attack)
	{
		DamageReport report = new DamageReport();
		
		foreach(DamageWrapper each in a_attack.damages)
		{
			report += ComputeDamage(each);
		}
		
		Debug.Log("Damages : " + report.ToString());
		return report;
	}
Example #2
0
	internal AttackWrapper Compute(Unit a_src)
	{
		AttackWrapper attack = new AttackWrapper();
		attack.source = a_src;
		attack.damages = new List<DamageWrapper>();
		
		foreach(DamageConf each in damages)
		{
			attack.damages.Add (each.Compute(a_src));
		}
		
		return attack;
	}
Example #3
0
    internal virtual AttackWrapper Compute(AttackInfos a_attackInfos)
    {
        AttackWrapper attack = new AttackWrapper();

        attack.conf        = this;
        attack.attackInfos = a_attackInfos;
        attack.effects     = new List <AEffect>();

        foreach (EffectConf each in onHitEffects)
        {
            AEffect computed = each.Compute(a_attackInfos);
            attack.effects.Add(computed);
        }

        return(attack);
    }
Example #4
0
    /// <summary>
    /// Check for possible targets and send them the attack.
    /// </summary>
    internal void FireAttack(Attack a_attack)
    {
        Vector3     pos     = a_attack.TargetPosition(_unit);
        List <Unit> targets = a_attack.SeekTargets(_unit, pos);

        if (targets.Count > 0)
        {
            AttackInfos attackInfos = new AttackInfos();
            attackInfos.affectedTargets = targets;
            attackInfos.targetPosition  = pos;
            attackInfos.critType        = TryToCrit();
            attackInfos.source          = _unit;

            AttackWrapper wrapper = a_attack.Compute(attackInfos);
            foreach (Unit each in targets)
            {
                Debug.Log(wrapper.Apply(each).ToString());
            }
        }
    }
Example #5
0
	public void OnAttackDelivered(AttackWrapper a_attack)
	{
		foreach(AUnitComponent each in _damageCallbacks)
		{
			if(each.enabled)
			{
				((IDamagesCallbacks)each).OnAttackDelivered(a_attack);
			}
		}	
	}
Example #6
0
	public void OnAttackReceived(AttackWrapper a_attack)
	{
		foreach(AUnitComponent each in _damageCallbacks)
		{
			if(each.enabled)
			{
				((IDamagesCallbacks)each).OnAttackReceived(a_attack);
			}
		}	
		//stats.hitpoints.Damage(stats.defense.ApplyDamage(a_attack).final);
	}