Exemple #1
0
        public override void Load()
        {
            if (PlayerRoster == null)
            {
                PlayerRoster = new Roster();
                PlayerRoster.LoadRoster();
            }

            base.Load();
            if (!IsServer)
            {
                LoadPreBattleMenu();
            }
            LoadMap();
            LoadMapAssets();
            LoadDeathmatchAIScripts();

            Dictionary <string, CutsceneScript> DeathmatchMapScripts = CutsceneScriptHolder.LoadAllScripts(typeof(DeathmatchMapCutsceneScriptHolder), this);

            foreach (CutsceneScript ActiveListScript in DeathmatchMapScripts.Values)
            {
                DicCutsceneScript.Add(ActiveListScript.Name, ActiveListScript);
            }

            SpiritMenu = new SpiritMenu(this);
            if (!IsServer)
            {
                SpiritMenu.Load();
            }

            BattleMapMenu = new MapMenu(this);
            if (!IsServer)
            {
                BattleMapMenu.Load(Content, FMODSystem);
            }

            UnitDeploymentScreen = new UnitDeploymentScreen(PlayerRoster);
            if (!IsServer)
            {
                UnitDeploymentScreen.Load(Content);
            }

            NonDemoScreen = new NonDemoScreen(this);
            if (!IsServer)
            {
                NonDemoScreen.Load();

                fntArial12 = Content.Load <SpriteFont>("Fonts/Arial12");
                fntArial16 = Content.Load <SpriteFont>("Fonts/Arial16");
            }
        }
