private void DrawStats(Player player) { //Blank stats area //rootConsole.DrawRect(statsDisplayTopLeft.x, statsDisplayTopLeft.y, Width - statsDisplayTopLeft.x, Height - statsDisplayTopLeft.y, true); DrawFrame(statsDisplayTopLeft.x, statsDisplayTopLeft.y - 1, statsDisplayBotRight.x - statsDisplayTopLeft.x + 2, statsDisplayBotRight.y - statsDisplayTopLeft.y + 3, false, statsFrameColor); int baseOffset = 2; //Mission Point missionOffset = new Point(baseOffset, 0); hitpointsOffset = new Point(baseOffset, 4); Point shieldOffset = new Point(baseOffset, 5); Point weaponOffset = new Point(baseOffset, 8); Point utilityOffset = new Point(baseOffset, 14); Point viewOffset = new Point(baseOffset, 20); Point cmbtOffset = new Point(baseOffset, 18); Point gameDataOffset = new Point(baseOffset, 25); var zoneName = "[" + (LevelToDisplay).ToString("00") + "] "; var zoneName2 = Game.Dungeon.DungeonInfo.LookupMissionName(LevelToDisplay); PrintLine(zoneName, statsDisplayTopLeft.x + missionOffset.x, statsDisplayTopLeft.y + missionOffset.y + 1, LineAlignment.Left, statsColor); PrintLine(zoneName2, statsDisplayTopLeft.x + missionOffset.x, statsDisplayTopLeft.y + missionOffset.y + 2, LineAlignment.Left, statsColor); //Draw HP Status int hpBarLength = 10; double playerHPRatio = player.Hitpoints / (double)player.MaxHitpoints; int hpBarEntries = (int)Math.Ceiling(hpBarLength * playerHPRatio); PrintLine("HP: ", statsDisplayTopLeft.x + hitpointsOffset.x, statsDisplayTopLeft.y + hitpointsOffset.y, LineAlignment.Left, statsColor); for (int i = 0; i < hpBarLength; i++) { if (i < hpBarEntries) { PutChar(statsDisplayTopLeft.x + hitpointsOffset.x + 5 + i, statsDisplayTopLeft.y + hitpointsOffset.y, heartChar, heartColor); } else { PutChar(statsDisplayTopLeft.x + hitpointsOffset.x + 5 + i, statsDisplayTopLeft.y + hitpointsOffset.y, heartChar, disabledColor); } } //Draw shield int shieldBarLength = 20; double playerShieldRatio = player.Shield / (double)player.MaxShield; int shieldBarEntries = (int)Math.Ceiling(shieldBarLength * playerShieldRatio); PrintLine("SD: ", statsDisplayTopLeft.x + shieldOffset.x, statsDisplayTopLeft.y + shieldOffset.y, LineAlignment.Left, statsColor); DrawShieldBar(player, shieldOffset, shieldBarEntries - 10); DrawShieldBar(player, shieldOffset + new Point(0, 1), Math.Min(shieldBarEntries, 10)); //Draw equipped weapon Item weapon = Game.Dungeon.Player.GetEquippedWeaponAsItem(); //string weaponStr = "Weapon: "; //PrintLine(weaponStr, statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y, LineAlignment.Left); if (weapon != null) { IEquippableItem weaponE = weapon as IEquippableItem; PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y, weapon.Representation, weaponColor); string weaponStr = weapon.SingleItemDescription; PrintLine(weaponStr, statsDisplayTopLeft.x + weaponOffset.x + 2, statsDisplayTopLeft.y + weaponOffset.y, LineAlignment.Left, weaponColor); //Ammo if (weaponE.HasFireAction()) { PrintLine("Am: ", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + 4, LineAlignment.Left); //TODO infinite ammo? int ammoBarLength = 10; double weaponAmmoRatio = weaponE.RemainingAmmo() / (double) weaponE.MaxAmmo(); int ammoBarEntries = (int)Math.Ceiling(ammoBarLength * weaponAmmoRatio); for (int i = 0; i < ammoBarLength; i++) { if (i < ammoBarEntries) { PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, ammoChar, orangeActivatedColor); } else { PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, ammoChar, orangeDisactivatedColor); } } } else if (weaponE.HasThrowAction() || weaponE.HasOperateAction()) { PrintLine("Am: ", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + 4, LineAlignment.Left, statsColor); //TODO infinite ammo? int ammoBarLength = 10; int ammoBarEntries = Math.Min(player.InventoryQuantityAvailable(weapon.GetType()), 10); //int ammoBarEntries = (int)Math.Ceiling(ammoBarLength * weaponAmmoRatio); for (int i = 0; i < ammoBarLength; i++) { if (i < ammoBarEntries) { PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, weapon.Representation, orangeActivatedColor); } else { PutChar(statsDisplayTopLeft.x + weaponOffset.x + 5 + i, statsDisplayTopLeft.y + weaponOffset.y + 4, weapon.Representation, orangeDisactivatedColor); } } } /* //Uses int useYOffset = 3; string uses = ""; if (weaponE.HasMeleeAction()) { PrintLine("Melee", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left); } else if (weaponE.HasFireAction() && weaponE.HasThrowAction()) { PrintLine("fire throw", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left); PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("F"), ColorPresets.White); PutChar(statsDisplayTopLeft.x + weaponOffset.x + 7, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("T"), ColorPresets.White); } else if (weaponE.HasFireAction()) { PrintLine("fire", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left); PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("F"), ColorPresets.White); } else if (weaponE.HasThrowAction()) { PrintLine("fire", statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, LineAlignment.Left); PutChar(statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + useYOffset, GetCharIconForLetter("T"), ColorPresets.White); }*/ //if (weaponE.HasOperateAction()) //{ // uses += "(u)se"; //} // PrintLine(uses, statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y + 4, LineAlignment.Left); } else { var weaponStr = "None"; PrintLine(weaponStr, statsDisplayTopLeft.x + weaponOffset.x, statsDisplayTopLeft.y + weaponOffset.y, LineAlignment.Left, weaponColor); } //Draw weapon choices var weaponOptionRow = 1; var weaponIconXOffset = -3; foreach (var kv in ItemMapping.WeaponMapping) { DrawWeaponChar(weaponOffset + new Point(weaponIconXOffset + (kv.Key) * 3, weaponOptionRow), kv.Value, kv.Key); } //Draw energy bar and use keys int energyBarLength = 20; double playerEnergyRatio = player.Energy / (double)player.MaxEnergy; int energyBarEntries = (int)Math.Ceiling(energyBarLength * playerEnergyRatio); PrintLine("EN: ", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 2, LineAlignment.Left, statsColor); DrawEnergyBar(player, utilityOffset + new Point(0, 2), energyBarEntries - 10); DrawEnergyBar(player, utilityOffset + new Point(0, 3), Math.Min(energyBarEntries, 10)); //Enable wetware name var equippedWetware = player.GetEquippedWetware(); if (equippedWetware != null) { var equippedWetwareItem = (equippedWetware as Item); PutChar(statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y, equippedWetwareItem.Representation, weaponColor); var wetwareStr = equippedWetwareItem.SingleItemDescription; PrintLine(wetwareStr, statsDisplayTopLeft.x + utilityOffset.x + 2, statsDisplayTopLeft.y + utilityOffset.y, LineAlignment.Left, weaponColor); } else { PrintLine("None", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y, LineAlignment.Left, weaponColor); } //Draw all available wetware var wetwareOptionRow = 1; int offset = 0; foreach (var kv in ItemMapping.WetwareMapping) { DrawWetwareChar(utilityOffset + new Point(offset * 3, wetwareOptionRow), kv.Value, kv.Key.ToString()); offset++; } // /* //Draw equipped utility Item utility = Game.Dungeon.Player.GetEquippedUtilityAsItem(); string utilityStr = "Utility: "; PrintLine(utilityStr, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y, LineAlignment.Left); if (utility != null) { utilityStr = utility.SingleItemDescription; PrintLine(utilityStr, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 1, LineAlignment.Left, utility.GetColour()); IEquippableItem utilityE = utility as IEquippableItem; string uses = ""; if (utilityE.HasOperateAction()) { uses += "(U)se"; } if (utilityE.HasThrowAction()) { uses += "(T)hrow "; } PrintLine(uses, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 2, LineAlignment.Left); } else { utilityStr = "Nothing"; PrintLine(utilityStr, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 1, LineAlignment.Left, nothingColor); } //Effect active (add ors) if (player.effects.Count > 0) { PlayerEffect thisEffect = player.effects[0]; if(thisEffect is PlayerEffectSimpleDuration) { PlayerEffectSimpleDuration durationEffect = thisEffect as PlayerEffectSimpleDuration; string effectName = thisEffect.GetName(); int effectRemainingDuration = durationEffect.GetRemainingDuration(); int effectTotalDuration = durationEffect.GetDuration(); Color effectColor = thisEffect.GetColor(); //Effect name PrintLine("Effect: ", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 3, LineAlignment.Left); PrintLine(effectName, statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 4, LineAlignment.Left, effectColor); //Duration PrintLine("Tm: ", statsDisplayTopLeft.x + utilityOffset.x, statsDisplayTopLeft.y + utilityOffset.y + 5, LineAlignment.Left); int ammoBarLength = 10; double weaponAmmoRatio = effectRemainingDuration / (double) effectTotalDuration; int ammoBarEntries = (int)Math.Ceiling(ammoBarLength * weaponAmmoRatio); for (int i = 0; i < ammoBarLength; i++) { if (i < ammoBarEntries) { PutChar(statsDisplayTopLeft.x + utilityOffset.x + 5 + i, statsDisplayTopLeft.y + utilityOffset.y + 5, explosionIcon, ColorPresets.Gold); } else { PutChar(statsDisplayTopLeft.x + utilityOffset.x + 5 + i, statsDisplayTopLeft.y + utilityOffset.y + 5, explosionIcon, ColorPresets.Gray); } } } }*/ //Draw what we can see //Creature takes precidence //string viewStr = "Target: "; //PrintLine(viewStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y, LineAlignment.Left, statsColor); if (CreatureToView != null && CreatureToView.Alive == true) { //Combat vs player var cover = player.GetPlayerCover(CreatureToView); if (cover.Item1 > 0) { PrintLine("(hard cover)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 3, LineAlignment.Left, ColorPresets.Gold); } else if (cover.Item2 > 0) { PrintLine("(soft cover)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 3, LineAlignment.Left, statsColor); } //PrintLine("Def: " + player.CalculateDamageModifierForAttacksOnPlayer(CreatureToView), statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 2, LineAlignment.Left, statsColor); //var cover = player.GetPlayerCover(CreatureToView); //PrintLine("C: " + cover.Item1 + "/" + cover.Item2, statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 3, LineAlignment.Left, statsColor); //Monster hp String nameStr = CreatureToView.SingleDescription;// +"(" + CreatureToView.Representation + ")"; PrintLine(nameStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 3, LineAlignment.Left, statsColor); int mhpBarLength = 10; double mplayerHPRatio = CreatureToView.Hitpoints / (double)CreatureToView.MaxHitpoints; int mhpBarEntries = (int)Math.Ceiling(mhpBarLength * mplayerHPRatio); PrintLine("HP: ", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 4, LineAlignment.Left, statsColor); for (int i = 0; i < mhpBarLength; i++) { if (i < mhpBarEntries) { PutChar(statsDisplayTopLeft.x + viewOffset.x + 5 + i, statsDisplayTopLeft.y + viewOffset.y + 4, heartChar, heartColor); } else { PutChar(statsDisplayTopLeft.x + viewOffset.x + 5 + i, statsDisplayTopLeft.y + viewOffset.y + 4, heartChar, disabledColor); } } //Behaviour if (CreatureToView.StunnedTurns > 0) { PrintLine("(Stunned: " + CreatureToView.StunnedTurns + ")", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, stunnedBackground); } else if (CreatureToView.InPursuit()) { PrintLine("(Hostile)", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, pursuitBackground); } else if (!CreatureToView.OnPatrol()) { PrintLine("(Investigating)", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, investigateBackground); } else { PrintLine("(Neutral)", statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 5, LineAlignment.Left, statsColor); } } else if (ItemToView != null && !ItemToView.InInventory) { String nameStr = ItemToView.SingleItemDescription; PrintLine(nameStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 3, LineAlignment.Left, ItemToView.GetColour()); } else if(FeatureToView != null) { String nameStr = FeatureToView.Description; PrintLine(nameStr, statsDisplayTopLeft.x + viewOffset.x, statsDisplayTopLeft.y + viewOffset.y + 3, LineAlignment.Left, FeatureToView.RepresentationColor()); } //Combat stats string bonusStr = ""; if (player.HasMeleeWeaponEquipped()) { var meleeBonus = player.CalculateMeleeAttackModifiersOnMonster(null); bonusStr = meleeBonus.ToString("#.#") + "x"; } else if (player.HasThrownWeaponEquipped()) { bonusStr = ""; } else { var rangedBonus = player.CalculateRangedAttackModifiersOnMonster(null); bonusStr = rangedBonus.ToString("#.#") + "x"; } PrintLine("Attk: " + bonusStr, statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 1, LineAlignment.Left, statsColor); //Defence var dodgeBonus = player.CalculateDamageModifierForAttacksOnPlayer(null); if (dodgeBonus < 0.71) { PrintLine("(s. dodge)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 2, LineAlignment.Left, ColorPresets.Gold); } else if (dodgeBonus < 0.81) { PrintLine("(dodge)", statsDisplayTopLeft.x + cmbtOffset.x, statsDisplayTopLeft.y + cmbtOffset.y + 2, LineAlignment.Left, statsColor); } /* //Game data PrintLine("Droids:", statsDisplayTopLeft.x + gameDataOffset.x, statsDisplayTopLeft.y + gameDataOffset.y, LineAlignment.Left); int noDroids = Game.Dungeon.DungeonInfo.MaxDeaths - Game.Dungeon.DungeonInfo.NoDeaths; for (int i = 0; i < noDroids; i++) { PutChar(statsDisplayTopLeft.x + gameDataOffset.x + 8 + i, statsDisplayTopLeft.y + gameDataOffset.y, Game.Dungeon.Player.Representation, Game.Dungeon.Player.RepresentationColor()); } PrintLine("Aborts:", statsDisplayTopLeft.x + gameDataOffset.x, statsDisplayTopLeft.y + gameDataOffset.y + 1, LineAlignment.Left); int noAborts = Game.Dungeon.DungeonInfo.MaxAborts - Game.Dungeon.DungeonInfo.NoAborts; for (int i = 0; i < noAborts; i++) { PutChar(statsDisplayTopLeft.x + gameDataOffset.x + 8 + i, statsDisplayTopLeft.y + gameDataOffset.y + 1, 'X',ColorPresets.Red); }*/ }
private void DrawPC(int levelToDraw, Player player) { if (player.LocationLevel != levelToDraw) return; Point PClocation = player.LocationMap; Color PCDrawColor = PCColor; if (DebugMode) { MapSquare pcSquare = Game.Dungeon.Levels[player.LocationLevel].mapSquares[player.LocationMap.x, player.LocationMap.y]; if (pcSquare.InMonsterFOV) { PCDrawColor = Color.Interpolate(PCDrawColor, ColorPresets.Red, 0.4); } } if (!isViewVisible(PClocation)) return; char pcRepresentation = player.Representation; var colorToUse = PCDrawColor; var hasActiveWetware = player.GetEquippedWetware(); if (hasActiveWetware != null) { colorToUse = ColorPresets.LightSkyBlue; if (hasActiveWetware.GetType() == typeof(Items.StealthWare)) pcRepresentation = (char)256; } tileMapLayer(TileLevel.Creatures)[ViewRelative(PClocation)] = new TileEngine.TileCell(pcRepresentation); tileMapLayer(TileLevel.Creatures)[ViewRelative(PClocation)].TileFlag = new LibtcodColorFlags(colorToUse); }