Exemple #1
0
        private void GenerateStats(UInt16[] means, UInt16[] deviations, StatFormula HPformula, StatFormula APformula)
        {
            RandomStuff randomator = _inhabitedMap.Randomator;

            _statsMain       = new UInt16[(sbyte)StatMain.COUNT, 2];
            _statsBasic      = new UInt16[(sbyte)StatBasic.COUNT, 2];
            _statsDerivative = new UInt16[(sbyte)StatDerivative.COUNT];

            for (int i = 0; i < (sbyte)StatMain.COUNT; ++i)
            {
                UInt16 statValue = (UInt16)randomator.DiscreteNormalDistributionSample(means[i], deviations[i], 1, Constants.StatMax);
                _statsMain[i, 0] = statValue; //base
                _statsMain[i, 1] = statValue; //current
            }

            // Create either methods or delegates support for the evaluation of secondary stats.

            // HP init
            //_statsBasic[(sbyte)StatBasic.HP, 1] = (UInt16)(GetStatMain(StatMain.Strength, false) * 4);
            _statsBasic[(sbyte)StatBasic.HP, 1] = HPformula(GetStatMain(StatMain.Strength, false));
            _statsBasic[(sbyte)StatBasic.HP, 0] = _statsBasic[(sbyte)StatBasic.HP, 1]; //current HP = max HP

            _statsBasic[(sbyte)StatBasic.AP, 1] = APformula(GetStatMain(StatMain.Agility, false));
            _statsBasic[(sbyte)StatBasic.AP, 0] = _statsBasic[(sbyte)StatBasic.AP, 1]; //current AP = max AP

            _statsBasic[(sbyte)StatBasic.XP, 1] = Constants.AdditionalXPNeededPerLevelUp;
            // Sight init
            _statsDerivative[(sbyte)StatDerivative.SightRange] = (UInt16)(10 + GetStatMain(StatMain.Sensitivity, false) / 2);
        }
Exemple #2
0
        /*
         * /// <summary>
         * /// Checks if tile is see-through or not.
         * /// </summary>
         * public bool CheckSightValidity(Coords point)
         * {
         *  if (!(_myCollider.CheckInBounds(point)))
         *      return false;
         *
         *  return _visibilityMap[point.X, point.Y] > 0;
         * }
         */


        /*
         * /// <summary>
         * /// Checks if tile allows passage
         * /// Some of this is redundant now that I have Tile.SeeAllowedMove. Should rethink.
         * /// </summary>
         * public bool CheckTilePassageValidity(Coords point)
         * {
         *  if (!this.CheckSightValidity(point))
         *  {
         *      return false;
         *  }
         *
         *  return _passabilityMap[point.X][point.Y];
         * }
         */

        #endregion

        #endregion

        #region Constructors

        // Constructs an xSize by ySize map. Default Tile set to TileBasicFloor.
        public Map(RandomStuff randomator, UInt16 xSize, UInt16 ySize)
        {
            // creates and fills the tile array
            this._xMax = xSize;
            this._yMax = ySize;

            this._pixelMaxX = (UInt32)(xSize * Constants.TileSize);
            this._pixelMaxY = (UInt32)(ySize * Constants.TileSize);

            _tiles         = new Tile[xSize, ySize];
            _visibilityMap = new float[xSize, ySize];
        }
Exemple #3
0
        public MapBattle(RandomStuff randomator, UInt16 xSize, UInt16 ySize)
            : base(randomator, xSize, ySize)
        {
            _tenancyMap = new Creature[xSize, ySize];
            for (Int32 i = 0; i < xSize; i++)
            {
                for (Int32 j = 0; j < ySize; j++)
                {
                    _tiles[i, j] = new Tile(this, new Coords(CoordsType.Tile, i, j), Constants.TileGeneratorGrass);
                }
            }

            this._myVisibilityTracker = new VisiblityTracker(xSize, ySize, _visibilityMap);

            // initializes the random number generator associated with this map
            this._randomator = randomator;
        }
        /// <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()
        {
            // TODO: Add your initialization logic here

            this.IsMouseVisible = true;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _myInterfaceMenu   = new InterfaceStartMenu(this);
            _myDrawerStartMenu = new DrawerStartMenu(this, Content, _myInterfaceMenu);

            _randomator = new RandomStuff(907);

            _myInterface = new InterfaceBattle(this);
            _myDrawer    = new DrawerBattle(this, Content, _myInterface);

            base.Initialize();
        }
Exemple #5
0
        private Coords RandomAccessibleHex(MoveRangeCalculator range)
        {
            List <Coords> possibleMoves = new List <Coords>();

            BitArray[] rangeMap = range.CurrentRangeMap;
            for (int i = 0; i < rangeMap.Length; ++i)
            {
                for (int j = 0; j < rangeMap[i].Count; ++j)
                {
                    if (rangeMap[i][j])
                    {
                        possibleMoves.Add(new Coords(i, j));
                    }
                }
            }

            RandomStuff randomator = _owner.MapGeneral.Randomator;

            return(possibleMoves[(Int32)(randomator.NSidedDice((UInt16)possibleMoves.Count, 1) - 1)]);
        }
 public MapGenerator(RandomStuff randomator, InterfaceBattle gameInterface, DrawerBattle drawer)
 {
     _randomator = randomator;
     _interface  = gameInterface;
     _drawer     = drawer;
 }
Exemple #7
0
 public MapWorld(RandomStuff randomator, UInt16 dimension)
     : this(randomator, dimension, dimension)
 {
 }
Exemple #8
0
 public MapWorld(RandomStuff randomator, UInt16 xSize, UInt16 ySize)
     : base(randomator, xSize, ySize)
 {
 }
Exemple #9
0
 public MapBattle(RandomStuff randomator, UInt16 dimension)
     : this(randomator, dimension, dimension)
 {
 }