public override bool CanActivateOnTarget(ManualSkill ActiveSkill) { for (int P = Context.Map.ListPlayer.Count - 1; P >= 0; --P) { for (int Squad = Context.Map.ListPlayer[P].ListSquad.Count - 1; Squad >= 0; --Squad) { if (Context.Map.ListPlayer[P].ListSquad[Squad].CurrentLeader == null || Context.Map.ListPlayer[P].ListSquad[Squad].CurrentLeader.Pilot == null || Context.Map.ListPlayer[P].ListSquad[Squad].IsDead) { continue; } for (int U = Context.Map.ListPlayer[P].ListSquad[Squad].UnitsAliveInSquad - 1; U >= 0; --U) { if (Context.Map.ListPlayer[P].ListSquad[Squad][U] == null || Context.Map.ListPlayer[P].ListSquad[Squad][U].Pilot == null) { continue; } Context.SetContext(Context.EffectOwnerSquad, Context.EffectOwnerUnit, Context.EffectOwnerCharacter, Context.Map.ListPlayer[P].ListSquad[Squad], Context.Map.ListPlayer[P].ListSquad[Squad][U], Context.Map.ListPlayer[P].ListSquad[Squad][U].Pilot); if (ActiveSkill.CanActivateEffectsOnTarget(Context.Map.ListPlayer[P].ListSquad[Squad][U].Pilot.Effects)) { return(true); } } } } return(false); }
public override bool CanActivateOnTarget(ManualSkill ActiveSkill) { if (Context.EffectOwnerSquad.CurrentLeader == null || Context.EffectOwnerSquad.CurrentLeader.Pilot == null || Context.EffectOwnerSquad.IsDead) { return(false); } for (int U = Context.EffectOwnerSquad.UnitsAliveInSquad - 1; U >= 0; --U) { if (Context.EffectOwnerSquad[U] == null || Context.EffectOwnerSquad[U].Pilot == null) { continue; } Context.SetContext(Context.EffectOwnerSquad, Context.EffectOwnerUnit, Context.EffectOwnerCharacter, Context.EffectOwnerSquad, Context.EffectOwnerUnit, Context.EffectOwnerSquad[U].Pilot, Context.Map.ActiveParser); if (ActiveSkill.CanActivateEffectsOnTarget(Context.EffectOwnerSquad[U].Pilot.Effects)) { return(true); } } return(false); }
public override bool CanActivateOnTarget(ManualSkill ActiveSkill) { if (Context.EffectOwnerSquad.CurrentLeader == null || Context.EffectOwnerSquad.CurrentLeader.Pilot == null || Context.EffectOwnerSquad.IsDead) { return(false); } Context.SetContext(Context.EffectOwnerSquad, Context.EffectOwnerUnit, Context.EffectOwnerCharacter, Context.EffectOwnerSquad, Context.EffectOwnerUnit, Context.EffectOwnerCharacter); return(ActiveSkill.CanActivateEffectsOnTarget(Context.EffectOwnerCharacter.Effects)); }
public override void Update(GameTime gameTime) { Map.CursorControl(Map.ListPlayer[Map.ActivePlayerIndex].InputManager); Map.UpdateCursorVisiblePosition(gameTime); //Loop through the players to find a Unit to control. for (int P = 0; P < Map.ListPlayer.Count; P++) { //Find if a current player Unit is under the cursor. int CursorSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero); if (CursorSelect >= 0) { if (BattlePreview == null) { BattlePreview = new BattlePreviewer(Map, P, CursorSelect, null); } BattlePreview.UpdateUnitDisplay(); } } if (Map.ListPlayer[Map.ActivePlayerIndex].InputManager.InputConfirmPressed()) { Squad TargetSquad = null; for (int P = Map.ListPlayer.Count - 1; P >= 0 && TargetSquad == null; --P) { int SquadIndex = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero); if (SquadIndex >= 0) { Context.SetContext(SkillSquad, SkillUnit, SkillPilot, Context.Map.ListPlayer[P].ListSquad[SquadIndex], Context.Map.ListPlayer[P].ListSquad[SquadIndex].CurrentLeader, Context.Map.ListPlayer[P].ListSquad[SquadIndex].CurrentLeader.Pilot, Context.Map.ActiveParser); Context.EffectTargetUnit.UpdateSkillsLifetime(SkillEffect.LifetimeTypeOnAction); if (ActiveSkill.CanActivateEffectsOnTarget(Context.EffectTargetCharacter.Effects)) { TargetSquad = Map.ListPlayer[P].ListSquad[SquadIndex]; } } } if (TargetSquad == null) { return; } Context.SetContext(Context.EffectOwnerSquad, Context.EffectOwnerUnit, Context.EffectOwnerCharacter, TargetSquad, TargetSquad.CurrentLeader, TargetSquad.CurrentLeader.Pilot, Context.Map.ActiveParser); Owner.AddAndExecuteEffect(ActiveSkill, Context.EffectTargetCharacter.Effects); Context.EffectTargetUnit.UpdateSkillsLifetime(SkillEffect.LifetimeTypeOnAction); SkillPilot.SP -= ActiveSkill.SPCost; Map.CursorPosition = SkillSquad.Position; Map.CursorPositionVisible = Map.CursorPosition; BattlePreview = null; if (SkillPilot.SP < ActiveSkill.SPCost) { Map.Update(gameTime);//Remove the drawable points if needed Map.RemoveScreen(this); } } else if (Map.ListPlayer[Map.ActivePlayerIndex].InputManager.InputCancelPressed()) { Map.CursorPosition = SkillSquad.Position; Map.CursorPositionVisible = Map.CursorPosition; Map.Update(gameTime);//Remove the drawable points if needed Map.RemoveScreen(this); } }