mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-24 00:29:12 +00:00
A few combat updates for better hand-to-hand and debugging.
This commit is contained in:
parent
d4551be85d
commit
c320e173cd
@ -196,7 +196,7 @@ end
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
||||||
word chance
|
word chance
|
||||||
byte agil, roll
|
byte agil, roll, bonus
|
||||||
|
|
||||||
// Chance to hit:
|
// Chance to hit:
|
||||||
// * agil *4
|
// * agil *4
|
||||||
@ -212,13 +212,16 @@ def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
|||||||
agil = agil + scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)
|
agil = agil + scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)
|
||||||
fin
|
fin
|
||||||
//combatDebug// if combatDebug; displayf3("Agil = %d+%d = %d\n", pPlayer->b_agility, agil - pPlayer->b_agility, agil); fin
|
//combatDebug// if combatDebug; displayf3("Agil = %d+%d = %d\n", pPlayer->b_agility, agil - pPlayer->b_agility, agil); fin
|
||||||
chance = (agil * 10) + (pPlayer->b_aiming * 5)
|
chance = (agil * 9) + (pPlayer->b_aiming * 5)
|
||||||
//combatDebug// if combatDebug; displayf3("Base chnc = %d*10 + %d*5 = %d%%\n", agil, pPlayer->b_aiming, chance); fin
|
//combatDebug// if combatDebug; displayf3("Base chnc = %d*9 + %d*5 = %d%%\n", agil, pPlayer->b_aiming, chance); fin
|
||||||
if pWeapon
|
if pWeapon
|
||||||
chance = chance + (scanModifiers(pWeapon=>p_modifiers, @S_AIMING)*5)
|
chance = chance + (scanModifiers(pWeapon=>p_modifiers, @S_AIMING)*5)
|
||||||
//combatDebug// if combatDebug; displayf1(" weap aim=%d*5\n", scanModifiers(pWeapon=>p_modifiers, @S_AIMING)); fin
|
//combatDebug// if combatDebug; displayf1(" weap aim=%d*5\n", scanModifiers(pWeapon=>p_modifiers, @S_AIMING)); fin
|
||||||
chance = chance + (scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)*5)
|
chance = chance + (scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)*5)
|
||||||
//combatDebug// if combatDebug; displayf1(" plyr skill=%d*5\n", scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)); fin
|
//combatDebug// if combatDebug; displayf1(" plyr skill=%d*5\n", scanModifiers(pPlayer=>p_skills, pWeapon=>s_itemKind)); fin
|
||||||
|
else
|
||||||
|
chance = chance + scanModifiers(pPlayer=>p_skills, @S_HAND_TO_HAND)*5
|
||||||
|
//combatDebug// if combatDebug; displayf1(" h-t-h skill=%d*5\n", scanModifiers(pPlayer=>p_skills, @S_HAND_TO_HAND)); fin
|
||||||
fin
|
fin
|
||||||
chance = chance - (max(0, pEnemy->b_enemyAttackRange - 5)) / 5)
|
chance = chance - (max(0, pEnemy->b_enemyAttackRange - 5)) / 5)
|
||||||
//combatDebug// if combatDebug; displayf1(" rng mod=%d\n", -max(0, pEnemy->b_enemyAttackRange - 5) / 5); fin
|
//combatDebug// if combatDebug; displayf1(" rng mod=%d\n", -max(0, pEnemy->b_enemyAttackRange - 5) / 5); fin
|
||||||
@ -227,7 +230,7 @@ def rollPlayerHit(pPlayer, pWeapon, pEnemy, sAction)
|
|||||||
|
|
||||||
// See if it's a hit
|
// See if it's a hit
|
||||||
roll = rollPercentileWithLuck(-(pPlayer->b_luck)) // luck can reduce roll = increase chance to hit
|
roll = rollPercentileWithLuck(-(pPlayer->b_luck)) // luck can reduce roll = increase chance to hit
|
||||||
//combatDebug// if combatDebug; displayf2("Roll=%d, need <%d\n", roll, abs(roll < chance)); getUpperKey(); fin
|
//combatDebug// if combatDebug; displayf2("Roll=%d, need <%d\n", roll, chance); getUpperKey(); fin
|
||||||
if roll >= chance
|
if roll >= chance
|
||||||
isPlural = FALSE
|
isPlural = FALSE
|
||||||
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)
|
||||||
@ -280,7 +283,7 @@ def playerMelee(pPlayer, pWeapon)#0
|
|||||||
byte agil
|
byte agil
|
||||||
|
|
||||||
// Maybe in the future we'll put this under control of a global script
|
// Maybe in the future we'll put this under control of a global script
|
||||||
sAction = "swings"
|
sAction = (rand16() % 2) ?? "punches" :: "kicks"
|
||||||
|
|
||||||
pEnemy = chooseEnemy(5, pPlayer->b_gangChoice) // max distance 5 feet for melee
|
pEnemy = chooseEnemy(5, pPlayer->b_gangChoice) // max distance 5 feet for melee
|
||||||
if !pEnemy
|
if !pEnemy
|
||||||
@ -314,7 +317,7 @@ 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
|
||||||
//combatDebug// if combatDebug; displayf1("Dmg bonus:\n agil=%d\n", pPlayer->b_agility); fin
|
//combatDebug// 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)
|
||||||
//combatDebug// if combatDebug; displayf1(" weap agil=%d\n", scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)); fin
|
//combatDebug// if combatDebug; displayf1(" weap agil=%d\n", scanModifiers(pWeapon=>p_modifiers, @S_AGILITY)); fin
|
||||||
@ -323,7 +326,7 @@ def playerMelee(pPlayer, pWeapon)#0
|
|||||||
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)
|
||||||
//combatDebug// if combatDebug; displayf1(" strngth*5=%d\n", pPlayer->b_strength * 5); fin
|
//combatDebug// if combatDebug; displayf1(" strngth*5=%d\n", pPlayer->b_strength * 5); fin
|
||||||
fin
|
fin
|
||||||
//combatDebug// if combatDebug; displayf1("Final bonus=%d%%\n", bonus); fin
|
//combatDebug// if combatDebug; displayf1("Final bonus=%d%%\n", bonus); fin
|
||||||
dmg = dmg + addPercent(dmg, bonus)
|
dmg = dmg + addPercent(dmg, bonus)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user