Example #1
0
        public static void RetainPlayerStatistics(StateComponents stateComponents, StateSpaceComponents spaceComponents)
        {
            Guid id = spaceComponents.Entities.Where(x => (x.ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER).Select(x => x.Id).First();
            SkillLevelsComponent  skills   = spaceComponents.SkillLevelsComponents[id];
            GameplayInfoComponent gameInfo = spaceComponents.GameplayInfoComponent;

            stateComponents.GameplayInfo      = gameInfo;
            stateComponents.PlayerSkillLevels = skills;
        }
Example #2
0
        public StateSpaceComponents()
        {
            EntitiesToDelete                  = new List <Guid>();
            Entities                          = new List <Entity>();
            PositionComponents                = new Dictionary <Guid, PositionComponent>();
            VelocityComponents                = new Dictionary <Guid, VelocityComponent>();
            DisplayComponents                 = new Dictionary <Guid, DisplayComponent>();
            AnimationComponents               = new Dictionary <Guid, AnimationComponent>();
            LabelComponents                   = new Dictionary <Guid, LabelComponent>();
            SightRadiusComponents             = new Dictionary <Guid, SightRadiusComponent>();
            SkillLevelsComponents             = new Dictionary <Guid, SkillLevelsComponent>();
            TargetPositionComponents          = new Dictionary <Guid, TargetPositionComponent>();
            DirectionComponents               = new Dictionary <Guid, DirectionComponent>();
            TimeToLiveComponents              = new Dictionary <Guid, TimeToLiveComponent>();
            CollisionComponents               = new Dictionary <Guid, CollisionComponent>();
            NameComponents                    = new Dictionary <Guid, NameComponent>();
            AICombatComponents                = new Dictionary <Guid, AICombat>();
            AIAlignmentComponents             = new Dictionary <Guid, AIAlignment>();
            AIStateComponents                 = new Dictionary <Guid, AIState>();
            AIFieldOfViewComponents           = new Dictionary <Guid, AIFieldOfView>();
            AISleepComponents                 = new Dictionary <Guid, AISleep>();
            AIRoamComponents                  = new Dictionary <Guid, AIRoam>();
            AIFleeComponents                  = new Dictionary <Guid, AIFlee>();
            InputMovementComponents           = new Dictionary <Guid, InputMovementComponent>();
            EntityMessageComponents           = new Dictionary <Guid, EntityMessageComponent>();
            AlternateFOVColorChangeComponents = new Dictionary <Guid, AlternateFOVColorChangeComponent>();
            HealthRegenerationComponents      = new Dictionary <Guid, HealthRegenerationComponent>();
            OutlineComponents                 = new Dictionary <Guid, OutlineComponent>();
            SecondaryOutlineComponents        = new Dictionary <Guid, SecondaryOutlineComponent>();
            InventoryComponents               = new Dictionary <Guid, InventoryComponent>();
            PickupComponents                  = new Dictionary <Guid, PickupComponent>();
            StatModificationComponents        = new Dictionary <Guid, StatModificationComponent>();
            ValueComponents                   = new Dictionary <Guid, ValueComponent>();
            ItemFunctionsComponents           = new Dictionary <Guid, ItemFunctionsComponent>();
            PassivesComponents                = new Dictionary <Guid, PassivesComponent>();
            ArtifactStatsComponents           = new Dictionary <Guid, ArtifactStatsComponent>();
            BurningComponents                 = new Dictionary <Guid, BurningComponent>();

            GlobalCollisionComponent = new GlobalCollisionComponent()
            {
                EntitiesThatCollided = new List <Guid>()
            };
            PlayerComponent       = new PlayerComponent();
            GameMessageComponent  = new GameMessageComponent();
            GameplayInfoComponent = new GameplayInfoComponent();
            ObserverComponent     = new ObserverComponent()
            {
                Observed = new List <Guid>()
            };
            InventoryMenuComponent = new InventoryMenuComponent();
            DelayedActions         = new List <Action>();
            random = new Random();
        }
Example #3
0
 public static void CreateGameplayInfo(StateComponents stateComponents, StateSpaceComponents spaceComponents)
 {
     if (stateComponents != null)
     {
         GameplayInfoComponent info = stateComponents.GameplayInfo;
         info.FloorsReached += 1;
         spaceComponents.GameplayInfoComponent = info;
     }
     else
     {
         //Set GameplayInfo
         spaceComponents.GameplayInfoComponent = new GameplayInfoComponent()
         {
             Kills = 0, StepsTaken = 0, FloorsReached = 1, Madness = 0
         };
     }
 }
Example #4
0
        public static void HandleDungeonMovement(StateSpaceComponents spaceComponents, GraphicsDeviceManager graphics, GameTime gameTime,
                                                 KeyboardState prevKeyboardState, MouseState prevMouseState, GamePadState prevGamepadState, Camera camera, DungeonTile[,] dungeonGrid, Vector2 dungeonDimensions)
        {
            IEnumerable <Guid> movableEntities = spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.InputMoveable) == ComponentMasks.InputMoveable).Select(x => x.Id);

            foreach (Guid id in movableEntities)
            {
                bool                   hitWall           = false;
                bool                   movement          = false;
                KeyboardState          keyState          = Keyboard.GetState();
                PositionComponent      pos               = spaceComponents.PositionComponents[id];
                GameplayInfoComponent  gameInfo          = spaceComponents.GameplayInfoComponent;
                InputMovementComponent movementComponent = spaceComponents.InputMovementComponents[id];
                if (keyState.IsKeyDown(Keys.NumPad8))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, 0, -1, ref movementComponent, gameTime, Keys.NumPad8);
                }
                else if (keyState.IsKeyDown(Keys.NumPad2))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, 0, 1, ref movementComponent, gameTime, Keys.NumPad2);
                }
                else if (keyState.IsKeyDown(Keys.NumPad6))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, 1, 0, ref movementComponent, gameTime, Keys.NumPad6);
                }
                else if (keyState.IsKeyDown(Keys.NumPad4))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, -1, 0, ref movementComponent, gameTime, Keys.NumPad4);
                }
                else if (keyState.IsKeyDown(Keys.NumPad5))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, 0, 0, ref movementComponent, gameTime, Keys.NumPad4);
                }
                else if (keyState.IsKeyDown(Keys.NumPad7))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, -1, -1, ref movementComponent, gameTime, Keys.NumPad7);
                }
                else if (keyState.IsKeyDown(Keys.NumPad9))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, 1, -1, ref movementComponent, gameTime, Keys.NumPad9);
                }
                else if (keyState.IsKeyDown(Keys.NumPad1))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, -1, 1, ref movementComponent, gameTime, Keys.NumPad1);
                }
                else if (keyState.IsKeyDown(Keys.NumPad3))
                {
                    movement = InputMovementSystem.CalculateMovement(ref pos, 1, 1, ref movementComponent, gameTime, Keys.NumPad3);
                }
                #region Item
                else if (keyState.IsKeyDown(Keys.Q) && prevKeyboardState.IsKeyUp(Keys.Q))
                {
                    if (spaceComponents.InventoryComponents.ContainsKey(id))
                    {
                        InventoryComponent invo = spaceComponents.InventoryComponents[id];
                        if (invo.Consumables.Count > 0)
                        {
                            ItemFunctionsComponent funcs = spaceComponents.ItemFunctionsComponents[invo.Consumables[0]];
                            InventorySystem.UseItem(spaceComponents, dungeonGrid, dungeonDimensions, invo.Consumables[0], id);
                        }
                    }
                }
                else if (keyState.IsKeyDown(Keys.E) && prevKeyboardState.IsKeyUp(Keys.E))
                {
                    if (spaceComponents.InventoryComponents.ContainsKey(id))
                    {
                        InventoryComponent invo = spaceComponents.InventoryComponents[id];
                        if (invo.Consumables.Count > 1)
                        {
                            ItemFunctionsComponent funcs = spaceComponents.ItemFunctionsComponents[invo.Consumables[1]];
                            InventorySystem.UseItem(spaceComponents, dungeonGrid, dungeonDimensions, invo.Consumables[1], id);
                        }
                    }
                }

                #endregion

                #region debug
                else if (keyState.IsKeyDown(Keys.OemPeriod) && prevKeyboardState.IsKeyUp(Keys.OemPeriod))
                {
                    TileSystem.CreateFire((int)pos.Position.X, (int)pos.Position.Y, spaceComponents, dungeonGrid);
                }

                #endregion


                //else if (keyState.IsKeyDown(Keys.Z) && prevKeyboardState.IsKeyUp(Keys.Z))
                //{
                //    SightRadiusComponent radius = spaceComponents.SightRadiusComponents[id];
                //    radius.CurrentRadius -= 1;
                //    spaceComponents.SightRadiusComponents[id] = (radius.CurrentRadius <= 0) ? spaceComponents.SightRadiusComponents[id] : radius;
                //    movement = true;
                //}
                //else if (keyState.IsKeyDown(Keys.X) && prevKeyboardState.IsKeyUp(Keys.X))
                //{
                //    SightRadiusComponent radius = spaceComponents.SightRadiusComponents[id];
                //    radius.CurrentRadius += 1;
                //    spaceComponents.SightRadiusComponents[id] = (radius.CurrentRadius > spaceComponents.SightRadiusComponents[id].MaxRadius) ? spaceComponents.SightRadiusComponents[id] : radius;
                //    movement = true;
                //}
                else
                {
                    movementComponent.IsButtonDown        = false;
                    movementComponent.TotalTimeButtonDown = 0f;
                    movementComponent.LastKeyPressed      = Keys.None;
                }
                bool outOfBounds = false;
                if (pos.Position.X < 0 || pos.Position.Y < 0 || pos.Position.X >= dungeonDimensions.X || pos.Position.Y >= dungeonDimensions.Y)
                {
                    outOfBounds = true;
                }
                if (!outOfBounds)
                {
                    hitWall = !dungeonGrid[(int)pos.Position.X, (int)pos.Position.Y].Occupiable && spaceComponents.CollisionComponents[id].Solid;
                    spaceComponents.InputMovementComponents[id] = movementComponent;
                    if (!hitWall && movement)
                    {
                        //Check collisions.  If no collisions, move into spot.
                        CollisionSystem.TryToMove(spaceComponents, dungeonGrid, pos, id);
                        if ((spaceComponents.Entities.Where(x => x.Id == id).First().ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER)
                        {
                            gameInfo.StepsTaken += 1;
                            spaceComponents.GameplayInfoComponent = gameInfo;
                            PlayerComponent player = spaceComponents.PlayerComponent;
                            player.PlayerTookTurn           = true;
                            spaceComponents.PlayerComponent = player;
                        }
                    }
                    if (hitWall)
                    {
                        MessageDisplaySystem.GenerateRandomGameMessage(spaceComponents, Messages.WallCollisionMessages, Colors.Messages.Normal);
                    }
                }
            }
        }
