diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 1ea24d16ed623312539270c051897383cdcd9910..b46c9e2dfeb86167d4215c933952f9b2015a08fe 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -67,6 +67,10 @@ function _M:init(t, no_default) t.mana_regen = t.mana_regen or 0.5 t.stamina_regen = t.stamina_regen or 0.3 -- Stamina regens slower than mana t.life_regen = t.life_regen or 0.25 -- Life regen real slow + t.equilibrium_regen = t.equilibrium_regen or -0.01 -- Equilibrium resets real slow + + -- Equilibrium has a default very high max, as bad effects happen even before reaching it + t.max_equilibrium = t.max_equilibrium or 100000 -- Default melee barehanded damage self.combat = { dam=1, atk=1, apr=0, dammod={str=1} } @@ -280,6 +284,7 @@ function _M:levelup() self.life = self.max_life self.mana = self.max_mana self.stamina = self.max_stamina + self.equilibrium = 0 -- Auto levelup ? if self.autolevel then @@ -310,6 +315,7 @@ function _M:learnTalent(t_id, force) -- If we learned a spell, get mana, if you learned a technique get stamina, if we learned a wild gift, get power local t = _M.talents_def[t_id] if t.type[1]:find("^spell/") and not self:knowTalent(self.T_MANA_POOL) then self:learnTalent(self.T_MANA_POOL) end + if t.type[1]:find("^gift/") and not self:knowTalent(self.T_EQUILIBRIUM_POOL) then self:learnTalent(self.T_EQUILIBRIUM_POOL) end if t.type[1]:find("^technique/") and not self:knowTalent(self.T_STAMINA_POOL) then self:learnTalent(self.T_STAMINA_POOL) end return true end @@ -349,6 +355,21 @@ function _M:preUseTalent(ab, silent) end end + -- Equilibrium is special, it has no max, but the higher it is the higher the chance of failure (and loss of the turn) + -- But it is not affected by fatigue + if ab.equilibrium or ab.sustain_equilibrium then + local eq = ab.equilibrium or ab.sustain_equilibrium + local chance = math.sqrt(eq + self:getEquilibrium()) / 60 + -- Fail ? lose energy and 1/10 more equilibrium + print("[Equilibrium] Use chance: ", 100 - chance * 100) + if not rng.percent(100 - chance * 100) then + game.logPlayer(self, "You fail to use %s due to your equilibrium!", ab.name) + self:incEquilibrium(eq / 10) + self:useEnergy() + return false + end + end + if not silent then -- Allow for silent talents if ab.message ~= nil then @@ -392,6 +413,9 @@ function _M:postUseTalent(ab, ret) if ab.sustain_stamina then self.max_stamina = self.max_stamina - ab.sustain_stamina end + if ab.sustain_equilibrium then + self:incEquilibrium(ab.sustain_equilibrium) + end else if ab.sustain_mana then self.max_mana = self.max_mana + ab.sustain_mana @@ -399,6 +423,9 @@ function _M:postUseTalent(ab, ret) if ab.sustain_stamina then self.max_stamina = self.max_stamina + ab.sustain_stamina end + if ab.sustain_equilibrium then + self:incEquilibrium(-ab.sustain_equilibrium) + end end else if ab.mana then @@ -407,8 +434,13 @@ function _M:postUseTalent(ab, ret) if ab.stamina then self:incStamina(-ab.stamina * (100 + self.fatigue) / 100) end + -- Equilibrium is not affected by fatigue + if ab.equilibrium then + self:incEquilibrium(ab.equilibrium) + end end + -- Cancel stealth! if ab.id ~= self.T_STEALTH then self:breakStealth() end diff --git a/game/modules/tome/class/PlayerDisplay.lua b/game/modules/tome/class/PlayerDisplay.lua index 2b93165b5ce4750a6f1989e754af940ce3336db1..c465cd154ee257be1fbd8508ae7e80506758d1d1 100644 --- a/game/modules/tome/class/PlayerDisplay.lua +++ b/game/modules/tome/class/PlayerDisplay.lua @@ -41,14 +41,17 @@ function _M:display() end self.surface:drawColorString(self.font, ("#c00000#Life: #00ff00#%d/%d"):format(game.player.life, game.player.max_life), 0, h, 255, 255, 255) h = h + self.font_h + if game.player:knowTalent(game.player.T_STAMINA_POOL) then + self.surface:drawColorString(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(game.player:getStamina(), game.player.max_stamina), 0, h, 255, 255, 255) h = h + self.font_h + end if game.player:knowTalent(game.player.T_MANA_POOL) then self.surface:drawColorString(self.font, ("#7fffd4#Mana: #00ff00#%d/%d"):format(game.player:getMana(), game.player.max_mana), 0, h, 255, 255, 255) h = h + self.font_h end if game.player:knowTalent(game.player.T_SOUL_POOL) then self.surface:drawColorString(self.font, ("#777777#Soul: #00ff00#%d/%d"):format(game.player:getSoul(), game.player.max_soul), 0, h, 255, 255, 255) h = h + self.font_h end - if game.player:knowTalent(game.player.T_STAMINA_POOL) then - self.surface:drawColorString(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(game.player:getStamina(), game.player.max_stamina), 0, h, 255, 255, 255) h = h + self.font_h + if game.player:knowTalent(game.player.T_EQUILIBRIUM_POOL) then + self.surface:drawColorString(self.font, ("#00ff74#Equi: #00ff00#%d"):format(game.player:getEquilibrium()), 0, h, 255, 255, 255) h = h + self.font_h end h = h + self.font_h diff --git a/game/modules/tome/data/talents.lua b/game/modules/tome/data/talents.lua index d1706b27eaa1af665b04ed4bc3604a4d3f7ec71f..ae1ad949ce09dd5fbd8625417ae011443ba9bd4c 100644 --- a/game/modules/tome/data/talents.lua +++ b/game/modules/tome/data/talents.lua @@ -1,4 +1,5 @@ load("/data/talents/misc/misc.lua") -load("/data/talents/spells/spells.lua") load("/data/talents/techniques/techniques.lua") load("/data/talents/cunning/cunning.lua") +load("/data/talents/spells/spells.lua") +load("/data/talents/gifts/gifts.lua") diff --git a/game/modules/tome/data/talents/gifts/gifts.lua b/game/modules/tome/data/talents/gifts/gifts.lua new file mode 100644 index 0000000000000000000000000000000000000000..57a6735131c2b9d0f6ae1331da6d52b3cdb84af1 --- /dev/null +++ b/game/modules/tome/data/talents/gifts/gifts.lua @@ -0,0 +1,26 @@ +-- Wild Gifts +newTalentType{ type="gift/slime", name = "slime powers", description = "Through dedicated consumption of slime mold juice you have gained an affinity with slime molds." } + +-- Generic requires for gifts based on talent level +gifts_req1 = { + stat = { wil=function(level) return 12 + (level-1) * 2 end }, + level = function(level) return 0 + (level-1) end, +} +gifts_req2 = { + stat = { wil=function(level) return 20 + (level-1) * 2 end }, + level = function(level) return 4 + (level-1) end, +} +gifts_req3 = { + stat = { wil=function(level) return 28 + (level-1) * 2 end }, + level = function(level) return 8 + (level-1) end, +} +gifts_req4 = { + stat = { wil=function(level) return 36 + (level-1) * 2 end }, + level = function(level) return 12 + (level-1) end, +} +gifts_req5 = { + stat = { wil=function(level) return 44 + (level-1) * 2 end }, + level = function(level) return 16 + (level-1) end, +} + +load("/data/talents/gifts/slime.lua") diff --git a/game/modules/tome/data/talents/misc/random.lua b/game/modules/tome/data/talents/gifts/slime.lua similarity index 83% rename from game/modules/tome/data/talents/misc/random.lua rename to game/modules/tome/data/talents/gifts/slime.lua index bb8a58f7b6ce2d5e2d4d9ee6aae871e2a7acf4b3..bd7b884a3990e218c121dcb9282ccb6e2903773f 100644 --- a/game/modules/tome/data/talents/misc/random.lua +++ b/game/modules/tome/data/talents/gifts/slime.lua @@ -1,18 +1,12 @@ --- Some randomly gained talents - ------------------------------------------------------------- --- Slime Powers! ------------------------------------------------------------- -newTalentType{ type="gift/slime", name = "slime powers", description = "Through dedicated consumption of slime mold juice you have gained an affinity with them." } - newTalent{ name = "Poisonous Spores", type = {"gift/slime", 1}, + require = gifts_req1, points = 5, message = "@Source@ releases poisonous spores at @target@.", + equilibrium = 2, cooldown = 10, range = 1, - require = {level = function(level) return 0 + (level-1) end,}, tactical = { ATTACK = 10, }, @@ -34,12 +28,13 @@ newTalent{ newTalent{ name = "Acidic Skin", type = {"gift/slime", 2}, + require = gifts_req2, points = 5, mode = "sustained", message = "The skin of @Source@ starts dripping acid.", + sustain_equilibrium = 25, cooldown = 10, range = 1, - require = {level = function(level) return 4 + (level-1) end,}, tactical = { DEFEND = 10, }, @@ -61,13 +56,14 @@ newTalent{ newTalent{ name = "Slime Spit", type = {"gift/slime", 3}, + require = gifts_req3, points = 5, + equilibrium = 4, cooldown = 30, tactical = { ATTACK = 10, }, range = 20, - require = {level = function(level) return 8 + (level-1) end,}, action = function(self, t) local tg = {type="bolt", range=self:getTalentRange(t)} local x, y = self:getTarget(tg) @@ -84,15 +80,16 @@ newTalent{ newTalent{ name = "Slime Roots", type = {"gift/slime", 4}, + require = gifts_req4, points = 5, + equilibrium = 5, cooldown = 20, tactical = { MOVEMENT = 10, }, range = 20, - require = {level = function(level) return 12 + (level-1) end,}, action = function(self, t) - local x, y = self:getTarget{type="ball", range=20 + self:getTalentLevel(t), radius=7 - self:getTalentLevel(t)} + local x, y = self:getTarget{type="ball", range=20 + self:getTalentLevel(t), radius=math.min(0, 5 - self:getTalentLevel(t))} if not x then return nil end -- Target code doesnot restrict the self coordinates to the range, it lets the poject function do it -- but we cant ... diff --git a/game/modules/tome/data/talents/misc/misc.lua b/game/modules/tome/data/talents/misc/misc.lua index 068b6139830f66753ad3e215703343aacc81459e..89aa794c47fe3379aeca4897cd465eb376abf272 100644 --- a/game/modules/tome/data/talents/misc/misc.lua +++ b/game/modules/tome/data/talents/misc/misc.lua @@ -1,6 +1,5 @@ -- Load other misc things load("/data/talents/misc/npcs.lua") -load("/data/talents/misc/random.lua") -- race & classes newTalentType{ type="base/class", name = "class", hide = true, description = "The basic talents defining a class." } @@ -27,6 +26,13 @@ newTalent{ mode = "passive", hide = true, } +newTalent{ + name = "Equilibrium Pool", + type = {"base/class", 1}, + info = "Allows you to have an equilibrium pool. Equilibrium is used to mesure your balance with nature and the use of wild gifts.", + mode = "passive", + hide = true, +} newTalent{ name = "Improved Health I", diff --git a/game/modules/tome/data/zones/sandworm-lair/npcs.lua b/game/modules/tome/data/zones/sandworm-lair/npcs.lua index b184061361c7ea84a0ccf6515ef176b819cf54d9..f69c5a33e1a93fd4eef59b2e148b7fcd84a0adff 100644 --- a/game/modules/tome/data/zones/sandworm-lair/npcs.lua +++ b/game/modules/tome/data/zones/sandworm-lair/npcs.lua @@ -41,7 +41,7 @@ newEntity{ define_as = "SANDWORM_QUEEN", body = { INVEN = 10, BODY=1 }, - resolvers.drops{chance=100, nb=1, {defined="TOME_OF_IMPROVEMENT"}, }, + resolvers.drops{chance=100, nb=1, {defined="SANDQUEEN_HEART"}, }, resolvers.drops{chance=100, nb=5, {ego_chance=100} }, talents = resolvers.talents{ diff --git a/game/modules/tome/data/zones/sandworm-lair/objects.lua b/game/modules/tome/data/zones/sandworm-lair/objects.lua index 56b6db53d4fa31077c664cc35ea89037b20dfd28..5f4999ab79151c4aa481c05d39a7d0d026f08d46 100644 --- a/game/modules/tome/data/zones/sandworm-lair/objects.lua +++ b/game/modules/tome/data/zones/sandworm-lair/objects.lua @@ -2,15 +2,15 @@ load("/data/general/objects/objects.lua") -- Artifact, droped by the sandworm queen newEntity{ - define_as = "TOME_OF_IMPROVEMENT", - type = "scroll", subtype = "tome", - name = "Tome of Improvement", unique=true, - display = "?", color=colors.VIOLET, - desc = [[This very rare tome of power contains magic words that can make the user stronger, wiser, more able, ...]], + define_as = "SANDQUEEN_HEART", + type = "corpse", subtype = "heart", + name = "Heart of the Sandworm Queen", unique=true, + display = "*", color=colors.VIOLET, + desc = [[The heart of the Ssandworm Queen, ripped from her dead body. You could ... consume it, should you feel mad enough.]], cost = 4000, - use_simple = { name="increase talent and stat points", use = function(self, who) - game.logPlayer(who, "#00FFFF#You read the tome alound and feel its magic changing you!") + use_simple = { name="consume the heart", use = function(self, who) + game.logPlayer(who, "#00FFFF#You consume the heart and feel the knowledge of this very old creature fill you!") who.unused_stats = who.unused_stats + 3 who.unused_talents = who.unused_talents + 2 game.logPlayer(who, "You have %d stat point(s) to spend. Press G to use them.", who.unused_stats) diff --git a/game/modules/tome/load.lua b/game/modules/tome/load.lua index 9bdf2a602485945e20673d80915c48d9601ce9f0..920208dc494dd3483e5a4a6f8433e1129811abb3 100644 --- a/game/modules/tome/load.lua +++ b/game/modules/tome/load.lua @@ -43,8 +43,9 @@ ActorTemporaryEffects:loadDefinition("/data/timed_effects.lua") -- Actor resources ActorResource:defineResource("Air", "air", nil, "air_regen", "Air capacity in your lungs. Entities that need not to breath are not affected.") -ActorResource:defineResource("Mana", "mana", ActorTalents.T_MANA_POOL, "mana_regen", "Mana represents your reserve of magical energies. Each spell cast consumes mana and each sustained spell reduces your maximun mana.") ActorResource:defineResource("Stamina", "stamina", ActorTalents.T_STAMINA_POOL, "stamina_regen", "Stamina represents your physical fatigue. Each physical ability used reduces it.") +ActorResource:defineResource("Mana", "mana", ActorTalents.T_MANA_POOL, "mana_regen", "Mana represents your reserve of magical energies. Each spell cast consumes mana and each sustained spell reduces your maximun mana.") +ActorResource:defineResource("Equilibrium", "equilibrium", ActorTalents.T_EQUILIBRIUM_POOL, "equilibrium_regen", "Equilibrium represents your stand in the grand balance of nature. The closer it is to 0 the more inbalance you are. Higher equilibrium states will impact negatively your ability to use Wild Gifts.") ActorResource:defineResource("Soul", "soul", ActorTalents.T_SOUL_POOL, "soul_regen", "Soul represents the amount of life energies/souls you have stolen. Each Necromantic spell requires some.") -- Actor stats diff --git a/ideas/gifts.ods b/ideas/gifts.ods index 28fe0fd247a4ec278013825de9b396c82331bd3b..0be89e0a7e327e24c7954e03a70b6ed3e95b35e7 100644 Binary files a/ideas/gifts.ods and b/ideas/gifts.ods differ