diff --git a/data-otservbr-global/lib/others/soulpit.lua b/data-otservbr-global/lib/others/soulpit.lua index 2628c1307be..8eeb80faa7e 100644 --- a/data-otservbr-global/lib/others/soulpit.lua +++ b/data-otservbr-global/lib/others/soulpit.lua @@ -116,6 +116,17 @@ SoulPit = { bossPosition = Position(32372, 31135, 8), exit = Position(32371, 31164, 8), zone = Zone("soulpit"), + + getMonsterVariationNameBySoulCore = function(searchName) + for mTypeName, soulCoreName in pairs(SoulPit.SoulCoresConfiguration.monsterVariationsSoulCore) do + if soulCoreName == searchName then + return mTypeName + end + end + + return nil + end, } SoulPit.zone:addArea(Position(32365, 31134, 8), Position(32382, 31152, 8)) +SoulPit.zone:setRemoveDestination(SoulPit.exit) diff --git a/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua b/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua index d4ba27b4735..1d3ddd21f66 100644 --- a/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua +++ b/data-otservbr-global/scripts/actions/soulpit/soulpit_fight.lua @@ -1,3 +1,5 @@ +SoulPit.zone:blockFamiliars() + local zoneEvent = ZoneEvent(SoulPit.zone) function zoneEvent.afterLeave(zone, creature) local player = creature:getPlayer() @@ -27,6 +29,10 @@ zoneEvent:register() local soulPitAction = Action() function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) logger.warn(item:getName()) + if target and target:getId() == SoulPit.obeliskActive then + creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting in the soulpit!") + return false + end if not target or target:getId() ~= SoulPit.obeliskInactive then return false end @@ -49,12 +55,6 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH 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() < SoulPit.requiredLevel then local message = string.format("All players need to be level %s or higher.", SoulPit.requiredLevel) @@ -72,8 +72,8 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH end local monsterName = string.gsub(item:getName(), " soul core", "") - - logger.warn("monster name: " .. monsterName) + local monsterVariationName = SoulPit.getMonsterVariationNameBySoulCore(item:getName()) + monsterName = monsterVariationName and monsterVariationName or monsterName SoulPit.zone:removeMonsters() @@ -95,9 +95,7 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH SoulPit.kickEvent = addEvent(function() SoulPit.encounter = nil - for _, player in pairs(SoulPit.zone:getPlayers()) do - player:teleportTo(SoulPit.exit) - end + SoulPit.zone:removePlayers() SoulPit.obeliskPosition:transformItem(SoulPit.obeliskActive, SoulPit.obeliskInactive) end, SoulPit.timeToKick) end @@ -106,8 +104,6 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH local function waveStart() 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 SoulPit.zone:randomPosition() or SoulPit.bossPosition for i = 1, SoulPit.timeToSpawnMonsters / 1000 do @@ -125,7 +121,6 @@ function soulPitAction.onUse(player, item, fromPosition, target, toPosition, isH return false end if stack == 40 then - logger.warn("ability name: {}", bossAbilityName) if bossAbility.monster then monster:registerEvent(bossAbilityName) end diff --git a/data-otservbr-global/scripts/creaturescripts/monster/soulpit_creatureevents.lua b/data-otservbr-global/scripts/creaturescripts/monster/soulpit_creatureevents.lua index 6a228144942..1810bab01fe 100644 --- a/data-otservbr-global/scripts/creaturescripts/monster/soulpit_creatureevents.lua +++ b/data-otservbr-global/scripts/creaturescripts/monster/soulpit_creatureevents.lua @@ -1,6 +1,6 @@ local enrage = CreatureEvent("enrageSoulPit") function enrage.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - if not creature or not creature:isMonster() then + if not creature or not creature:isMonster() and creature:getMaster() then return true end @@ -26,7 +26,7 @@ enrage:register() local overpower = CreatureEvent("overpowerSoulPit") function overpower.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) - if creature and attacker and attacker:isMonster() and attacker:getForgeStack() == 40 then + if creature and attacker and attacker:isMonster() and attacker:getForgeStack() == 40 and not attacker:getMaster() then primaryDamage = primaryDamage * 1.1 secondaryDamage = secondaryDamage * 1.1 creature:getPosition():sendMagicEffect(CONST_ME_CRITICAL_DAMAGE) diff --git a/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua b/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua index 6b26cdd45d3..51ccca2d979 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_intensehex.lua @@ -10,7 +10,7 @@ local spell = Spell("instant") function spell.onCastSpell(creature, var) local monster = creature:getMonster() - if monster and monster:soulPit() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + if monster and monster:soulPit() and not monster:getMaster() 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 293c8859dea..05493618461 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_opressor.lua @@ -27,7 +27,7 @@ local combats = { combatRoot, combatFear } function spell.onCastSpell(creature, var) local monster = creature:getMonster() - if monster and monster:soulPit() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + if monster and monster:soulPit() and not monster:getMaster() 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 7ed71742f8f..f2fe9d3a4a9 100644 --- a/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua +++ b/data-otservbr-global/scripts/spells/monster/soulpit_powerless.lua @@ -10,7 +10,7 @@ local spell = Spell("instant") function spell.onCastSpell(creature, var) local monster = creature:getMonster() - if monster and monster:soulPit() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then + if monster and monster:soulPit() and not monster:getMaster() and table.contains(creature:getEvents(CREATURE_EVENT_THINK), "opressorSoulPit") then return combat:execute(creature, var) end