Ejemplo n.º 1
0
        public static void EndPlayerPhase(DeathmatchMap Map)
        {
            //Reset the cursor.
            Map.ActiveSquadIndex = -1;

            if (Map.IsClient && GameScreen.FMODSystem.sndActiveBGMName != Map.sndBattleThemeName && !string.IsNullOrEmpty(Map.sndBattleThemeName))
            {
                Map.sndBattleTheme.Stop();
                Map.sndBattleTheme.SetLoop(true);
                Map.sndBattleTheme.PlayAsBGM();
                GameScreen.FMODSystem.sndActiveBGMName = Map.sndBattleThemeName;
            }

            do
            {
                Map.ActivePlayerIndex++;
                UpdateDelayedAttacks(Map, Map.ActivePlayerIndex);
                UpdatePERAttacks(Map, Map.ActivePlayerIndex);

                if (Map.ActivePlayerIndex >= Map.ListPlayer.Count)
                {
                    Map.OnNewTurn();
                    UpdateDelayedAttacks(Map, Map.ActivePlayerIndex);
                    UpdatePERAttacks(Map, Map.ActivePlayerIndex);
                }

                foreach (Player ActivePlayer in Map.ListPlayer)
                {
                    for (int S = 0; S < ActivePlayer.ListSquad.Count; S++)
                    {
                        Squad ActiveSquad = ActivePlayer.ListSquad[S];

                        for (int U = ActiveSquad.UnitsAliveInSquad - 1; U >= 0; --U)
                        {
                            ActiveSquad[U].UpdateSkillsLifetime(SkillEffect.LifetimeTypeTurns + Map.ActivePlayerIndex);
                            Map.ActivateAutomaticSkills(ActiveSquad, ActiveSquad[U], null, ActiveSquad, ActiveSquad[U]);
                        }
                    }
                }
            }while (!Map.ListPlayer[Map.ActivePlayerIndex].IsAlive);

            for (int S = 0; S < Map.ListPlayer[Map.ActivePlayerIndex].ListSquad.Count; S++)
            {
                Squad ActiveSquad = Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[S];

                for (int U = ActiveSquad.UnitsAliveInSquad - 1; U >= 0; --U)
                {
                    Map.ActivateAutomaticSkills(ActiveSquad, ActiveSquad[U], "Player Phase Start Requirement", ActiveSquad, ActiveSquad[U]);

                    //Repair passive bonus.
                    if (ActiveSquad[U].Boosts.RepairModifier)
                    {
                        for (int U2 = ActiveSquad.UnitsAliveInSquad - 1; U2 >= 0; --U2)
                        {
                            ActiveSquad[U2].HealUnit((int)(ActiveSquad[U2].MaxHP * 0.05));
                        }
                    }

                    //Resupply passive bonus.
                    if (ActiveSquad[U].Boosts.ResupplyModifier)
                    {
                        for (int U2 = ActiveSquad.UnitsAliveInSquad - 1; U2 >= 0; --U2)
                        {
                            ActiveSquad[U2].RefillEN((int)(ActiveSquad[U2].MaxEN * 0.05));
                        }
                    }

                    ActiveSquad[U].OnPlayerPhaseStart(Map.ActivePlayerIndex, ActiveSquad);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            if (InputHelper.InputConfirmPressed() && ListUnitPart.Count > 0)
            {
                ManualSkill ActiveSpirit = ListUnitPart[CursorIndex].Spirit;

                if (ActiveSpirit.Range > 0)
                {
                    Map.ComputeRange(ActiveSquad.Position, 0, ActiveSpirit.Range);
                }

                for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; U++)
                {
                    for (int C = 0; C < ActiveSquad[U].ArrayCharacterActive.Length; C++)
                    {
                        Map.GlobalDeathmatchContext.SetContext(ActiveSquad, ActiveSquad[U], ActiveSquad[U].ArrayCharacterActive[C], null, null, null, Map.ActiveParser);

                        ManualSkill SpiritToActivate = ActiveSpirit;

                        //Consume SP and activate skills.
                        SpiritToActivate.ActiveSkillFromMenu(ActiveSquad[U].ArrayCharacterActive[C], ActiveSquad);
                        //Update skills activation to disable those who can't be used anymore.
                        SpiritToActivate.UpdateSkillActivation();
                    }
                }

                for (int P = 0; P < Map.ListPlayer.Count; ++P)
                {
                    for (int S = 0; S < Map.ListPlayer[P].ListSquad.Count; ++S)
                    {
                        for (int U = 0; U < Map.ListPlayer[P].ListSquad[S].UnitsAliveInSquad; ++U)
                        {
                            Map.ActivateAutomaticSkills(Map.ListPlayer[P].ListSquad[S], Map.ListPlayer[P].ListSquad[S][U], string.Empty, Map.ListPlayer[P].ListSquad[S], Map.ListPlayer[P].ListSquad[S][U]);
                        }
                    }
                }

                Map.GlobalDeathmatchContext.SetContext(null, null, null, null, null, null, Map.ActiveParser);

                Map.sndConfirm.Play();
            }
            else if (InputHelper.InputCancelPressed())
            {
                Map.CursorPosition        = ActiveSquad.Position;
                Map.CursorPositionVisible = Map.CursorPosition;

                Map.sndCancel.Play();

                RemoveScreen(this);
            }

            #region Move the Spirit Menu cursor

            else if (InputHelper.InputUpPressed())
            {//Move Spirit cursor down.
                if (CursorIndex - 1 >= 0)
                {
                    CursorIndex--;

                    Map.sndSelection.Play();
                }
            }
            else if (InputHelper.InputDownPressed())
            {//Move Spirit cursor up.
                if (CursorIndex + 1 < ListUnitPart.Count)
                {
                    CursorIndex++;

                    Map.sndSelection.Play();
                }
            }

            #endregion
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            #region Toggle Spirit

            //Add or remove the EN needed to the pilot.
            if (InputHelper.InputCommand1Pressed())
            {
                if (ActiveSpirit == null)
                {
                    return;
                }

                if (ActiveSpirit.CanActivate)
                {
                    if (PilotSpiritActivation[ActiveUnitIndex][PilotIndex].Contains(ActiveSpirit))//Deactivate Skill
                    {
                        ListSelectedSpirit.Remove(ActiveSpirit);
                        PilotSpiritActivation[ActiveUnitIndex][PilotIndex].Remove(ActiveSpirit);

                        Map.sndSelection.Play();
                    }
                    else if (GetPilotRemainingSP() - ActiveSpirit.SPCost >= 0)//Activate Skill
                    {
                        if (ListSelectedSpirit.Count == 0 || (!ActiveSpirit.Target.MustBeUsedAlone && !ListSelectedSpirit.Last().Target.MustBeUsedAlone))
                        {
                            ListSelectedSpirit.Add(ActiveSpirit);
                            PilotSpiritActivation[ActiveUnitIndex][PilotIndex].Add(ActiveSpirit);

                            Map.sndSelection.Play();
                        }
                    }
                    else
                    {
                        Map.sndDeny.Play();
                    }
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }

            #endregion

            else if (InputHelper.InputConfirmPressed())
            {
                if (ActiveSpirit == null)
                {
                    return;
                }

                if (ListSelectedSpirit.Count == 0)
                {
                    if (ActiveSpirit.CanActivate && GetPilotRemainingSP() - ActiveSpirit.SPCost >= 0)
                    {
                        ListSelectedSpirit.Add(ActiveSpirit);
                        PilotSpiritActivation[ActiveUnitIndex][PilotIndex].Add(ActiveSpirit);
                    }
                    else
                    {
                        return;
                    }
                }

                if (ListSelectedSpirit[0].Range > 0)
                {
                    List <Vector3> ListMVChoice = Map.ComputeRange(ActiveSquad.Position, 0, ListSelectedSpirit[0].Range);
                    Map.ListLayer[Map.ActiveLayerIndex].LayerGrid.AddDrawablePoints(ListMVChoice, Color.FromNonPremultiplied(0, 128, 0, 190));
                }

                for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; U++)
                {
                    for (int C = 0; C < ActiveSquad[U].ArrayCharacterActive.Length; C++)
                    {
                        for (int S = 0; S < PilotSpiritActivation[ActiveUnitIndex][PilotIndex].Count; ++S)
                        {
                            Map.GlobalDeathmatchContext.SetContext(ActiveSquad, ActiveSquad[U], ActiveSquad[U].ArrayCharacterActive[C], null, null, null);

                            ManualSkill SpiritToActivate = PilotSpiritActivation[ActiveUnitIndex][PilotIndex][S];

                            //Consume SP and activate skills.
                            SpiritToActivate.ActiveSkillFromMenu(ActiveSquad[U].ArrayCharacterActive[C], ActiveSquad);
                            //Update skills activation to disable those who can't be used anymore.
                            SpiritToActivate.UpdateSkillActivation();

                            ListSelectedSpirit.Remove(SpiritToActivate);
                            PilotSpiritActivation[ActiveUnitIndex][PilotIndex].Remove(SpiritToActivate);
                        }
                    }
                }

                for (int P = 0; P < Map.ListPlayer.Count; ++P)
                {
                    for (int S = 0; S < Map.ListPlayer[P].ListSquad.Count; ++S)
                    {
                        for (int U = 0; U < Map.ListPlayer[P].ListSquad[S].UnitsAliveInSquad; ++U)
                        {
                            Map.ActivateAutomaticSkills(Map.ListPlayer[P].ListSquad[S], Map.ListPlayer[P].ListSquad[S][U], string.Empty, Map.ListPlayer[P].ListSquad[S], Map.ListPlayer[P].ListSquad[S][U]);
                        }
                    }
                }

                Map.GlobalDeathmatchContext.SetContext(null, null, null, null, null, null);

                Map.sndConfirm.Play();
            }
            else if (InputHelper.InputCancelPressed())
            {
                Map.CursorPosition        = ActiveSquad.Position;
                Map.CursorPositionVisible = Map.CursorPosition;

                Map.sndCancel.Play();

                RemoveScreen(this);
            }

            #region Move the Spirit Menu cursor

            else if (InputHelper.InputUpPressed())
            {//Move Spirit cursor down.
                if (CursorIndex - 1 >= 0)
                {
                    CursorIndex--;

                    Map.sndSelection.Play();
                }
                //End of Spirit list, move to last pilot.
                else if (PilotIndex - 1 > 0)
                {
                    PilotIndex--;
                    Map.sndSelection.Play();
                }
            }
            else if (InputHelper.InputDownPressed())
            {//Move Spirit cursor up.
                if (CursorIndex + 1 < ActiveSquad[ActiveUnitIndex].ArrayCharacterActive[PilotIndex].ArrayPilotSpirit.Length)
                {
                    CursorIndex++;

                    Map.sndSelection.Play();
                }
                //End of Spirit list, move to next pilot.
                else if (PilotIndex + 1 < ActiveSquad[ActiveUnitIndex].ArrayCharacterActive.Length)
                {
                    PilotIndex++;
                    Map.sndSelection.Play();
                }
            }
            else if (InputHelper.InputRightPressed())
            {
                if (ActiveUnitIndex < ActiveSquad.UnitsAliveInSquad - 1)
                {
                    ActiveUnitIndex++;
                    PilotIndex  = 0;
                    CursorIndex = 0;
                }
            }
            else if (InputHelper.InputLeftPressed())
            {
                if (ActiveUnitIndex > 0)
                {
                    ActiveUnitIndex--;
                    PilotIndex  = 0;
                    CursorIndex = 0;
                }
            }

            #endregion
        }