public TownController(GameWorld gameWorld, ISaveGameRepository saveGameRepository, IAsciiArtRepository asciiArtRepository, IDice dice)
 {
     _gameWorld = gameWorld;
     _saveGameRepository = saveGameRepository;
     _asciiArtRepository = asciiArtRepository;
     _dice = dice;
 }
 public NewGameController(ISaveGameRepository saveGameRepository, IAsciiArtRepository asciiArtRepository, IStatsGenerator statsGenerator, GameWorld gameWorld)
 {
     _saveGameRepository = saveGameRepository;
     _asciiArtRepository = asciiArtRepository;
     _statsGenerator = statsGenerator;
     _gameWorld = gameWorld;
 }
 public InnController(GameWorld gameWorld, ISaveGameRepository saveGameRepository, IAsciiArtRepository asciiArtRepository, IDice dice)
 {
     _gameWorld = gameWorld;
     _saveGameRepository = saveGameRepository;
     _asciiArtRepository = asciiArtRepository;
     _dice = dice;
     _title = "Welcome to the Tolbooth Tavern. The food ain't great and the beds aren't soft. But it's the only Inn in town.";
 }
 public SpellBookController(GameWorld gameWorld, IAsciiArtRepository asciiArtRepository, IDice dice)
 {
     _gameWorld = gameWorld;
     _asciiArtRepository = asciiArtRepository;
     _dice = dice;
     _title = DefaultTitle;
     _information = DefaultInformation;
 }
 public LoadGameController(ISaveGameRepository saveGameRepository, IAsciiArtRepository asciiArtRepository, GameWorld gameWorld)
 {
     _saveGameRepository = saveGameRepository;
     _asciiArtRepository = asciiArtRepository;
     _gameWorld = gameWorld;
 }
Exemple #6
0
        public void LoadToGameWorld(GameWorld gameWorld)
        {
            var player = new Player
            {
                BaseStats = Stats,
                Class = Game.Class.FromName(Class),
                Level = Level,
                Gold = Gold,
                Experience = Experience,
                Name = CharacterName,
                Race = Game.Race.FromName(Race),
                Weapon = Weapon
            };

            player.CurrentHitPoints = player.MaxHitPoints;
            player.CurrentEnergy = player.MaxEnergy;
            gameWorld.Player = player;

            gameWorld.SaveGameId = Id;
            gameWorld.CurrentDungeonLevel = CurrentDungeonLevel;
            gameWorld.TotalNumberOfMonstersDefeated = TotalNumberOfMonstersDefeated;

            gameWorld.Player.ClearInventory();
            if (Inventory != null)
            {
                foreach (var item in Inventory)
                {
                    gameWorld.Player.AddItemToInventory(item);
                }
            }

            gameWorld.Player.ClearSpellBook();
            if (SpellBook != null)
            {
                foreach (var spell in SpellBook)
                {
                    gameWorld.Player.AddSpellToSpellBook(spell);
                }
            }

            gameWorld.BossesDefeated.Clear();
            if (BossesDefeated != null)
            {
                foreach (var boss in BossesDefeated)
                {
                    gameWorld.BossesDefeated.Add(boss);
                }
            }
        }
Exemple #7
0
        public static SaveGameData FromGameWorld(GameWorld gameWorld)
        {
            var saveGameData = new SaveGameData
            {
                BossesDefeated = new List<string>(gameWorld.BossesDefeated),
                CharacterName = gameWorld.Player.Name,
                Class = gameWorld.Player.Class.Name,
                CurrentDungeonLevel = gameWorld.CurrentDungeonLevel,
                Id = gameWorld.SaveGameId,
                Level = gameWorld.Player.Level,
                Gold = gameWorld.Player.Gold,
                Experience = gameWorld.Player.Experience,
                Race = gameWorld.Player.Race.Name,
                Stats = gameWorld.Player.BaseStats,
                TotalNumberOfMonstersDefeated = gameWorld.TotalNumberOfMonstersDefeated,
                Weapon = gameWorld.Player.Weapon,
                Inventory = gameWorld.Player.Inventory.ToList(),
                SpellBook = gameWorld.Player.SpellBook.ToList()
            };

            return saveGameData;
        }