Example #5
0
        public static void ApplyBurnDamage(StateSpaceComponents spaceComponents, DungeonTile[,] dungeonGrid)
        {
            if (spaceComponents.PlayerComponent.PlayerTookTurn)
            {
                Entity player = spaceComponents.Entities.Where(z => (z.ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER).FirstOrDefault();
                foreach (Guid id in spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.BurningStatus) == ComponentMasks.BurningStatus).Select(x => x.Id))
                {
                    bool isPlayer     = player.Id == id;
                    bool extinguished = false;
                    //If the entity is in water, extinguish the burning effect instead.
                    if (spaceComponents.PositionComponents.ContainsKey(id))
                    {
                        PositionComponent pos = spaceComponents.PositionComponents[id];
                        if (dungeonGrid[(int)pos.Position.X, (int)pos.Position.Y].Type == TileType.TILE_WATER)
                        {
                            spaceComponents.Entities.Where(x => x.Id == id).First().ComponentFlags &= ~Component.COMPONENT_BURNING;
                            spaceComponents.DelayedActions.Add(new Action(() =>
                            {
                                spaceComponents.BurningComponents.Remove(id);
                            }));
                            if (isPlayer)
                            {
                                spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Microsoft.Xna.Framework.Color, string>(Colors.Messages.StatusChange, string.Format("[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] " + "You extinguish yourself in the water.")));
                            }
                            extinguished = true;
                        }
                    }
                    if (!extinguished && spaceComponents.BurningComponents.ContainsKey(id))
                    {
                        BurningComponent burning = spaceComponents.BurningComponents[id];
                        burning.TurnsLeft -= 1;
                        SkillLevelsComponent skills = spaceComponents.SkillLevelsComponents[id];
                        int damage = spaceComponents.random.Next(burning.MinDamage, burning.MaxDamage + 1);
                        skills.CurrentHealth -= damage;
                        spaceComponents.SkillLevelsComponents[id] = skills;
                        spaceComponents.BurningComponents[id]     = burning;

                        //Handle Death
                        if (skills.CurrentHealth <= 0)
                        {
                            Entity deadEntity = spaceComponents.Entities.Where(x => x.Id == id).FirstOrDefault();
                            if (deadEntity != null)
                            {
                                InventorySystem.DropWholeInventory(spaceComponents, deadEntity.Id, spaceComponents.PositionComponents[deadEntity.Id].Position);
                                deadEntity.ComponentFlags &= ~Component.COMPONENT_POSITION;
                            }
                            spaceComponents.EntitiesToDelete.Add(id);
                            if (isPlayer)
                            {
                                //SCORE RECORD
                                spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Microsoft.Xna.Framework.Color, string>(Colors.Messages.Special, string.Format("[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] " + Messages.Deaths.FirePlayer, spaceComponents.NameComponents[id].Name)));
                            }
                            else
                            {
                                spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Microsoft.Xna.Framework.Color, string>(Colors.Messages.Special, string.Format("[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] " + Messages.Deaths.Fire, spaceComponents.NameComponents[id].Name)));
                                GameplayInfoComponent gameInfo = spaceComponents.GameplayInfoComponent;
                                gameInfo.Kills += 1;
                                spaceComponents.GameplayInfoComponent = gameInfo;
                            }
                        }

                        //Handle Burning running out
                        if (burning.TurnsLeft <= 0)
                        {
                            spaceComponents.Entities.Where(x => x.Id == id).First().ComponentFlags &= ~Component.COMPONENT_BURNING;
                            spaceComponents.DelayedActions.Add(new Action(() =>
                            {
                                spaceComponents.BurningComponents.Remove(id);
                            }));
                        }
                    }
                }
            }
        }
