Fix updating armor class

This commit is contained in:
Alexander Batalov 2022-08-06 20:05:33 +03:00
parent 33bda1612c
commit d7966cdab2
1 changed files with 9 additions and 5 deletions

View File

@ -1746,7 +1746,7 @@ static void opWieldItem(Program* program)
int hand = HAND_RIGHT;
bool v1 = false;
bool shouldAdjustArmorClass = false;
Object* oldArmor = NULL;
Object* newArmor = NULL;
if (critter == gDude) {
@ -1756,11 +1756,12 @@ static void opWieldItem(Program* program)
if (itemGetType(item) == ITEM_TYPE_ARMOR) {
oldArmor = critterGetArmor(gDude);
}
v1 = true;
// SFALL
shouldAdjustArmorClass = true;
newArmor = item;
}
}
if (_inven_wield(critter, item, hand) == -1) {
scriptPredefinedError(program, "wield_obj_critter", SCRIPT_ERROR_FOLLOWS);
@ -1769,8 +1770,11 @@ static void opWieldItem(Program* program)
}
if (critter == gDude) {
if (v1) {
if (shouldAdjustArmorClass) {
_adjust_ac(critter, oldArmor, newArmor);
// SFALL
interfaceRenderArmorClass(false);
}
bool animated = !gameUiIsDisabled();