Exemple #2
0
        public void InitPlayerBattle(Squad ActiveSquad, SupportSquadHolder ActiveSquadSupport, int AttackerPlayerIndex,
                                     Squad TargetSquad, SupportSquadHolder TargetSquadSupport, int DefenderPlayerIndex,
                                     bool IsActiveSquadOnRight)
        {
            if (TargetSquad.CurrentLeader.Boosts.AttackFirstModifier && !ActiveSquad.CurrentLeader.Boosts.AttackFirstModifier)
            {
                Squad ActiveSquadTemp = ActiveSquad;
                SupportSquadHolder ActiveSquadSupportTemp = ActiveSquadSupport;
                int AttackerPlayerIndexTemp = AttackerPlayerIndex;

                ActiveSquad         = TargetSquad;
                ActiveSquadSupport  = TargetSquadSupport;
                AttackerPlayerIndex = DefenderPlayerIndex;

                TargetSquad         = ActiveSquadTemp;
                TargetSquadSupport  = ActiveSquadSupportTemp;
                DefenderPlayerIndex = AttackerPlayerIndexTemp;
            }

            ActivePlayerIndex = AttackerPlayerIndex;
            ActiveSquadIndex  = ListPlayer[AttackerPlayerIndex].ListSquad.IndexOf(ActiveSquad);
            TargetPlayerIndex = DefenderPlayerIndex;
            TargetSquadIndex  = ListPlayer[TargetPlayerIndex].ListSquad.IndexOf(TargetSquad);

            bool ShowAnimation = Constants.ShowAnimation && ActiveSquad.CurrentLeader.CurrentAttack.Animations.Start.AnimationName != null;

            ListNextAnimationScreen.Clear();
            NonDemoScreen.ListNonDemoBattleFrame.Clear();
            ListActionMenuChoice.RemoveAllSubActionPanels();

            SquadBattleResult AttackingResult = CalculateFinalHP(ActiveSquad, ActiveSquadSupport.ActiveSquadSupport, ActivePlayerIndex,
                                                                 BattleMenuOffenseFormationChoice, TargetSquad, TargetSquadSupport.ActiveSquadSupport, TargetPlayerIndex, true, true);

            AnimationScreen.AnimationUnitStats UnitStats = new AnimationScreen.AnimationUnitStats(ActiveSquad, TargetSquad, IsActiveSquadOnRight);
            SquadBattleResult DefendingResult            = new SquadBattleResult(new BattleResult[1] {
                new BattleResult()
            });

            if (ShowAnimation)
            {
                if (IsActiveSquadOnRight)
                {
                    GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.RightAttackLeft, AttackingResult);
                }
                else
                {
                    GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.LeftAttackRight, AttackingResult);
                }
            }

            if (AttackingResult.ArrayResult[0].Target.ComputeRemainingHPAfterDamage(AttackingResult.ArrayResult[0].AttackDamage) > 0)
            {
                //Counter.
                if (TargetSquad.CurrentLeader.BattleDefenseChoice == Unit.BattleDefenseChoices.Attack)
                {
                    DefendingResult = CalculateFinalHP(TargetSquad, null, TargetPlayerIndex,
                                                       BattleMenuDefenseFormationChoice, ActiveSquad, null, ActivePlayerIndex, true, true);

                    if (ShowAnimation)
                    {
                        if (IsActiveSquadOnRight)
                        {
                            GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.RightConteredByLeft, DefendingResult);
                        }
                        else
                        {
                            GenerateNextAnimationScreens(ActiveSquad, ActiveSquadSupport, TargetSquad, TargetSquadSupport, UnitStats, AnimationScreen.BattleAnimationTypes.LeftConteredByRight, DefendingResult);
                        }
                    }
                }
            }

            if (ShowAnimation)
            {
                PushScreen(ListNextAnimationScreen[0]);
                ListNextAnimationScreen.RemoveAt(0);
                ListNextAnimationScreen.Add(new EndBattleAnimationScreen(this, ActiveSquad, ActiveSquadSupport, AttackerPlayerIndex,
                                                                         TargetSquad, TargetSquadSupport, DefenderPlayerIndex, AttackingResult, DefendingResult));
            }
            else
            {
                NonDemoScreen.InitNonDemo(ActiveSquad, ActiveSquadSupport, AttackerPlayerIndex, AttackingResult, BattleMenuOffenseFormationChoice,
                                          TargetSquad, TargetSquadSupport, DefenderPlayerIndex, DefendingResult, BattleMenuDefenseFormationChoice, IsActiveSquadOnRight);

                NonDemoScreen.Alive = true;
                ListGameScreen.Insert(0, NonDemoScreen);
            }

            //AttackingSquad Activations.
            for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; U++)
            {
                ActiveSquad[U].UpdateSkillsLifetime(SkillEffect.LifetimeTypeBattle);
            }
            //DefendingSquad Activations.
            for (int U = 0; U < TargetSquad.UnitsAliveInSquad; U++)
            {
                TargetSquad[U].UpdateSkillsLifetime(SkillEffect.LifetimeTypeBattle);
            }

            FinalizeMovement(ActiveSquad, (int)GetTerrain(ActiveSquad).MovementCost);
            ActiveSquad.EndTurn();

            bool HasAfterAttack = false;
            ActionPanelDeathmatch AfterAttack = new ActionPanelMainMenu(this, ActiveSquad, AttackerPlayerIndex);

            if (ActiveSquad.CurrentLeader.Boosts.PostAttackModifier.Attack)
            {
                HasAfterAttack = true;
                AfterAttack.AddChoiceToCurrentPanel(new ActionPanelAttackPart1(ActiveSquad.CanMove, ActiveSquad, AttackerPlayerIndex, this));
            }

            if (ActiveSquad.CurrentLeader.Boosts.PostAttackModifier.Move)
            {
                HasAfterAttack = true;
                CursorPosition = ActiveSquad.Position;
                AfterAttack.AddChoiceToCurrentPanel(new ActionPanelMovePart1(this, ActiveSquad.Position, CameraPosition, ActiveSquad, AttackerPlayerIndex, true));
            }

            if (HasAfterAttack)
            {
                AfterAttack.AddChoiceToCurrentPanel(new ActionPanelWait(this, ActiveSquad));
                ListActionMenuChoice.Add(AfterAttack);
            }
        }