Skip to content

Commit

Permalink
baby items
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoSupremo committed Sep 24, 2022
1 parent 815f802 commit 3b19943
Show file tree
Hide file tree
Showing 99 changed files with 1,321 additions and 1,127 deletions.
40 changes: 36 additions & 4 deletions components/baby/baby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,29 @@ function BabyComponent:post_activate()

self._eat_listener = radiant.events.listen(self._entity, 'stonehearth:eat_food', function(e)
self._sv._calories_consumed = self._sv._calories_consumed + e.food_data.satisfaction
if self._sv._calories_consumed > 200 then
if self._sv._calories_consumed > self:calories_target() then
self:grow()
end
end)

self._conversation_listener = radiant.events.listen(self._entity, 'stonehearth:conversation:results_produced', function(e)
local target = stonehearth.conversation:get_target(self._entity)
if not (target and target:is_valid()) then
return
end
radiant.entities.add_thought(target, 'stonehearth:thoughts:social:animal:booped', {
tooltip_args = {
species = "i18n(swamp_goblins:entities.goblins.baby.display_name)"
}
})
end)
end

function BabyComponent:calories_target()
if radiant.entities.has_buff(self._entity, "swamp_goblins:buffs:baby:bottle") then
return 150
end
return 300
end

function BabyComponent:grow()
Expand All @@ -40,9 +59,9 @@ function BabyComponent:grow()
local facing = radiant.entities.get_facing(self._entity)

local equipment_component = self._entity:get_component("stonehearth:equipment")
local mind_booster = equipment_component:has_item_type("swamp_goblins:baby:toy:upgraded")
local body_booster = equipment_component:has_item_type("swamp_goblins:baby:bottle:upgraded")
local spirit_booster = equipment_component:has_item_type("swamp_goblins:baby:blanket:upgraded")
local mind_booster = equipment_component:has_item_type("swamp_goblins:baby:toy2")
local body_booster = equipment_component:has_item_type("swamp_goblins:baby:bottle2")
local spirit_booster = equipment_component:has_item_type("swamp_goblins:baby:blanket2")

radiant.entities.destroy_entity(self._entity)

Expand Down Expand Up @@ -78,12 +97,21 @@ function BabyComponent:reroll_stats(adult, mind_booster,body_booster,spirit_boos

if mind_booster and (new_mind>current_mind) then
attributes_component:set_attribute("mind", new_mind)
for i=1, new_mind-current_mind do
radiant.entities.add_thought(adult, 'stonehearth:thoughts:baby:mind_booster')
end
end
if body_booster and (new_body>current_body) then
attributes_component:set_attribute("body", new_body)
for i=1, new_body-current_body do
radiant.entities.add_thought(adult, 'stonehearth:thoughts:baby:body_booster')
end
end
if spirit_booster and (new_spirit>current_spirit) then
attributes_component:set_attribute("spirit", new_spirit)
for i=1, new_spirit-current_spirit do
radiant.entities.add_thought(adult, 'stonehearth:thoughts:baby:spirit_booster')
end
end
end

Expand All @@ -100,6 +128,10 @@ function BabyComponent:destroy()
self._eat_listener:destroy()
self._eat_listener = nil
end
if self._conversation_listener then
self._conversation_listener:destroy()
self._conversation_listener = nil
end
end

return BabyComponent
12 changes: 12 additions & 0 deletions data/buffs/baby/blanket.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "buff",
"axis": "buff",
"display_name": "i18n(swamp_goblins:entities.baby.blanket.display_name)",
"description": "i18n(swamp_goblins:entities.baby.blanket.flavor)",
"icon": "/stonehearth/ui/game/images/spirit_stat.png",
"modifiers" : {
"sleep_duration": {
"multiply": 0.5
}
}
}
12 changes: 12 additions & 0 deletions data/buffs/baby/bottle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "buff",
"axis": "buff",
"display_name": "i18n(swamp_goblins:entities.baby.bottle.display_name)",
"description": "i18n(swamp_goblins:entities.baby.bottle.flavor)",
"icon": "/stonehearth/ui/game/images/body_stat.png",
"modifiers" : {
"calorie_burn_multiplier": {
"multiply": 0.8
}
}
}
15 changes: 15 additions & 0 deletions data/buffs/baby/toy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "buff",
"axis": "buff",
"display_name": "i18n(swamp_goblins:entities.baby.toy.display_name)",
"description": "i18n(swamp_goblins:entities.baby.toy.flavor)",
"icon": "/stonehearth/ui/game/images/mind_stat.png",
"modifiers" : {
"social_loss_amount": {
"multiply": 0.5
},
"speed": {
"multiply": 1.11
}
}
}
29 changes: 0 additions & 29 deletions data/effects/mosquito_cloud/mosquito_cloud.json

This file was deleted.

28 changes: 28 additions & 0 deletions data/happiness/thoughts.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
{
"type": "index",
"thoughts": {
"baby": {
"values": {
"mind_booster": {
"display_name": "i18n(swamp_goblins:data.happiness.thoughts.baby.values.mind_booster.display_name)",
"tooltip": "i18n(swamp_goblins:data.happiness.thoughts.baby.values.mind_booster.tooltip)",
"happiness_delta": 1,
"duration": "1d",
"stackable": true,
"max_stacks": 10
},
"body_booster": {
"display_name": "i18n(swamp_goblins:data.happiness.thoughts.baby.values.body_booster.display_name)",
"tooltip": "i18n(swamp_goblins:data.happiness.thoughts.baby.values.body_booster.tooltip)",
"happiness_delta": 1,
"duration": "1d",
"stackable": true,
"max_stacks": 10
},
"spirit_booster": {
"display_name": "i18n(swamp_goblins:data.happiness.thoughts.baby.values.spirit_booster.display_name)",
"tooltip": "i18n(swamp_goblins:data.happiness.thoughts.baby.values.spirit_booster.tooltip)",
"happiness_delta": 1,
"duration": "1d",
"stackable": true,
"max_stacks": 10
}
}
},
"water":{
"mutually_exclusive": false,
"values":{
Expand Down
115 changes: 0 additions & 115 deletions data/horde/particles/mosquito_cloud/mosquito.json

This file was deleted.

Loading

0 comments on commit 3b19943

Please sign in to comment.