Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions engine/assets/langs/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,101 @@ ITEM_STICK_SHORTNAME=Stick
ITEM_STICK_DESCRIPTION=* "Stick" - Weapon AT 0\n* Its bark is worse than\n its bite.
ITEM_STICK_USE=* You threw the stick away.[wait:5]\n* Then picked it back up.

ITEM_MONSTER_CANDY_NAME=Monster Candy
ITEM_MONSTER_CANDY_SHORTNAME=MnstrCndy
ITEM_MONSTER_CANDY_DESCRIPTION=* "Monster Candy" - Heals 10 HP\n* Has a distinct,[wait:5] \n non-licorice flavor.
ITEM_MONSTER_CANDY_DESCRIPTION_SHOP=Heals 10 HP\n(Licorice-\nfree\nguaranteed.)
ITEM_MONSTER_CANDY_USE=\n* Very un-licorice-like.
ITEM_MONSTER_CANDY_USE_2=\n* ... tastes like licorice.

ITEM_SPIDER_DONUT_NAME=Spider Donut
ITEM_SPIDER_DONUT_SHORTNAME=SpidrDont
ITEM_SPIDER_DONUT_SHORTNAME2=SpdrDonut
ITEM_SPIDER_DONUT_DESCRIPTION=* "Spider Donut" - Heals 12 HP\n* A donut made with Spider\n Cider in the batter.
ITEM_SPIDER_DONUT_DESCRIPTION_SHOP=undefined
ITEM_SPIDER_DONUT_USE=* Don't worry,[wait:5] Spider didn't.

ITEM_SPIDER_CIDER_NAME=Spider Cider
ITEM_SPIDER_CIDER_SHORTNAME=SpidrCidr
ITEM_SPIDER_CIDER_SHORTNAME2=SpdrCider
ITEM_SPIDER_CIDER_DESCRIPTION=* "Spider Cider" - Heals 24 HP\n* Made with whole spiders,[wait:5]\n not just the juice.
ITEM_SPIDER_CIDER_DESCRIPTION_SHOP=undefined

ITEM_BUTTERSCOTCH_PIE_NAME=Butterscotch Pie
ITEM_BUTTERSCOTCH_PIE_SHORTNAME=ButtsPie
ITEM_BUTTERSCOTCH_PIE_SHORTNAME2=Pie
ITEM_BUTTERSCOTCH_PIE_DESCRIPTION=* "Butterscotch Pie" - All HP\n* Butterscotch-cinnamon\n pie,[wait:5] one slice.
ITEM_BUTTERSCOTCH_PIE_DESCRIPTION_SHOP=undefined

ITEM_SNOWMAN_PIECE_NAME=Snowman Piece
ITEM_SNOWMAN_PIECE_SHORTNAME=SnowPiece
ITEM_SNOWMAN_PIECE_SHORTNAME2=SnowPiece
ITEM_SNOWMAN_PIECE_DESCRIPTION=* "Snowman Piece" - Heals 45 HP\n* Please take this to the\n ends of the earth.
ITEM_SNOWMAN_PIECE_DESCRIPTION_SHOP=undefined

ITEM_NICE_CREAM_NAME=Nice Cream
ITEM_NICE_CREAM_SHORTNAME=NiceCream
ITEM_NICE_CREAM_SHORTNAME2=NiceCream
ITEM_NICE_CREAM_DESCRIPTION=* "Nice Cream" - Heals 15 HP\n* Instead of a joke,[wait:5] the\n wrapper says something nice.
ITEM_NICE_CREAM_DESCRIPTION_SHOP=undefined
ITEM_NICE_CREAM_USE=* You're just great!
ITEM_NICE_CREAM_USE_2=* You look nice today!
ITEM_NICE_CREAM_USE_3=* Are those claws natural?
ITEM_NICE_CREAM_USE_4=* You're super spiffy!
ITEM_NICE_CREAM_USE_5=* Have a wonderful day!
ITEM_NICE_CREAM_USE_6=* Is this as sweet as you?
ITEM_NICE_CREAM_USE_7=* (An illustration of a hug.)
ITEM_NICE_CREAM_USE_8=* Love yourself! I love you!

