Exemplo n.º 1
0
        public void EndTurn()
        {
            SortedDictionary <UInt32, Creature> menagerie = _currentMap.Menagerie;

            // end turn
            _scheduler.EndTurn();

            if (_myInterface.SelectedCreature != null)
            {
                _myInterface.SelectedCreature.MyMoveRangeCalculator.Update();
            }

            // this crap should be in the scheduler
            foreach (KeyValuePair <UInt32, Creature> kvp in menagerie)
            {
                //fix later
                Creature current = kvp.Value;
                current.SetStatBasic(Creature.StatBasic.AP, true, current.GetStatBasic(Creature.StatBasic.AP, false));
                current.MyMoveRangeCalculator.Update();
            }
            for (sbyte i = 0; i < _currentMap.TeamCount; ++i)
            {
                Team currentTeam = _currentMap.TeamRosterGetTeamFrom(i);
                if (currentTeam != _playerTeam)
                {
                    foreach (Creature c in currentTeam.Members)
                    {
                        c.CreatureBrain.Update();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void StartNewBattle()
        {
            MapGenerator mapGen = new MapGenerator(_randomator, _myInterface, _myDrawer);

            _currentMap      = mapGen.GenerateBasicGrasslands(Constants.MapSize, Constants.MapSize);
            this._playerTeam = _currentMap.TeamRosterGetTeamFrom(0);

            _currentMap.SetTile(new Coords(0, 0), new Tile(_currentMap, new Coords(CoordsType.Tile, 0, 0), Constants.TileGeneratorGrass));
            _currentMap.SetTile(new Coords(0, 1), new Tile(_currentMap, new Coords(CoordsType.Tile, 0, 1), Constants.TileGeneratorGrass));
            _currentMap.SetTile(new Coords(3, 3), new Tile(_currentMap, new Coords(CoordsType.Tile, 3, 3), Constants.TileGeneratorGrass));
            _currentMap.AnalyzeTileAccessibility();

            _scheduler = new Scheduler(_currentMap);
            _ledger    = new Ledger(_scheduler);

            _myInterface.MyDrawer = _myDrawer;

            Creature hero1 = _currentMap.CreateCreature(new Coords(CoordsType.Tile, 0, 0), _currentMap.TeamRosterGetTeamFrom(0),
                                                        Constants.CreatureGeneratorHero, new BrainPlayerControlled(), _myDrawer, _myInterface);

            Creature hero2 = _currentMap.CreateCreature(new Coords(CoordsType.Tile, 0, 1), _currentMap.TeamRosterGetTeamFrom(0),
                                                        Constants.CreatureGeneratorHero, new BrainPlayerControlled(), _myDrawer, _myInterface);

            hero2.SkillPointsAdd(5);

            _currentMap.CreateItem(hero1, Constants.ItemGeneratorSword);
            _currentMap.CreateItem(hero2, Constants.ItemGeneratorSword);
            _currentMap.CreateItem(hero2, Constants.ItemGeneratorBow);
        }
        public void PopulateMapWithMonsters(MapBattle map)
        {
            map.CreateTeam(Color.Red);
            map.CreateTeam(Color.Blue); //team 1. fix this later.

            for (int i = 0; i < map.BoundX; ++i)
            {
                for (int j = 0; j < map.BoundY; ++j)
                {
                    UInt32 dicethrow = _randomator.NSidedDice(50, 1);
                    if (dicethrow == 20 && map.TileIsPassable(new Coords(i, j)))
                    {
                        Creature goblin = map.CreateCreature(new Coords(CoordsType.Tile, i, j), map.TeamRosterGetTeamFrom(1),
                                                             Constants.CreatureGeneratorGoblin, new BrainBasicAI(_drawer), _drawer, _interface);
                        //map.CreateSpellForCreature(goblin, Spells.SkillMelee, _drawer, _interface);
                    }
                }
            }
        }