Пример #1
0
        private void PrepareToAttack()
        {
            AttackChoice = Map.GetAttackChoice(ActiveSquad.CurrentLeader, ActiveSquad.Position);
            Map.ListLayer[0].LayerGrid.AddDrawablePoints(AttackChoice, Color.FromNonPremultiplied(255, 0, 0, 190));
            Map.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Focused;

            if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
            {
                Map.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.ALL;
            }
            else
            {
                Map.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.Focused;
            }

            //Prepare the Battle Sumary menu.
            Map.BattleMenuCursorIndex = 0;

            //Show the Battle Sumary Menu.
            Map.BattleMenuStage = DeathmatchMap.BattleMenuStages.Default;

            //Prepare the Cursor to move.
            Map.CursorPosition.X      = ActiveSquad.X;
            Map.CursorPosition.Y      = ActiveSquad.Y;
            Map.CursorPositionVisible = Map.CursorPosition;
            AICursorNextPosition.X    = TargetSquad.X;
            AICursorNextPosition.Y    = TargetSquad.Y;
            Map.GetAttackChoice(ActiveSquad.CurrentLeader, ActiveSquad.Position);

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

            if (ActiveSquad.CurrentWingmanA != null)
            {
                ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                if (ActiveSquad.CurrentWingmanA.PLAAttack >= 0)
                {
                    Attack PLAAttack = ActiveSquad.CurrentWingmanA.ListAttack[ActiveSquad.CurrentWingmanA.PLAAttack];
                    PLAAttack.UpdateAttack(ActiveSquad.CurrentWingmanA, ActiveSquad.Position, TargetSquad.Position, TargetSquad.CurrentMovement, true);

                    if (PLAAttack.CanAttack)
                    {
                        ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                    }
                }
            }

            if (ActiveSquad.CurrentWingmanB != null)
            {
                ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                if (ActiveSquad.CurrentWingmanB.PLAAttack >= 0)
                {
                    Attack PLAAttack = ActiveSquad.CurrentWingmanB.ListAttack[ActiveSquad.CurrentWingmanB.PLAAttack];
                    PLAAttack.UpdateAttack(ActiveSquad.CurrentWingmanB, ActiveSquad.Position, TargetSquad.Position, TargetSquad.CurrentMovement, true);

                    if (PLAAttack.CanAttack)
                    {
                        ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                    }
                }
            }

            //Simulate defense reaction.
            DeathmatchMap.PrepareDefenseSquadForBattle(Map, ActiveSquad, TargetSquad);
            //Compute the Attacker's accuracy and Wingmans reaction.
            DeathmatchMap.PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);
        }
Пример #2
0
        private void PrepareToAttack()
        {
            ListAttackChoice  = Map.GetAttackChoice(ActiveSquad.CurrentLeader, ActiveSquad.Position);
            ListAttackTerrain = new List <MovementAlgorithmTile>();
            foreach (Vector3 ActiveTerrain in ListAttackChoice)
            {
                ListAttackTerrain.Add(Map.GetTerrain(ActiveTerrain.X, ActiveTerrain.Y, (int)ActiveTerrain.Z));
            }
            Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190));
            Map.BattleMenuDefenseFormationChoice = BattleMap.FormationChoices.Focused;

            if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
            {
                Map.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.ALL;
            }
            else
            {
                Map.BattleMenuOffenseFormationChoice = BattleMap.FormationChoices.Focused;
            }

            //Prepare the Battle Sumary menu.
            Map.BattleMenuCursorIndex = 0;

            //Show the Battle Sumary Menu.
            Map.BattleMenuStage = DeathmatchMap.BattleMenuStages.Default;

            //Prepare the Cursor to move.
            Map.CursorPosition.X      = ActiveSquad.X;
            Map.CursorPosition.Y      = ActiveSquad.Y;
            Map.CursorPositionVisible = Map.CursorPosition;
            AICursorNextPosition.X    = TargetSquad.X;
            AICursorNextPosition.Y    = TargetSquad.Y;
            Map.GetAttackChoice(ActiveSquad.CurrentLeader, ActiveSquad.Position);

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

            if (ActiveSquad.CurrentWingmanA != null)
            {
                ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                if (ActiveSquad.CurrentWingmanA.PLAAttack >= 0)
                {
                    Attack PLAAttack = ActiveSquad.CurrentWingmanA.ListAttack[ActiveSquad.CurrentWingmanA.PLAAttack];
                    PLAAttack.UpdateAttack(ActiveSquad.CurrentWingmanA, ActiveSquad.Position, TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement, true);

                    if (PLAAttack.CanAttack)
                    {
                        ActiveSquad.CurrentWingmanA.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                    }
                }
            }

            if (ActiveSquad.CurrentWingmanB != null)
            {
                ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Defend;
                if (ActiveSquad.CurrentWingmanB.PLAAttack >= 0)
                {
                    Attack PLAAttack = ActiveSquad.CurrentWingmanB.ListAttack[ActiveSquad.CurrentWingmanB.PLAAttack];
                    PLAAttack.UpdateAttack(ActiveSquad.CurrentWingmanB, ActiveSquad.Position, TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement, true);

                    if (PLAAttack.CanAttack)
                    {
                        ActiveSquad.CurrentWingmanB.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                    }
                }
            }

            //Simulate defense reaction.
            DeathmatchMap.PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, Target.Item1, Target.Item2);
            //Compute the Attacker's accuracy and Wingmans reaction.
            DeathmatchMap.PrepareAttackSquadForBattle(Map, ActiveSquad, TargetSquad);
        }