ITEM_BISICLE_NAME=Bisicle
ITEM_BISICLE_SHORTNAME=Bisicle
ITEM_BISICLE_SHORTNAME2=Bisicle
ITEM_BISICLE_DESCRIPTION=* "Bisicle" - Heals 11 HP\n* It's a two-pronged popsicle,[wait:5]\n so you can eat it twice.
ITEM_BISICLE_DESCRIPTION_SHOP=Heals 11HP x 2\nEat it twice!
ITEM_BISICLE_USE=* You eat one half of\n the Bisicle.

ITEM_UNISICLE_NAME=Unisicle
ITEM_UNISICLE_SHORTNAME=Unisicle
ITEM_UNISICLE_SHORTNAME2=Popsicle
ITEM_UNISICLE_DESCRIPTION=* "Unisicle" - Heals 11 HP\n* It's a SINGLE-pronged popsicle.[wait:5]\n* Wait,[wait:5] that's just normal...
ITEM_UNISICLE_DESCRIPTION_SHOP=undefined

ITEM_CINNAMON_BUNNY_NAME=Cinnamon Bunny
ITEM_CINNAMON_BUNNY_SHORTNAME=CinnaBun
ITEM_CINNAMON_BUNNY_SHORTNAME2=C. Bun
ITEM_CINNAMON_BUNNY_DESCRIPTION=* "Cinnamon Bunny" - Heals 22 HP\n* A cinnamon roll in the shape\n of a bunny.
ITEM_CINNAMON_BUNNY_DESCRIPTION_SHOP=Heals 22HP\nIt's my own\nrecipe.

ITEM_TEMMIE_FLAKES_NAME=Temmie Flakes
ITEM_TEMMIE_FLAKES_SHORTNAME=TemFlakes
ITEM_TEMMIE_FLAKES_SHORTNAME2=TemFlakes
ITEM_TEMMIE_FLAKES_DESCRIPTION=* "Temmie Flakes" - Heals 2 HP\n* It's just torn up pieces\n of colored construction paper.
ITEM_TEMMIE_FLAKES_DESCRIPTION_SHOP=Heals 2HP\nfood of\ntem

ITEM_ABANDONED_QUICHE_NAME=Abandoned Quiche
ITEM_ABANDONED_QUICHE_SHORTNAME=Ab Quiche
ITEM_ABANDONED_QUICHE_SHORTNAME2=Quiche
ITEM_ABANDONED_QUICHE_DESCRIPTION=* "Abandoned Quiche" Heals 34 HP\n* A psychologically damaged\n spinach egg pie.
ITEM_ABANDONED_QUICHE_DESCRIPTION_SHOP=undefined
ITEM_ABANDONED_QUICHE_DROP=* You leave the Quiche on the\n ground and tell it you'll\n be right back.
ITEM_ABANDONED_QUICHE_USE=* You eat the quiche.

ITEM_DOG_RESIDUE_NAME=Dog Residue
ITEM_DOG_RESIDUE_SHORTNAME=DogResidu
ITEM_DOG_RESIDUE_SHORTNAME2=D.Residue
ITEM_DOG_RESIDUE_DESCRIPTION=* "Dog Residue" - Dog Item\n* Shiny trail left\n behind by a dog.
ITEM_DOG_RESIDUE_DESCRIPTION_2=* "Dog Residue" - Dog Item\n* Dog-shaped husk shed\n from a dog's carapace.
ITEM_DOG_RESIDUE_DESCRIPTION_3=* "Dog Residue" - Dog Item\n* Dirty dishes left\n unwashed by a dog.
ITEM_DOG_RESIDUE_DESCRIPTION_4=* "Dog Residue" - Dog Item\n* Glowing crystals secreted\n by a dog.
ITEM_DOG_RESIDUE_DESCRIPTION_5=* "Dog Residue" - Dog Item\n* Jigsaw puzzle left\n unfinished by a dog.
ITEM_DOG_RESIDUE_DESCRIPTION_6=* "Dog Residue" - Dog Item\n* Web spun by a dog\n to ensnare prey.
ITEM_DOG_RESIDUE_DESCRIPTION_SHOP=undefined
ITEM_DOG_RESIDUE_USE=* You used the Dog Residue.
ITEM_DOG_RESIDUE_USE_SUCCESS=* The rest of your inventory\n filled up with Dog Residue.
ITEM_DOG_RESIDUE_USE_FAIL=* ...
ITEM_DOG_RESIDUE_USE_FAIL_2=* You finished using it.
ITEM_DOG_RESIDUE_USE_FAIL_3=* An uneasy atmosphere fills\n the room.

