// ------------------------------------------------------------------------------- // DamageTargets // ------------------------------------------------------------------------------- public static void DamageTargets(CharacterBase source, InstanceBase activator, int amount, CharacterBase[] targets) { foreach (CharacterBase target in targets) { if (target != null) { int level = 0; int accuracy = 0; TemplateAdvanced template = null; if (activator is InstanceItem) { template = ((InstanceItem)activator).template; //level = ((InstanceItem)activator).level; } else if (activator is InstanceSkill) { template = ((InstanceSkill)activator).template; level = ((InstanceSkill)activator).level; } amount += template.CalculatedEffect(source, target, level); if (source != null) { accuracy = source.stats.Accuracy; } amount = RPGHelper.CalculateFinalDamage(amount, template.attackType, template.element, target); if (source != null) { amount += source.CalculateHitType(amount, target, template); } target.InflictBuffs(template.useBuffType, accuracy, false, template.removeBuff); if (target.parent != null && template.hitEffect != null) { Finder.fx.SpawnEffect(target.parent.transform, template.hitEffect); } amount = target.InflictDamage(amount); Finder.log.Add(string.Format("{0} {1} {2} {3}", target.Name, Finder.txt.actionNames.takes, amount, Finder.txt.basicVocabulary.damage)); } } }