mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-24 00:29:12 +00:00
Added debug mode for combat formulas, which will help in balancing the formulas.
This commit is contained in:
parent
ce31c5bda8
commit
bca6410d70
@ -23,6 +23,7 @@ word[] funcTbl = @_combat_zoneEncounter
|
|||||||
byte nPlayersFighting
|
byte nPlayersFighting
|
||||||
byte nEnemiesFighting
|
byte nEnemiesFighting
|
||||||
byte isFleeing
|
byte isFleeing
|
||||||
|
byte combatDebug
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def combatPause()#0
|
def combatPause()#0
|
||||||
@ -93,7 +94,7 @@ end
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
||||||
word chance
|
word chance
|
||||||
byte agil
|
byte agil, roll
|
||||||
|
|
||||||
// Chance to hit:
|
// Chance to hit:
|
||||||
// * agil *4
|
// * agil *4
|
||||||
@ -107,16 +108,24 @@ def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
|||||||
if pWeapon
|
if pWeapon
|
||||||
agil = agil + scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)
|
agil = agil + scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)
|
||||||
fin
|
fin
|
||||||
|
if combatDebug; displayf3("Agil = %d+%d = %d\n", pPlayer->b_agility, agil - pPlayer->b_agility, agil); fin
|
||||||
chance = (agil * 4) + pPlayer->b_aiming
|
chance = (agil * 4) + pPlayer->b_aiming
|
||||||
|
if combatDebug; displayf3("Base chnc = %d*4+%d = %d%%\n", agil, pPlayer->b_aiming, chance); fin
|
||||||
if pWeapon
|
if pWeapon
|
||||||
chance = chance + scanModifiers(pWeapon=>p_modifiers, @S_AIMING)
|
chance = chance + scanModifiers(pWeapon=>p_modifiers, @S_AIMING)
|
||||||
|
if combatDebug; displayf1(" weap aim=%d\n", scanModifiers(pWeapon=>p_modifiers, @S_AIMING)); fin
|
||||||
chance = chance + scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)
|
chance = chance + scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)
|
||||||
|
if combatDebug; displayf1(" plyr skill=%d\n", scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)); fin
|
||||||
fin
|
fin
|
||||||
chance = max(5, min(90, chance))
|
chance = max(5, min(90, chance))
|
||||||
|
if combatDebug; displayf1(" rng mod=%d\n", max(0, pEnemy->b_enemyAttackRange - 5) / 5); fin
|
||||||
chance = max(0, chance - (max(0, pEnemy->b_enemyAttackRange - 5)) / 5))
|
chance = max(0, chance - (max(0, pEnemy->b_enemyAttackRange - 5)) / 5))
|
||||||
|
if combatDebug; displayf1("Final chnc = %d%%\n", chance); fin
|
||||||
|
|
||||||
// See if it's a hit
|
// See if it's a hit
|
||||||
if (rand16() % 100) >= chance
|
roll = rand16() % 100
|
||||||
|
if combatDebug; displayf2("Roll=%d Hit=%d\n", roll, abs(roll < chance)); getUpperKey(); fin
|
||||||
|
if roll >= chance
|
||||||
setPlural(0)
|
setPlural(0)
|
||||||
displayf3("\n%s %s at %s but misses.\n", pPlayer=>s_name, sAction, pEnemy=>s_name)
|
displayf3("\n%s %s at %s but misses.\n", pPlayer=>s_name, sAction, pEnemy=>s_name)
|
||||||
return FALSE
|
return FALSE
|
||||||
@ -178,11 +187,14 @@ def playerMelee(pPlayer, pWeapon)#0
|
|||||||
fin
|
fin
|
||||||
|
|
||||||
if pWeapon
|
if pWeapon
|
||||||
dmg = rollDice(pWeapon=>r_meleeDmg)
|
dmg = pWeapon=>r_meleeDmg
|
||||||
else
|
else
|
||||||
// If using just fists, damage is nd4+h, where n is hand-to-hand skill + 1
|
// If using just fists, damage is nd4+h, where n is hand-to-hand skill + 1
|
||||||
dmg = rollDice(encodeDice(scanModifiers(pPlayer=>p_skills, @S_HAND_TO_HAND)+1, 4, 0))
|
dmg = encodeDice(scanModifiers(pPlayer=>p_skills, @S_HAND_TO_HAND)+1, 4, 0)
|
||||||
fin
|
fin
|
||||||
|
if combatDebug; displayf3("Base dmg: %dd%d+%d = ", (dmg>>12) & $F, (dmg >> 8) & $F, dmg & $FF); fin
|
||||||
|
dmg = rollDice(dmg)
|
||||||
|
if combatDebug; displayf1("%d\n", dmg); fin
|
||||||
|
|
||||||
// Damage bonus is:
|
// Damage bonus is:
|
||||||
// 1% per point of combined player and weapon agility
|
// 1% per point of combined player and weapon agility
|
||||||
@ -191,14 +203,20 @@ def playerMelee(pPlayer, pWeapon)#0
|
|||||||
// (no contribution of strength)
|
// (no contribution of strength)
|
||||||
// (enemies don't have armor)
|
// (enemies don't have armor)
|
||||||
bonus = pPlayer->b_agility
|
bonus = pPlayer->b_agility
|
||||||
|
if combatDebug; displayf1("Dmg bonus:\n agil=%d\n", pPlayer->b_agility); fin
|
||||||
if pWeapon
|
if pWeapon
|
||||||
bonus = bonus + scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)
|
bonus = bonus + scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)
|
||||||
|
if combatDebug; displayf1(" weap agil=%d\n", scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)); fin
|
||||||
bonus = bonus + (scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)*2)
|
bonus = bonus + (scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)*2)
|
||||||
|
if combatDebug; displayf1(" plyr skill*2=%d\n", scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)*2); fin
|
||||||
fin
|
fin
|
||||||
if scanModifiers(pPlayer=>p_skills, @S_HAND_TO_HAND)
|
if scanModifiers(pPlayer=>p_skills, @S_HAND_TO_HAND)
|
||||||
bonus = bonus + (pPlayer->b_strength * 5)
|
bonus = bonus + (pPlayer->b_strength * 5)
|
||||||
|
if combatDebug; displayf1(" strngth*5=%d\n", pPlayer->b_strength * 5); fin
|
||||||
fin
|
fin
|
||||||
|
if combatDebug; displayf1("Final bonus=%d%%\n", bonus); fin
|
||||||
dmg = dmg + addPercent(dmg, bonus)
|
dmg = dmg + addPercent(dmg, bonus)
|
||||||
|
if combatDebug; displayf1("Final dmg=%d\n", dmg); getUpperKey(); fin
|
||||||
damageEnemy(pPlayer, pEnemy, dmg, sAction)
|
damageEnemy(pPlayer, pEnemy, dmg, sAction)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -231,7 +249,11 @@ def playerShoot(pPlayer, pWeapon)#0
|
|||||||
// TODO: consider multi-shot weapons
|
// TODO: consider multi-shot weapons
|
||||||
|
|
||||||
// Calculate damage
|
// Calculate damage
|
||||||
|
if combatDebug
|
||||||
|
displayf3("Base dmg: %dd%d+%d = ", (pWeapon=>r_projectileDmg>>12) & $F, (pWeapon=>r_projectileDmg >> 8) & $F, pWeapon=>r_projectileDmg & $FF)
|
||||||
|
fin
|
||||||
dmg = rollDice(pWeapon=>r_projectileDmg)
|
dmg = rollDice(pWeapon=>r_projectileDmg)
|
||||||
|
if combatDebug; displayf1("%d\n", dmg); fin
|
||||||
|
|
||||||
// Damage bonus is:
|
// Damage bonus is:
|
||||||
// * 1% per point of combined player and weapon agility
|
// * 1% per point of combined player and weapon agility
|
||||||
@ -239,6 +261,13 @@ def playerShoot(pPlayer, pWeapon)#0
|
|||||||
// (no contribution of strength)
|
// (no contribution of strength)
|
||||||
// (enemies don't have armor)
|
// (enemies don't have armor)
|
||||||
dmg = dmg + addPercent(dmg, agil + scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind))
|
dmg = dmg + addPercent(dmg, agil + scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind))
|
||||||
|
if combatDebug
|
||||||
|
displayf1("dmg bonus:\n agil=%d\n", agil)
|
||||||
|
displayf1(" plyr skill=%d\n", scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind))
|
||||||
|
displayf1("final bonus=%d%%\n", agil + scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind))
|
||||||
|
displayf1("final dmg=%d\n", dmg)
|
||||||
|
getUpperKey()
|
||||||
|
fin
|
||||||
|
|
||||||
// Okay, do that damage.
|
// Okay, do that damage.
|
||||||
damageEnemy(pPlayer, pEnemy, dmg, sAction)
|
damageEnemy(pPlayer, pEnemy, dmg, sAction)
|
||||||
@ -336,6 +365,7 @@ def playerCombatChoose(pl)#0
|
|||||||
loop
|
loop
|
||||||
|
|
||||||
// Let them know their options
|
// Let them know their options
|
||||||
|
restoreCursor()
|
||||||
rawDisplayf1("^D%s", pl=>s_name)
|
rawDisplayf1("^D%s", pl=>s_name)
|
||||||
displayOption('M', "Melee")
|
displayOption('M', "Melee")
|
||||||
if pWeapon
|
if pWeapon
|
||||||
@ -358,7 +388,6 @@ def playerCombatChoose(pl)#0
|
|||||||
canAdvance = minEnemyDist() > 5
|
canAdvance = minEnemyDist() > 5
|
||||||
if canAdvance; displayOption('A', "Advance"); fin
|
if canAdvance; displayOption('A', "Advance"); fin
|
||||||
|
|
||||||
restoreCursor()
|
|
||||||
while TRUE
|
while TRUE
|
||||||
pl->b_combatChoice = getUpperKey()
|
pl->b_combatChoice = getUpperKey()
|
||||||
when pl->b_combatChoice
|
when pl->b_combatChoice
|
||||||
@ -381,6 +410,14 @@ def playerCombatChoose(pl)#0
|
|||||||
is 'A'
|
is 'A'
|
||||||
if canAdvance; return; fin
|
if canAdvance; return; fin
|
||||||
break
|
break
|
||||||
|
is '%'
|
||||||
|
if global->b_godmode
|
||||||
|
clearWindow()
|
||||||
|
combatDebug = 1-combatDebug
|
||||||
|
rawDisplayf1("Combat debug: %d\n\n", combatDebug)
|
||||||
|
return playerCombatChoose(pl)
|
||||||
|
fin
|
||||||
|
break
|
||||||
wend
|
wend
|
||||||
beep()
|
beep()
|
||||||
loop
|
loop
|
||||||
@ -601,6 +638,7 @@ def startCombat(mapCode)#1
|
|||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
isFleeing = FALSE
|
isFleeing = FALSE
|
||||||
|
combatDebug = FALSE
|
||||||
makeRandomGroup(mapCode)
|
makeRandomGroup(mapCode)
|
||||||
|
|
||||||
// Display portrait of first group
|
// Display portrait of first group
|
||||||
@ -640,10 +678,11 @@ def startCombat(mapCode)#1
|
|||||||
elsif n == 'F'
|
elsif n == 'F'
|
||||||
displayStr("\n\nFleeing...\n")
|
displayStr("\n\nFleeing...\n")
|
||||||
return 0
|
return 0
|
||||||
// Secret option for testing: just die
|
// Secret option for testing: instant victory
|
||||||
elsif n == '#' and global->b_godmode
|
elsif n == '#' and global->b_godmode
|
||||||
displayStr("\n\n")
|
displayStr("\n\n")
|
||||||
return 99
|
return 99
|
||||||
|
// Secret option for testing: just die
|
||||||
elsif n == '*' and global->b_godmode
|
elsif n == '*' and global->b_godmode
|
||||||
displayStr("\n\n")
|
displayStr("\n\n")
|
||||||
return -99
|
return -99
|
||||||
|
@ -12,6 +12,7 @@ import gamelib
|
|||||||
|
|
||||||
//////////// Shared library routines ////////////
|
//////////// Shared library routines ////////////
|
||||||
// Let's try to keep these predef's in lexical order
|
// Let's try to keep these predef's in lexical order
|
||||||
|
predef abs(n)#1
|
||||||
predef addEncounterZone(code, x, y, dist, chance)#0
|
predef addEncounterZone(code, x, y, dist, chance)#0
|
||||||
predef addGold(amount)#1
|
predef addGold(amount)#1
|
||||||
predef addPlayerToParty(playerFuncNum)#0
|
predef addPlayerToParty(playerFuncNum)#0
|
||||||
|
@ -1056,7 +1056,7 @@ end
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Return the absolute value of a number
|
// Return the absolute value of a number
|
||||||
def abs(n)#1
|
export def abs(n)#1
|
||||||
if n < 0; return -n; fin
|
if n < 0; return -n; fin
|
||||||
return n
|
return n
|
||||||
end
|
end
|
||||||
|
@ -439,6 +439,7 @@ def interactWithItem(player, item)#1
|
|||||||
is 'E'
|
is 'E'
|
||||||
if item->t_type == TYPE_ARMOR or item->t_type == TYPE_WEAPON
|
if item->t_type == TYPE_ARMOR or item->t_type == TYPE_WEAPON
|
||||||
doEquip(player, item)
|
doEquip(player, item)
|
||||||
|
return NULL
|
||||||
else
|
else
|
||||||
beep
|
beep
|
||||||
fin
|
fin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user