예제 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            MonsterManager.Initialize();
            SpellManager.Initialize();
            AttackManager.Initialize();
            SoundManager.Initialize();
            TextManager.Initialize(360, 413);
            TeamManager.Initialize();

            sceneOne = new BattleScene(1, 50, 130); // y was 139
            sceneOne.Initialize();

            sceneTwo = new BattleScene(2, 665, 130, true);
            sceneTwo.Initialize();

            combatThread = new Thread(CombatLoop);

            base.Initialize();
        }
예제 #2
0
        /// <summary>
        /// Generate and return a list of actions from active monsters
        /// </summary>
        /// <param name="sceneRef">The target scene to target monsters from</param>
        public List <Action> GetMonsterActions(BattleScene sceneRef)
        {
            // Get the monster's action at a given position
            List <Action> actList = new List <Action>();

            foreach (Monster mon in GetAllLiveMonsters())
            {
                if (mon == null)
                {
                    continue;
                }

                // Rolls the monster's initiative and figure out it's action
                mon.Init = mon.Evasion += Globals.rnd.Next(0, 50);
                Action        action = new Action(mon);
                MonsterAction monAct = mon.GetAction();

                if (monAct.Name == "Attack")
                {
                    // If monster is in back row, it will instead return 'nothing'
                    if (MonsterIsBackRow(mon))
                    {
                        action.Nothing = true;
                        action.Targets.Add(mon);
                        actList.Add(action);
                        continue;
                    }

                    action.Physical = true;

                    // Confused monsters target their allies and themselves
                    if (mon.HasTempStatus(TempStatus.Confuse))
                    {
                        action.Targets.Add(this.GetFrontRowTarget());
                    }
                    else
                    {
                        action.Targets.Add(sceneRef.GetFrontRowTarget());
                    }

                    actList.Add(action);
                    continue;
                }
                else
                {
                    // Get Spell
                    Spell spell = SpellManager.GetSpellByName(monAct.Name);
                    spell.Accuracy    = monAct.Accuracy;
                    action.Spell      = spell;
                    action.SpellLevel = monAct.Level;

                    // Deal mp cost here, why not
                    mon.MP -= monAct.MPCost;

                    switch (monAct.Target)
                    {
                    case "Self":
                        action.Targets.Add(mon);
                        break;

                    case "SingleTarget":
                        action.Targets.Add(sceneRef.GetAnySingleTarget());
                        break;

                    case "EnemyParty":
                        action.Targets = sceneRef.GetAllLiveMonsters().ToList();
                        break;

                    case "CasterParty":
                        action.Targets = GetAllLiveMonsters().ToList();
                        break;

                    default:
                        throw new Exception("Invalid monAct target: " + monAct.Target);
                    }
                    actList.Add(action);
                }
            }

            return(actList);
        }