Beispiel #1
0
        public CoreGameEngine()
        {
            m_instance = this;

            m_saveLoad = new SaveLoadCore();

            m_timingEngine = new CoreTimingEngine();
            m_monsterSkillEngine = new MonsterSkillEffectEngine(this);

            m_dungeon = new Dictionary<int, Map>();

            StairsMapping.Setup();

            CoreGameEngineInterface.SetupCoreGameEngineInterface(this);
        }
Beispiel #2
0
        // Called by PublicGameEngine after any call to CoreGameEngine which passes time.
        internal void AfterPlayerAction(CoreGameEngine engine)
        {
            UpdatePlayerVisitedStatus();

            // Regenerate health mana if out of combat for a bit.
            const int NumberOfRoundsUntilHealthFull = 20;
            if (!CurrentOrRecentDanger())
            {
                // Always heal at least 1 point if we're not topped off. Thanks integer math!
                int hpToHeal = m_player.MaxHP / NumberOfRoundsUntilHealthFull;               
                if (m_player.CurrentHP < m_player.MaxHP && hpToHeal <= 0)
                    hpToHeal = 1;
                int mpToHeal = m_player.MaxMP / NumberOfRoundsUntilHealthFull;
                if (m_player.CurrentMP < m_player.MaxMP && mpToHeal <= 0)
                    mpToHeal = 1;

                bool magicalHeal = m_player.HasAttribute("Regeneration");
                m_player.Heal(hpToHeal, magicalHeal);
                m_player.GainMP(mpToHeal);
            }
            
            // Until the player gets a turn
            while (true)
            {
                Character nextCharacter = m_timingEngine.GetNextActor(m_player, m_map);
                if (nextCharacter is Player)
                    return;

                Monster monster = nextCharacter as Monster; 
                monster.Action(CoreGameEngineInstance.Instance);
            }
        }
Beispiel #3
0
 // Called by PublicGameEngine after any call that could pass time.
 internal void BeforePlayerAction(CoreGameEngine engine)
 {
     UpdatePlayerVisitedStatus();
 }
 internal MonsterSkillEffectEngine(CoreGameEngine engine)
 {
     m_engine = engine;
 }
Beispiel #5
0
 public void Dispose()
 {
     m_instance = null;
 }