mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-09-12 08:00:06 +00:00
Fix auto-reload for Bows. A couple minor combat display fixes.
This commit is contained in:
parent
1ecddcf190
commit
dba14b92bc
@ -307,12 +307,18 @@ def reload(pl, pWeapon, echo)#0
|
|||||||
item = item=>p_nextObj
|
item = item=>p_nextObj
|
||||||
loop
|
loop
|
||||||
if !item
|
if !item
|
||||||
|
if echo
|
||||||
displayf3("\n%s has no ammo for %s %s!\n", pl=>s_name, hisHerTheir(pl->c_gender), pWeapon=>s_name))
|
displayf3("\n%s has no ammo for %s %s!\n", pl=>s_name, hisHerTheir(pl->c_gender), pWeapon=>s_name))
|
||||||
|
fin
|
||||||
return
|
return
|
||||||
fin
|
fin
|
||||||
|
|
||||||
// Transfer ammo to weapon
|
// Transfer ammo to weapon
|
||||||
|
if pWeapon->b_clipSize
|
||||||
n = min(item=>w_count, pWeapon->b_clipSize - pWeapon->b_clipCurrent)
|
n = min(item=>w_count, pWeapon->b_clipSize - pWeapon->b_clipCurrent)
|
||||||
|
else
|
||||||
|
n = min(item=>w_count, 1) // clipSize=0 implies auto-reloading weapon
|
||||||
|
fin
|
||||||
pWeapon->b_clipCurrent = pWeapon->b_clipCurrent + n
|
pWeapon->b_clipCurrent = pWeapon->b_clipCurrent + n
|
||||||
item=>w_count = item=>w_count - n
|
item=>w_count = item=>w_count - n
|
||||||
if item=>w_count == 0
|
if item=>w_count == 0
|
||||||
@ -373,7 +379,10 @@ end
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def displayOption(key, str)#0
|
def displayOption(key, str)#0
|
||||||
rawDisplayf2("\n (%c)^T033%s ", key, str)
|
rawDisplayStr("\n (")
|
||||||
|
displayChar(key)
|
||||||
|
rawDisplayStr(")^T028")
|
||||||
|
rawDisplayStr(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -520,7 +529,7 @@ def playerCombatChoose(pl)#0
|
|||||||
|
|
||||||
// Let them know their options
|
// Let them know their options
|
||||||
setCursor(cursX, cursY)
|
setCursor(cursX, cursY)
|
||||||
rawDisplayf1("^D%s choice:", pl=>s_name)
|
rawDisplayf1("^D%s:", pl=>s_name)
|
||||||
displayOption('M', "Melee")
|
displayOption('M', "Melee")
|
||||||
if pWeapon
|
if pWeapon
|
||||||
// Special (for e.g. bows): clipSize zero means weapon reloads automatically
|
// Special (for e.g. bows): clipSize zero means weapon reloads automatically
|
||||||
@ -529,8 +538,12 @@ def playerCombatChoose(pl)#0
|
|||||||
fin
|
fin
|
||||||
if pWeapon->b_clipCurrent
|
if pWeapon->b_clipCurrent
|
||||||
canShoot = TRUE
|
canShoot = TRUE
|
||||||
|
if pWeapon->b_clipSize
|
||||||
|
displayOption('S', sprintf2("Shoot %d:%d", pWeapon->b_clipCurrent, pWeapon->b_clipSize))
|
||||||
|
else
|
||||||
displayOption('S', "Shoot")
|
displayOption('S', "Shoot")
|
||||||
fin
|
fin
|
||||||
|
fin
|
||||||
if pWeapon->b_clipCurrent < pWeapon->b_clipSize
|
if pWeapon->b_clipCurrent < pWeapon->b_clipSize
|
||||||
canReload = TRUE
|
canReload = TRUE
|
||||||
displayOption('R', "Reload")
|
displayOption('R', "Reload")
|
||||||
@ -618,9 +631,6 @@ def playerCombatTurn(pl)#0
|
|||||||
break
|
break
|
||||||
is 'F'
|
is 'F'
|
||||||
break
|
break
|
||||||
is 'D'
|
|
||||||
playerDodge(pl)
|
|
||||||
break
|
|
||||||
is 'S'
|
is 'S'
|
||||||
for i = 1 to pl->b_shotChoice
|
for i = 1 to pl->b_shotChoice
|
||||||
if nEnemiesFighting and pWeapon->b_clipCurrent
|
if nEnemiesFighting and pWeapon->b_clipCurrent
|
||||||
@ -668,6 +678,7 @@ def enemyCombatTurn(pe)#1
|
|||||||
pl = randomFromListFiltered(global=>p_players, p_nextObj, @canFight)
|
pl = randomFromListFiltered(global=>p_players, p_nextObj, @canFight)
|
||||||
if !pl; return FALSE; fin
|
if !pl; return FALSE; fin
|
||||||
|
|
||||||
|
setPlural(FALSE)
|
||||||
displayf3("\n%s %s %s ", pe=>s_name, pe=>s_attackText, pl=>s_name)
|
displayf3("\n%s %s %s ", pe=>s_name, pe=>s_attackText, pl=>s_name)
|
||||||
|
|
||||||
// Roll to hit
|
// Roll to hit
|
||||||
@ -1033,13 +1044,15 @@ def _combat_zoneEncounter(s_encZone)#1
|
|||||||
determineCombatOrder()
|
determineCombatOrder()
|
||||||
|
|
||||||
p = global=>p_combatFirst
|
p = global=>p_combatFirst
|
||||||
while p
|
while TRUE // not just "while p", so that we always check nPlayersFighting etc.
|
||||||
if !nPlayersFighting
|
if !nPlayersFighting
|
||||||
return -99 // special code for death
|
return -99 // special code for death
|
||||||
elsif !nEnemiesFighting
|
elsif !nEnemiesFighting
|
||||||
processWin()
|
processWin()
|
||||||
// Note: no need to clear heap -- the caller does that.
|
// Note: no need to clear heap -- the caller does that.
|
||||||
return 1
|
return 1
|
||||||
|
elsif !p
|
||||||
|
break
|
||||||
fin
|
fin
|
||||||
|
|
||||||
if canFight(p)
|
if canFight(p)
|
||||||
@ -1050,8 +1063,8 @@ def _combat_zoneEncounter(s_encZone)#1
|
|||||||
// Note: no need to clear heap -- the caller does that.
|
// Note: no need to clear heap -- the caller does that.
|
||||||
return 0
|
return 0
|
||||||
fin
|
fin
|
||||||
playerCombatTurn(p)
|
|
||||||
if p->b_combatChoice <> 'D'
|
if p->b_combatChoice <> 'D'
|
||||||
|
playerCombatTurn(p)
|
||||||
combatPause()
|
combatPause()
|
||||||
fin
|
fin
|
||||||
break
|
break
|
||||||
|
@ -586,7 +586,8 @@ def _showPlayerSheet(player_num)#1 // funcTbl functions always have to return a
|
|||||||
// Other operations...
|
// Other operations...
|
||||||
is '&' // add health cheat
|
is '&' // add health cheat
|
||||||
if global->b_godmode
|
if global->b_godmode
|
||||||
player=>w_health = player=>w_health + 50
|
player=>w_health = player=>w_maxHealth
|
||||||
|
redisplay = 2
|
||||||
fin
|
fin
|
||||||
break
|
break
|
||||||
is '$' // add gold cheat
|
is '$' // add gold cheat
|
||||||
|
Loading…
Reference in New Issue
Block a user