Fix several combat bugs (#204)

This commit is contained in:
drjfaust 2022-12-06 12:17:11 +03:00 committed by GitHub
parent 3a541d4b67
commit d49869f45c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -4167,7 +4167,7 @@ static int _attackFindInvalidFlags(Object* critter, Object* item)
// 0x4240DC // 0x4240DC
static int attackComputeCriticalFailure(Attack* attack) static int attackComputeCriticalFailure(Attack* attack)
{ {
attack->attackerFlags |= DAM_HIT; attack->attackerFlags &= ~DAM_HIT;
if (attack->attacker != NULL && _critter_flag_check(attack->attacker->pid, CRITTER_INVULNERABLE)) { if (attack->attacker != NULL && _critter_flag_check(attack->attacker->pid, CRITTER_INVULNERABLE)) {
return 0; return 0;
@ -4668,7 +4668,7 @@ void _apply_damage(Attack* attack, bool animated)
bool attackerIsCritter = attacker != NULL && FID_TYPE(attacker->fid) == OBJ_TYPE_CRITTER; bool attackerIsCritter = attacker != NULL && FID_TYPE(attacker->fid) == OBJ_TYPE_CRITTER;
bool v5 = attack->defender != attack->oops; bool v5 = attack->defender != attack->oops;
if (attackerIsCritter && (attacker->data.critter.combat.results & DAM_DEAD) != 0) { if (attackerIsCritter && (attacker->data.critter.combat.results & DAM_DEAD) == 0) {
_set_new_results(attacker, attack->attackerFlags); _set_new_results(attacker, attack->attackerFlags);
// TODO: Not sure about "attack->defender == attack->oops". // TODO: Not sure about "attack->defender == attack->oops".
_damage_object(attacker, attack->attackerDamage, animated, attack->defender == attack->oops, attacker); _damage_object(attacker, attack->attackerDamage, animated, attack->defender == attack->oops, attacker);
@ -5297,7 +5297,7 @@ static void combatAddDamageFlagsDescription(char* dest, int flags, Object* critt
strcat(dest, messageListItem.text); strcat(dest, messageListItem.text);
} }
messageListItem.num = flagsList[flagsListLength - 1]; messageListItem.num = num + flagsList[flagsListLength - 1];
if (messageListGetItem(&gCombatMessageList, &messageListItem)) { if (messageListGetItem(&gCombatMessageList, &messageListItem)) {
strcat(dest, messageListItem.text); strcat(dest, messageListItem.text);
} }