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; }
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; }
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); }
/// <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()); } } }
public void OnAttackDelivered(AttackWrapper a_attack) { foreach(AUnitComponent each in _damageCallbacks) { if(each.enabled) { ((IDamagesCallbacks)each).OnAttackDelivered(a_attack); } } }
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); }