Commit 6ecf89c3fb28d663f8451a387d224ce963be3296

Authored by dg
1 parent c17c17fa

Split talents into talents and skills. Both have their own points. Talents are c…

…lass defining stuff, mostly combat oriented while skills will be learnable by more classes and are mostly utility
Increasing stats/talents will recast sustained talents (with a few exceptions)


git-svn-id: http://svn.net-core.org/repos/t-engine4@848 51575b47-30f0-44d4-a5cc-537603b46e54
... ... @@ -75,6 +75,7 @@ function _M:init(t, no_default)
75 75
76 76 self.unused_stats = self.unused_stats or 0
77 77 self.unused_talents = self.unused_talents or 0
  78 + self.unused_skills = self.unused_skills or 0
78 79 self.unused_talents_types = self.unused_talents_types or 0
79 80
80 81 t.lite = t.lite or 0
... ... @@ -556,7 +557,9 @@ end
556 557
557 558 function _M:levelup()
558 559 self.unused_stats = self.unused_stats + 3 + self:getRankStatAdjust()
559   - self.unused_talents = self.unused_talents + 2
  560 + if self.level % 5 == 0 then self.unused_talents = self.unused_talents + 1 end
  561 + self.unused_talents = self.unused_talents + 1
  562 + self.unused_skills = self.unused_skills + 1
560 563 -- At levels 10, 20 and 30 we gain a new talent type
561 564 if self.level == 10 or self.level == 20 or self.level == 30 then
562 565 self.unused_talents_types = self.unused_talents_types + 1
... ...
... ... @@ -273,7 +273,8 @@ function _M:levelup()
273 273 game.log("#00ffff#Welcome to level %d.", self.level)
274 274 if self.unused_stats > 0 then game.log("You have %d stat point(s) to spend. Press G to use them.", self.unused_stats) end
275 275 if self.unused_talents > 0 then game.log("You have %d talent point(s) to spend. Press G to use them.", self.unused_talents) end
276   - if self.unused_talents_types > 0 then game.log("You have %d talent category point(s) to spend. Press G to use them.", self.unused_talents_types) end
  276 + if self.unused_skills > 0 then game.log("You have %d skill point(s) to spend. Press G to use them.", self.unused_skills) end
  277 + if self.unused_talents_types > 0 then game.log("You have %d category point(s) to spend. Press G to use them.", self.unused_talents_types) end
277 278
278 279 if self.level == 10 then world:gainAchievement("LEVEL_10", self) end
279 280 if self.level == 20 then world:gainAchievement("LEVEL_20", self) end
... ...
... ... @@ -17,6 +17,8 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
  20 +newSkill = function(t) t.skill = true return newTalent(t) end
  21 +
