Skip to content
Snippets Groups Projects
Commit 9c82e0a0 authored by dg's avatar dg
Browse files

wild gifts now use equilibrium

git-svn-id: http://svn.net-core.org/repos/t-engine4@325 51575b47-30f0-44d4-a5cc-537603b46e54
parent daeace4c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
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")
-- 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")
-- 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 ...
......
-- 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",
......
......@@ -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{
......
......@@ -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)
......
......@@ -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
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment