Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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]);
            }
        }
Ejemplo n.º 4
0
 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;
         }
     }
 }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        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();
            }
        }
Ejemplo n.º 8
0
        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();
            }
        }
Ejemplo n.º 9
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();
            }
        }
Ejemplo n.º 10
0
 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;
     }
 }
Ejemplo n.º 11
0
        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;
                    }
                }
            }
        }
Ejemplo n.º 12
0
        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();
                }
            }
        }
Ejemplo n.º 13
0
        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();
            }
        }
Ejemplo n.º 14
0
        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();
            }
        }
Ejemplo n.º 15
0
        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();
            }
        }
Ejemplo n.º 16
0
        private void UpdateSquadMemberDefenseSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                Map.BattleMenuCursorIndexThird++;
                if (Map.BattleMenuCursorIndexSecond > 0 && Map.BattleMenuCursorIndexThird >= 3 &&
                    (!TargetSquad[Map.BattleMenuCursorIndexSecond].CanAttack || TargetSquad.CurrentLeader.BattleDefenseChoice != Unit.BattleDefenseChoices.Attack || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndexThird = 1;
                }
                else if (Map.BattleMenuCursorIndexThird >= 3)
                {
                    Map.BattleMenuCursorIndexThird = 0;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                Map.BattleMenuCursorIndexThird--;
                if (Map.BattleMenuCursorIndexSecond > 0 && Map.BattleMenuCursorIndexThird <= 0 &&
                    (!TargetSquad[Map.BattleMenuCursorIndexSecond].CanAttack || TargetSquad.CurrentLeader.BattleDefenseChoice != Unit.BattleDefenseChoices.Attack || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndexThird = 2;
                }
                else if (Map.BattleMenuCursorIndexThird < 0)
                {
                    Map.BattleMenuCursorIndexThird = 2;
                }

                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                if ((Unit.BattleDefenseChoices)Map.BattleMenuCursorIndexThird == Unit.BattleDefenseChoices.Attack)
                {
                    if (Map.BattleMenuCursorIndexSecond == 0)
                    {
                        TargetSquad.CurrentLeader.UpdateNonMAPAttacks(TargetSquad.Position, ActiveSquad.Position, ActiveSquad.ArrayMapSize, ActiveSquad.CurrentMovement, TargetSquad.CanMove);

                        Map.WeaponIndexOld = TargetSquad.CurrentLeader.AttackIndex;
                        TargetSquad.CurrentLeader.AttackIndex = 0;//Make sure you select the first weapon.
                        Map.BattleMenuStage = DeathmatchMap.BattleMenuStages.ChooseAttack;
                    }
                    else
                    {
                        TargetSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;

                        //Simulate offense reaction.
                        DeathmatchMap.PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);

                        if (Map.BattleMenuDefenseFormationChoice == FormationChoices.Spread)
                        {
                            if (Map.BattleMenuCursorIndexSecond == 1)
                            {
                                TargetSquad.CurrentWingmanA.AttackIndex    = TargetSquad.CurrentWingmanA.PLAAttack;
                                TargetSquad.CurrentWingmanA.AttackAccuracy = Map.CalculateHitRate(TargetSquad.CurrentWingmanA, TargetSquad,
                                                                                                  ActiveSquad.CurrentWingmanA, ActiveSquad, ActiveSquad.CurrentWingmanA.BattleDefenseChoice).ToString() + "%";
                            }
                            else if (Map.BattleMenuCursorIndexSecond == 2)
                            {
                                TargetSquad.CurrentWingmanB.AttackIndex    = TargetSquad.CurrentWingmanB.PLAAttack;
                                TargetSquad.CurrentWingmanB.AttackAccuracy = Map.CalculateHitRate(TargetSquad.CurrentWingmanB, TargetSquad,
                                                                                                  ActiveSquad.CurrentWingmanB, ActiveSquad, ActiveSquad.CurrentWingmanB.BattleDefenseChoice).ToString() + "%";
                            }
                        }
                        else if (Map.BattleMenuDefenseFormationChoice == FormationChoices.Focused)
                        {
                            if (Map.BattleMenuCursorIndexSecond == 1)
                            {
                                TargetSquad.CurrentWingmanA.AttackIndex    = TargetSquad.CurrentWingmanA.PLAAttack;
                                TargetSquad.CurrentWingmanA.AttackAccuracy = Map.CalculateHitRate(TargetSquad.CurrentWingmanA, TargetSquad,
                                                                                                  ActiveSquad.CurrentLeader, ActiveSquad, ActiveSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%";
                            }
                            else if (Map.BattleMenuCursorIndexSecond == 2)
                            {
                                TargetSquad.CurrentWingmanB.AttackIndex    = TargetSquad.CurrentWingmanB.PLAAttack;
                                TargetSquad.CurrentWingmanB.AttackAccuracy = Map.CalculateHitRate(TargetSquad.CurrentWingmanB, TargetSquad,
                                                                                                  ActiveSquad.CurrentLeader, ActiveSquad, ActiveSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%";
                            }
                        }
                        Map.BattleMenuStage = DeathmatchMap.BattleMenuStages.Default;
                    }
                }
                else if (Map.BattleMenuCursorIndexSecond == 0)
                {
                    TargetSquad.CurrentLeader.BattleDefenseChoice = (Unit.BattleDefenseChoices)Map.BattleMenuCursorIndexThird;
                    Map.BattleMenuDefenseFormationChoice          = FormationChoices.Focused;

                    //Simulate offense reaction.
                    DeathmatchMap.PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);

                    if (TargetSquad.CurrentWingmanA != null && TargetSquad.CurrentWingmanA.BattleDefenseChoice == Unit.BattleDefenseChoices.Attack)
                    {
                        TargetSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                    }
                    if (TargetSquad.CurrentWingmanB != null && TargetSquad.CurrentWingmanB.BattleDefenseChoice == Unit.BattleDefenseChoices.Attack)
                    {
                        TargetSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                    }

                    Map.BattleMenuStage = DeathmatchMap.BattleMenuStages.Default;
                }
                else
                {
                    TargetSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice = (Unit.BattleDefenseChoices)Map.BattleMenuCursorIndexThird;
                    //Simulate offense reaction.
                    DeathmatchMap.PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);
                    Map.BattleMenuStage = DeathmatchMap.BattleMenuStages.Default;
                }

                Map.sndConfirm.Play();
            }
        }
