Skip to content

Commit

Permalink
refactor: large seashell and move to core
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires authored and elsongabriel committed Mar 18, 2024
1 parent e0bfe4f commit a3ca460
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
1 change: 0 additions & 1 deletion data-canary/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Storage = {
},
},

DelayLargeSeaShell = 30002,
Imbuement = 30004,
}

Expand Down
28 changes: 0 additions & 28 deletions data-canary/scripts/actions/other/large_sea_shell.lua

This file was deleted.

30 changes: 30 additions & 0 deletions data/scripts/actions/objects/large_seashell.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local largeSeashell = Action()

function largeSeashell.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:hasExhaustion("delay-large-seashell") then
player:say("You have already opened a shell today.", TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
return true
end

local chance = math.random(100)
local message = "Nothing is inside."

if chance <= 16 then
doTargetCombatHealth(0, player, COMBAT_PHYSICALDAMAGE, -200, -200, CONST_ME_NONE)
message = "Ouch! You squeezed your fingers."
elseif chance > 16 and chance <= 64 then
Game.createItem(math.random(281, 282), 1, player:getPosition())
message = "You found a beautiful pearl."
player:addAchievementProgress("Shell Seeker", 100)
end

player:setExhaustion("delay-large-seashell", 20 * 60 * 60)
player:say(message, TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
item:transform(198)
item:decay()
item:getPosition():sendMagicEffect(CONST_ME_BUBBLES)
return true
end

largeSeashell:id(197)
largeSeashell:register()

0 comments on commit a3ca460

Please sign in to comment.