public void Update(Player _player, InputState _inputState, Nothing _nothing, Lantern _lantern, List <AggressiveEnemy> _aggressiveEnemies)
        {
            if (_player.X == X && _player.Y == Y)
            {
                if (IsUsed == false)
                {
                    if (_inputState.IsActivateItem(PlayerIndex.One))
                    {
                        if (_player.Light.durability < this.durability || _player.Light == _nothing)
                        {
                            message       = "E to use";
                            _player.Light = this;

                            IsUsed = true;
                            _player.Actions--;

                            if (_player.Actions == 0)
                            {
                                _player.EndTurn(_player, _lantern, _nothing, _aggressiveEnemies);
                            }
                        }
                        else
                        {
                            message = "Less durable";
                        }
                    }
                }
            }

            if (_player.Light == this)
            {
                _player.Fov = Brightness;
            }

            if (_player.Light.durability == 0)
            {
                _player.Light = _nothing;
            }

            if (_player.Light == _nothing)
            {
                _player.Fov = 3;
            }
        }
예제 #2
0
        public void EndTurn(Player _player, Lantern _lantern, Nothing _nothing, List <AggressiveEnemy> _aggressiveEnemies)
        {
            Actions = MaxActions;
            TurnsPassed++;

            if (_player.Light != _nothing)
            {
                _player.Light.durability--;
            }

            if (_aggressiveEnemies.Count == 0)
            {
                Global.GameState = GameStates.PlayerTurn;
            }
            else
            {
                Global.GameState = GameStates.EnemyTurn;
            }
        }
예제 #3
0
        public Game1()
            : base()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            _inputState = new InputState();
            rnd         = new Random();

            _nothing = new Nothing()
            {
                durability = 0,
                DamageDice = "1d4+"
            };

            _potion  = new Potion(_map);
            _lantern = new Lantern(_map);
            _sword   = new Weapon(_map);
        }
예제 #4
0
        public void Update(Player _player, InputState _inputState, Nothing _nothing, Lantern _lantern, List <AggressiveEnemy> _aggressiveEnemies)
        {
            if (_player.X == X && _player.Y == Y)
            {
                if (IsUsed == false)
                {
                    if (_inputState.IsActivateItem(PlayerIndex.One))
                    {
                        if (_player.Weapon == _nothing)
                        {
                            message        = "E to use";
                            _player.Weapon = this;

                            IsUsed = true;
                            _player.Actions--;

                            if (_player.Actions == 0)
                            {
                                _player.EndTurn(_player, _lantern, _nothing, _aggressiveEnemies);
                            }
                        }
                        if (_player.Weapon != _nothing)
                        {
                            message = "E to use";

                            _player.Weapon.IsUsed = false;

                            if (_map.IsWalkable(_player.X, _player.Y + 1))
                            {
                                _player.Weapon.X = _player.X;
                                _player.Weapon.Y = _player.Y + 1;
                            }
                            else if (_map.IsWalkable(_player.X, _player.Y - 1))
                            {
                                _player.Weapon.X = _player.X;
                                _player.Weapon.Y = _player.Y - 1;
                            }
                            else if (_map.IsWalkable(_player.X + 1, _player.Y))
                            {
                                _player.Weapon.X = _player.X + 1;
                                _player.Weapon.Y = _player.Y;
                            }
                            else if (_map.IsWalkable(_player.X - 1, _player.Y))
                            {
                                _player.Weapon.X = _player.X - 1;
                                _player.Weapon.Y = _player.Y;
                            }

                            _player.Weapon = this;

                            IsUsed = true;
                            _player.Actions--;

                            if (_player.Actions == 0)
                            {
                                _player.EndTurn(_player, _lantern, _nothing, _aggressiveEnemies);
                            }
                        }
                    }
                }
            }

            if (_player.Weapon == this)
            {
                _player.DamageDice = DamageDice;
            }

            if (_player.Weapon == _nothing)
            {
                _player.DamageDice = "1d4+";
            }
        }