public override void DoUpdate(GameTime gameTime) { NavigateThroughNextChoices(Map.sndSelection, Map.sndConfirm); if (ActiveInputManager.InputConfirmPressed()) {//Make sure the mouse is inside the menu. AddToPanelListAndSelect(ListNextChoice[ActionMenuCursor]); foreach (InteractiveProp ActiveProp in Map.LayerManager[(int)ActiveSquad.Position.Z].ListProp) { foreach (Vector3 MovedOverPoint in ListMVHoverPoints) { ActiveProp.OnMovedOverBeforeStop(ActiveSquad, MovedOverPoint, CursorPosition); } } Map.sndConfirm.Play(); } else if (ActiveInputManager.InputCancelPressed()) { } if (ActiveInputManager.InputUpPressed()) { ActionMenuCursor -= (ActionMenuCursor > 0) ? 1 : 0; Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed() && ActiveSquad.CurrentLeader.CanAttack) { ActionMenuCursor += (ActionMenuCursor < ListNextChoice.Count - 1) ? 1 : 0; Map.sndSelection.Play(); } }
public override void DoUpdate(GameTime gameTime) { switch (ActiveSquad.CurrentLeader.CurrentAttack.MAPAttributes.Property) { case WeaponMAPProperties.Spread: if (ActiveInputManager.InputConfirmPressed()) { } else { Map.CursorControl(ActiveInputManager); //Move the cursor } break; case WeaponMAPProperties.Direction: Map.SelectMAPEnemies(ActivePlayerIndex, ActiveSquadIndex, ListAttackChoice); Map.sndConfirm.Play(); break; case WeaponMAPProperties.Targeted: if (ActiveInputManager.InputConfirmPressed()) { Map.SelectMAPEnemies(ActivePlayerIndex, ActiveSquadIndex, ListAttackChoice); Map.sndConfirm.Play(); } else { Map.CursorControl(ActiveInputManager); //Move the cursor BattlePreview.UpdateUnitDisplay(); } break; } }
private void UpdateFormationSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { Map.BattleMenuCursorIndexSecond += Map.BattleMenuCursorIndexSecond < 1 ? 1 : 0; Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { Map.BattleMenuCursorIndexSecond -= Map.BattleMenuCursorIndexSecond > 0 ? 1 : 0; Map.sndSelection.Play(); } if (ActiveInputManager.InputConfirmPressed()) { if (Map.BattleMenuCursorIndexSecond == 0) { Map.BattleMenuDefenseFormationChoice = FormationChoices.Focused; } else if (Map.BattleMenuCursorIndexSecond == 1) { Map.BattleMenuDefenseFormationChoice = FormationChoices.Spread; } Map.UpdateWingmansSelection(TargetSquad, ActiveSquad, Map.BattleMenuDefenseFormationChoice); Map.BattleMenuStage = BattleMenuStages.Default; Map.sndConfirm.Play(); } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputConfirmPressed()) { Map.ListGameScreen.Remove(Map); Map.ListGameScreen.Insert(0, ListMapChangeChoice[ActionMenuCursor]); RemoveAllSubActionPanels(); } if (ActiveInputManager.InputUpPressed()) { --ActionMenuCursor; if (ActionMenuCursor < 0) { ActionMenuCursor = ListMapChangeChoice.Count - 1; } } else if (ActiveInputManager.InputDownPressed()) { ++ActionMenuCursor; if (ActionMenuCursor >= ListMapChangeChoice.Count) { ActionMenuCursor = 0; } } }
public override void DoUpdate(GameTime gameTime) { Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190)); if (ActiveInputManager.InputConfirmPressed()) { if (ListAttackChoice.Contains(Map.CursorPosition)) { for (int X = 0; X < CurrentAttack.MAPAttributes.ListChoice.Count; X++) { for (int Y = 0; Y < CurrentAttack.MAPAttributes.ListChoice[X].Count; Y++) { if (CurrentAttack.MAPAttributes.ListChoice[X][Y]) { ListAttackChoice.Add(new Vector3(Map.CursorPosition.X + X - CurrentAttack.MAPAttributes.Width, Map.CursorPosition.Y + Y - CurrentAttack.MAPAttributes.Height, Map.CursorPosition.Z)); } } } Map.sndConfirm.Play(); } else { Map.sndDeny.Play(); } } else { Map.CursorControl(ActiveInputManager);//Move the cursor BattlePreview.UpdateUnitDisplay(); } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { ActionMenuCursor -= (ActionMenuCursor > 0) ? 1 : 0; sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { ActionMenuCursor += ActionMenuCursor < ListNextChoice.Count ? 1 : 0; sndSelection.Play(); } else if (ActiveInputManager.InputMovePressed()) { int X = 490; for (int C = 0; C < ListNextChoice.Count; ++C) { int Y = 10 + C * fntFinlanderFont.LineSpacing; if (ActiveInputManager.IsInZone(X, Y + 6, X + MinActionMenuWidth, Y + fntFinlanderFont.LineSpacing)) { if (ActionMenuCursor != C) { ActionMenuCursor = C; sndSelection.Play(); } break; } } } else if (ActiveInputManager.InputConfirmPressed()) { AddToPanelListAndSelect(ListNextChoice[ActionMenuCursor]); } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputConfirmPressed()) { if (ConfirmMenuChoice == 0) { RemoveAllActionPanels(); AddToPanelListAndSelect(new ActionPanelPhaseChange(Map)); } else if (ConfirmMenuChoice == 1) { RemoveFromPanelList(this); } } else if (ActiveInputManager.InputCancelPressed()) { RemoveFromPanelList(this); } else if (ActiveInputManager.InputLeftPressed()) { if (ConfirmMenuChoice == 1) { ConfirmMenuChoice = 0; } } else if (ActiveInputManager.InputRightPressed()) { if (ConfirmMenuChoice == 0) { ConfirmMenuChoice = 1; } } }
private void UpdateSupportSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { --TargetSquadSupport.ActiveSquadSupportIndex; if (TargetSquadSupport.ActiveSquadSupportIndex < -1) { TargetSquadSupport.ActiveSquadSupportIndex = TargetSquadSupport.Count - 1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { ++TargetSquadSupport.ActiveSquadSupportIndex; if (TargetSquadSupport.ActiveSquadSupportIndex >= TargetSquadSupport.Count) { TargetSquadSupport.ActiveSquadSupportIndex = -1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputConfirmPressed()) { Map.BattleMenuStage = BattleMenuStages.Default; Map.sndConfirm.Play(); } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputConfirmPressed()) { CancelPanel(); } }
private void UpdateSquadMemberSelection(GameTime gameTime) { if (ActiveInputManager.InputDownPressed()) { Map.BattleMenuCursorIndexSecond += Map.BattleMenuCursorIndexSecond < ActiveSquad.UnitsAliveInSquad - 1 ? 1 : 0; Map.sndSelection.Play(); } else if (ActiveInputManager.InputUpPressed()) { Map.BattleMenuCursorIndexSecond -= Map.BattleMenuCursorIndexSecond > 1 ? 1 : 0; Map.sndSelection.Play(); } if (ActiveInputManager.InputConfirmPressed()) { if (Map.BattleMenuCursorIndexSecond == 1) { Map.BattleMenuCursorIndexThird = (int)ActiveSquad.CurrentWingmanA.BattleDefenseChoice; } else if (Map.BattleMenuCursorIndexSecond == 2) { Map.BattleMenuCursorIndexThird = (int)ActiveSquad.CurrentWingmanB.BattleDefenseChoice; } Map.BattleMenuStage = BattleMenuStages.ChooseSquadMemberDefense; Map.sndConfirm.Play(); } else if (ActiveInputManager.InputCancelPressed()) { Map.BattleMenuStage = BattleMenuStages.Default; Map.sndCancel.Play(); } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputConfirmPressed() || ActiveInputManager.InputCancelPressed()) { //Reset the cursor. RemoveFromPanelList(this); } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputConfirmPressed()) { List <Squad> ListOtherSquads = FindOtherSquad("Tower"); Unit NewLeader = Unit.FromType("Normal", "Electric Wall", Map.Content, Map.DicUnitType, Map.DicRequirement, Map.DicEffect, Map.DicAutomaticSkillTarget); NewLeader.ArrayCharacterActive = new Character[0]; //Initialise the Unit stats. NewLeader.Init(); Map.SpawnSquad(0, new Squad("Tower", NewLeader), 0, Map.CursorPosition, (int)Map.CursorPosition.Z); if (ListOtherSquads.Count > 0) { foreach (Squad ActiveOtherSquad in ListOtherSquads) { Vector3 Position = ActiveOtherSquad.Position; while ((Map.CursorPosition.X != Position.X && Map.CursorPosition.Y == Position.Y) || (Map.CursorPosition.X == Position.X && Map.CursorPosition.Y != Position.Y)) { Vector3 Diff = Map.CursorPosition - Position; Position.X += Math.Sign(Diff.X); Position.Y += Math.Sign(Diff.Y); Position.Z += Math.Sign(Diff.Z); if (!Map.CheckForObstacleAtPosition(Position, Vector3.Zero)) { NewLeader = Unit.FromType("Normal", "Electric Wall", Map.Content, Map.DicUnitType, Map.DicRequirement, Map.DicEffect, Map.DicAutomaticSkillTarget); NewLeader.ArrayCharacterActive = new Character[0]; //Initialise the Unit stats. NewLeader.Init(); Map.SpawnSquad(Map.ActivePlayerIndex, new Squad("Tower", NewLeader), 0, Position, (int)Position.Z); } } } } Map.sndConfirm.Play(); CancelPanel(); } else if (ActiveInputManager.InputCancelPressed()) { } else { Map.CursorControl(ActiveInputManager); } Map.LayerManager.AddDrawablePoints(ListBuildTerrain, Color.Coral); }
private void UpdateSupportSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { --ActiveSquadSupport.ActiveSquadSupportIndex; if (ActiveSquadSupport.ActiveSquadSupportIndex < -1) { ActiveSquadSupport.ActiveSquadSupportIndex = ActiveSquadSupport.Count - 1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { ++ActiveSquadSupport.ActiveSquadSupportIndex; if (ActiveSquadSupport.ActiveSquadSupportIndex >= ActiveSquadSupport.Count) { ActiveSquadSupport.ActiveSquadSupportIndex = -1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputConfirmPressed()) { if (ActiveSquadSupport.ActiveSquadSupportIndex >= 0) { Map.BattleMenuStage = BattleMenuStages.ChooseSupportAttack; //Update weapons so you know which one is in attack range. ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.DisableAllAttacks(); ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.UpdateAllAttacks( ActiveSquadSupport.ActiveSquadSupport.Position, TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement, ActiveSquadSupport.ActiveSquadSupport.CanMove); Map.WeaponIndexOld = ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex; ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex = 0;//Make sure you select the first weapon. } else { Map.BattleMenuStage = BattleMenuStages.Default; } Map.sndConfirm.Play(); } else if (ActiveInputManager.InputCancelPressed()) { Map.BattleMenuStage = BattleMenuStages.Default; Map.sndCancel.Play(); } }
public override void DoUpdate(GameTime gameTime) { if (TimeSinceSaveInSeconds == 0) { Map.SaveTemporaryMap(); TimeSinceSaveInSeconds = gameTime.ElapsedGameTime.TotalSeconds; } else { TimeSinceSaveInSeconds += gameTime.ElapsedGameTime.TotalSeconds; if (ActiveInputManager.InputConfirmPressed() || ActiveInputManager.InputCancelPressed() || TimeSinceSaveInSeconds > 3) { RemoveAllSubActionPanels(); } } }
public override void DoUpdate(GameTime gameTime) { Map.LayerManager.AddDrawablePoints(ListMVChoice, Color.FromNonPremultiplied(0, 128, 0, 190)); Map.LayerManager.AddDrawablePath(ListMovedOverTerrain); Map.CursorControl(ActiveInputManager);//Move the cursor if (ActiveInputManager.InputConfirmPressed()) { if (CheckIfUnitCanMove()) { ListNextChoice.Clear(); AddToPanelListAndSelect(new ActionPanelMovePart2(Map, ActivePlayerIndex, ActiveSquadIndex, IsPostAttack, ListMovedOverPoint)); Map.sndConfirm.Play(); } } else if (Map.CursorPosition == ActiveSquad.Position) { ListMovedOverTerrain.Clear(); ListMovedOverPoint.Clear(); ListMovedOverTerrain.Add(Map.GetTerrain(ActiveSquad.X, ActiveSquad.Y, (int)ActiveSquad.Z)); ListMovedOverPoint.Add(ActiveSquad.Position); LastCusorMVPosition = Map.CursorPosition; } else if (ListMVPoints.Contains(Map.CursorPosition) && Map.CursorPosition != LastCusorMVPosition) { if (Math.Abs(LastCusorMVPosition.X - Map.CursorPosition.X) + Math.Abs(LastCusorMVPosition.Y - Map.CursorPosition.Y) > 1) { ComputeNewHoverPath(); } else if (ListMovedOverPoint.Contains(Map.CursorPosition)) { RemoveHoverChoice(); } else { AddHoverChoice(); } LastCusorMVPosition = Map.CursorPosition; } }
public override void DoUpdate(GameTime gameTime) { Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190)); if (ActiveInputManager.InputConfirmPressed()) { CreateAttack(ActiveSquad.CurrentLeader.CurrentAttack); Map.sndConfirm.Play(); } else { bool CursorMoved = Map.UpdateMapNavigation(ActiveInputManager); if (CursorMoved) { BattlePreview = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack); } BattlePreview.UpdateUnitDisplay(); } }
public override void DoUpdate(GameTime gameTime) { Map.CursorControl(ActiveInputManager);//Move the cursor Map.LayerManager.AddDrawablePoints(ListMVChoice, Color.FromNonPremultiplied(0, 128, 0, 190)); if (ActiveInputManager.InputConfirmPressed()) { //Find if a current player Unit is under the cursor. int CursorSelect = Map.CheckForSquadAtPosition(Map.ActivePlayerIndex, Map.CursorPosition, Vector3.Zero); if (CursorSelect >= 0 && ListMVPoints.Contains(Map.CursorPosition)) { bool CanRepair = false; for (int U = Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect].UnitsAliveInSquad - 1; U >= 0; --U) { if (Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].HP < Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].MaxHP) { Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].HealUnit( (ActiveSquad.CurrentLeader.PilotLevel * 100) + (ActiveSquad.CurrentLeader.PilotSKL * 10)); CanRepair = true; } } if (CanRepair) { LevelUpMenu BattleRecap = new LevelUpMenu(Map, ActiveSquad.CurrentLeader.Pilot, ActiveSquad.CurrentLeader, ActiveSquad, true); BattleRecap.TotalExpGained += 25; if (Constants.ShowBattleRecap) { Map.PushScreen(BattleRecap); } else { BattleRecap.LevelUp(); } ActiveSquad.EndTurn(); RemoveAllSubActionPanels(); } } } }
private void UpdateSupportAttackSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { --ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex; if (ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex < 0) { ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex = ListAttackActiveSquadSupport.Count - 1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { ++ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex; if (ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex >= ListAttackActiveSquadSupport.Count) { ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.AttackIndex = 0; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputConfirmPressed()) { if (ActiveSquadSupport.ActiveSquadSupport.CurrentLeader.CurrentAttack.CanAttack) { Map.BattleMenuStage = BattleMenuStages.Default; Map.sndConfirm.Play(); } else { Map.sndDeny.Play(); } } else if (ActiveInputManager.InputCancelPressed()) { ActiveSquadSupport.ActiveSquadSupportIndex = ActiveSquadSupportIndexOld; Map.BattleMenuStage = BattleMenuStages.ChooseSupport; Map.sndCancel.Play(); } }
public override void DoUpdate(GameTime gameTime) { Map.CursorControl(ActiveInputManager);//Move the cursor Map.LayerManager.AddDrawablePoints(ListTerrainChoice, Color.FromNonPremultiplied(0, 128, 0, 190)); if (ActiveInputManager.InputConfirmPressed()) { //Find if a current player Unit is under the cursor. int CursorSelect = Map.CheckForSquadAtPosition(Map.ActivePlayerIndex, Map.CursorPosition, Vector3.Zero); if (CursorSelect >= 0 && ListMVChoice.Contains(Map.CursorPosition)) { bool CanResupply = false; for (int U = Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect].UnitsAliveInSquad - 1; U >= 0; --U) { if (Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].HP < Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].MaxHP) { //Refill EN. Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].RefillEN(Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].MaxEN); //Refill Weapons. foreach (Core.Attacks.Attack ActiveAttack in Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].ListAttack) { ActiveAttack.Ammo = ActiveAttack.MaxAmmo; } //Drop Morale by 10 points. Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].Pilot.Will = Math.Max(50, Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[CursorSelect][U].Pilot.Will - 10); CanResupply = true; } } if (CanResupply) { ActiveSquad.EndTurn(); RemoveAllSubActionPanels(); } } } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputConfirmPressed()) { if (ListAttackChoice.Contains(Map.CursorPosition)) { Map.SelectMAPEnemies(ActivePlayerIndex, ActiveSquadIndex, ListAttackChoice); Map.sndConfirm.Play(); } else { Map.sndDeny.Play(); } } else { Map.CursorControl(ActiveInputManager);//Move the cursor BattlePreview.UpdateUnitDisplay(); } Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190)); }
public override void DoUpdate(GameTime gameTime) { if (PhaseTime >= 0) { if (ActiveInputManager.InputConfirmPressed() || ActiveInputManager.InputCancelPressed() || ActiveInputManager.InputSkipPressed()) { PhaseTime = 0; } else { PhaseTime--; } if (PhaseTime > 0) { return; } else if (PhaseTime == 0)//Phase start. { StartPlayerPhase(Map, Map.ListPlayer[Map.ActivePlayerIndex]); } } }
public override void DoUpdate(GameTime gameTime) { if (ActiveInputManager.InputCancelPressed()) { RemoveFromPanelList(this); } else if (ActiveInputManager.InputConfirmPressed()) { Map.CursorPosition = ListMapMenuUnitPosition[MapUnitListChoice].Item2; Map.CursorPositionVisible = Map.CursorPosition; Map.PushScreen(new BattleMapScreen.CenterOnSquadCutscene(Map.CenterCamera, Map, Map.CursorPosition)); } else if (ActiveInputManager.InputUpPressed()) { MapUnitListChoice -= (MapUnitListChoice > 0) ? 1 : 0; } else if (ActiveInputManager.InputDownPressed()) { ++MapUnitListChoice; if (MapUnitListChoice >= UnitListMaxPerPage) { MapUnitListChoice = UnitListMaxPerPage - 1; } else if ((MapUnitListCurrentPage - 1) * UnitListMaxPerPage + MapUnitListChoice >= ListMapMenuUnitPosition.Count) { MapUnitListChoice = (ListMapMenuUnitPosition.Count - 1) % UnitListMaxPerPage; } } else if (ActiveInputManager.InputLeftPressed()) { MapUnitListCurrentPage -= (MapUnitListCurrentPage > 1) ? 1 : 0; } else if (ActiveInputManager.InputRightPressed()) { MapUnitListCurrentPage += (MapUnitListCurrentPage < MapUnitListCurrentPageMax) ? 1 : 0; } }
private void UpdateDefenseSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { Map.BattleMenuCursorIndexSecond -= Map.BattleMenuCursorIndexSecond > 0 ? 1 : 0; Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { Map.BattleMenuCursorIndexSecond += Map.BattleMenuCursorIndexSecond < 2 ? 1 : 0; Map.sndSelection.Play(); } if (ActiveInputManager.InputConfirmPressed()) { if (Map.BattleMenuCursorIndexSecond == 0) { TargetSquad.CurrentLeader.UpdateNonMAPAttacks(TargetSquad.Position, ActiveSquad.Position, ActiveSquad.ArrayMapSize, ActiveSquad.CurrentMovement, true); Map.WeaponIndexOld = TargetSquad.CurrentLeader.AttackIndex; TargetSquad.CurrentLeader.AttackIndex = 0;//Make sure you select the first weapon. Map.BattleMenuStage = BattleMenuStages.ChooseAttack; } else if (Map.BattleMenuCursorIndexSecond == 1) { TargetSquad.CurrentLeader.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend; Map.BattleMenuStage = BattleMenuStages.Default; ActiveSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentLeader, ActiveSquad, TargetSquad.CurrentLeader, TargetSquad, Unit.BattleDefenseChoices.Defend).ToString() + "%"; } else if (Map.BattleMenuCursorIndexSecond == 2) { TargetSquad.CurrentLeader.BattleDefenseChoice = Unit.BattleDefenseChoices.Evade; Map.BattleMenuStage = BattleMenuStages.Default; ActiveSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentLeader, ActiveSquad, TargetSquad.CurrentLeader, TargetSquad, Unit.BattleDefenseChoices.Evade).ToString() + "%"; } Map.sndConfirm.Play(); } }
public override void DoUpdate(GameTime gameTime) { //Move up or down in the menu. if (ActiveInputManager.InputUpPressed()) { --ActionMenuSwitchSquadCursor; if (ActiveSquad.UnitsAliveInSquad == 2) { if (ActionMenuSwitchSquadCursor < 0) { ActionMenuSwitchSquadCursor = 1; } } if (ActiveSquad.UnitsAliveInSquad == 3) { if (ActionMenuSwitchSquadCursor < 0) { ActionMenuSwitchSquadCursor = 5; } } } else if (ActiveInputManager.InputDownPressed()) { ++ActionMenuSwitchSquadCursor; if (ActiveSquad.UnitsAliveInSquad == 2) { if (ActionMenuSwitchSquadCursor >= 2) { ActionMenuSwitchSquadCursor = 0; } } if (ActiveSquad.UnitsAliveInSquad == 3) { if (ActionMenuSwitchSquadCursor >= 6) { ActionMenuSwitchSquadCursor = 0; } } } if (ActiveInputManager.InputConfirmPressed()) { int OldLeader = 0; int OldWingmanA = 1; int OldWingmanB = 2; if (ActiveSquad.UnitsAliveInSquad == 2) { if (ActiveSquad.At(OldLeader).HP <= 0) { OldLeader = OldWingmanA; OldWingmanA = OldWingmanB; } else if (ActiveSquad.At(OldWingmanA).HP <= 0) { OldWingmanA = OldWingmanB; } if (ActionMenuSwitchSquadCursor == 0) { ActiveSquad.SetLeader(OldLeader); ActiveSquad.SetWingmanA(OldWingmanA); } else if (ActionMenuSwitchSquadCursor == 1) { ActiveSquad.SetLeader(OldWingmanA); ActiveSquad.SetWingmanA(OldLeader); } } else if (ActiveSquad.UnitsAliveInSquad == 3) { switch (ActionMenuSwitchSquadCursor) { case 0: ActiveSquad.SetLeader(OldLeader); ActiveSquad.SetWingmanA(OldWingmanA); ActiveSquad.SetWingmanB(OldWingmanB); break; case 1: ActiveSquad.SetLeader(OldLeader); ActiveSquad.SetWingmanA(OldWingmanB); ActiveSquad.SetWingmanB(OldWingmanA); break; case 2: ActiveSquad.SetLeader(OldWingmanA); ActiveSquad.SetWingmanA(OldLeader); ActiveSquad.SetWingmanB(OldWingmanB); break; case 3: ActiveSquad.SetLeader(OldWingmanA); ActiveSquad.SetWingmanA(OldWingmanB); ActiveSquad.SetWingmanB(OldLeader); break; case 4: ActiveSquad.SetLeader(OldWingmanB); ActiveSquad.SetWingmanA(OldLeader); ActiveSquad.SetWingmanB(OldWingmanA); break; case 5: ActiveSquad.SetLeader(OldWingmanB); ActiveSquad.SetWingmanA(OldWingmanA); ActiveSquad.SetWingmanB(OldLeader); break; } } } }
public override void DoUpdate(GameTime gameTime) { Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190)); if (ActiveInputManager.InputConfirmPressed()) { int TargetSelect = 0; //Verify if the cursor is over one of the possible MV position. while ((Map.CursorPosition.X != ListAttackChoice[TargetSelect].X || Map.CursorPosition.Y != ListAttackChoice[TargetSelect].Y) && ++TargetSelect < ListAttackChoice.Count) { ; } //If nothing was found. if (TargetSelect >= ListAttackChoice.Count) { return; } Map.TargetSquadIndex = -1; for (int P = 0; P < Map.ListPlayer.Count; P++) { //Find if a Unit is under the cursor. TargetSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero); //If one was found. if (TargetSelect >= 0) { if (Map.ListPlayer[ActivePlayerIndex].Team != Map.ListPlayer[P].Team)//If it's an ennemy. { ActiveSquad.CurrentLeader.CurrentAttack.UpdateAttack(ActiveSquad.CurrentLeader, ActiveSquad.Position, Map.CursorPosition, ActiveSquad.ArrayMapSize, Map.ListPlayer[P].ListSquad[TargetSelect].CurrentMovement, ActiveSquad.CanMove); if (!ActiveSquad.CurrentLeader.CurrentAttack.CanAttack) { Map.sndDeny.Play(); return; } Map.PrepareSquadsForBattle(ActivePlayerIndex, ActiveSquadIndex, P, TargetSelect); SupportSquadHolder ActiveSquadSupport = new SupportSquadHolder(); ActiveSquadSupport.PrepareAttackSupport(Map, ActivePlayerIndex, ActiveSquad, P, TargetSelect); SupportSquadHolder TargetSquadSupport = new SupportSquadHolder(); TargetSquadSupport.PrepareDefenceSupport(Map, P, Map.ListPlayer[P].ListSquad[TargetSelect]); Map.ComputeTargetPlayerDefence(ActivePlayerIndex, ActiveSquadIndex, ActiveSquadSupport, P, TargetSelect, TargetSquadSupport); break; } } } Map.sndConfirm.Play(); } else { bool CursorMoved = Map.UpdateMapNavigation(ActiveInputManager); if (CursorMoved) { BattlePreview = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack); } BattlePreview.UpdateUnitDisplay(); } }
private void UpdateBaseMenu(GameTime gameTime) { if (ActiveInputManager.InputLeftPressed()) { Map.BattleMenuCursorIndex--; if (Map.BattleMenuCursorIndex == BattleMenuChoices.Support) {//Can't pick Support. (No Support Squads nearby) if (ActiveSquadSupport.Count <= 0) { Map.BattleMenuCursorIndex = BattleMenuChoices.Formation; } } if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation) {//Can't pick Formation. (No wingmans or ALL attack) if (ActiveSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL) { Map.BattleMenuCursorIndex = BattleMenuChoices.Action; } } if (Map.BattleMenuCursorIndex < BattleMenuChoices.Start) { Map.BattleMenuCursorIndex = BattleMenuChoices.Demo; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputRightPressed()) { Map.BattleMenuCursorIndex++; if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation) {//Can't pick Formation. (No wingmans or ALL attack) if (ActiveSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL) { Map.BattleMenuCursorIndex = BattleMenuChoices.Support; } } if (Map.BattleMenuCursorIndex == BattleMenuChoices.Support) {//Can't pick Support. (No Support Squads nearby) if (ActiveSquadSupport.Count <= 0) { Map.BattleMenuCursorIndex = BattleMenuChoices.Demo; } } if (Map.BattleMenuCursorIndex > BattleMenuChoices.Demo) { Map.BattleMenuCursorIndex = BattleMenuChoices.Start; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputMovePressed()) { if (ActiveInputManager.IsInZone(0, Constants.Height - 30, 125, Constants.Height)) { Map.BattleMenuCursorIndex = BattleMenuChoices.Start; } else if (ActiveInputManager.IsInZone(125, Constants.Height - 30, 255, Constants.Height)) { Map.BattleMenuCursorIndex = BattleMenuChoices.Action; } else if (ActiveInputManager.IsInZone(255, Constants.Height - 30, 385, Constants.Height) && (ActiveSquad.UnitsAliveInSquad > 1 && Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL)) { Map.BattleMenuCursorIndex = BattleMenuChoices.Formation; } else if (ActiveInputManager.IsInZone(385, Constants.Height - 30, 510, Constants.Height) && ActiveSquadSupport.Count > 0) { Map.BattleMenuCursorIndex = BattleMenuChoices.Support; } else if (ActiveInputManager.IsInZone(510, Constants.Height - 30, 635, Constants.Height)) { Map.BattleMenuCursorIndex = BattleMenuChoices.Demo; } } else if (ActiveInputManager.InputCommand1Pressed()) { Map.SpiritMenu.InitSpiritScreen(ActiveSquad); Map.BattleMenuStage = BattleMenuStages.Default; } else if (ActiveInputManager.InputCommand2Pressed()) { //Constants.ShowAnimation = !Constants.ShowAnimation; Map.sndSelection.Play(); } if (ActiveInputManager.InputConfirmPressed()) { switch (Map.BattleMenuCursorIndex) { //Begin attack. case BattleMenuChoices.Start: StartBattle(); break; case BattleMenuChoices.Action: if (ActiveSquad.UnitsAliveInSquad == 1) { ActiveSquad.CurrentLeader.UpdateNonMAPAttacks(ActiveSquad.Position, TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement, ActiveSquad.CanMove); ActiveSquad.CurrentLeader.AttackIndex = 0; //Make sure you select the first weapon. Map.BattleMenuStage = BattleMenuStages.ChooseAttack; } else { Map.BattleMenuStage = BattleMenuStages.ChooseSquadMember; //Choose squad member. Map.BattleMenuCursorIndexSecond = 1; //Leader is attacking, can't put him on defend or evade. } break; case BattleMenuChoices.Formation: Map.BattleMenuCursorIndexSecond = (int)Map.BattleMenuOffenseFormationChoice; Map.BattleMenuStage = BattleMenuStages.ChooseFormation; break; case BattleMenuChoices.Support: Map.BattleMenuCursorIndexSecond = 0; ActiveSquadSupportIndexOld = ActiveSquadSupport.ActiveSquadSupportIndex; Map.BattleMenuStage = BattleMenuStages.ChooseSupport; break; case BattleMenuChoices.Demo: Constants.ShowAnimation = !Constants.ShowAnimation; break; } Map.sndConfirm.Play(); } else if (ActiveInputManager.InputCancelPressed()) { CancelPanel(); } }
private void UpdateAttackSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { --ActiveSquad.CurrentLeader.AttackIndex; if (ActiveSquad.CurrentLeader.AttackIndex < 0) { ActiveSquad.CurrentLeader.AttackIndex = ListAttackActiveSquadSupport.Count - 1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { ++ActiveSquad.CurrentLeader.AttackIndex; if (ActiveSquad.CurrentLeader.AttackIndex >= ListAttackActiveSquadSupport.Count) { ActiveSquad.CurrentLeader.AttackIndex = 0; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputMovePressed()) { int YStep = 25; for (int A = 0; A < ListAttackActiveSquadSupport.Count; ++A) { int YStart = 122 + A * YStep; if (ActiveInputManager.IsInZone(0, YStart, Constants.Width, YStart + YStep)) { ActiveSquad.CurrentLeader.AttackIndex = A; break; } } } //Exit the weapon panel. else if (ActiveInputManager.InputConfirmPressed()) { if (ActiveSquad.CurrentLeader.CurrentAttack.CanAttack) { if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL) { Map.BattleMenuOffenseFormationChoice = FormationChoices.ALL; } Map.BattleMenuStage = BattleMenuStages.Default; ActiveSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentLeader, ActiveSquad, TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%"; if (!Map.ListPlayer[TargetPlayerIndex].IsPlayerControlled) { PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex); } Map.sndConfirm.Play(); } else { Map.sndDeny.Play(); } } else if (ActiveInputManager.InputCancelPressed()) { Map.BattleMenuStage = BattleMenuStages.Default; Map.sndCancel.Play(); } }
private void UpdateFormationSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { Map.BattleMenuCursorIndexSecond -= Map.BattleMenuCursorIndexSecond > 0 ? 1 : 0; Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { Map.BattleMenuCursorIndexSecond += Map.BattleMenuCursorIndexSecond < 1 ? 1 : 0; Map.sndSelection.Play(); } if (ActiveInputManager.InputConfirmPressed()) { if (Map.BattleMenuCursorIndexSecond == 0) { Map.BattleMenuOffenseFormationChoice = FormationChoices.Focused; } else if (Map.BattleMenuCursorIndexSecond == 1) { Map.BattleMenuOffenseFormationChoice = FormationChoices.Spread; } Map.UpdateWingmansSelection(ActiveSquad, TargetSquad, Map.BattleMenuOffenseFormationChoice); if (ActiveSquad.CurrentWingmanA != null) { if (ActiveSquad.CurrentWingmanA.CanAttack) { ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack; } else { ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend; } } if (ActiveSquad.CurrentWingmanB != null) { if (ActiveSquad.CurrentWingmanB.CanAttack) { ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack; } else { ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend; } } //Simulate defense reaction. PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex); PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad); Map.BattleMenuStage = BattleMenuStages.Default; Map.sndConfirm.Play(); } else if (ActiveInputManager.InputCancelPressed()) { Map.BattleMenuStage = BattleMenuStages.Default; Map.sndCancel.Play(); } }
private void UpdateSquadMemberDefenseSelection(GameTime gameTime) { if (ActiveInputManager.InputUpPressed()) { Map.BattleMenuCursorIndexThird++; if (Map.BattleMenuCursorIndexThird >= 3) { if (Map.BattleMenuCursorIndexSecond > 0 && Map.BattleMenuCursorIndexThird >= 3 && (!ActiveSquad[Map.BattleMenuCursorIndexSecond].CanAttack || ActiveSquad.CurrentLeader.BattleDefenseChoice != Unit.BattleDefenseChoices.Attack || Map.BattleMenuOffenseFormationChoice == FormationChoices.ALL)) { Map.BattleMenuCursorIndexThird = 1; } else { Map.BattleMenuCursorIndexThird = 0; } } Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { Map.BattleMenuCursorIndexThird--; if (Map.BattleMenuCursorIndexSecond > 0 && Map.BattleMenuCursorIndexThird <= 0 && (!ActiveSquad[Map.BattleMenuCursorIndexSecond].CanAttack || ActiveSquad.CurrentLeader.BattleDefenseChoice != Unit.BattleDefenseChoices.Attack || Map.BattleMenuOffenseFormationChoice == FormationChoices.ALL)) { Map.BattleMenuCursorIndexThird = 2; } else if (Map.BattleMenuCursorIndexThird < 0) { Map.BattleMenuCursorIndexThird = 2; } Map.sndSelection.Play(); } if (ActiveInputManager.InputConfirmPressed()) { ActiveSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice = (Unit.BattleDefenseChoices)Map.BattleMenuCursorIndexThird; if (ActiveSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice == Unit.BattleDefenseChoices.Attack) { //Simulate defense reaction. PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex); if (Map.BattleMenuOffenseFormationChoice == FormationChoices.Spread) { if (Map.BattleMenuCursorIndexSecond == 1) { ActiveSquad.CurrentWingmanA.AttackIndex = ActiveSquad.CurrentWingmanA.PLAAttack; ActiveSquad.CurrentWingmanA.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanA, ActiveSquad, TargetSquad.CurrentWingmanA, TargetSquad, TargetSquad.CurrentWingmanA.BattleDefenseChoice).ToString() + "%"; } else if (Map.BattleMenuCursorIndexSecond == 2) { ActiveSquad.CurrentWingmanB.AttackIndex = ActiveSquad.CurrentWingmanB.PLAAttack; ActiveSquad.CurrentWingmanB.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanB, ActiveSquad, TargetSquad.CurrentWingmanB, TargetSquad, TargetSquad.CurrentWingmanB.BattleDefenseChoice).ToString() + "%"; } } else if (Map.BattleMenuOffenseFormationChoice == FormationChoices.Focused) { if (Map.BattleMenuCursorIndexSecond == 1) { ActiveSquad.CurrentWingmanA.AttackIndex = ActiveSquad.CurrentWingmanA.PLAAttack; ActiveSquad.CurrentWingmanA.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanA, ActiveSquad, TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%"; } else if (Map.BattleMenuCursorIndexSecond == 2) { ActiveSquad.CurrentWingmanB.AttackIndex = ActiveSquad.CurrentWingmanB.PLAAttack; ActiveSquad.CurrentWingmanB.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentWingmanB, ActiveSquad, TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%"; } } } Map.BattleMenuStage = BattleMenuStages.Default; Map.sndConfirm.Play(); } else if (ActiveInputManager.InputCancelPressed()) { Map.BattleMenuStage = BattleMenuStages.ChooseSquadMember; Map.sndCancel.Play(); } }
public override void DoUpdate(GameTime gameTime) { int YStep = 25; int YStart = 122; //Move the cursor. if (ActiveInputManager.InputUpPressed()) { --ActiveSquad.CurrentLeader.AttackIndex; if (ActiveSquad.CurrentLeader.AttackIndex < 0) { ActiveSquad.CurrentLeader.AttackIndex = ListAttack.Count - 1; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputDownPressed()) { ++ActiveSquad.CurrentLeader.AttackIndex; if (ActiveSquad.CurrentLeader.AttackIndex >= ListAttack.Count) { ActiveSquad.CurrentLeader.AttackIndex = 0; } Map.sndSelection.Play(); } else if (ActiveInputManager.InputMovePressed()) { for (int A = 0; A < ListAttack.Count; A++) { if (ActiveInputManager.IsInZone(0, YStart + A * YStep, Constants.Width, YStart + (A + 1) * YStep)) { ActiveSquad.CurrentLeader.AttackIndex = A; break; } } } //Exit the weapon panel. if (ActiveInputManager.InputConfirmPressed(0, YStart + ActiveSquad.CurrentLeader.AttackIndex * YStep, Constants.Width, YStart + (ActiveSquad.CurrentLeader.AttackIndex + 1) * YStep)) { if (ActiveSquad.CurrentLeader.CurrentAttack.CanAttack) { if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.PER) { AddToPanelListAndSelect(new ActionPanelAttackPER(Map, ActivePlayerIndex, ActiveSquadIndex)); } else if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.MAP) { AddToPanelListAndSelect(new ActionPanelAttackMAP(Map, ActivePlayerIndex, ActiveSquadIndex)); } else { AddToPanelListAndSelect(new ActionPanelAttackPart2(Map, ActivePlayerIndex, ActiveSquadIndex)); } } else { Map.sndDeny.Play(); } } }