Example #6
0
        public static void HandleMeleeCombat(StateSpaceComponents spaceComponents, int cellSize)
        {
            IEnumerable <Guid> entities = spaceComponents.GlobalCollisionComponent.EntitiesThatCollided.Distinct();

            foreach (Guid id in entities)
            {
                Entity collidingObject = spaceComponents.Entities.Where(x => x.Id == id).FirstOrDefault();
                if (collidingObject == null || (((collidingObject.ComponentFlags & ComponentMasks.CombatReadyAI) != ComponentMasks.CombatReadyAI) && (collidingObject.ComponentFlags & Component.COMPONENT_PLAYER) != Component.COMPONENT_PLAYER))
                {
                    //If the colliding object isn't a combat ready AI or a player, don't try to do combat with it.
                    continue;
                }
                foreach (Guid collidedEntity in spaceComponents.CollisionComponents[id].CollidedObjects)
                {
                    Entity collidedObject = spaceComponents.Entities.Where(x => x.Id == collidedEntity).FirstOrDefault();
                    if (collidedObject != null && (((collidedObject.ComponentFlags & ComponentMasks.CombatReadyAI) == ComponentMasks.CombatReadyAI) || (collidedObject.ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER))
                    {
                        int damageDone = 0;
                        SkillLevelsComponent   collidedStats     = spaceComponents.SkillLevelsComponents[collidedEntity];
                        SkillLevelsComponent   attackingStats    = spaceComponents.SkillLevelsComponents[id];
                        EntityMessageComponent collidedMessages  = spaceComponents.EntityMessageComponents[collidedEntity];
                        EntityMessageComponent attackingMessages = spaceComponents.EntityMessageComponents[id];
                        bool isPlayerAttacking     = ((spaceComponents.Entities.Where(x => x.Id == id).First().ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER);
                        bool isPlayerBeingAttacked = ((spaceComponents.Entities.Where(x => x.Id == collidedEntity).First().ComponentFlags & Component.COMPONENT_PLAYER) == Component.COMPONENT_PLAYER);

                        //If the two attacking creatures don't share an alignment, allow the attack to happen.
                        if (spaceComponents.AIAlignmentComponents[id].Alignment != spaceComponents.AIAlignmentComponents[collidedEntity].Alignment && collidedStats.CurrentHealth > 0 && attackingStats.CurrentHealth > 0)
                        {
                            string combatString = "[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] ";
                            combatString += isPlayerBeingAttacked ?
                                            string.Format(attackingMessages.AttackPlayerMessages[spaceComponents.random.Next(0, attackingMessages.AttackPlayerMessages.Count())], spaceComponents.NameComponents[id].Name)
                                : string.Format(attackingMessages.AttackNPCMessages[spaceComponents.random.Next(0, attackingMessages.AttackNPCMessages.Count())], spaceComponents.NameComponents[id].Name, spaceComponents.NameComponents[collidedEntity].Name);

                            //Hit
                            if (CombatSystem.WillMeleeAttackHit(spaceComponents.random, CombatSystem.CalculateAccuracy(spaceComponents, attackingStats, id, collidedStats, collidedEntity)))
                            {
                                //Determine weapon strength and die numbers here, then...
                                damageDone = CombatSystem.CalculateMeleeDamage(spaceComponents, attackingStats, id);
                                collidedStats.CurrentHealth -= damageDone;
                                if (attackingStats.TimesMissed > 5)
                                {
                                    combatString += string.Format(collidedMessages.BrokenDodgeStreakTakeDamageMessages[spaceComponents.random.Next(0, collidedMessages.BrokenDodgeStreakTakeDamageMessages.Count())], damageDone);
                                }
                                else
                                {
                                    combatString += string.Format(collidedMessages.NormalTakeDamageMessages[spaceComponents.random.Next(0, collidedMessages.NormalTakeDamageMessages.Count())], damageDone);
                                }
                                attackingStats.TimesHit   += 1;
                                attackingStats.TimesMissed = 0;
                                Color messageColor = (spaceComponents.AIAlignmentComponents[id].Alignment == AIAlignments.ALIGNMENT_HOSTILE) ? Colors.Messages.Bad : Colors.Messages.Good;
                                spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Microsoft.Xna.Framework.Color, string>(messageColor, combatString));
                                InventorySystem.IncrementDamageGivenWithArtifact(spaceComponents, id, damageDone);
                                InventorySystem.UpdateMaxCombo(spaceComponents, id, (int)attackingStats.TimesHit);
                                InventorySystem.IncrementDamageTakenWithArtifact(spaceComponents, collidedEntity, damageDone);
                                if ((spaceComponents.Entities.Where(x => x.Id == collidedEntity).First().ComponentFlags & Component.COMPONENT_AI_STATE) == Component.COMPONENT_AI_STATE)
                                {
                                    AIState state = spaceComponents.AIStateComponents[collidedEntity];
                                    if (state.State == AIStates.STATE_ROAMING)
                                    {
                                        AISystem.AITryToFind(collidedEntity, spaceComponents);
                                    }
                                }
                            }
                            //Miss
                            else
                            {
                                attackingStats.TimesMissed += 1;
                                if (attackingStats.TimesMissed > 5)
                                {
                                    combatString += string.Format(collidedMessages.StreakDodgeMessages[spaceComponents.random.Next(0, collidedMessages.StreakDodgeMessages.Count())], damageDone);
                                }
                                else
                                {
                                    combatString += string.Format(collidedMessages.NormalDodgeMessages[spaceComponents.random.Next(0, collidedMessages.NormalDodgeMessages.Count())], damageDone);
                                }
                                attackingStats.TimesHit = 0;
                                Color messageColor = (spaceComponents.AIAlignmentComponents[id].Alignment == AIAlignments.ALIGNMENT_HOSTILE) ? Colors.Messages.Good : Colors.Messages.Bad;
                                spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Microsoft.Xna.Framework.Color, string>(messageColor, combatString));
                                InventorySystem.IncrementTimesDodgedWithArtifact(spaceComponents, collidedEntity);
                                InventorySystem.IncrementTimesMissesWithArtifact(spaceComponents, id);
                            }


                            if (collidedStats.CurrentHealth <= 0)
                            {
                                Entity deadEntity = spaceComponents.Entities.Where(x => x.Id == collidedEntity).FirstOrDefault();
                                if (deadEntity != null)
                                {
                                    InventorySystem.DropWholeInventory(spaceComponents, deadEntity.Id, spaceComponents.PositionComponents[deadEntity.Id].Position);
                                    deadEntity.ComponentFlags &= ~Component.COMPONENT_POSITION;
                                }
                                InventorySystem.IncrementKillsWithArtifact(spaceComponents, id);
                                spaceComponents.EntitiesToDelete.Add(collidedEntity);
                                if (isPlayerAttacking)
                                {
                                    spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Color, string>(Colors.Messages.Special, string.Format("[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] " + "You killed the {0}!", spaceComponents.NameComponents[collidedEntity].Name)));
                                    GameplayInfoComponent gameInfo = spaceComponents.GameplayInfoComponent;
                                    gameInfo.Kills += 1;
                                    spaceComponents.GameplayInfoComponent = gameInfo;
                                }
                                else if (isPlayerBeingAttacked)
                                {
                                    spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Color, string>(Colors.Messages.Special, string.Format("[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] " + "You were killed by a {0}!", spaceComponents.NameComponents[id].Name)));
                                    //SCORE RECORD
                                }
                                else
                                {
                                    spaceComponents.GameMessageComponent.GameMessages.Add(new Tuple <Color, string>(Colors.Messages.Special, string.Format("[TURN " + spaceComponents.GameplayInfoComponent.StepsTaken + "] " + "{0} killed the {1}!", spaceComponents.NameComponents[id].Name, spaceComponents.NameComponents[collidedEntity].Name)));
                                }
                            }
                            spaceComponents.SkillLevelsComponents[id]             = attackingStats;
                            spaceComponents.SkillLevelsComponents[collidedEntity] = collidedStats;
                        }
                    }
                }
            }
        }
