mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-23 05:29:50 +00:00
Show player health/max health and weapon damage in stats
This commit is contained in:
parent
7be0683eb9
commit
da809614bb
@ -275,7 +275,7 @@ def playerCombatTurn(pl)
|
||||
// Get weapon
|
||||
pWeapon = pl=>p_items
|
||||
while pWeapon
|
||||
if pWeapon->t_type == TYPE_WEAPON; break; fin
|
||||
if pWeapon->t_type == TYPE_WEAPON and pWeapon->b_flags & ITEM_FLAG_EQUIP; break; fin
|
||||
pWeapon = pWeapon=>p_nextObj
|
||||
loop
|
||||
|
||||
|
@ -1170,35 +1170,6 @@ export def rightJustifyNum(num, rightX)
|
||||
rightJustifyStr(convertDec(num), rightX)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def displayPlayerData(player)
|
||||
word pi
|
||||
|
||||
// Display the player's name and health
|
||||
rawDisplayStr(player=>s_name)
|
||||
if mapIs3D
|
||||
rightJustifyNum(global=>w_gold, CHAR_WND_GOLD_X)
|
||||
else
|
||||
// Locate the equipped weapon
|
||||
pi = player=>p_items
|
||||
while pi
|
||||
if pi->t_type == TYPE_WEAPON and pi->b_flags & ITEM_FLAG_EQUIP
|
||||
break
|
||||
fin
|
||||
pi = pi=>p_nextObj
|
||||
loop
|
||||
if pi
|
||||
rightJustifyStr(pi=>s_name, CHAR_WND_WEAPON_X)
|
||||
else
|
||||
rightJustifyStr("Fists", CHAR_WND_WEAPON_X)
|
||||
fin
|
||||
fin
|
||||
rightJustifyNum(player=>w_health, CHAR_WND_LIFE_X)
|
||||
|
||||
// All done.
|
||||
rawDisplayStr("\n")
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display the party data on the screen
|
||||
export def showParty()
|
||||
@ -1209,19 +1180,19 @@ export def showParty()
|
||||
clearWindow()
|
||||
|
||||
// Display header
|
||||
rawDisplayStr("^LName") // begin underline mode
|
||||
if mapIs3D
|
||||
rightJustifyStr("Gold", CHAR_WND_GOLD_X)
|
||||
else
|
||||
rightJustifyStr("Weapon", CHAR_WND_WEAPON_X)
|
||||
fin
|
||||
rightJustifyStr("Life", CHAR_WND_LIFE_X)
|
||||
rawDisplayStr("^L\n") // end underline mode
|
||||
rawDisplayStr("^LName^T070Health^L\n") // begin underline mode
|
||||
// rightJustifyStr("Health", CHAR_WND_LIFE_X)
|
||||
// rawDisplayStr("^L\n") // end underline mode
|
||||
|
||||
// Display each character
|
||||
p = global=>p_players
|
||||
while p
|
||||
displayPlayerData(p)
|
||||
// Display the player's name and health
|
||||
displayStr(p=>s_name)
|
||||
rawDisplayStr("^T070")
|
||||
// rightJustifyNum(p=>w_health, CHAR_WND_LIFE_X)
|
||||
// displayChar('\n')
|
||||
displayf2("%d/%d\n", p=>w_health, p=>w_maxHealth)
|
||||
p = p=>p_nextObj
|
||||
loop
|
||||
|
||||
|
@ -28,7 +28,7 @@ const TYPE_USE = $0102
|
||||
const TYPE_DROP = $0103
|
||||
|
||||
// Tab positions
|
||||
const CHAR_WND_STAT_X = 20
|
||||
const CHAR_WND_STAT_X = 30
|
||||
const CHAR_WND_INV_X = 16
|
||||
|
||||
// This pointer is the root of all heap-tracked (and garbage collected) objects.
|
||||
@ -87,11 +87,10 @@ end
|
||||
def unequip(player, type, kind)
|
||||
word item
|
||||
|
||||
if not kind; return; fin
|
||||
item = player=>p_items
|
||||
while item
|
||||
if item->t_type == type
|
||||
if streqi(item=>s_itemKind, kind) and item->b_flags & ITEM_FLAG_EQUIP
|
||||
if (streqi(item=>s_itemKind, kind) or type == TYPE_WEAPON) and item->b_flags & ITEM_FLAG_EQUIP
|
||||
item->b_flags = item->b_flags & ~ITEM_FLAG_EQUIP
|
||||
return item
|
||||
fin
|
||||
@ -172,7 +171,7 @@ def displaySkill(str, val, col)
|
||||
end
|
||||
// Show player data
|
||||
def showPlayerSheet(num, i_page, i_rows)
|
||||
word player, skill
|
||||
word player, skill, weapon, dmg
|
||||
byte col, n_item
|
||||
|
||||
// Count the number of players
|
||||
@ -190,16 +189,38 @@ def showPlayerSheet(num, i_page, i_rows)
|
||||
setWindow2()
|
||||
clearWindow()
|
||||
rawDisplayStr("^T040^LStats^L\n")
|
||||
rightJustifyNum(player=>w_health, CHAR_WND_STAT_X); rawDisplayStr("^T024Health\n")
|
||||
rightJustifyNum(player->b_intelligence, CHAR_WND_STAT_X); rawDisplayStr("^T024Intelligence\n")
|
||||
rightJustifyNum(player->b_strength, CHAR_WND_STAT_X); rawDisplayStr("^T024Strength\n")
|
||||
rightJustifyNum(player->b_agility, CHAR_WND_STAT_X); rawDisplayStr("^T024Agility\n")
|
||||
rightJustifyNum(player->b_stamina, CHAR_WND_STAT_X); rawDisplayStr("^T024Stamina\n")
|
||||
rightJustifyNum(player->b_charisma, CHAR_WND_STAT_X); rawDisplayStr("^T024Charisma\n")
|
||||
rightJustifyNum(player->b_spirit, CHAR_WND_STAT_X); rawDisplayStr("^T024Spirit\n")
|
||||
rightJustifyNum(player->b_luck, CHAR_WND_STAT_X); rawDisplayStr("^T024Luck\n")
|
||||
rightJustifyNum(player->b_armor, CHAR_WND_STAT_X); rawDisplayStr("^T024Armor\n")
|
||||
|
||||
rightJustifyNum(player=>w_health, CHAR_WND_STAT_X); rawDisplayStr("^T032Health\n")
|
||||
rightJustifyNum(player->b_intelligence, CHAR_WND_STAT_X); rawDisplayStr("^T032Intelligence\n")
|
||||
rightJustifyNum(player->b_strength, CHAR_WND_STAT_X); rawDisplayStr("^T032Strength\n")
|
||||
rightJustifyNum(player->b_agility, CHAR_WND_STAT_X); rawDisplayStr("^T032Agility\n")
|
||||
rightJustifyNum(player->b_stamina, CHAR_WND_STAT_X); rawDisplayStr("^T032Stamina\n")
|
||||
rightJustifyNum(player->b_charisma, CHAR_WND_STAT_X); rawDisplayStr("^T032Charisma\n")
|
||||
rightJustifyNum(player->b_spirit, CHAR_WND_STAT_X); rawDisplayStr("^T032Spirit\n")
|
||||
rightJustifyNum(player->b_luck, CHAR_WND_STAT_X); rawDisplayStr("^T032Luck\n")
|
||||
rightJustifyNum(player->b_armor, CHAR_WND_STAT_X); rawDisplayStr("^T032Armor\n")
|
||||
// Get weapon
|
||||
weapon = player=>p_items
|
||||
while weapon
|
||||
if weapon->t_type == TYPE_WEAPON and weapon->b_flags & ITEM_FLAG_EQUIP; break; fin
|
||||
weapon = weapon=>p_nextObj
|
||||
loop
|
||||
if weapon
|
||||
dmg = weapon=>r_projectileDmg
|
||||
else
|
||||
dmg = 0
|
||||
fin
|
||||
if dmg > 0
|
||||
displayf3("%dd%d+%d", (dmg >> 12) & $0F, (dmg >> 8) & $0F, dmg & $0F)
|
||||
rawDisplayStr("^T032Projectile\n")
|
||||
else
|
||||
if weapon
|
||||
dmg = weapon=>r_meleeDmg
|
||||
else
|
||||
dmg = $01601
|
||||
fin
|
||||
displayf3("%dd%d+%d", (dmg >> 12) & $0F, (dmg >> 8) & $0F, dmg & $0F)
|
||||
rawDisplayStr("^T032Melee\n")
|
||||
fin
|
||||
// Show aquired skills in lower right panel
|
||||
setWindow3()
|
||||
clearWindow()
|
||||
|
Loading…
x
Reference in New Issue
Block a user