# World shop
WORLD_SHOP_ACTION_BUY=Buy
WORLD_SHOP_ACTION_SELL=Sell
Expand Down
Binary file added engine/assets/sounds/dogresidue.wav
Binary file not shown.
26 changes: 20 additions & 6 deletions engine/item/consumable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@ function ItemConsumable:setType(type)
self.type = type
end

--- Uses the consumable item
function ItemConsumable:use()
if type(self.onBeforeUse) == "function" then
self:onBeforeUse()
end

--- Gets the item's heal text
--- @return Dummy.Text.Text
function ItemConsumable:getHealText()
local heal_text = Lang.translate("BATTLE_ITEM_HEAL", self:getHeal())
if self:getHeal() + Player.getHP() >= Player.getMaxHP() then
heal_text = Lang.translate("BATTLE_ITEM_HEAL_MAX")
end
return heal_text
end

--- (Override) Gets the item's final dialogue text when used
--- @return Dummy.Text.Text[]
function ItemConsumable:getDialogueTexts()
local heal_text = self:getHealText()

local dialogue_text = heal_text
local use_texts = self:getUseTexts()
Expand All @@ -46,6 +50,16 @@ function ItemConsumable:use()
end

local texts = { dialogue_text, table.unpack(use_texts, 2) }
return texts
end

--- Uses the consumable item
function ItemConsumable:use()
if type(self.onBeforeUse) == "function" then
self:onBeforeUse()
end

local texts = self:getDialogueTexts()
if World.isInBattle() then
Battle.playDialogueText(table.unpack(texts))
else
Expand Down
14 changes: 10 additions & 4 deletions engine/item/equipment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@ function ItemEquipment:setType(type)
self.type = type
end

--- (Override) Gets the item's final dialogue text when used
--- @return Dummy.Text.Text[]
function ItemEquipment:getDialogueTexts()
local texts = self:getUseTexts()
if #texts <= 0 then
texts = { { "BATTLE_ITEM_EQUIPMENT_USE", Lang.translate(self:getName()) } }
end
return texts
end
--- Uses the equipment item
function ItemEquipment:use()
if type(self.onBeforeUse) == "function" then
self:onBeforeUse()
end

local texts = self:getUseTexts()
if #texts <= 0 then
texts = { { "BATTLE_ITEM_EQUIPMENT_USE", Lang.translate(self:getName()) } }
end
local texts = self:getDialogueTexts()
if World.isInBattle() then
Battle.playDialogueText(table.unpack(texts))
else
Expand Down
13 changes: 9 additions & 4 deletions engine/item/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ function Item:setDropText(text, ...)
self.drop_texts = { text, ... }
end

--- (Override) Gets the item's final dialogue text when used
--- @return Dummy.Text.Text[]
function Item:getDialogueTexts()
return self:getUseTexts()
end
--- Gets the item's buy price
--- @return integer
function Item:getBuyPrice()
Expand Down Expand Up @@ -123,12 +128,12 @@ function Item:use()
end
if not can_use then return end

local use_texts = self:getUseTexts()
if #use_texts > 0 then
local dialogue_texts = self:getDialogueTexts()
if #dialogue_texts > 0 then
if World.isInBattle() then
Battle.playDialogueText(table.unpack(use_texts))
Battle.playDialogueText(table.unpack(dialogue_texts))
else
World.playDialogue(use_texts)
World.playDialogue(dialogue_texts)
end
end

Expand Down
30 changes: 30 additions & 0 deletions engine/items/abandoned_quiche.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--- @class Item.AbandonedQuiche : Dummy.Item.Consumable
local AbandonedQuicheItem = Class(ItemConsumable, "Item.AbandonedQuiche")

--- Creates an abandoned quiche
--- @return Item.AbandonedQuiche
function AbandonedQuicheItem:new()
self = Class:new(AbandonedQuicheItem, {
"abandoned_quiche", -- item identifier
"ITEM_ABANDONED_QUICHE_NAME", -- item name
"ITEM_ABANDONED_QUICHE_SHORTNAME", -- item short name
"ITEM_ABANDONED_QUICHE_DESCRIPTION", -- item description
34,
"food"
})

