From 77d55a48f113440b123393154a8125f281fcbec2 Mon Sep 17 00:00:00 2001 From: captainurist <73941350+captainurist@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:58:00 +0900 Subject: [PATCH] Monster supertype logic moved out --- src/Engine/Graphics/Outdoor.cpp | 2 +- src/Engine/Graphics/Vis.cpp | 2 +- src/Engine/Objects/Actor.cpp | 26 ++++------- src/Engine/Objects/Character.cpp | 19 ++++---- src/Engine/Objects/MonsterEnums.cpp | 39 +++++++++++++++++ src/Engine/Objects/MonsterEnums.h | 14 +++++- src/Engine/Objects/Monsters.cpp | 68 ----------------------------- src/Engine/Objects/Monsters.h | 3 -- src/Engine/Objects/SpriteObject.cpp | 2 +- src/Engine/Spells/CastSpellInfo.cpp | 10 ++--- src/GUI/UI/NPCTopics.cpp | 2 +- src/GUI/UI/UIPopup.cpp | 2 +- 12 files changed, 79 insertions(+), 110 deletions(-) diff --git a/src/Engine/Graphics/Outdoor.cpp b/src/Engine/Graphics/Outdoor.cpp index 83db382f3b7f..8daece0449d0 100644 --- a/src/Engine/Graphics/Outdoor.cpp +++ b/src/Engine/Graphics/Outdoor.cpp @@ -2317,7 +2317,7 @@ void UpdateActors_ODM() { pActors[Actor_ITR].aiState == Summoned || !pActors[Actor_ITR].moveSpeed) continue; - bool Water_Walk = MonsterStats::BelongsToSupertype(pActors[Actor_ITR].monsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL); + bool Water_Walk = supertypeForMonsterId(pActors[Actor_ITR].monsterInfo.uID) == MONSTER_SUPERTYPE_WATER_ELEMENTAL; pActors[Actor_ITR].sectorId = 0; diff --git a/src/Engine/Graphics/Vis.cpp b/src/Engine/Graphics/Vis.cpp index 63927359ce60..01260dae453b 100644 --- a/src/Engine/Graphics/Vis.cpp +++ b/src/Engine/Graphics/Vis.cpp @@ -791,7 +791,7 @@ bool Vis::isBillboardPartOfSelection(int billboardId, Vis_SelectionFilter *filte return false; auto only_target_undead = filter->select_flags & TargetUndead; - auto target_not_undead = MonsterStats::BelongsToSupertype(pActors[object_idx].monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) == 0; + auto target_not_undead = supertypeForMonsterId(pActors[object_idx].monsterInfo.uID) != MONSTER_SUPERTYPE_UNDEAD; if (only_target_undead && target_not_undead) return false; diff --git a/src/Engine/Objects/Actor.cpp b/src/Engine/Objects/Actor.cpp index b0a8373b4f10..ddaeb9849a0b 100644 --- a/src/Engine/Objects/Actor.cpp +++ b/src/Engine/Objects/Actor.cpp @@ -1611,8 +1611,7 @@ void Actor::AI_RandomMove(unsigned int uActor_id, Pid uTarget_id, absx = absy + (absx / 2); else absx = absx + absy / 2; - if (MonsterStats::BelongsToSupertype(pActors[uActor_id].monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(pActors[uActor_id].monsterInfo.uID) == MONSTER_SUPERTYPE_TREANT) { if (!uActionLength) uActionLength = 256; Actor::AI_StandOrBored(uActor_id, Pid(OBJECT_Character, 0), uActionLength, &doNotInitializeBecauseShouldBeRandom); @@ -1905,8 +1904,7 @@ void Actor::AI_Pursue1(unsigned int uActorID, Pid a2, signed int arg0, } else { v10 = pDir; } - if (MonsterStats::BelongsToSupertype(v7->monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(v7->monsterInfo.uID) == MONSTER_SUPERTYPE_TREANT) { if (!uActionLength) uActionLength = 256; Actor::AI_StandOrBored(uActorID, Pid::character(0), uActionLength, v10); return; @@ -1955,8 +1953,7 @@ void Actor::AI_Flee(unsigned int uActorID, Pid sTargetPid, } Actor::GetDirectionInfo(v7, Pid::character(0), &v10, 0); v13 = &v10; - if (MonsterStats::BelongsToSupertype(v5->monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT) || + if (supertypeForMonsterId(v5->monsterInfo.uID) == MONSTER_SUPERTYPE_TREANT || sTargetPid.type() == OBJECT_Actor && v13->uDistance < 307.2) { if (!uActionLength) uActionLength = 256; Actor::AI_StandOrBored(uActorID, Pid::character(0), uActionLength, v13); @@ -2007,8 +2004,7 @@ void Actor::AI_Pursue2(unsigned int uActorID, Pid a2, Actor::GetDirectionInfo(v8, a2, &a3, v6); v10 = &a3; } - if (MonsterStats::BelongsToSupertype(v7->monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(v7->monsterInfo.uID) == MONSTER_SUPERTYPE_TREANT) { if (!uActionLength) uActionLength = 256; Actor::AI_StandOrBored(uActorID, Pid::character(0), uActionLength, v10); return; @@ -2063,8 +2059,7 @@ void Actor::AI_Pursue3(unsigned int uActorID, Pid a2, Actor::GetDirectionInfo(v7, a2, &a3, v5); v20 = &a3; } - if (MonsterStats::BelongsToSupertype(v6->monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(v6->monsterInfo.uID) == MONSTER_SUPERTYPE_TREANT) { if (!uActionLength) uActionLength = 256; return Actor::AI_StandOrBored(uActorID, Pid::character(0), uActionLength, a4); } @@ -2412,9 +2407,7 @@ void Actor::ActorDamageFromMonster(Pid attacker_id, pushDistance = 20 * finalDmg / pActors[actor_id].monsterInfo.uHP; if (pushDistance > 10) pushDistance = 10; - if (!MonsterStats::BelongsToSupertype( - pActors[actor_id].monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(pActors[actor_id].monsterInfo.uID) != MONSTER_SUPERTYPE_TREANT) { pVelocity->x = (int32_t)fixpoint_mul(pushDistance, pVelocity->x); pVelocity->y = @@ -3286,8 +3279,7 @@ void Actor::DamageMonsterFromParty(Pid a1, unsigned int uActorID_Monster, } } if (knockbackValue > 10) knockbackValue = 10; - if (!MonsterStats::BelongsToSupertype(pMonster->monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(pMonster->monsterInfo.uID) != MONSTER_SUPERTYPE_TREANT) { pVelocity->x = fixpoint_mul(knockbackValue, pVelocity->x); pVelocity->y = fixpoint_mul(knockbackValue, pVelocity->y); pVelocity->z = fixpoint_mul(knockbackValue, pVelocity->z); @@ -4781,9 +4773,7 @@ void ItemDamageFromActor(Pid uObjID, unsigned int uActorID, (signed int)pActors[uActorID].monsterInfo.uHP > 10) a2a = 10; - if (!MonsterStats::BelongsToSupertype( - pActors[uActorID].monsterInfo.uID, - MONSTER_SUPERTYPE_TREANT)) { + if (supertypeForMonsterId(pActors[uActorID].monsterInfo.uID) != MONSTER_SUPERTYPE_TREANT) { pVelocity->x = fixpoint_mul(a2a, pVelocity->x); pVelocity->y = fixpoint_mul(a2a, pVelocity->y); pVelocity->z = fixpoint_mul(a2a, pVelocity->z); diff --git a/src/Engine/Objects/Character.cpp b/src/Engine/Objects/Character.cpp index 1d0dc00efe17..a916c0ad43f2 100644 --- a/src/Engine/Objects/Character.cpp +++ b/src/Engine/Objects/Character.cpp @@ -1145,21 +1145,20 @@ int Character::CalculateMeleeDmgToEnemyWithWeapon(ItemGen *weapon, ITEM_ENCHANTMENT enchType = weapon->special_enchantment; // check against enchantments - if (MonsterStats::BelongsToSupertype(uTargetActorID, - MONSTER_SUPERTYPE_UNDEAD) && + if (supertypeForMonsterId(uTargetActorID) == MONSTER_SUPERTYPE_UNDEAD && (enchType == ITEM_ENCHANTMENT_UNDEAD_SLAYING || itemId == ITEM_ARTIFACT_GHOULSBANE || itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE)) { totalDmg *= 2; // double damage vs undead - } else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && + } else if (supertypeForMonsterId(uTargetActorID) == MONSTER_SUPERTYPE_KREEGAN && (enchType == ITEM_ENCHANTMENT_DEMON_SLAYING || itemId == ITEM_ARTIFACT_GIBBET)) { totalDmg *= 2; // double damage vs devils - } else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && + } else if (supertypeForMonsterId(uTargetActorID) == MONSTER_SUPERTYPE_DRAGON && (enchType == ITEM_ENCHANTMENT_DRAGON_SLAYING || itemId == ITEM_ARTIFACT_GIBBET)) { totalDmg *= 2; // double damage vs dragons - } else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_ELF) && + } else if (supertypeForMonsterId(uTargetActorID) == MONSTER_SUPERTYPE_ELF && (enchType == ITEM_ENCHANTMENT_ELF_SLAYING || itemId == ITEM_RELIC_OLD_NICK)) { totalDmg *= 2; // double damage vs elf - } else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && + } else if (supertypeForMonsterId(uTargetActorID) == MONSTER_SUPERTYPE_TITAN && (enchType == ITEM_ENCHANTMENT_TITAN_SLAYING)) { totalDmg *= 2; // double damage vs titan } @@ -1247,16 +1246,16 @@ int Character::CalculateRangedDamageTo(MonsterId uMonsterInfoID) { if (uMonsterInfoID != MONSTER_INVALID) { // check against bow enchantments if (itemenchant == ITEM_ENCHANTMENT_UNDEAD_SLAYING && - MonsterStats::BelongsToSupertype(uMonsterInfoID, MONSTER_SUPERTYPE_UNDEAD)) { // double damage vs undead + supertypeForMonsterId(uMonsterInfoID) == MONSTER_SUPERTYPE_UNDEAD) { // double damage vs undead damage *= 2; } else if (itemenchant == ITEM_ENCHANTMENT_DEMON_SLAYING && - MonsterStats::BelongsToSupertype(uMonsterInfoID, MONSTER_SUPERTYPE_KREEGAN)) { // double vs devils + supertypeForMonsterId(uMonsterInfoID) == MONSTER_SUPERTYPE_KREEGAN) { // double vs devils damage *= 2; } else if (itemenchant == ITEM_ENCHANTMENT_DRAGON_SLAYING && - MonsterStats::BelongsToSupertype(uMonsterInfoID, MONSTER_SUPERTYPE_DRAGON)) { // double vs dragons + supertypeForMonsterId(uMonsterInfoID) == MONSTER_SUPERTYPE_DRAGON) { // double vs dragons damage *= 2; } else if (itemenchant == ITEM_ENCHANTMENT_ELF_SLAYING && - MonsterStats::BelongsToSupertype(uMonsterInfoID, MONSTER_SUPERTYPE_ELF)) { // double vs elf + supertypeForMonsterId(uMonsterInfoID) == MONSTER_SUPERTYPE_ELF) { // double vs elf damage *= 2; } } diff --git a/src/Engine/Objects/MonsterEnums.cpp b/src/Engine/Objects/MonsterEnums.cpp index 83cd63c937dc..b9542c1d4bb0 100644 --- a/src/Engine/Objects/MonsterEnums.cpp +++ b/src/Engine/Objects/MonsterEnums.cpp @@ -248,3 +248,42 @@ ItemId itemDropForMonsterType(MonsterType monsterType) { default: return ITEM_NULL; } } + +MONSTER_SUPERTYPE supertypeForMonsterType(MonsterType monsterType) { + switch (monsterType) { + case MONSTER_TYPE_GHOST: + case MONSTER_TYPE_LICH: + case MONSTER_TYPE_SKELETON_WARRIOR: + case MONSTER_TYPE_VAMPIRE: + case MONSTER_TYPE_WIGHT: + case MONSTER_TYPE_ZOMBIE: + case MONSTER_TYPE_GHOUL: + return MONSTER_SUPERTYPE_UNDEAD; + case MONSTER_TYPE_DEVIL: + return MONSTER_SUPERTYPE_KREEGAN; + case MONSTER_TYPE_PEASANT_ELF_FEMALE_A: + case MONSTER_TYPE_PEASANT_ELF_FEMALE_B: + case MONSTER_TYPE_PEASANT_ELF_FEMALE_C: + case MONSTER_TYPE_PEASANT_ELF_MALE_A: + case MONSTER_TYPE_PEASANT_ELF_MALE_B: + case MONSTER_TYPE_PEASANT_ELF_MALE_C: + case MONSTER_TYPE_ELF_ARCHER: + case MONSTER_TYPE_ELF_SPEARMAN: + return MONSTER_SUPERTYPE_ELF; + + // TODO(captainurist): should also include mega-dragon? + case MONSTER_TYPE_DRAGON: + return MONSTER_SUPERTYPE_DRAGON; + + // TODO(captainurist): This needs some reworking it seems. Water elemental supertype is about water walking, + // treant supertype is about being a tree that can't move. The rest are about "of X slaying". + case MONSTER_TYPE_ELEMENTAL_WATER: + return MONSTER_SUPERTYPE_WATER_ELEMENTAL; + case MONSTER_TYPE_TREANT: + return MONSTER_SUPERTYPE_TREANT; + case MONSTER_TYPE_TITAN: + return MONSTER_SUPERTYPE_TITAN; + default: + return MONSTER_SUPERTYPE_NONE; + } +} diff --git a/src/Engine/Objects/MonsterEnums.h b/src/Engine/Objects/MonsterEnums.h index 6110c3596c35..bbd1ee56838d 100644 --- a/src/Engine/Objects/MonsterEnums.h +++ b/src/Engine/Objects/MonsterEnums.h @@ -490,10 +490,22 @@ enum class MONSTER_SUPERTYPE { MONSTER_SUPERTYPE_WATER_ELEMENTAL = 0x5, MONSTER_SUPERTYPE_TREANT = 0x6, MONSTER_SUPERTYPE_TITAN = 0x7, - MONSTER_SUPERTYPE_8 = 0x8, + MONSTER_SUPERTYPE_8 = 0x8, // TODO(captainurist): not an arena monster? Drop? }; using enum MONSTER_SUPERTYPE; +/** + * @offset 0x00438BDF + * + * @param monsterType Monster type to check. + * @return Supertype for the provided monster type. + */ +MONSTER_SUPERTYPE supertypeForMonsterType(MonsterType monsterType); + +inline MONSTER_SUPERTYPE supertypeForMonsterId(MonsterId monsterId) { + return supertypeForMonsterType(monsterTypeForMonsterId(monsterId)); +} + enum class SPECIAL_ATTACK_TYPE : uint8_t { SPECIAL_ATTACK_NONE = 0, SPECIAL_ATTACK_CURSE = 1, diff --git a/src/Engine/Objects/Monsters.cpp b/src/Engine/Objects/Monsters.cpp index 3ca799f2b46a..bcbe685d548b 100644 --- a/src/Engine/Objects/Monsters.cpp +++ b/src/Engine/Objects/Monsters.cpp @@ -1081,71 +1081,3 @@ MonsterId MonsterList::GetMonsterIDByName(const std::string &pMonsterName) { } Error("Monster not found: %s", pMonsterName.c_str()); } -//----- (00438BDF) -------------------------------------------------------- -bool MonsterStats::BelongsToSupertype(MonsterId uMonsterInfoID, - enum MONSTER_SUPERTYPE eSupertype) { - switch (eSupertype) { - case MONSTER_SUPERTYPE_UNDEAD: - if (uMonsterInfoID >= MONSTER_GHOST_A && - uMonsterInfoID <= MONSTER_GHOST_C // 70<=id<=72 - || uMonsterInfoID >= MONSTER_LICH_A && - uMonsterInfoID <= MONSTER_LICH_C // 91-93 - || - uMonsterInfoID >= MONSTER_SKELETON_WARRIOR_A && - uMonsterInfoID <= MONSTER_SKELETON_WARRIOR_C // 199-201 - || - uMonsterInfoID >= MONSTER_VAMPIRE_A && - uMonsterInfoID <= MONSTER_VAMPIRE_C // 217-219 - || uMonsterInfoID >= MONSTER_WIGHT_A && - uMonsterInfoID <= MONSTER_WIGHT_C // 223-225 - || - uMonsterInfoID >= MONSTER_ZOMBIE_A && - uMonsterInfoID <= MONSTER_ZOMBIE_C // 229-231 - || - uMonsterInfoID >= MONSTER_GHOUL_A && - uMonsterInfoID <= MONSTER_GHOUL_C) // 256-258 - return true; - return false; - case MONSTER_SUPERTYPE_KREEGAN: - if (uMonsterInfoID >= MONSTER_DEVIL_A && - uMonsterInfoID <= MONSTER_DEVIL_C) // 22-24 - return true; - return false; - case MONSTER_SUPERTYPE_ELF: - if (uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_A_A && - uMonsterInfoID <= - MONSTER_PEASANT_ELF_MALE_C_C // 133 - 150 - || - uMonsterInfoID >= MONSTER_ELF_ARCHER_A && - uMonsterInfoID <= MONSTER_ELF_ARCHER_C // 49-51 - || uMonsterInfoID >= MONSTER_ELF_SPEARMAN_A && - uMonsterInfoID <= - MONSTER_ELF_SPEARMAN_C) // 52-54 - return true; - return false; - case MONSTER_SUPERTYPE_DRAGON: - if (uMonsterInfoID >= MONSTER_DRAGON_A && - uMonsterInfoID <= MONSTER_DRAGON_C) // 25-27 - return true; - return false; - case MONSTER_SUPERTYPE_WATER_ELEMENTAL: - if (uMonsterInfoID >= MONSTER_ELEMENTAL_WATER_A && - uMonsterInfoID <= - MONSTER_ELEMENTAL_WATER_C) // 46-48 - return true; - return false; - case MONSTER_SUPERTYPE_TREANT: - if (uMonsterInfoID >= MONSTER_TREANT_A && - uMonsterInfoID <= MONSTER_TREANT_C) // 253-255 - return true; - return false; - case MONSTER_SUPERTYPE_TITAN: - if (uMonsterInfoID >= MONSTER_TITAN_A && - uMonsterInfoID <= MONSTER_TITAN_C) // 211-213 - return true; - return false; - default: - return false; - } - return false; -} diff --git a/src/Engine/Objects/Monsters.h b/src/Engine/Objects/Monsters.h index 82c1f2667237..3bf93dc6c3fe 100644 --- a/src/Engine/Objects/Monsters.h +++ b/src/Engine/Objects/Monsters.h @@ -84,9 +84,6 @@ struct MonsterStats { void InitializePlacements(const Blob &placements); MonsterId FindMonsterByTextureName(const std::string &Str2); - static bool BelongsToSupertype(MonsterId uMonsterInfoID, - MONSTER_SUPERTYPE eSupertype); - IndexedArray pInfos; // 0 - 5b18h std::array pPlaceStrings; // 5B18h placement counts from 1 unsigned int uNumMonsters; // 5B94h // TODO(captainurist): can drop? diff --git a/src/Engine/Objects/SpriteObject.cpp b/src/Engine/Objects/SpriteObject.cpp index ceb58e890b43..41addccfb24e 100644 --- a/src/Engine/Objects/SpriteObject.cpp +++ b/src/Engine/Objects/SpriteObject.cpp @@ -1036,7 +1036,7 @@ bool processSpellImpact(unsigned int uLayingItemID, Pid pid) { case SPRITE_SPELL_LIGHT_DESTROY_UNDEAD: { if (pid.type() == OBJECT_Actor && - MonsterStats::BelongsToSupertype(pActors[pid.id()].monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) { + supertypeForMonsterId(pActors[pid.id()].monsterInfo.uID) == MONSTER_SUPERTYPE_UNDEAD) { applySpellSpriteDamage(uLayingItemID, pid); } updateSpriteOnImpact(object); diff --git a/src/Engine/Spells/CastSpellInfo.cpp b/src/Engine/Spells/CastSpellInfo.cpp index 93f82f3d7ece..5f872c735f3a 100644 --- a/src/Engine/Spells/CastSpellInfo.cpp +++ b/src/Engine/Spells/CastSpellInfo.cpp @@ -446,7 +446,7 @@ void CastSpellInfoHelpers::castSpell() { pSpellSprite.uFacing = target_direction.uYawAngle; pSpellSprite.uAttributes |= SPRITE_ATTACHED_TO_HEAD; int obj_id = pSpellSprite.Create(0, 0, 0, 0); - if (!MonsterStats::BelongsToSupertype(pActors[monster_id].monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) { + if (supertypeForMonsterId(pActors[monster_id].monsterInfo.uID) != MONSTER_SUPERTYPE_UNDEAD) { spellFailed(pCastSpell, LSTR_SPELL_FAILED); pPlayer->SpendMana(uRequiredMana); // decrease mana on failure setSpellRecovery(pCastSpell, recoveryTime); @@ -1751,7 +1751,7 @@ void CastSpellInfoHelpers::castSpell() { pSpellSprite.uType = SPRITE_SPELL_SPIRIT_TURN_UNDEAD_1; initSpellSprite(&pSpellSprite, spell_level, spell_mastery, pCastSpell); for (Actor *actor : render->getActorsInViewport(4096)) { - if (MonsterStats::BelongsToSupertype(actor->monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) { + if (supertypeForMonsterId(actor->monsterInfo.uID) == MONSTER_SUPERTYPE_UNDEAD) { pSpellSprite.vPosition = actor->pos - Vec3i(0, 0, actor->height * -0.8); pSpellSprite.spell_target_pid = Pid(OBJECT_Actor, actor->id); pSpellSprite.Create(0, 0, 0, 0); @@ -2059,7 +2059,7 @@ void CastSpellInfoHelpers::castSpell() { GameTime spell_duration = GameTime::FromMinutes(10 * spell_level); int monster_id = spell_targeted_at.id(); // v730 = 836 * monster_id; - if (MonsterStats::BelongsToSupertype(pActors[monster_id].monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) { + if (supertypeForMonsterId(pActors[monster_id].monsterInfo.uID) == MONSTER_SUPERTYPE_UNDEAD) { spellFailed(pCastSpell, LSTR_SPELL_FAILED); pPlayer->SpendMana(uRequiredMana); // decrease mana on failure setSpellRecovery(pCastSpell, recoveryTime); @@ -2104,7 +2104,7 @@ void CastSpellInfoHelpers::castSpell() { initSpellSprite(&pSpellSprite, spell_level, spell_mastery, pCastSpell); for (Actor *actor : render->getActorsInViewport(4096)) { // Change: do not exit loop when first undead monster is found - if (!MonsterStats::BelongsToSupertype(actor->monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) { + if (supertypeForMonsterId(actor->monsterInfo.uID) != MONSTER_SUPERTYPE_UNDEAD) { pSpellSprite.vPosition = actor->pos - Vec3i(0, 0, actor->height * -0.8); pSpellSprite.spell_target_pid = Pid(OBJECT_Actor, actor->id); pSpellSprite.Create(0, 0, 0, 0); @@ -2742,7 +2742,7 @@ void CastSpellInfoHelpers::castSpell() { assert(false); } int monster_id = spell_targeted_at.id(); - if (!MonsterStats::BelongsToSupertype(pActors[monster_id].monsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) { + if (supertypeForMonsterId(pActors[monster_id].monsterInfo.uID) != MONSTER_SUPERTYPE_UNDEAD) { spellFailed(pCastSpell, LSTR_SPELL_FAILED); pPlayer->SpendMana(uRequiredMana); // decrease mana on failure setSpellRecovery(pCastSpell, recoveryTime); diff --git a/src/GUI/UI/NPCTopics.cpp b/src/GUI/UI/NPCTopics.cpp index 70d5a1eaf033..1ed6fc537dc7 100644 --- a/src/GUI/UI/NPCTopics.cpp +++ b/src/GUI/UI/NPCTopics.cpp @@ -326,7 +326,7 @@ void prepareArenaFight(DIALOGUE_TYPE dialogue) { std::vector candidateIds; for (MonsterId i : allArenaMonsters()) { if (pMonsterStats->pInfos[i].uAIType != 1) { - if (!MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8)) { + if (supertypeForMonsterId(pMonsterStats->pInfos[i].uID) != MONSTER_SUPERTYPE_8) { if (pMonsterStats->pInfos[i].uLevel >= monsterMinLevel && pMonsterStats->pInfos[i].uLevel <= monsterMaxLevel) { candidateIds.push_back(i); diff --git a/src/GUI/UI/UIPopup.cpp b/src/GUI/UI/UIPopup.cpp index fa642ee39753..be5d212283f9 100644 --- a/src/GUI/UI/UIPopup.cpp +++ b/src/GUI/UI/UIPopup.cpp @@ -1035,7 +1035,7 @@ void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow) { } /** - * @offset 0x00417BB5. + * @offset 0x00417BB5 * * @brief Generating message for skill description popup. *