public bool Step(Battle battle) { if (IsDisabled) { return(true); } target = findTarget(battle); if (target == null) { return(false); } if (Team.IsFriendly(target.Team)) { if (ChildrenCount() == 0) { link(target); } else { support(target); } } else { attack(target); } target = null; return(false); }
private void link(Fighter target) { if (Team.IsFriendly(target.Team)) { // Link to root of target's tree Fighter root = target.GetRoot(); // Check if fighters are already linked bool alreadyLinked = false; foreach (Fighter c in root.children) { if (this == c) { alreadyLinked = true; break; } } // Link the two fighters if (!alreadyLinked) { next = target; root.children.Add(this); // Apply link skill if (Style.LinkSkill != null) { Style.LinkSkill.Apply(this, target); } // Notify Linked(this, new FighterEventArgs { Target = root }); } } }