-- the price the player will pay to buy the item in the shop
self:setBuyPrice(1)
-- the price at which the item will be sold in the shop
self:setSellPrice(76)
-- the text that will appear in the shop item info at the top right on the buy menu when hovering an item
self:setShopDescription("ITEM_ABANDONED_QUICHE_DESCRIPTION_SHOP")
-- the text that will appear when the item is dropped on the ground
self:setDropText("ITEM_ABANDONED_QUICHE_DROP")
-- the text that will appear when the item is used
self:setUseText("ITEM_ABANDONED_QUICHE_USE")

return self
end

return AbandonedQuicheItem
36 changes: 36 additions & 0 deletions engine/items/bisicle.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- @class Item.Bisicle : Dummy.Item.Consumable
local BisicleItem = Class(ItemConsumable, "Item.Bisicle")

--- Creates a bisicle
--- @return Item.Bisicle
function BisicleItem:new()
self = Class:new(BisicleItem, {
"bisicle", -- item identifier
"ITEM_BISICLE_NAME", -- item name
"ITEM_BISICLE_SHORTNAME", -- item short name
"ITEM_BISICLE_DESCRIPTION", -- item description
11,
"food"
})

-- the price the player will pay to buy the item in the shop
self:setBuyPrice(15)
-- the price at which the item will be sold in the shop
self:setSellPrice(5)
-- the text that will appear in the shop item info at the top right on the buy menu when hovering an item
self:setShopDescription("ITEM_BISICLE_DESCRIPTION_SHOP")
-- the main text that will appear when the item is used.
self.use_texts = {
"ITEM_BISICLE_USE"
}

return self
end

function BisicleItem:onUse()
-- Add a unisicle to the player's inventory when the bisicle is used.
local unisicle = require("items.unisicle"):new()
Player.addItem(unisicle)
end

return BisicleItem
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--- @class WorldExample.Item.Blanket : Dummy.Item.Consumable
local BlanketItem = Class(ItemEquipment, "WorldExample.Item.Blanket")
--- @class Item.Blanket : Dummy.Item.Consumable
local BlanketItem = Class(ItemEquipment, "Item.Blanket")

--- Creates a monster candy
--- @return WorldExample.Item.Blanket
--- Creates a blanket
--- @return Item.Blanket
function BlanketItem:new()
self = Class:new(BlanketItem, {
"blanket", -- item identifier
Expand Down
26 changes: 26 additions & 0 deletions engine/items/butterscotch_pie.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- @class Item.ButterScotchPie : Dummy.Item.Consumable
local ButterScotchPieItem = Class(ItemConsumable, "Item.ButterScotchPie")

--- Creates a butterscotch pie
--- @return Item.ButterScotchPie
function ButterScotchPieItem:new()
self = Class:new(ButterScotchPieItem, {
"butterscotch_pie", -- item identifier
"ITEM_BUTTERSCOTCH_PIE_NAME", -- item name
"ITEM_BUTTERSCOTCH_PIE_SHORTNAME", -- item short name
"ITEM_BUTTERSCOTCH_PIE_DESCRIPTION", -- item description
Player.getMaxHP(),
"food"
})

-- the price the player will pay to buy the item in the shop
self:setBuyPrice(1)
-- the price at which the item will be sold in the shop
self:setSellPrice(180)
-- the text that will appear in the shop item info at the top right on the buy menu when hovering an item
self:setShopDescription("ITEM_BUTTERSCOTCH_PIE_DESCRIPTION_SHOP")

return self
end

return ButterScotchPieItem
26 changes: 26 additions & 0 deletions engine/items/cinnamon_bunny.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- @class Item.CinnamonBunny : Dummy.Item.Consumable
local CinnamonBunnyItem = Class(ItemConsumable, "Item.CinnamonBunny")

--- Creates a cinnamon bunny
--- @return Item.CinnamonBunny
function CinnamonBunnyItem:new()
self = Class:new(CinnamonBunnyItem, {
"cinnamon_bunny", -- item identifier
"ITEM_CINNAMON_BUNNY_NAME", -- item name
"ITEM_CINNAMON_BUNNY_SHORTNAME", -- item short name
"ITEM_CINNAMON_BUNNY_DESCRIPTION", -- item description
22,
"food"
})

-- the price the player will pay to buy the item in the shop
self:setBuyPrice(25)
-- the price at which the item will be sold in the shop
self:setSellPrice(8)
-- the text that will appear in the shop item info at the top right on the buy menu when hovering an item
self:setShopDescription("ITEM_CINNAMON_BUNNY_DESCRIPTION_SHOP")

return self
end

return CinnamonBunnyItem
Loading