From 3647df2157ada94a473facaf9fba04cfe81a27df Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Mon, 2 Dec 2024 21:32:18 -0300 Subject: [PATCH] fix: soulpit fight --- data-otservbr-global/lib/others/load.lua | 1 + data-otservbr-global/lib/others/soulpit.lua | 73 ++++++ .../monster/humanoids/orc_warlord.lua | 3 + .../scripts/actions/soulpit/soulpit_fight.lua | 220 +++++------------- .../spells/monster/soulpit_intensehex.lua | 8 +- .../spells/monster/soulpit_opressor.lua | 16 +- .../spells/monster/soulpit_powerless.lua | 10 +- src/creatures/monsters/monster.cpp | 20 +- src/creatures/monsters/monster.hpp | 2 + .../functions/core/game/game_functions.cpp | 49 ++++ .../functions/core/game/game_functions.hpp | 1 + 11 files changed, 219 insertions(+), 184 deletions(-) create mode 100644 data-otservbr-global/lib/others/soulpit.lua diff --git a/data-otservbr-global/lib/others/load.lua b/data-otservbr-global/lib/others/load.lua index 031c8fb2026..3422819b9f8 100644 --- a/data-otservbr-global/lib/others/load.lua +++ b/data-otservbr-global/lib/others/load.lua @@ -1 +1,2 @@ dofile(DATA_DIRECTORY .. "/lib/others/dawnport.lua") +dofile(DATA_DIRECTORY .. "/lib/others/soulpit.lua") diff --git a/data-otservbr-global/lib/others/soulpit.lua b/data-otservbr-global/lib/others/soulpit.lua new file mode 100644 index 00000000000..c716e8c7817 --- /dev/null +++ b/data-otservbr-global/lib/others/soulpit.lua @@ -0,0 +1,73 @@ +SoulPit = { + encounter = nil, + soulCores = Game.getSoulCoreItems(), + requiredLevel = 8, + playerPositions = { + { pos = Position(32371, 31155, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, + { pos = Position(32371, 31156, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, + { pos = Position(32371, 31157, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, + { pos = Position(32371, 31158, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, + { pos = Position(32371, 31159, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, + }, + waves = { + [1] = { + stacks = { + [1] = 6, + [40] = 1 + }, + }, + [2] = { + stacks = { + [1] = 4, + [5] = 3, + }, + }, + [3] = { + stacks = { + [1] = 5, + [15] = 2, + }, + }, + [4] = { + stacks = { + [1] = 3, + [5] = 3, + [40] = 1, + }, + }, + }, + effects = { + [1] = CONST_ME_TELEPORT, + [5] = CONST_ME_ORANGETELEPORT, + [15] = CONST_ME_REDTELEPORT, + [40] = CONST_ME_PURPLETELEPORT, + }, + possibleAbilities = { + "overpowerSoulPit", + "enrageSoulPit", + "opressorSoulPit", + }, + bossAbilities = { + ["overpowerSoulPit"] = { + player = true, + monster = false, + }, + ["enrageSoulPit"] = { + player = false, + monster = true, + }, + ["opressorSoulPit"] = { + player = false, + monster = true, + }, + }, + timeToKick = 3 * 1000, -- 3 seconds + checkMonstersDelay = 4.5 * 1000, -- 4.5 seconds | The check delay should never be less than the timeToSpawnMonsters. + timeToSpawnMonsters = 4 * 1000, -- 4 seconds + totalMonsters = 7, + bossPosition = Position(32372, 31135, 8), + exit = Position(32371, 31164, 8), + zone = Zone("soulpit"), +} + +SoulPit.zone:addArea(Position(32365, 31134, 8), Position(32382, 31152, 8)) diff --git a/data-otservbr-global/monster/humanoids/orc_warlord.lua b/data-otservbr-global/monster/humanoids/orc_warlord.lua index db5b0e20288..5b33843d971 100644 --- a/data-otservbr-global/monster/humanoids/orc_warlord.lua +++ b/data-otservbr-global/monster/humanoids/orc_warlord.lua @@ -107,6 +107,9 @@ monster.loot = { monster.attacks = { { name = "melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -250 }, { name = "combat", interval = 2000, chance = 20, type = COMBAT_PHYSICALDAMAGE, minDamage = 0, maxDamage = -200, range = 7, shootEffect = CONST_ANI_THROWINGSTAR, target = false }, + { name = "soulpit opressor", interval = 2000, chance = 25, minDamage = 0, maxDamage = 0 }, + { name = "soulpit powerless", interval = 2000, chance = 30, minDamage = 0, maxDamage = 0 }, + { name = "soulpit intensehex", interval = 2000, chance = 15, minDamage = 0, maxDamage = 0 }, } monster.defenses = { diff --git a/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua b/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua index d389b77fc0d..09303ccbd3a 100644 --- a/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua +++ b/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua @@ -1,114 +1,24 @@ -local config = { - soulCores = Game.getSoulCoreItems(), - requiredLevel = 8, - playerPositions = { - { pos = Position(32371, 31155, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, - { pos = Position(32371, 31156, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, - { pos = Position(32371, 31157, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, - { pos = Position(32371, 31158, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, - { pos = Position(32371, 31159, 8), teleport = Position(32373, 31138, 8), effect = CONST_ME_TELEPORT }, - }, - waves = { - [1] = { - stacks = { - [1] = 7, - }, - }, - [2] = { - stacks = { - [1] = 4, - [5] = 3, - }, - }, - [3] = { - stacks = { - [1] = 5, - [15] = 2, - }, - }, - [4] = { - stacks = { - [1] = 3, - [5] = 3, - [40] = 1, - }, - }, - }, - effects = { - [1] = CONST_ME_TELEPORT, - [5] = CONST_ME_ORANGETELEPORT, - [15] = CONST_ME_REDTELEPORT, - [40] = CONST_ME_PURPLETELEPORT, - }, - bossAbilitiesIndexes = {}, - bossAbilities = { - ["enrage"] = { - monsterEvents = { - "enrageSoulPit", - }, - }, - ["opressor"] = { - spells = { - { name = "soulpit opressor", interval = 2000, chance = 25, minDamage = 0, maxDamage = 0 }, - { name = "soulpit powerless", interval = 2000, chance = 30, minDamage = 0, maxDamage = 0 }, - { name = "soulpit hexer", interval = 2000, chance = 15, minDamage = 0, maxDamage = 0 }, - }, - }, - ["overpower"] = { - playerEvents = { - "overpowerSoulPit" - }, - }, - }, - checkMonstersDelay = 4.5 * 1000, -- 4.5 seconds | The check delay should never be less than the timeToSpawnMonsters. - timeToSpawnMonsters = 4 * 1000, -- 4 seconds - totalMonsters = 7, - bossPosition = Position(32372, 31135, 8), - exit = Position(32371, 31164, 8), - zone = Zone("soulpit"), -} - -for name, _ in pairs(config.bossAbilities) do - table.insert(config.bossAbilitiesIndexes, name) - logger.warn(name) -end - -config.zone:addArea(Position(32365, 31134, 8), Position(32382, 31152, 8)) - -local enrage = CreatureEvent("enrageSoulPit") -function enrage.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - if not creature or not creature:isMonster() then - return true +local zoneEvent = ZoneEvent(SoulPit.zone) +function zoneEvent.afterLeave(zone, creature) + local player = creature:getPlayer() + if not player then + return false end - local healthPercentage = creature:getHealth() / creature:getMaxHealth() - - if healthPercentage >= 0.5 and healthPercentage <= 0.7 then - primaryDamage = primaryDamage * 0.9 -- 10% damage reduction - secondaryDamage = secondaryDamage * 0.9 -- 10% damage reduction - elseif healthPercentage >= 0.3 and healthPercentage < 0.5 then - primaryDamage = primaryDamage * 0.75 -- 25% damage reduction - secondaryDamage = secondaryDamage * 0.75 -- 25% damage reduction - elseif healthPercentage > 0 and healthPercentage < 0.3 then - primaryDamage = primaryDamage * 0.6 -- 40% damage reduction - secondaryDamage = secondaryDamage * 0.6 -- 40% damage reduction + if table.empty(zone:getPlayers()) then + if SoulPit.encounter then + SoulPit.encounter:reset() + SoulPit.encounter = nil + end end - return primaryDamage, primaryType, secondaryDamage, secondaryType -end -enrage:register() - -local overpower = CreatureEvent("overpowerSoulPit") -function overpower.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - if attacker:getForgeStack() == 40 then - primaryDamage = primaryDamage * 1.1 - secondaryDamage = secondaryDamage * 1.1 - creature:getPosition():sendMagicEffect(CONST_ME_CRITICAL_DAMAGE) + for abilityName, abilityInfo in pairs(SoulPit.bossAbilities) do + if abilityInfo.player then + player:unregisterEvent(abilityName) + end end - - return primaryDamage, primaryType, secondaryDamage, secondaryType end -overpower:register() +zoneEvent:register() local soulPitAction = Action() function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) @@ -117,7 +27,7 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH end local isParticipant = false - for _, v in ipairs(config.playerPositions) do + for _, v in ipairs(SoulPit.playerPositions) do if Position(v.pos) == player:getPosition() then isParticipant = true end @@ -128,17 +38,22 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH end local lever = Lever() - lever:setPositions(config.playerPositions) + lever:setPositions(SoulPit.playerPositions) lever:setCondition(function(creature) if not creature or not creature:isPlayer() then return true end + if not table.empty(SoulPit.zone:getPlayers()) then + local message = "Someone is fighting in the arena!" + creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) + return false + end + local isAccountNormal = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER - if isAccountNormal and creature:getLevel() < config.requiredLevel then - local message = "All players need to be level " .. config.requiredLevel .. " or higher." + if isAccountNormal and creature:getLevel() < SoulPit.requiredLevel then + local message = string.format("All players need to be level %s or higher.", SoulPit.requiredLevel) creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) return false end @@ -154,83 +69,74 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH logger.warn("monster name: " .. monsterName) - config.zone:removeMonsters() + SoulPit.zone:removeMonsters() + + if SoulPit.encounter ~= nil then + SoulPit.encounter:reset() + end local encounter = Encounter("Soulpit", { - zone = config.zone, + zone = SoulPit.zone, }) + SoulPit.encounter = encounter + local function waveStart() - for stack, amount in pairs(config.waves[encounter.currentStage].stacks) do + for stack, amount in pairs(SoulPit.waves[encounter.currentStage].stacks) do logger.warn("stack: " .. stack) logger.warn("amount: " .. amount) for i = 1, amount do - local position = stack ~= 40 and config.zone:randomPosition() or config.bossPosition - for i = 1, config.timeToSpawnMonsters / 1000 do + local position = stack ~= 40 and SoulPit.zone:randomPosition() or SoulPit.bossPosition + for i = 1, SoulPit.timeToSpawnMonsters / 1000 do encounter:addEvent(function(position) - position:sendMagicEffect(config.effects[stack]) + position:sendMagicEffect(SoulPit.effects[stack]) end, i * 1000, position) end - encounter:addEvent(function(name, stack, position) - local monster = Game.createMonster(name, position) + local randomAbility = SoulPit.possibleAbilities[math.random(1, #SoulPit.possibleAbilities)] + local chosenBossAbility = SoulPit.bossAbilities[randomAbility] + + encounter:addEvent(function(name, stack, position, bossAbilityName, bossAbility) + local monster = Game.createSoulPitMonster(name, position, stack) if not monster then return false end - monster:setForgeStack(stack) - local icon = stack <= 15 and CreatureIconModifications_ReducedHealth or CreatureIconModifications_ReducedHealthExclamation - monster:removeIcon("forge") - monster:setIcon("soulpit", CreatureIconCategory_Modifications, icon, stack <= 15 and stack or 0) - monster:setDropLoot(false) if stack == 40 then - local monsterType = monster:getType() - local randomAbility = bossAbilitiesIndexes[math.random(#bossAbilitiesIndexes)] - logger.warn("the random ability chosen was: " .. randomAbility) - for _, ability in pairs(config.bossAbilities[randomAbility]) do - if ability.spells then - for _, spell in pairs(ability.spells) do - monsterType:addAttack(readSpell(spell, monsterType)) - end - end - if ability.monsterEvents then - for _, name in pairs(ability.monsterEvents) do - monster:registerEvent(name) - end - end - if ability.playerEvents then - for _, name in pairs(ability.playerEvents) do - for _, players in pairs(config.zone:getPlayers()) do - player:registerEvent(name) - end - end - end + logger.warn("ability name: {}", bossAbilityName) + if bossAbility.monster then + monster:registerEvent(bossAbilityName) + end + if bossAbility.player then + player:registerEvent(bossAbilityName) end end - end, config.timeToSpawnMonsters, monsterName, stack, position) + end, SoulPit.timeToSpawnMonsters, monsterName, stack, position, randomAbility, chosenBossAbility) end end end - for i = 1, #config.waves do + for i = 1, #SoulPit.waves do encounter :addStage({ start = waveStart, }) - :autoAdvance({ delay = config.checkMonstersDelay, monstersKilled = true }) + :autoAdvance({ delay = SoulPit.checkMonstersDelay, monstersKilled = true }) end function encounter:onReset(position) - for _, player in pairs(config.zone:getPlayers()) do + SoulPit.zone:removeMonsters() + + for _, player in pairs(SoulPit.zone:getPlayers()) do player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have defeated the core of the %s soul and unlocked its animus mastery!", monsterName)) - player:teleportTo(config.exit) - for abilityName, abilities in pairs(config.bossAbilities) do - if abilities.playerEvents then - for _, eventName in pairs(abilities.playerEvents) do - player:registerEvent(eventName) - end - end - end + -- Add the monster animus mastery for the player. end + + addEvent(function() + SoulPit.encounter = nil + for _, player in pairs(SoulPit.zone:getPlayers()) do + player:teleportTo(SoulPit.exit) + end + end, SoulPit.timeToKick) end encounter:start() @@ -239,7 +145,7 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH return true end -for _, itemType in pairs(config.soulCores) do +for _, itemType in pairs(SoulPit.soulCores) do soulPitAction:id(itemType:getId()) end soulPitAction:register() diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua b/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua index b737cfec107..b9ce99fdd89 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua @@ -8,14 +8,12 @@ combat:addCondition(condition) local spell = Spell("instant") -local zone = Zone("soulpit") - function spell.onCastSpell(creature, var) - if not zone:isInZone(creature:getPosition()) or creature:getForgeStack() ~= 40 then - return true + if table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + return combat:execute(creature, var) end - return combat:execute(creature, var) + return true end spell:name("soulpit intensehex") diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua b/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua index 7fda90ef77a..afe2dae554e 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua @@ -2,7 +2,7 @@ local combatRoot = Combat() combatRoot:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ROOTS) -local area = createCombatArea(AREA_WAVE11) +local area = createCombatArea(AREA_ROOT_OPRESSOR) combatRoot:setArea(area) local condition = Condition(CONDITION_ROOTED) @@ -14,6 +14,9 @@ combatRoot:addCondition(condition) local combatFear = Combat() combatFear:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLUE_GHOST) +local area = createCombatArea(AREA_FEAR_OPRESSOR) +combatRoot:setArea(area) + local condition = Condition(CONDITION_FEARED) condition:setParameter(CONDITION_PARAM_TICKS, 3000) combatFear:addCondition(condition) @@ -22,16 +25,13 @@ local spell = Spell("instant") local combats = { combatRoot, combatFear } -local zone = Zone("soulpit") - function spell.onCastSpell(creature, var) - if not zone:isInZone(creature:getPosition()) or creature:getForgeStack() ~= 40 then - return true + if table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + for _, combat in pairs(combats) do + combat:execute(creature, var) + end end - for _, combat in pairs(combats) do - combat:execute(creature, var) - end return true end diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua b/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua index 516bf0c7194..2edbe0b6d8b 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua @@ -2,20 +2,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_NONE) -local condition = Condition(CONDITION_ROOTED) +local condition = Condition(CONDITION_POWERLESS) condition:setParameter(CONDITION_PARAM_TICKS, 3000) combat:addCondition(condition) local spell = Spell("instant") -local zone = Zone("soulpit") - function spell.onCastSpell(creature, var) - if not zone:isInZone(creature:getPosition()) or creature:getForgeStack() ~= 40 then - return true + if table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + return combat:execute(creature, var) end - return combat:execute(creature, var) + return true end spell:name("soulpit powerless") diff --git a/src/creatures/monsters/monster.cpp b/src/creatures/monsters/monster.cpp index 7276bea19d1..d396bb47744 100644 --- a/src/creatures/monsters/monster.cpp +++ b/src/creatures/monsters/monster.cpp @@ -697,7 +697,8 @@ bool Monster::isOpponent(const std::shared_ptr &creature) const { } uint64_t Monster::getLostExperience() const { - return skillLoss ? mType->info.experience : 0; + float extraExperience = forgeStack <= 15 ? (forgeStack + 10) / 10 : 28; + return skillLoss ? static_cast(std::round(mType->info.experience * extraExperience)) : 0; } uint16_t Monster::getLookCorpse() const { @@ -2541,6 +2542,15 @@ void Monster::getPathSearchParams(const std::shared_ptr &creature, Fin } } +void Monster::applyStacks() { + // Change health based in stacks + const auto percentToIncrement = 1 + (15 * forgeStack + 35) / 100.f; + auto newHealth = static_cast(std::ceil(static_cast(healthMax) * percentToIncrement)); + + healthMax = newHealth; + health = newHealth; +} + void Monster::configureForgeSystem() { if (!canBeForgeMonster()) { return; @@ -2557,13 +2567,6 @@ void Monster::configureForgeSystem() { g_game().updateCreatureIcon(static_self_cast()); } - // Change health based in stacks - const auto percentToIncrement = 1 + (15 * forgeStack + 35) / 100.f; - auto newHealth = static_cast(std::ceil(static_cast(healthMax) * percentToIncrement)); - - healthMax = newHealth; - health = newHealth; - // Event to give Dusts const std::string &Eventname = "ForgeSystemMonster"; registerCreatureEvent(Eventname); @@ -2589,6 +2592,7 @@ uint16_t Monster::getForgeStack() const { void Monster::setForgeStack(uint16_t stack) { forgeStack = stack; + applyStacks(); } ForgeClassifications_t Monster::getMonsterForgeClassification() const { diff --git a/src/creatures/monsters/monster.hpp b/src/creatures/monsters/monster.hpp index b8a6087acc1..c9e5745da69 100644 --- a/src/creatures/monsters/monster.hpp +++ b/src/creatures/monsters/monster.hpp @@ -183,6 +183,8 @@ class Monster final : public Creature { static uint32_t monsterAutoID; + void applyStacks(); + void configureForgeSystem(); bool canBeForgeMonster() const; diff --git a/src/lua/functions/core/game/game_functions.cpp b/src/lua/functions/core/game/game_functions.cpp index c338ad1eba4..97e97e996a2 100644 --- a/src/lua/functions/core/game/game_functions.cpp +++ b/src/lua/functions/core/game/game_functions.cpp @@ -66,6 +66,7 @@ void GameFunctions::init(lua_State* L) { Lua::registerMethod(L, "Game", "createItem", GameFunctions::luaGameCreateItem); Lua::registerMethod(L, "Game", "createContainer", GameFunctions::luaGameCreateContainer); Lua::registerMethod(L, "Game", "createMonster", GameFunctions::luaGameCreateMonster); + Lua::registerMethod(L, "Game", "createSoulPitMonster", GameFunctions::luaGameCreateSoulPitMonster); Lua::registerMethod(L, "Game", "createNpc", GameFunctions::luaGameCreateNpc); Lua::registerMethod(L, "Game", "generateNpc", GameFunctions::luaGameGenerateNpc); Lua::registerMethod(L, "Game", "createTile", GameFunctions::luaGameCreateTile); @@ -548,6 +549,54 @@ int GameFunctions::luaGameCreateMonster(lua_State* L) { return 1; } +int GameFunctions::luaGameCreateSoulPitMonster(lua_State* L) { + // Game.createSoulPitMonster(monsterName, position, [stack = 1, [, extended = false[, force = false[, master = nil]]]]) + const auto &monster = Monster::createMonster(Lua::getString(L, 1)); + if (!monster) { + lua_pushnil(L); + return 1; + } + + bool isSummon = false; + if (lua_gettop(L) >= 6) { + if (const auto &master = Lua::getCreature(L, 6)) { + monster->setMaster(master, true); + isSummon = true; + } + } + + const Position &position = Lua::getPosition(L, 2); + const uint8_t stack = Lua::getNumber(L, 3, 1); + const bool extended = Lua::getBoolean(L, 4, false); + const bool force = Lua::getBoolean(L, 5, false); + const CreatureIconModifications_t icon = stack < 40 ? CreatureIconModifications_t::ReducedHealth : CreatureIconModifications_t::ReducedHealthExclamation; + if (g_game().placeCreature(monster, position, extended, force)) { + monster->setSkillLoss(stack == 40); + monster->setForgeStack(stack); + monster->setDropLoot(false); + monster->setIcon("soulpit", CreatureIcon(icon, stack < 40 ? stack : 0)); + monster->onSpawn(); + const auto &mtype = monster->getMonsterType(); + if (mtype && mtype->info.raceid > 0 && mtype->info.bosstiaryRace == BosstiaryRarity_t::RARITY_ARCHFOE) { + for (const auto &spectator : Spectators().find(monster->getPosition(), true)) { + if (const auto &tmpPlayer = spectator->getPlayer()) { + tmpPlayer->sendBosstiaryCooldownTimer(); + } + } + } + + Lua::pushUserdata(L, monster); + Lua::setMetatable(L, -1, "Monster"); + } else { + if (isSummon) { + monster->setMaster(nullptr); + } else { + } + lua_pushnil(L); + } + return 1; +} + int GameFunctions::luaGameGenerateNpc(lua_State* L) { // Game.generateNpc(npcName) const auto &npc = Npc::createNpc(Lua::getString(L, 1)); diff --git a/src/lua/functions/core/game/game_functions.hpp b/src/lua/functions/core/game/game_functions.hpp index 4a9521c826d..e70c7c0f6f1 100644 --- a/src/lua/functions/core/game/game_functions.hpp +++ b/src/lua/functions/core/game/game_functions.hpp @@ -46,6 +46,7 @@ class GameFunctions { static int luaGameCreateItem(lua_State* L); static int luaGameCreateContainer(lua_State* L); static int luaGameCreateMonster(lua_State* L); + static int luaGameCreateSoulPitMonster(lua_State* L); static int luaGameGenerateNpc(lua_State* L); static int luaGameCreateNpc(lua_State* L); static int luaGameCreateTile(lua_State* L);