protected override bool CheckValidityInternal(Entities.Entity Performer, List <Entities.Entity> Selection, TurnInfo TI) { Effects.Orders.OrderWithUses TheOrder = (Effects.Orders.OrderWithUses)(((Entities.Effect_Entity)Performer).GetEffect()); Entities.Unit TheTarget = (Entities.Unit)Selection[0]; Modules.Target.TargettingData TD = new Modules.Target.TargettingData(); TD.AttackType.Long = true; if (TheTarget.GetCurrentRange() == Range.Long) { TD.TargetType.Long = true; } else if (TheTarget.GetCurrentRange() == Range.Short) { TD.TargetType.Short = true; } int cost = 0; TheTarget.CheckTargetStatus(null, TD, ref cost); return(TheOrder.GetNumUses(mActionIndex) > 0 && TD.Result()); }
/// <summary> /// Returns the CP cost for Runner to attack Target if possible /// or -1 if this attack is not possible. /// </summary> public int Run(Entities.Unit Runner, Entities.Unit Target) { int Cost = 0; TargettingData TD = new TargettingData(); foreach (TargettingModule TM in TargetModules) { TM.Run(Runner, Target, TD, ref Cost); } Target.CheckTargetStatus(Runner, TD, ref Cost); if (Cost < 0) { Cost = 0; } if (!TD.Result()) { return(-1); } else { return(Cost); } }