Skip to content

Commit

Permalink
fix: log error 'primal pack beast not exist' and health display (#2598)
Browse files Browse the repository at this point in the history
Resolves the log error stating "Monster with name primal pack beast not exist" that appears when a player engages with 'the primal menace'. It also corrects the health bar display for primal beasts to ensure it appears filled upon their creation, aligning with the global standards for creature health displays.

These adjustments improve both the accuracy of the game's logging system and the visual feedback provided to players during encounters with primal beasts.
  • Loading branch information
pennaor committed May 16, 2024
1 parent 84c9658 commit b83c9b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions data-otservbr-global/lib/quests/the_primal_ordeal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ function RegisterPrimalPackBeast(template)
primalMonster.loot = {}
primalMonster.name = "Primal Pack Beast"
primalMonster.description = "a primal pack beast"

primalMonster.health = primalMonster.health
primalMonster.maxHealth = primalMonster.maxHealth
primalMonster.maxHealth = primalMonster.maxHealth * 0.7
primalMonster.health = primalMonster.maxHealth
primalMonster.raceId = nil
primalMonster.Bestiary = nil
primalMonster.corpse = 0

primal:register(primalMonster)
end
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ local thePrimalMenaceConfig = {
CountGrowthPerHazard = 1.05,
CountMax = 6,

HpRateOnSpawn = 0.7,
MonsterPool = {
"Emerald Tortoise (Primal)",
"Gore Horn (Primal)",
Expand Down Expand Up @@ -291,8 +290,6 @@ local function spawnMonster(monsterId, spawnPosition)
MonsterId = primalMonster:getId(),
Created = os.time(),
}
local monsterMaxHealth = primalMonster:getMaxHealth()
primalMonster:setHealth(monsterMaxHealth * thePrimalMenaceConfig.MonsterConfig.HpRateOnSpawn)

local primalBeasts = monster:getStorageValue(thePrimalMenaceConfig.Storage.PrimalBeasts)
table.insert(primalBeasts, primalBeastEntry)
Expand Down
5 changes: 3 additions & 2 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6493,9 +6493,10 @@ bool Game::combatBlockHit(CombatDamage &damage, std::shared_ptr<Creature> attack
InternalGame::sendBlockEffect(primaryBlockType, damage.primary.type, target->getPosition(), attacker);
// Damage reflection primary
if (!damage.extension && attacker) {
if (targetPlayer && attacker->getMonster() && damage.primary.type != COMBAT_HEALING) {
std::shared_ptr<Monster> attackerMonster = attacker->getMonster();
if (attackerMonster && targetPlayer && damage.primary.type != COMBAT_HEALING) {
// Charm rune (target as player)
const auto mType = g_monsters().getMonsterType(attacker->getName());
const auto &mType = attackerMonster->getMonsterType();
if (mType) {
charmRune_t activeCharm = g_iobestiary().getCharmFromTarget(targetPlayer, mType);
if (activeCharm == CHARM_PARRY) {
Expand Down

0 comments on commit b83c9b4

Please sign in to comment.