Fix incorrect AP cost when AI reloads a weapon
This commit is contained in:
parent
1e5047cd48
commit
40d6348b09
|
@ -2554,9 +2554,14 @@ static int _ai_try_attack(Object* a1, Object* a2)
|
||||||
_gsound_play_sfx_file_volume(sfx, volume);
|
_gsound_play_sfx_file_volume(sfx, volume);
|
||||||
_ai_magic_hands(a1, weapon, 5002);
|
_ai_magic_hands(a1, weapon, 5002);
|
||||||
|
|
||||||
int actionPoints = a1->data.critter.combat.ap;
|
// SFALL: Fix incorrect AP cost when AI reloads a weapon.
|
||||||
if (actionPoints >= 2) {
|
// CE: There is a commented out code which checks
|
||||||
a1->data.critter.combat.ap = actionPoints - 2;
|
// available action points before performing reload. Not
|
||||||
|
// sure why it was commented, probably needs additional
|
||||||
|
// testing.
|
||||||
|
int actionPointsRequired = weaponGetActionPointCost(a1, HIT_MODE_RIGHT_WEAPON_RELOAD, false);
|
||||||
|
if (a1->data.critter.combat.ap >= actionPointsRequired) {
|
||||||
|
a1->data.critter.combat.ap -= actionPointsRequired;
|
||||||
} else {
|
} else {
|
||||||
a1->data.critter.combat.ap = 0;
|
a1->data.critter.combat.ap = 0;
|
||||||
}
|
}
|
||||||
|
@ -2577,9 +2582,14 @@ static int _ai_try_attack(Object* a1, Object* a2)
|
||||||
_gsound_play_sfx_file_volume(sfx, volume);
|
_gsound_play_sfx_file_volume(sfx, volume);
|
||||||
_ai_magic_hands(a1, weapon, 5002);
|
_ai_magic_hands(a1, weapon, 5002);
|
||||||
|
|
||||||
int actionPoints = a1->data.critter.combat.ap;
|
// SFALL: Fix incorrect AP cost when AI reloads a
|
||||||
if (actionPoints >= 2) {
|
// weapon.
|
||||||
a1->data.critter.combat.ap = actionPoints - 2;
|
// CE: See note above, probably need to check
|
||||||
|
// available action points before performing
|
||||||
|
// reload.
|
||||||
|
int actionPointsRequired = weaponGetActionPointCost(a1, HIT_MODE_RIGHT_WEAPON_RELOAD, false);
|
||||||
|
if (a1->data.critter.combat.ap >= actionPointsRequired) {
|
||||||
|
a1->data.critter.combat.ap -= actionPointsRequired;
|
||||||
} else {
|
} else {
|
||||||
a1->data.critter.combat.ap = 0;
|
a1->data.critter.combat.ap = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue