diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua b/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua index b9ce99fdd89..6b26cdd45d3 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua @@ -9,7 +9,8 @@ combat:addCondition(condition) local spell = Spell("instant") function spell.onCastSpell(creature, var) - if table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + local monster = creature:getMonster() + if monster and monster:soulPit() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then return combat:execute(creature, var) end diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua b/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua index bfbadc8a714..293c8859dea 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua @@ -26,7 +26,8 @@ local spell = Spell("instant") local combats = { combatRoot, combatFear } function spell.onCastSpell(creature, var) - if table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + local monster = creature:getMonster() + if monster and monster:soulPit() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then for _, combat in pairs(combats) do combat:execute(creature, var) end diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua b/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua index 2edbe0b6d8b..7ed71742f8f 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua @@ -9,7 +9,8 @@ combat:addCondition(condition) local spell = Spell("instant") function spell.onCastSpell(creature, var) - if table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + local monster = creature:getMonster() + if monster and monster:soulPit() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then return combat:execute(creature, var) end diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 4335db2bd53..e6764b496d3 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -5744,7 +5744,9 @@ bool Player::onKilledMonster(const std::shared_ptr &monster) { return false; } addHuntingTaskKill(mType); - addBestiaryKill(mType); + if (!monster->getSoulPit()) { + addBestiaryKill(mType); + } addBosstiaryKill(mType); return false; } diff --git a/src/lua/functions/creatures/monster/monster_functions.cpp b/src/lua/functions/creatures/monster/monster_functions.cpp index 3f5d0c25ea8..77793f8508b 100644 --- a/src/lua/functions/creatures/monster/monster_functions.cpp +++ b/src/lua/functions/creatures/monster/monster_functions.cpp @@ -66,6 +66,8 @@ void MonsterFunctions::init(lua_State* L) { Lua::registerMethod(L, "Monster", "hazardDamageBoost", MonsterFunctions::luaMonsterHazardDamageBoost); Lua::registerMethod(L, "Monster", "hazardDefenseBoost", MonsterFunctions::luaMonsterHazardDefenseBoost); + Lua::registerMethod(L, "Monster", "soulPit", MonsterFunctions::luaMonsterSoulPit); + Lua::registerMethod(L, "Monster", "addReflectElement", MonsterFunctions::luaMonsterAddReflectElement); Lua::registerMethod(L, "Monster", "addDefense", MonsterFunctions::luaMonsterAddDefense); Lua::registerMethod(L, "Monster", "getDefense", MonsterFunctions::luaMonsterGetDefense); @@ -700,6 +702,23 @@ int MonsterFunctions::luaMonsterHazardDefenseBoost(lua_State* L) { return 1; } +int MonsterFunctions::luaMonsterSoulPit(lua_State* L) { + // get: monster:soulPit() ; set: monster:soulPit(hazard) + const auto &monster = Lua::getUserdataShared(L, 1); + const bool soulPit = Lua::getBoolean(L, 2, false); + if (monster) { + if (lua_gettop(L) == 1) { + Lua::pushBoolean(L, monster->getSoulPit()); + } else { + monster->setSoulPit(soulPit); + Lua::pushBoolean(L, monster->getSoulPit()); + } + } else { + lua_pushnil(L); + } + return 1; +} + int MonsterFunctions::luaMonsterAddReflectElement(lua_State* L) { // monster:addReflectElement(type, percent) const auto &monster = Lua::getUserdataShared(L, 1); diff --git a/src/lua/functions/creatures/monster/monster_functions.hpp b/src/lua/functions/creatures/monster/monster_functions.hpp index 4ba696e941b..fdc45d7732c 100644 --- a/src/lua/functions/creatures/monster/monster_functions.hpp +++ b/src/lua/functions/creatures/monster/monster_functions.hpp @@ -76,6 +76,8 @@ class MonsterFunctions { static int luaMonsterAddDefense(lua_State* L); static int luaMonsterGetDefense(lua_State* L); + static int luaMonsterSoulPit(lua_State* L); + static int luaMonsterIsDead(lua_State* L); static int luaMonsterImmune(lua_State* L);