20 22 load("/data/talents/misc/misc.lua")
21 23 load("/data/talents/techniques/techniques.lua")
22 24 load("/data/talents/cunning/cunning.lua")
... ...
... ... @@ -21,7 +21,7 @@ newTalent{
21 21 name = "Stealth",
22 22 type = {"cunning/stealth", 1},
23 23 require = cuns_req1,
24   - mode = "sustained",
  24 + mode = "sustained", no_sustain_autoreset = true,
25 25 points = 5,
26 26 cooldown = 10,
27 27 activate = function(self, t)
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Trap Detection",
22 22 type = {"cunning/survival", 1},
23 23 require = cuns_req1,
... ... @@ -29,7 +29,7 @@ newTalent{
29 29 end,
30 30 }
31 31
32   -newTalent{
  32 +newSkill{
33 33 name = "Heightened Senses",
34 34 type = {"cunning/survival", 2},
35 35 require = cuns_req2,
... ... @@ -52,7 +52,7 @@ newTalent{
52 52 end,
53 53 }
54 54
55   -newTalent{
  55 +newSkill{
56 56 name = "Trap Disarm",
57 57 type = {"cunning/survival", 3},
58 58 require = cuns_req3,
... ... @@ -64,7 +64,7 @@ newTalent{
64 64 end,
65 65 }
66 66
67   -newTalent{
  67 +newSkill{
68 68 name = "Evasion",
69 69 type = {"cunning/survival", 4},
70 70 points = 5,
... ...
... ... @@ -29,7 +29,7 @@ local function cancelChants(self)
29 29 end
30 30 end
31 31
32   -newTalent{
  32 +newSkill{
33 33 name = "Chant of Fortitude",
34 34 type = {"divine/chants", 1},
35 35 mode = "sustained",
... ... @@ -69,7 +69,7 @@ newTalent{
69 69 end,
70 70 }
71 71
72   -newTalent{
  72 +newSkill{
73 73 name = "Chant of Fortress",
74 74 type = {"divine/chants", 2},
75 75 mode = "sustained",
... ... @@ -107,7 +107,7 @@ newTalent{
107 107 end,
108 108 }
109 109
110   -newTalent{
  110 +newSkill{
111 111 name = "Chant of Resistance",
112 112 type = {"divine/chants",3},
113 113 mode = "sustained",
... ... @@ -150,7 +150,7 @@ newTalent{
150 150 end,
151 151 }
152 152
153   -newTalent{
  153 +newSkill{
154 154 name = "Chant of Light",
155 155 type = {"divine/chants", 4},
156 156 mode = "sustained",
... ...
... ... @@ -29,7 +29,7 @@ local function cancelHymns(self)
29 29 end
30 30 end
31 31
32   -newTalent{
  32 +newSkill{
33 33 name = "Hymn of Shadows",
34 34 type = {"divine/hymns", 1},
35 35 mode = "sustained",
... ... @@ -67,7 +67,7 @@ newTalent{
67 67 end,
68 68 }
69 69
70   -newTalent{
  70 +newSkill{
71 71 name = "Hymn of Detection",
72 72 type = {"divine/hymns", 2},
73 73 mode = "sustained",
... ... @@ -104,7 +104,7 @@ newTalent{
104 104 end,
105 105 }
106 106
107   -newTalent{
  107 +newSkill{
108 108 name = "Hymn of Perseverance",
109 109 type = {"divine/hymns",3},
110 110 mode = "sustained",
... ... @@ -145,7 +145,7 @@ newTalent{
145 145 end,
146 146 }
147 147
148   -newTalent{
  148 +newSkill{
149 149 name = "Hymn of Moonlight",
150 150 type = {"divine/hymns",4},
151 151 mode = "sustained",
... ...
... ... @@ -72,7 +72,7 @@ newTalent{
72 72 name = "Jumpgate",
73 73 type = {"divine/twilight", 2},
74 74 require = divi_req2,
75   - mode = "sustained",
  75 + mode = "sustained", no_sustain_autoreset = true,
76 76 points = 5,
77 77 cooldown = 20,
78 78 negative_sustain = 20,
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Poisonous Spores",
22 22 type = {"wild-gift/slime", 1},
23 23 require = gifts_req1,
... ... @@ -45,7 +45,7 @@ newTalent{
45 45 end,
46 46 }
47 47
48   -newTalent{
  48 +newSkill{
49 49 name = "Acidic Skin",
50 50 type = {"wild-gift/slime", 2},
51 51 require = gifts_req2,
... ... @@ -74,7 +74,7 @@ newTalent{
74 74 end,
75 75 }
76 76
77   -newTalent{
  77 +newSkill{
78 78 name = "Slime Spit",
79 79 type = {"wild-gift/slime", 3},
80 80 require = gifts_req3,
... ... @@ -99,7 +99,7 @@ newTalent{
99 99 end,
100 100 }
101 101
102   -newTalent{
  102 +newSkill{
103 103 name = "Slime Roots",
104 104 type = {"wild-gift/slime", 4},
105 105 require = gifts_req4,
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Rituals Capacity",
22 22 type = {"rituals/rituals", 1},
23 23 points = 5,
... ... @@ -28,7 +28,7 @@ newTalent{
28 28 end,
29 29 }
30 30
31   -newTalent{
  31 +newSkill{
32 32 name = "Rituals Study",
33 33 type = {"rituals/rituals", 1},
34 34 points = 5,
... ...
... ... @@ -34,7 +34,7 @@ newTalent{
34 34 local x, y = self:getTarget(tg)
35 35 if not x or not y then return nil end
36 36 local dam = self:spellCrit(self:combatTalentSpellDamage(t, 20, 290))
37   - self:project(tg, x, y, DamageType.LIGHTNING, rng.avg(dam / 5, dam, 3))
  37 + self:project(tg, x, y, DamageType.LIGHTNING, rng.avg(dam / 3, dam, 3))
38 38 local _ _, x, y = self:canProject(tg, x, y)
39 39 game.level.map:particleEmitter(self.x, self.y, math.max(math.abs(x-self.x), math.abs(y-self.y)), "lightning", {tx=x-self.x, ty=y-self.y})
40 40 game:playSoundNear(self, "talents/lightning")
... ... @@ -42,7 +42,7 @@ newTalent{
42 42 end,
43 43 info = function(self, t)
44 44 return ([[Conjures up mana into a powerful beam of lightning doing %0.2f to %0.2f damage
45   - The damage will increase with the Magic stat]]):format(self:combatTalentSpellDamage(t, 20, 290) / 5, self:combatTalentSpellDamage(t, 20, 290))
  45 + The damage will increase with the Magic stat]]):format(self:combatTalentSpellDamage(t, 20, 290) / 3, self:combatTalentSpellDamage(t, 20, 290))
46 46 end,
47 47 }
48 48
... ... @@ -102,7 +102,8 @@ newTalent{
102 102 for i, actor in ipairs(targets) do
103 103 local tgr = {type="beam", range=self:getTalentRange(t), friendlyfire=false, talent=t, x=sx, y=sy}
104 104 print("[Chain lightning] jumping from", sx, sy, "to", actor.x, actor.y)
105   - self:project(tgr, actor.x, actor.y, DamageType.LIGHTNING, rng.avg(1, self:spellCrit(self:combatTalentSpellDamage(t, 10, 200)), 5))
  105 + local dam = self:spellCrit(self:combatTalentSpellDamage(t, 10, 200))
  106 + self:project(tgr, actor.x, actor.y, DamageType.LIGHTNING, rng.avg(rng.avg(dam / 3, dam, 3), dam, 5))
106 107 game.level.map:particleEmitter(sx, sy, math.max(math.abs(actor.x-sx), math.abs(actor.y-sy)), "lightning", {tx=actor.x-sx, ty=actor.y-sy})
107 108 sx, sy = actor.x, actor.y
108 109 end
... ... @@ -112,10 +113,11 @@ newTalent{
112 113 return true
113 114 end,
114 115 info = function(self, t)
115   - return ([[Invokes a forking beam of lightning doing 1 to %0.2f damage and forking to an other target.
  116 + return ([[Invokes a forking beam of lightning doing %0.2f to %0.2f damage and forking to an other target.
116 117 It can hit up to %d targets and will never hit the same one twice, neither will it hit the caster.
117 118 The damage will increase with the Magic stat]]):
118 119 format(
  120 + self:combatTalentSpellDamage(t, 10, 200) / 3,
119 121 self:combatTalentSpellDamage(t, 10, 200),
120 122 3 + self:getTalentLevelRaw(t)
121 123 )
... ...
... ... @@ -104,7 +104,7 @@ newTalent{
104 104 newTalent{
105 105 name = "Disruption Shield",
106 106 type = {"spell/arcane",4},
107   - require = spells_req4,
  107 + require = spells_req4, no_sustain_autoreset = true,
108 108 points = 5,
109 109 mode = "sustained",
110 110 sustain_mana = 150,
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Phase Door",
22 22 type = {"spell/conveyance",1},
23 23 require = spells_req1,
... ... @@ -63,7 +63,7 @@ newTalent{
63 63 end,
64 64 }
65 65
66   -newTalent{
  66 +newSkill{
67 67 name = "Teleport",
68 68 type = {"spell/conveyance",2},
69 69 require = spells_req2,
... ... @@ -110,7 +110,7 @@ newTalent{
110 110 end,
111 111 }
112 112
113   -newTalent{
  113 +newSkill{
114 114 name = "Displacement Shield",
115 115 type = {"spell/conveyance", 3},
116 116 require = spells_req3,
... ... @@ -141,7 +141,7 @@ newTalent{
141 141 end,
142 142 }
143 143
144   -newTalent{
  144 +newSkill{
145 145 name = "Probability Travel",
146 146 type = {"spell/conveyance",4},
147 147 mode = "sustained",
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Sense",
22 22 type = {"spell/divination", 1},
23 23 require = spells_req1,
... ... @@ -46,7 +46,7 @@ newTalent{
46 46 end,
47 47 }
48 48
49   -newTalent{
  49 +newSkill{
50 50 name = "Identify",
51 51 type = {"spell/divination", 2},
52 52 require = spells_req2,
... ... @@ -94,7 +94,7 @@ newTalent{
94 94 end,
95 95 }
96 96
97   -newTalent{
  97 +newSkill{
98 98 name = "Vision",
99 99 type = {"spell/divination", 3},
100 100 require = spells_req3,
... ... @@ -111,7 +111,7 @@ newTalent{
111 111 end,
112 112 }
113 113
114   -newTalent{
  114 +newSkill{
115 115 name = "Telepathy",
116 116 type = {"spell/divination", 4},
117 117 mode = "sustained",
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Regeneration",
22 22 type = {"spell/nature", 1},
23 23 require = spells_req1,
... ... @@ -38,7 +38,7 @@ newTalent{
38 38 end,
39 39 }
40 40
41   -newTalent{
  41 +newSkill{
42 42 name = "Heal",
43 43 type = {"spell/nature", 2},
44 44 require = spells_req2,
... ... @@ -59,7 +59,7 @@ newTalent{
59 59 end,
60 60 }
61 61
62   -newTalent{
  62 +newSkill{
63 63 name = "Restoration",
64 64 type = {"spell/nature", 3},
65 65 require = spells_req3,
... ... @@ -95,7 +95,7 @@ newTalent{
95 95 end,
96 96 }
97 97
98   -newTalent{
  98 +newSkill{
99 99 name = "Nature's Call",
100 100 type = {"spell/nature", 4},
101 101 require = spells_req4,
... ...
... ... @@ -18,7 +18,7 @@
18 18 -- darkgod@te4.org
19 19
20 20 -- Default archery attack
21   -newTalent{
  21 +newSkill{
22 22 name = "Shoot",
23 23 type = {"technique/archery-base", 1},
24 24 no_energy = true,
... ...
... ... @@ -20,7 +20,7 @@
20 20 ----------------------------------------------------
21 21 -- Active techniques
22 22 ----------------------------------------------------
23   -newTalent{
  23 +newSkill{
24 24 name = "Precise Strikes",
25 25 type = {"technique/combat-techniques-active", 1},
26 26 mode = "sustained",
... ... @@ -47,7 +47,7 @@ newTalent{
47 47 end,
48 48 }
49 49
50   -newTalent{
  50 +newSkill{
51 51 name = "Rush",
52 52 type = {"technique/combat-techniques-active", 2},
53 53 message = "@Source@ rushes out!",
... ... @@ -89,7 +89,7 @@ newTalent{
89 89 end,
90 90 }
91 91
92   -newTalent{
  92 +newSkill{
93 93 name = "Perfect Strike",
94 94 type = {"technique/combat-techniques-active", 3},
95 95 points = 5,
... ... @@ -105,7 +105,7 @@ newTalent{
105 105 end,
106 106 }
107 107
108   -newTalent{
  108 +newSkill{
109 109 name = "Blinding Speed",
110 110 type = {"technique/combat-techniques-active", 4},
111 111 points = 5,
... ... @@ -124,7 +124,7 @@ newTalent{
124 124 ----------------------------------------------------
125 125 -- Passive techniques
126 126 ----------------------------------------------------
127   -newTalent{
  127 +newSkill{
128 128 name = "Quick Recovery",
129 129 type = {"technique/combat-techniques-passive", 1},
130 130 require = techs_strdex_req1,
... ... @@ -141,7 +141,7 @@ newTalent{
141 141 end,
142 142 }
143 143
144   -newTalent{
  144 +newSkill{
145 145 name = "Fast Metabolism",
146 146 type = {"technique/combat-techniques-passive", 2},
147 147 require = techs_strdex_req2,
... ... @@ -158,7 +158,7 @@ newTalent{
158 158 end,
159 159 }
160 160
161   -newTalent{
  161 +newSkill{
162 162 name = "Spell Shield",
163 163 type = {"technique/combat-techniques-passive", 3},
164 164 require = techs_strdex_req3,
... ... @@ -175,7 +175,7 @@ newTalent{
175 175 end,
176 176 }
177 177
178   -newTalent{
  178 +newSkill{
179 179 name = "Unending Frenzy",
180 180 type = {"technique/combat-techniques-passive", 4},
181 181 require = techs_strdex_req4,
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Heavy Armour Training",
22 22 type = {"technique/combat-training", 1},
23 23 mode = "passive",
... ... @@ -29,7 +29,7 @@ newTalent{
29 29 end,
30 30 }
31 31
32   -newTalent{
  32 +newSkill{
33 33 name = "Massive Armour Training",
34 34 type = {"technique/combat-training", 2},
35 35 mode = "passive",
... ... @@ -41,7 +41,7 @@ newTalent{
41 41 end,
42 42 }
43 43
44   -newTalent{
  44 +newSkill{
45 45 name = "Health",
46 46 type = {"technique/combat-training", 1},
47 47 mode = "passive",
... ... @@ -58,7 +58,7 @@ newTalent{
58 58 end,
59 59 }
60 60
61   -newTalent{
  61 +newSkill{
62 62 name = "Weapon Combat",
63 63 type = {"technique/combat-training", 1},
64 64 points = 10,
... ... @@ -69,7 +69,7 @@ newTalent{
69 69 end,
70 70 }
71 71
72   -newTalent{
  72 +newSkill{
73 73 name = "Sword Mastery",
74 74 type = {"technique/combat-training", 1},
75 75 points = 10,
... ... @@ -80,7 +80,7 @@ newTalent{
80 80 end,
81 81 }
82 82
83   -newTalent{
  83 +newSkill{
84 84 name = "Axe Mastery",
85 85 type = {"technique/combat-training", 1},
86 86 points = 10,
... ... @@ -91,7 +91,7 @@ newTalent{
91 91 end,
92 92 }
93 93
94   -newTalent{
  94 +newSkill{
95 95 name = "Mace Mastery",
96 96 type = {"technique/combat-training", 1},
97 97 points = 10,
... ... @@ -102,7 +102,7 @@ newTalent{
102 102 end,
103 103 }
104 104
105   -newTalent{
  105 +newSkill{
106 106 name = "Knife Mastery",
107 107 type = {"technique/combat-training", 1},
108 108 points = 10,
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Ghoul",
22 22 type = {"undead/ghoul", 1},
23 23 mode = "passive",
... ... @@ -36,7 +36,7 @@ newTalent{
36 36 end,
37 37 }
38 38
39   -newTalent{
  39 +newSkill{
40 40 name = "Ghoulish Leap",
41 41 type = {"undead/ghoul", 2},
42 42 require = undeads_req2,
... ... @@ -76,7 +76,7 @@ newTalent{
76 76 end,
77 77 }
78 78
79   -newTalent{
  79 +newSkill{
80 80 name = "Gnaw",
81 81 type = {"undead/ghoul", 3},
82 82 require = undeads_req3,
... ... @@ -109,7 +109,7 @@ newTalent{
109 109 end,
110 110 }
111 111
112   -newTalent{
  112 +newSkill{
113 113 name = "Retch",
114 114 type = {"undead/ghoul",4},
115 115 require = undeads_req4,
... ...
... ... @@ -17,7 +17,7 @@
17 17 -- Nicolas Casalini "DarkGod"
18 18 -- darkgod@te4.org
19 19
20   -newTalent{
  20 +newSkill{
21 21 name = "Skeleton",
22 22 type = {"undead/skeleton", 1},
23 23 mode = "passive",
... ... @@ -36,7 +36,7 @@ newTalent{
36 36 end,
37 37 }
38 38
39   -newTalent{
  39 +newSkill{
40 40 name = "Sharp Bones",
41 41 type = {"undead/skeleton", 2},
42 42 require = undeads_req2,
... ... @@ -77,7 +77,7 @@ newTalent{
77 77 end,
78 78 }
79 79
80   -newTalent{
  80 +newSkill{
81 81 name = "Bone Armour",
82 82 type = {"undead/skeleton", 3},
83 83 require = undeads_req3,
... ... @@ -97,7 +97,7 @@ newTalent{
97 97 end,
98 98 }
99 99
100   -newTalent{ short_name = "SKELETON_REASSEMBLE",
  100 +newSkill{ short_name = "SKELETON_REASSEMBLE",
101 101 name = "Re-assemble",
102 102 type = {"undead/skeleton",4},
103 103 require = undeads_req4,
... ...
... ... @@ -26,6 +26,7 @@ module(..., package.seeall, class.inherit(engine.Dialog))
26 26 function _M:init(actor, on_finish)
27 27 self.actor = actor
28 28 self.actor_dup = actor:clone()
  29 + self.unused_stats = self.actor.unused_stats
29 30 engine.Dialog.init(self, "Stats Levelup: "..actor.name, 500, 300)
30 31
31 32 self.sel = 1
... ... @@ -39,8 +40,10 @@ function _M:init(actor, on_finish)
39 40 EXIT = function()
40 41 game:unregisterDialog(self)
41 42
  43 + self:finish()
  44 +
42 45 -- if talents to spend, do it now
43   - if self.actor.unused_talents > 0 or self.actor.unused_talents_types > 0 then
  46 + if self.actor.unused_skills > 0 or self.actor.unused_talents > 0 or self.actor.unused_talents_types > 0 then
44 47 local dt = LevelupTalentsDialog.new(self.actor, on_finish)
45 48 game:registerDialog(dt)
46 49 end
... ... @@ -57,6 +60,29 @@ function _M:init(actor, on_finish)
57 60 }
58 61 end
59 62
  63 +function _M:finish()
  64 + if self.actor.unused_stats == self.unused_stats then return end
  65 + local reset = {}
  66 + for tid, act in pairs(self.actor.sustain_talents) do
  67 + if act then
  68 + local t = self.actor:getTalentFromId(tid)
  69 + if t.no_sustain_autoreset then
  70 + game.logPlayer(self.actor, "#LIGHT_BLUE#Warning: You have increased some of your statistics, talent %s is actually sustained, if it is dependant on one of the stats you changed you need to re-use it for the changes to take effect.")
  71 + else
  72 + reset[#reset+1] = tid
  73 + end
  74 + end
  75 + end
  76 + for i, tid in ipairs(reset) do
  77 + local old = self.actor.energy.value
  78 + self.actor:useTalent(tid)
  79 + self.actor.energy.value = old
  80 + self.actor.talents_cd[tid] = nil
  81 + self.actor:useTalent(tid)
  82 + self.actor.energy.value = old
  83 + end
  84 +end
  85 +
60 86 function _M:incStat(v)
61 87 if v == 1 then
62 88 if self.actor.unused_stats <= 0 then
... ...
... ... @@ -35,7 +35,7 @@ function _M:init(actor, on_finish)
35 35
36 36 self.sel = 1
37 37 self.scroll = 1
38   - self.max = math.floor((self.ih - 45) / self.font_h) - 1
  38 + self.max = math.floor((self.ih - 65) / self.font_h) - 1
39 39
40 40 self:keyCommands({
41 41 __TEXTINPUT = function(c)
... ... @@ -62,11 +62,12 @@ function _M:init(actor, on_finish)
62 62 world:gainAchievement("ELEMENTALIST", self.actor)
63 63 world:gainAchievement("WARPER", self.actor)
64 64
  65 + self:finish()
65 66 if on_finish then on_finish() end
66 67 end,
67 68 })
68 69 self:mouseZones{
69   - { x=2, y=45, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty)
  70 + { x=2, y=65, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty)
70 71 self.changed = true
71 72 self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list)
72 73 if button == "left" then self:learn(true)
... ... @@ -96,7 +97,7 @@ function _M:generateList()
96 97 for j, t in ipairs(tt.talents) do
97 98 if not t.hide then
98 99 local typename = "talent"
99   - if t.type[1]:find("^spell/") then typename = "spell" end
  100 + if t.skill then typename = "skill" end
100 101 list[#list+1] = { name=" "..t.name.." ("..typename..")", talent=t.id, color=not ttknown and {128,128,128} }
101 102 if self.actor:getTalentLevelRaw(t.id) == t.points then
102 103 known[#known+1] = {name="known", color=ttknown and {0,255,0} or {128,128,128}}
... ... @@ -116,6 +117,31 @@ function _M:generateList()
116 117 self.list_known = known
117 118 end
118 119
  120 +function _M:finish()
  121 + -- Go through all sustained spells
  122 + local reset = {}
  123 + for tid, act in pairs(self.actor.sustain_talents) do
  124 + if act then
  125 + local t = self.actor:getTalentFromId(tid)
  126 + if self.actor:getTalentLevelRaw(tid) ~= self.actor_dup:getTalentLevelRaw(tid) then
  127 + if t.no_sustain_autoreset then
  128 + game.logPlayer(self.actor, "#LIGHT_BLUE#Warning: You have increased your level in %s, but it cannot be auto-reactivated. The new level will only be used when you re-use it.")
  129 + else
  130 + reset[#reset+1] = tid
  131 + end
  132 + end
  133 + end
  134 + end
  135 + for i, tid in ipairs(reset) do
  136 + local old = self.actor.energy.value
  137 + self.actor:useTalent(tid)
  138 + self.actor.energy.value = old
  139 + self.actor.talents_cd[tid] = nil
  140 + self.actor:useTalent(tid)
  141 + self.actor.energy.value = old
  142 + end
  143 +end
  144 +
119 145 function _M:learn(v)
120 146 if self.list[self.sel].type then
121 147 self:learnType(self.list[self.sel].type, v)
... ... @@ -134,39 +160,77 @@ end
134 160
135 161 function _M:learnTalent(t_id, v)
136 162 local t = self.actor:getTalentFromId(t_id)
137   - if v then
138   - if self.actor.unused_talents < 1 then
139   - self:simplePopup("Not enough talent points", "You have no talent points left!")
140   - return
141   - end
142   - if not self.actor:canLearnTalent(t) then
143   - self:simplePopup("Cannot learn talent", "Prerequisites not met!")
144   - return
145   - end
146   - if self.actor:getTalentLevelRaw(t_id) >= t.points then
147   - self:simplePopup("Already known", "You already fully know this talent!")
148   - return
  163 + if not t.skill then
  164 + if v then
  165 + if self.actor.unused_talents < 1 then
  166 + self:simplePopup("Not enough talent points", "You have no talent points left!")
  167 + return
  168 + end
  169 + if not self.actor:canLearnTalent(t) then
  170 + self:simplePopup("Cannot learn talent", "Prerequisites not met!")
  171 + return
  172 + end
  173 + if self.actor:getTalentLevelRaw(t_id) >= t.points then
  174 + self:simplePopup("Already known", "You already fully know this talent!")
  175 + return
  176 + end
  177 + self.actor:learnTalent(t_id)
  178 + self.actor.unused_talents = self.actor.unused_talents - 1
  179 + self.talents_changed[t_id] = true
  180 + else
  181 + if not self.actor:knowTalent(t_id) then
  182 + self:simplePopup("Impossible", "You do not know this talent!")
  183 + return
  184 + end
  185 + if self.actor_dup:getTalentLevelRaw(t_id) == self.actor:getTalentLevelRaw(t_id) then
  186 + self:simplePopup("Impossible", "You cannot unlearn talents!")
  187 + return
  188 + end
  189 + self.actor:unlearnTalent(t_id)
  190 + local ok, dep_miss = self:checkDeps()
  191 + if ok then
  192 + self.actor.unused_talents = self.actor.unused_talents + 1
  193 + else
  194 + self:simplePopup("Impossible", "You can not unlearn this talent because of talent: "..dep_miss)
  195 + self.actor:learnTalent(t_id)
  196 + return
  197 + end
149 198 end
150   - self.actor:learnTalent(t_id)
151   - self.actor.unused_talents = self.actor.unused_talents - 1
152   - self.talents_changed[t_id] = true
153 199 else
154   - if not self.actor:knowTalent(t_id) then
155   - self:simplePopup("Impossible", "You do not know this talent!")
156   - return
157   - end
158   - if self.actor_dup:getTalentLevelRaw(t_id) == self.actor:getTalentLevelRaw(t_id) then
159   - self:simplePopup("Impossible", "You cannot unlearn talents!")
160   - return
161   - end
162   - self.actor:unlearnTalent(t_id)
163   - local ok, dep_miss = self:checkDeps()
164   - if ok then
165   - self.actor.unused_talents = self.actor.unused_talents + 1
166   - else
167   - self:simplePopup("Impossible", "You can not unlearn this talent because of talent: "..dep_miss)
  200 + if v then
  201 + if self.actor.unused_skills < 1 then
  202 + self:simplePopup("Not enough skill points", "You have no skill points left!")
  203 + return
  204 + end
  205 + if not self.actor:canLearnTalent(t) then
  206 + self:simplePopup("Cannot learn skill", "Prerequisites not met!")
  207 + return
  208 + end
  209 + if self.actor:getTalentLevelRaw(t_id) >= t.points then
  210 + self:simplePopup("Already known", "You already fully know this skill!")
  211 + return
  212 + end
168 213 self.actor:learnTalent(t_id)
169   - return
  214 + self.actor.unused_skills = self.actor.unused_skills - 1
  215 + self.talents_changed[t_id] = true
  216 + else
  217 + if not self.actor:knowTalent(t_id) then
  218 + self:simplePopup("Impossible", "You do not know this skill!")
  219 + return
  220 + end
  221 + if self.actor_dup:getTalentLevelRaw(t_id) == self.actor:getTalentLevelRaw(t_id) then
  222 + self:simplePopup("Impossible", "You cannot unlearn skills!")
  223 + return
  224 + end
  225 + self.actor:unlearnTalent(t_id)
  226 + local ok, dep_miss = self:checkDeps()
  227 + if ok then
  228 + self.actor.unused_skills = self.actor.unused_skills + 1
  229 + else
  230 + self:simplePopup("Impossible", "You can not unlearn this skill because of skill: "..dep_miss)
  231 + self.actor:learnTalent(t_id)
  232 + return
  233 + end
170 234 end
171 235 end
172 236 self:generateList()
... ... @@ -175,11 +239,11 @@ end
175 239 function _M:learnType(tt, v)
176 240 if v then
177 241 if self.actor:knowTalentType(tt) then
178   - self:simplePopup("Impossible", "You do already know this talent category!")
  242 + self:simplePopup("Impossible", "You do already know this category!")
179 243 return
180 244 end
181 245 if self.actor.unused_talents_types == 0 then
182   - self:simplePopup("Not enough talent category points", "You have no talent category points left!")
  246 + self:simplePopup("Not enough talent category points", "You have no category points left!")
183 247 return
184 248 end
185 249 self.actor:learnTalentType(tt)
... ... @@ -190,7 +254,7 @@ function _M:learnType(tt, v)
190 254 return
191 255 end
192 256 if not self.actor:knowTalentType(tt) then
193   - self:simplePopup("Impossible", "You do not know this talent category!")
  257 + self:simplePopup("Impossible", "You do not know this category!")
194 258 return
195 259 end
196 260 self.actor:unlearnTalentType(tt)
... ... @@ -198,7 +262,7 @@ function _M:learnType(tt, v)
198 262 if ok then
199 263 self.actor.unused_talents_types = self.actor.unused_talents_types + 1
200 264 else
201   - self:simplePopup("Impossible", "You can not unlearn this category because of talent: "..dep_miss)
  265 + self:simplePopup("Impossible", "You can not unlearn this category because of: "..dep_miss)
202 266 self.actor:learnTalentType(tt)
203 267 return
204 268 end
... ... @@ -225,21 +289,29 @@ Mouse: #00FF00#Left click#FFFFFF# to learn; #00FF00#right click#FFFFFF# to unlea
225 289 lines = self.actor:getTalentTypeFrom(self.list[self.sel].type).description:splitLines(self.iw / 2 - 10, self.font)
226 290 else
227 291 local str = ""
228   - str = str .. "#00FFFF#Talent\n"
229   - str = str .. "#00FFFF#A talent allows you to perform new combat moves, cast spells, and improve your character. You gain two talent point every level. You may also find trainers or artifacts that allow you to learn more.\n\n"
  292 + local what
  293 + if self.list[self.sel].skill then
  294 + what = "skill"
  295 + str = str .. "#00FFFF#Skill\n"
  296 + str = str .. "#00FFFF#A skill allows you to perform various utility actions and improve your character. You gain one skill point every level. You may also find trainers or artifacts that allow you to learn more.\n\n"
  297 + else
  298 + what = "talent"
  299 + str = str .. "#00FFFF#Talent\n"
  300 + str = str .. "#00FFFF#A talent allows you to perform new combat moves, cast spells, and improve your character. You gain one talent point every level and two every 5 levels. You may also find trainers or artifacts that allow you to learn more.\n\n"
  301 + end
230 302 helplines = str:splitLines(self.iw / 2 - 10, self.font)
231 303 local t = self.actor:getTalentFromId(self.list[self.sel].talent)
232 304
233 305 if self.actor:getTalentLevelRaw(t.id) > 0 then
234 306 lines = self.actor:getTalentFullDescription(t):splitLines(self.iw / 2 - 10, self.font)
235 307 local req = self.actor:getTalentReqDesc(self.list[self.sel].talent, 0)
236   - req = "Current talent level: "..self.actor:getTalentLevelRaw(t.id).."\n"..req
  308 + req = "Current "..what.." level: "..self.actor:getTalentLevelRaw(t.id).."\n"..req
237 309 reqlines = req:splitLines(self.iw / 2 - 10, self.font)
238 310 end
239 311
240 312 if self.actor:getTalentLevelRaw(t.id) < t.points then
241 313 local req2 = self.actor:getTalentReqDesc(self.list[self.sel].talent, 1)
242   - req2 = "Next talent level: "..(self.actor:getTalentLevelRaw(t.id)+1).."\n"..req2
  314 + req2 = "Next "..what.." level: "..(self.actor:getTalentLevelRaw(t.id)+1).."\n"..req2
243 315 reqlines2 = req2:splitLines(self.iw / 2 - 10, self.font)
244 316 lines2 = self.actor:getTalentFullDescription(t, 1):splitLines(self.iw / 2 - 10, self.font)
245 317 end
... ... @@ -285,12 +357,13 @@ Mouse: #00FF00#Left click#FFFFFF# to learn; #00FF00#right click#FFFFFF# to unlea
285 357 end
286 358
287 359 -- Talents
288   - s:drawColorStringBlended(self.font, "Talent categories points left: #00FF00#"..self.actor.unused_talents_types, 2, 2)
  360 + s:drawColorStringBlended(self.font, "Categories points left: #00FF00#"..self.actor.unused_talents_types, 2, 2)
289 361 s:drawColorStringBlended(self.font, "Talents points left: #00FF00#"..self.actor.unused_talents, 2, 2 + self.font_h)
290   - self:drawWBorder(s, 2, 40, 200)
  362 + s:drawColorStringBlended(self.font, "Skills points left: #00FF00#"..self.actor.unused_skills, 2, 2 + self.font_h * 2)
  363 + self:drawWBorder(s, 2, 60, 200)
291 364
292   - self:drawSelectionList(s, 2, 45, self.font_h, self.list, self.sel, "name" , self.scroll, self.max)
293   - self:drawSelectionList(s, self.iw / 2 - 70, 45, self.font_h, self.list_known, self.sel, "name", self.scroll, self.max)
  365 + self:drawSelectionList(s, 2, 65, self.font_h, self.list, self.sel, "name" , self.scroll, self.max)
  366 + self:drawSelectionList(s, self.iw / 2 - 70, 65, self.font_h, self.list_known, self.sel, "name", self.scroll, self.max)
294 367
295 368 self.changed = false
296 369 end
... ...
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type