예제 #1
0
        protected override void InternalInit()
        {
            ScreenState state = new ScreenState
            {
                Width  = Seven.Configuration.WindowWidth,
                Height = Seven.Configuration.WindowHeight
            };

            _victoryEvent = new EndOfBattleEvent("Victory!");
            _lossEvent    = new EndOfBattleEvent("Annihilated!");

            Screen = new BattleScreen(this, state);

            SpeedValue = (32768 / (120 + (Seven.Party.BattleSpeed * 15 / 8)));

            GlobalClock = new BattleClock(SpeedValue);

            Allies = new Ally[Party.PARTY_SIZE];

            int[] e = _formation.GetAllyTurnTimersElapsed(Party);

            for (int i = 0; i < Party.PARTY_SIZE; i++)
            {
                if (Party[i] != null)
                {
                    Allies[i] = new Ally(this, i, e[i]);
                    Allies[i].InitMenu(state);
                }
            }

            if (Allies.All(a => a == null))
            {
                throw new GameDataException("Must have at least one ally in battle.");
            }

            EnemyList = _formation.GetEnemyList(this);

            foreach (Ally ally in Allies)
            {
                if (ally != null)
                {
                    CombatantClocks.Add(ally.TurnTimer);
                    CombatantClocks.Add(ally.V_Timer);
                    CombatantClocks.Add(ally.C_Timer);
                    ally.TurnTimer.Unpause();
                }
            }

            foreach (Enemy enemy in EnemyList)
            {
                CombatantClocks.Add(enemy.TurnTimer);
                CombatantClocks.Add(enemy.V_Timer);
                CombatantClocks.Add(enemy.C_Timer);
                enemy.EnterBattle();
            }

            foreach (Enemy enemy in EnemyList)
            {
                enemy.TurnTimer.Unpause();
            }
        }