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);
        }
Exemple #2
0
        public DrawerBattle(Game1 myGame, ContentManager content, InterfaceBattle myInterface) : base(myGame, content)
        {
            _myInterface = myInterface;

            _zoom = Constants.ZoomDefault;

            //_myMoveRangeCalculator = new MoveRangeCalculator(_currentMap);
            _currentMap = myGame.CurrentMap;

            Load_content();
        }
 public void PopulateMapWithItems(MapBattle map)
 {
     for (int i = 0; i < map.BoundX; ++i)
     {
         for (int j = 0; j < map.BoundY; ++j)
         {
             UInt32 dicethrow = _randomator.NSidedDice(200, 1);
             if (dicethrow == 19 && map.TileIsPassable(new Coords(i, j)))
             {
                 map.CreateItem(new Coords(i, j), Constants.ItemGeneratorShield);
             }
         }
     }
 }
Exemple #4
0
 public Spell(Spells type, Creature agent, DrawerBattle drawer, InterfaceBattle myInterface,
              SpellTarget targetType, UInt16 range, UInt16 magnitude, UInt16 executionTime)
 {
     _type       = type;
     _agent      = agent;
     _map        = _agent.MapBattlemap;
     _drawer     = drawer;
     _interface  = myInterface;
     _targetType = targetType;
     //_spellEffects = spellEffects;
     _range         = range;
     _magnitude     = magnitude;
     _executionTime = executionTime;
 }
        private MoveRangeCalculator(MapBattle currentMap)
        {
            _currentMap = currentMap;

            _directionMap = new Direction?[_currentMap.BoundX, _currentMap.BoundY];

            _rangeMap = new BitArray[_currentMap.BoundX];
            for (int i = 0; i < _currentMap.BoundX; ++i)
            {
                _rangeMap[i] = new BitArray(_currentMap.BoundY);
            }

            _APCount = new Int32[_currentMap.BoundX, _currentMap.BoundY];
        }
        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);
                    }
                }
            }
        }
Exemple #7
0
        public Creature(MapBattle currentMap, Coords startPos, UInt16 ID, Team team, CreatureGenerator generator, Brain creatureBrain)
            : base(currentMap, startPos, ID, team, creatureBrain)
        {
            this._name = generator.name;


            this._myInventoryBackpack = new Inventory(this, Constants.InventorySize);
            this._myInventoryEquipped = new Inventory(this, (sbyte)InventoryType.COUNT);
            this._myBitmap            = generator.creatureBitmaps;

            this._inhabitedMap = currentMap;
            this._inhabitedMap.MenagerieAddCreatureTo(ID, this);

            this._myVisibilityTracker = _inhabitedMap.MyVisibilityTracker;
            //this._myPathfinder = _inhabitedMap.MyPathfinder;

            this._creatureBrain       = creatureBrain;
            _creatureBrain.MyCreature = this;

            this._fieldOfView = new BitArray[currentMap.BoundX];
            for (int i = 0; i < currentMap.BoundX; ++i)
            {
                _fieldOfView[i] = new BitArray(currentMap.BoundY);
            }

            GenerateStats(generator.MainStatsMeans, generator.MainStatsDeviations);

            _APMoveCosts   = generator.APMoveCosts;
            _APActionCosts = generator.APActionCosts;

            this._positionTile = startPos;
            this._inhabitedMap.TenancyMap[startPos.X, startPos.Y] = this;
            _myVisibilityTracker.VisibilityResidentAdd(startPos, this);
            //this._inhabitedMap.VacancyMap[startPos.X][startPos.Y] = false;

            this._myMoveRangeCalculator = new MoveRangeCalculator(this);
            _myMoveRangeCalculator.Update();
            this.FieldOfViewUpdate();
            //this._inhabitedMap.MyCollider.RegisterCreature(this);
        }
        public MapBattle GenerateBasicGrasslands(UInt16 dimensionX, UInt16 dimensionY)
        {
            MapBattle newMap = new MapBattle(_randomator, dimensionX, dimensionY);

            LinkMapToDrawerAndInterface(newMap);

            for (int i = 0; i < dimensionX; ++i)
            {
                for (int j = 0; j < dimensionY; ++j)
                {
                    // Move the constant parameters to constants
                    UInt32 dicethrow     = _randomator.NSidedDice(20, 1);
                    Coords currentCoords = new Coords(i, j);

                    if (dicethrow == 1)
                    {
                        newMap.SetTile(currentCoords, new Tile(newMap, currentCoords, Constants.TileGeneratorSwamp));
                    }
                    else if (dicethrow <= 2)
                    {
                        newMap.SetTile(currentCoords, new Tile(newMap, currentCoords, Constants.TileGeneratorWallStone));
                    }
                    else if (dicethrow <= 5)
                    {
                        newMap.SetTile(currentCoords, new Tile(newMap, currentCoords, Constants.TileGeneratorForest));
                    }
                    // the rest is grass by default. throw items and monsters onto it.
                }
            }

            newMap.AnalyzeTileAccessibility();

            PopulateMapWithItems(newMap);
            PopulateMapWithMonsters(newMap);

            return(newMap);
        }
 private void LinkMapToDrawerAndInterface(MapBattle map)
 {
     _interface.SetCurrentMapBattle(map);
     _drawer.SetCurrentMap(map);
 }
Exemple #10
0
 public void SetCurrentMap(MapBattle map)
 {
     _currentMap = map;
 }
 public InterfaceBattle(Game1 myGame)
     : base(myGame)
 {
     _currentMap = _myGame.CurrentMap;
     DeclareRectangles();
 }