mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-08 18:30:35 +00:00
Fixed so some enemies get a crack at you when you're fleeing.
This commit is contained in:
parent
dab8bd2908
commit
d89d9dfbad
@ -2925,7 +2925,7 @@ end
|
|||||||
def packMoveBackward(blk)
|
def packMoveBackward(blk)
|
||||||
{
|
{
|
||||||
assert blk.field.size() == 0
|
assert blk.field.size() == 0
|
||||||
outIndented("moveBackward()\n")
|
outIndented("moveWayBackward()\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
def makeTriggerTbl(scripts, xRange, yRange)
|
def makeTriggerTbl(scripts, xRange, yRange)
|
||||||
|
@ -236,7 +236,7 @@ def playerCombatChoose(pl)
|
|||||||
fin
|
fin
|
||||||
if nWeapons >= 2
|
if nWeapons >= 2
|
||||||
canChange = TRUE
|
canChange = TRUE
|
||||||
displayOption('C', "Change weapon")
|
displayOption('C', "Chg weapon")
|
||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
displayOption('D', "Dodge")
|
displayOption('D', "Dodge")
|
||||||
@ -492,7 +492,7 @@ def startCombat(mapCode)
|
|||||||
displayStr("\n\nBattle! \n")
|
displayStr("\n\nBattle! \n")
|
||||||
return 1
|
return 1
|
||||||
elsif n == 'F'
|
elsif n == 'F'
|
||||||
displayStr("\n\nCoward. ")
|
displayStr("\n\nFleeing... \n")
|
||||||
return 0
|
return 0
|
||||||
// Secret option for testing: just win
|
// Secret option for testing: just win
|
||||||
elsif n == '#'
|
elsif n == '#'
|
||||||
@ -511,16 +511,17 @@ def _combat_zoneEncounter(s_encZone)
|
|||||||
|
|
||||||
// Show portrait and threat details, find out if player wants to fight (vs. run)
|
// Show portrait and threat details, find out if player wants to fight (vs. run)
|
||||||
answer = startCombat(s_encZone)
|
answer = startCombat(s_encZone)
|
||||||
if !answer; return 0; fin
|
|
||||||
if answer == 99
|
if answer == 99
|
||||||
global=>p_enemyGroups = NULL // results in no living enemies, or "win"
|
global=>p_enemyGroups = NULL // results in no living enemies, or "win"
|
||||||
|
elsif !answer
|
||||||
|
isFleeing = TRUE
|
||||||
fin
|
fin
|
||||||
|
|
||||||
// Do each round of combat until player wins, loses, or flees
|
// Do each round of combat until player wins, loses, or flees
|
||||||
while TRUE
|
while TRUE
|
||||||
p = global=>p_players
|
p = global=>p_players
|
||||||
while p
|
while p
|
||||||
if canFight(p) and nEnemiesFighting
|
if canFight(p) and nEnemiesFighting and !isFleeing
|
||||||
playerCombatChoose(p)
|
playerCombatChoose(p)
|
||||||
fin
|
fin
|
||||||
p = p=>p_nextObj
|
p = p=>p_nextObj
|
||||||
@ -557,15 +558,16 @@ def _combat_zoneEncounter(s_encZone)
|
|||||||
getUpperKey()
|
getUpperKey()
|
||||||
// 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 isFleeing
|
|
||||||
displayStr("\nYou have fled.")
|
|
||||||
// Note: no need to clear heap -- the caller does that.
|
|
||||||
return 0
|
|
||||||
fin
|
fin
|
||||||
|
|
||||||
if canFight(p)
|
if canFight(p)
|
||||||
when p->t_type
|
when p->t_type
|
||||||
is TYPE_PLAYER
|
is TYPE_PLAYER
|
||||||
|
if isFleeing
|
||||||
|
displayStr("\nYou have fled.")
|
||||||
|
// Note: no need to clear heap -- the caller does that.
|
||||||
|
return 0
|
||||||
|
fin
|
||||||
playerCombatTurn(p)
|
playerCombatTurn(p)
|
||||||
combatPause()
|
combatPause()
|
||||||
break
|
break
|
||||||
|
@ -80,7 +80,7 @@ const setGround = gameLibVecs + 3*6
|
|||||||
const queue_teleport = gameLibVecs + 3*7
|
const queue_teleport = gameLibVecs + 3*7
|
||||||
const setPortrait = gameLibVecs + 3*8
|
const setPortrait = gameLibVecs + 3*8
|
||||||
const clearPortrait = gameLibVecs + 3*9
|
const clearPortrait = gameLibVecs + 3*9
|
||||||
const moveBackward = gameLibVecs + 3*10
|
const moveWayBackward = gameLibVecs + 3*10
|
||||||
const getUpperKey = gameLibVecs + 3*11
|
const getUpperKey = gameLibVecs + 3*11
|
||||||
const clearWindow = gameLibVecs + 3*12
|
const clearWindow = gameLibVecs + 3*12
|
||||||
const getGlobals = gameLibVecs + 3*13
|
const getGlobals = gameLibVecs + 3*13
|
||||||
|
@ -95,7 +95,7 @@ word animPauseCt
|
|||||||
// Game library functions
|
// Game library functions
|
||||||
predef _setScriptInfo, _scriptDisplayStr, _scriptDisplayStrNL, _getYN
|
predef _setScriptInfo, _scriptDisplayStr, _scriptDisplayStrNL, _getYN
|
||||||
predef _queue_setMap, _setSky, _setGround, _queue_teleport, _setPortrait, _clearPortrait
|
predef _queue_setMap, _setSky, _setGround, _queue_teleport, _setPortrait, _clearPortrait
|
||||||
predef _moveBackward, _getUpperKey, _clearWindow, _setPortrait
|
predef _moveWayBackward, _getUpperKey, _clearWindow, _setPortrait
|
||||||
predef _getGlobals, _rand16
|
predef _getGlobals, _rand16
|
||||||
predef _printf1, _printf2, _printf3
|
predef _printf1, _printf2, _printf3
|
||||||
predef _displayf1, _displayf2, _displayf3
|
predef _displayf1, _displayf2, _displayf3
|
||||||
@ -111,7 +111,7 @@ predef _rdkey, _initHeap, _scriptCombat
|
|||||||
|
|
||||||
word gameLib_addrs = @_setScriptInfo, @_scriptDisplayStr, @_scriptDisplayStrNL, @_getYN
|
word gameLib_addrs = @_setScriptInfo, @_scriptDisplayStr, @_scriptDisplayStrNL, @_getYN
|
||||||
word = @_queue_setMap, @_setSky, @_setGround, @_queue_teleport, @_setPortrait, @_clearPortrait
|
word = @_queue_setMap, @_setSky, @_setGround, @_queue_teleport, @_setPortrait, @_clearPortrait
|
||||||
word = @_moveBackward, @_getUpperKey, @_clearWindow
|
word = @_moveWayBackward, @_getUpperKey, @_clearWindow
|
||||||
word = @_getGlobals, @_rand16
|
word = @_getGlobals, @_rand16
|
||||||
word = @_printf1, @_printf2, @_printf3
|
word = @_printf1, @_printf2, @_printf3
|
||||||
word = @_displayf1, @_displayf2, @_displayf3
|
word = @_displayf1, @_displayf2, @_displayf3
|
||||||
@ -1370,12 +1370,25 @@ end
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Move backward one step (3D mode). Also actually works in 2D mode.
|
// Move backward one step (3D mode). Also actually works in 2D mode.
|
||||||
def _moveBackward()
|
def moveBackward()
|
||||||
adjustDir(8)
|
adjustDir(8)
|
||||||
moveForward()
|
moveForward()
|
||||||
adjustDir(8)
|
adjustDir(8)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Move backward four steps (3D mode), or one step (2D mode)
|
||||||
|
def _moveWayBackward()
|
||||||
|
adjustDir(8)
|
||||||
|
moveForward()
|
||||||
|
if mapIs3D
|
||||||
|
moveForward()
|
||||||
|
moveForward()
|
||||||
|
moveForward()
|
||||||
|
fin
|
||||||
|
adjustDir(8)
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Turn left (3D mode)
|
// Turn left (3D mode)
|
||||||
def rotateLeft()
|
def rotateLeft()
|
||||||
@ -1749,6 +1762,9 @@ def _setPortrait(portraitNum)
|
|||||||
// And show the first frame
|
// And show the first frame
|
||||||
showAnimFrame()
|
showAnimFrame()
|
||||||
|
|
||||||
|
// Clear the keyboard strobe in case the player was moving at high speed
|
||||||
|
^kbdStrobe
|
||||||
|
|
||||||
// Do not render over the portrait
|
// Do not render over the portrait
|
||||||
needRender = FALSE
|
needRender = FALSE
|
||||||
end
|
end
|
||||||
@ -1954,7 +1970,7 @@ def doCombat(mapCode)
|
|||||||
|
|
||||||
// If the party fled the combat instead of winning, back up to previous square.
|
// If the party fled the combat instead of winning, back up to previous square.
|
||||||
if (!result)
|
if (!result)
|
||||||
moveBackward()
|
moveWayBackward()
|
||||||
fin
|
fin
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user