Example #7
0
        public static void WriteMessages(StateSpaceComponents spaceComponents, SpriteBatch spriteBatch, Camera camera, SpriteFont font, DungeonTile[,] dungeonGrid)
        {
            float opacity        = 1.15f;
            float decrement      = .09f;
            int   messageNumber  = 0;
            int   messageSpacing = (int)font.MeasureString("g").Y + 1;;

            //Draw message log
            if (spaceComponents.GameMessageComponent.IndexBegin > 0)
            {
                float textHeight = font.MeasureString(Messages.ScrollingMessages).Y;
                spriteBatch.DrawString(font, Messages.ScrollingMessages, new Vector2(10, (int)camera.DungeonUIViewport.Bounds.Bottom - (int)textHeight - 10 - (messageNumber * messageSpacing)), Color.MediumVioletRed);
                messageNumber += 1;
            }
            foreach (Tuple <Color, string> message in spaceComponents.GameMessageComponent.GameMessages.Reverse <Tuple <Color, string> >().Skip(spaceComponents.GameMessageComponent.IndexBegin))
            {
                if (opacity < 0)
                {
                    break;
                }
                opacity -= decrement;
                string text = MessageDisplaySystem.WordWrap(font, message.Item2, camera.DungeonUIViewport.Width - 20);

                float textHeight = font.MeasureString(text).Y;
                spriteBatch.DrawString(font, text, new Vector2(10, (int)camera.DungeonUIViewport.Bounds.Bottom - (int)textHeight - 10 - (messageNumber * messageSpacing)), message.Item1 * opacity);
                messageNumber += Regex.Matches(text, System.Environment.NewLine).Count;
                messageNumber += 1;
            }
            while (spaceComponents.GameMessageComponent.GameMessages.Count > spaceComponents.GameMessageComponent.MaxMessages)
            {
                spaceComponents.GameMessageComponent.GameMessages.RemoveAt(0);
            }
            spriteBatch.DrawString(font, spaceComponents.GameMessageComponent.GlobalMessage, new Vector2(10, camera.Bounds.Height - messageSpacing), spaceComponents.GameMessageComponent.GlobalColor);

            messageNumber = 0;
            //Draw statistics
            List <Tuple <Color, string> > statsToPrint = new List <Tuple <Color, string> >();
            GameplayInfoComponent         gameplayInfo = spaceComponents.GameplayInfoComponent;

            statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Floor {0}", gameplayInfo.FloorsReached)));
            statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Steps: {0}", gameplayInfo.StepsTaken)));
            statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Kills: {0}", gameplayInfo.Kills)));
            Entity player = spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.Player) == ComponentMasks.Player).FirstOrDefault();

            if (player != null)
            {
                SkillLevelsComponent skills    = InventorySystem.ApplyStatModifications(spaceComponents, player.Id, spaceComponents.SkillLevelsComponents[player.Id]);
                InventoryComponent   inventory = spaceComponents.InventoryComponents[player.Id];
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Health:  {0} / {1}", skills.CurrentHealth, skills.Health)));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Wealth: {0}", skills.Wealth)));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Damage: {0}-{1}", skills.MinimumDamage, skills.MaximumDamage)));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Accuracy: {0}", skills.Accuracy)));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, string.Format("Defense: {0}", skills.Defense)));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                //Status Effects:
                Statuses statuses = StatusSystem.GetStatusEffectsOfEntity(spaceComponents, player.Id, dungeonGrid);
                if (statuses == Statuses.NONE)
                {
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, Messages.StatusMessages.Normal));
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                }
                //If there are status effects on the player..
                else
                {
                    if ((statuses & Statuses.BURNING) == Statuses.BURNING)
                    {
                        BurningComponent burning = spaceComponents.BurningComponents[player.Id];
                        statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Bad, string.Format(Messages.StatusMessages.Burning, burning.MinDamage, burning.MaxDamage, burning.TurnsLeft)));
                    }
                    if ((statuses & Statuses.UNDERWATER) == Statuses.UNDERWATER)
                    {
                        statsToPrint.Add(new Tuple <Color, string>(Colors.Caves.WaterInRange, Messages.StatusMessages.Underwater));
                    }
                    if ((statuses & Statuses.HEALTHREGEN) == Statuses.HEALTHREGEN)
                    {
                        HealthRegenerationComponent healthRegen = spaceComponents.HealthRegenerationComponents[player.Id];
                        statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Good, string.Format(Messages.StatusMessages.HealthRegen, healthRegen.HealthRegain, healthRegen.RegenerateTurnRate)));
                    }
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                }

                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Special, string.Format(Messages.InventoryArtifacts + " ({0}/{1})", inventory.Artifacts.Count, inventory.MaxArtifacts)));
                foreach (Guid id in inventory.Artifacts)
                {
                    NameComponent          name          = spaceComponents.NameComponents[id];
                    ArtifactStatsComponent artifactStats = spaceComponents.ArtifactStatsComponents[id];
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.LootPickup, string.Format("{0} Lv{1}", name.Name, artifactStats.UpgradeLevel)));
                }

                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Special, string.Format(Messages.InventoryConsumables + " ({0}/{1})", inventory.Consumables.Count, inventory.MaxConsumables)));
                if (inventory.Consumables.Count > 0)
                {
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                    NameComponent          name  = spaceComponents.NameComponents[inventory.Consumables[0]];
                    ItemFunctionsComponent funcs = spaceComponents.ItemFunctionsComponents[inventory.Consumables[0]];
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.LootPickup, string.Format("{0}({1})", name.Name, funcs.Uses)));
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, "Q - Use"));
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, "X - Throw"));
                    statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, System.Environment.NewLine));
                    if (inventory.Consumables.Count > 1)
                    {
                        name  = spaceComponents.NameComponents[inventory.Consumables[1]];
                        funcs = spaceComponents.ItemFunctionsComponents[inventory.Consumables[1]];
                        statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.LootPickup, string.Format("{0}({1})", name.Name, funcs.Uses)));
                        statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, "E - Use"));
                        statsToPrint.Add(new Tuple <Color, string>(Colors.Messages.Normal, "C - Throw"));
                    }
                }
            }

            if (font != null)
            {
                foreach (Tuple <Color, string> stat in statsToPrint)
                {
                    string  text        = MessageDisplaySystem.WordWrap(font, stat.Item2, camera.DungeonUIViewportLeft.Width - messageSpacing);
                    Vector2 messageSize = font.MeasureString(stat.Item2);
                    spriteBatch.DrawString(font, text, new Vector2(camera.DungeonUIViewportLeft.X + 10, 10 + (messageSpacing * messageNumber)), stat.Item1);
                    messageNumber += 1;
                    messageNumber += Regex.Matches(text, System.Environment.NewLine).Count;
                }
            }
        }