Ejemplo n.º 17
0
        private void UpdateAttackSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                --TargetSquad.CurrentLeader.AttackIndex;
                if (TargetSquad.CurrentLeader.AttackIndex < 0)
                {
                    TargetSquad.CurrentLeader.AttackIndex = ListAttackTargetSquad.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++TargetSquad.CurrentLeader.AttackIndex;
                if (TargetSquad.CurrentLeader.AttackIndex >= ListAttackTargetSquad.Count)
                {
                    TargetSquad.CurrentLeader.AttackIndex = 0;
                }

                Map.sndSelection.Play();
            }
            //Exit the weapon panel.
            if (ActiveInputManager.InputConfirmPressed())
            {
                if (TargetSquad.CurrentLeader.CurrentAttack.CanAttack)
                {
                    TargetSquad[Map.BattleMenuCursorIndexSecond].BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;

                    if (TargetSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
                    {
                        Map.BattleMenuDefenseFormationChoice = FormationChoices.ALL;

                        if (TargetSquad.CurrentLeader.BattleDefenseChoice == Unit.BattleDefenseChoices.Attack &&
                            TargetSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
                        {
                            Map.BattleMenuDefenseFormationChoice = FormationChoices.ALL;

                            if (TargetSquad.CurrentWingmanA != null)
                            {
                                TargetSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                            }

                            if (ActiveSquad.CurrentWingmanA != null)
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyA = Map.CalculateHitRate(TargetSquad.CurrentLeader, TargetSquad,
                                                                                                    ActiveSquad.CurrentWingmanA, ActiveSquad, ActiveSquad.CurrentWingmanA.BattleDefenseChoice).ToString() + "%";
                            }
                            else
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyA = "0%";
                            }

                            if (TargetSquad.CurrentWingmanB != null)
                            {
                                TargetSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                            }

                            if (ActiveSquad.CurrentWingmanB != null)
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyB = Map.CalculateHitRate(TargetSquad.CurrentLeader, TargetSquad,
                                                                                                    ActiveSquad.CurrentWingmanB, ActiveSquad, ActiveSquad.CurrentWingmanB.BattleDefenseChoice).ToString() + "%";
                            }
                            else
                            {
                                TargetSquad.CurrentLeader.MAPAttackAccuracyB = "0%";
                            }
                        }
                    }
                    else
                    {
                        if (Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                        {
                            Map.BattleMenuDefenseFormationChoice = FormationChoices.Focused;
                        }

                        Map.UpdateWingmansSelection(TargetSquad, ActiveSquad, Map.BattleMenuOffenseFormationChoice);
                    }
                    Map.BattleMenuStage = BattleMenuStages.Default;

                    TargetSquad.CurrentLeader.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;

                    //Simulate offense reaction.
                    PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);
                    //The Defense Leader now attack.
                    TargetSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(TargetSquad.CurrentLeader, TargetSquad,
                                                                                    ActiveSquad.CurrentLeader, ActiveSquad, Unit.BattleDefenseChoices.Attack).ToString() + "%";

                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }