public bool Event_DoSkillEffects(ComponentEvent e) { var skillEffects = (ECompileSkillEffects)e; // get all of the entities in the radius, and add them to the effected entities AreaMap map = Engine.instance.world.currentMap; Entity[] hits = map.GetAllObjectsInRadius(skillEffects.baseLocation, radius); // add each, but also make sure not to repeat any foreach (Entity hit in hits) { bool newTarget = true; foreach (var combat in skillEffects.combats) { if (combat.defender == hit) { newTarget = false; } } // the list did not contain this target yet, so add an attack for it if (newTarget) { skillEffects.combats.Add(new CombatInstance(skillEffects.user, hit) { { "skill", owner } }); } } return(true); }
public bool Event_GetTargets(ComponentEvent e) { AreaMap map = Engine.instance.world.currentMap; var targetEvent = (ETargetSkill)e; Entity[] targets = map.GetAllObjectsInRadius(targetEvent.location, radius); targetEvent.targets.AddRange(targets); return(true); }