gifts.lua
9.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
-- Wild Gifts
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/call", name = "call of the wild", generic = true, description = "Be at one with nature." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/harmony", name = "harmony", generic = true, description = "Nature heals and cleans you." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/antimagic", name = "antimagic", generic = true, description = "The way to combat magic, or even nullify it." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/summon-melee", name = "summoning (melee)", description = "The art of calling creatures to your aid." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/summon-distance", name = "summoning (distance)", description = "The art of calling creatures to your aid." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/summon-utility", name = "summoning (utility)", description = "The art of calling creatures to your aid." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/summon-augmentation", name = "summoning (augmentation)", description = "The art of calling creatures to your aid." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/summon-advanced", name = "summoning (advanced)", min_lev = 10, description = "The art of calling creatures to your aid." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/slime", name = "slime aspect", generic = true, description = "Through dedicated consumption of slime mold juice, you have gained an affinity with slime molds." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/fungus", name = "fungus", generic = true, description = "By covering yourself in fungus you better your healing." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/sand-drake", name = "sand drake aspect", description = "Take on the defining aspects of a Sand Drake." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/fire-drake", name = "fire drake aspect", description = "Take on the defining aspects of a Fire Drake." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/cold-drake", name = "cold drake aspect", description = "Take on the defining aspects of a Cold Drake." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/storm-drake", name = "storm drake aspect", description = "Take on the defining aspects of a Storm Drake." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/mindstar-mastery", name = "mindstar mastery", generic = true, description = "Learn to channel your mental power through mindstars, forming powerful psionic blades." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/earthen-power", name = "earthen power", description = "Dwarves have learned to imbue their shields with the power of stone itself." }
newTalentType{ allow_random=true, is_nature=true, type="wild-gift/earthen-vines", name = "earthen vines", description = "Control the stone itself and bring it alive in the form of dreadful vines." }
-- 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,
}
gifts_req_high1 = {
stat = { wil=function(level) return 22 + (level-1) * 2 end },
level = function(level) return 10 + (level-1) end,
}
gifts_req_high2 = {
stat = { wil=function(level) return 30 + (level-1) * 2 end },
level = function(level) return 14 + (level-1) end,
}
gifts_req_high3 = {
stat = { wil=function(level) return 38 + (level-1) * 2 end },
level = function(level) return 18 + (level-1) end,
}
gifts_req_high4 = {
stat = { wil=function(level) return 46 + (level-1) * 2 end },
level = function(level) return 22 + (level-1) end,
}
gifts_req_high5 = {
stat = { wil=function(level) return 54 + (level-1) * 2 end },
level = function(level) return 26 + (level-1) end,
}
load("/data/talents/gifts/call.lua")
load("/data/talents/gifts/harmony.lua")
load("/data/talents/gifts/antimagic.lua")
load("/data/talents/gifts/slime.lua")
load("/data/talents/gifts/fungus.lua")
load("/data/talents/gifts/sand-drake.lua")
load("/data/talents/gifts/fire-drake.lua")
load("/data/talents/gifts/cold-drake.lua")
load("/data/talents/gifts/storm-drake.lua")
function checkMaxSummon(self, silent)
local nb = 0
-- Count party members
if game.party:hasMember(self) then
for act, def in pairs(game.party.members) do
if act.summoner and act.summoner == self and act.wild_gift_summon then nb = nb + 1 end
end
else
for _, act in pairs(game.level.entities) do
if act.summoner and act.summoner == self and act.wild_gift_summon then nb = nb + 1 end
end
end
local max = math.max(1, math.floor(self:getCun() / 10))
if self:attr("nature_summon_max") then
max = max + self:attr("nature_summon_max")
end
if nb >= max then
if not silent then
game.logPlayer(self, "#PINK#You can not summon any more; you have too many summons already (%d). You can increase the limit with higher Cunning(+1 for every 10).", nb)
end
return true
else
return false
end
end
function setupSummon(self, m, x, y, no_control)
m.unused_stats = 0
m.unused_talents = 0
m.unused_generics = 0
m.unused_talents_types = 0
m.no_inventory_access = true
m.no_points_on_levelup = true
m.save_hotkeys = true
m.ai_state = m.ai_state or {}
m.ai_state.tactic_leash = 100
-- Try to use stored AI talents to preserve tweaking over multiple summons
m.ai_talents = self.stored_ai_talents and self.stored_ai_talents[m.name] or {}
local main_weapon = self:getInven("MAINHAND") and self:getInven("MAINHAND")[1]
m.life_regen = m.life_regen + (self:attr("nature_summon_regen") or 0)
m:attr("combat_apr", self:combatAPR(main_weapon))
m.inc_damage = table.clone(self.inc_damage, true)
m.resists_pen = table.clone(self.resists_pen, true)
m:attr("stun_immune", self:attr("stun_immune"))
m:attr("blind_immune", self:attr("blind_immune"))
m:attr("pin_immune", self:attr("pin_immune"))
m:attr("confusion_immune", self:attr("confusion_immune"))
m:attr("numbed", self:attr("numbed"))
if game.party:hasMember(self) then
local can_control = not no_control and self:knowTalent(self.T_SUMMON_CONTROL)
m.remove_from_party_on_death = true
game.party:addMember(m, {
control=can_control and "full" or "no",
type="summon",
title="Summon",
orders = {target=true, leash=true, anchor=true, talents=true},
on_control = function(self)
local summoner = self.summoner
self:setEffect(self.EFF_SUMMON_CONTROL, 1000, {incdur=2 + summoner:getTalentLevel(self.T_SUMMON_CONTROL) * 3, res=summoner:getCun(7, true) * summoner:getTalentLevelRaw(self.T_SUMMON_CONTROL)})
self:hotkeyAutoTalents()
end,
on_uncontrol = function(self)
self:removeEffect(self.EFF_SUMMON_CONTROL)
end,
})
end
m:resolve() m:resolve(nil, true)
m:forceLevelup(self.level)
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "summon")
-- Summons never flee
m.ai_tactic = m.ai_tactic or {}
m.ai_tactic.escape = 0
local p = self:hasEffect(self.EFF_FRANTIC_SUMMONING)
if p then
p.dur = p.dur - 1
if p.dur <= 0 then self:removeEffect(self.EFF_FRANTIC_SUMMONING) end
end
if m.wild_gift_detonate and self:isTalentActive(self.T_MASTER_SUMMONER) and self:knowTalent(self.T_GRAND_ARRIVAL) then
local dt = self:getTalentFromId(m.wild_gift_detonate)
if dt.on_arrival then
dt.on_arrival(self, self:getTalentFromId(self.T_GRAND_ARRIVAL), m)
end
end
if m.wild_gift_detonate and self:isTalentActive(self.T_MASTER_SUMMONER) and self:knowTalent(self.T_NATURE_CYCLE) then
local t = self:getTalentFromId(self.T_NATURE_CYCLE)
for _, tid in ipairs{self.T_RAGE, self.T_DETONATE, self.T_WILD_SUMMON} do
if self.talents_cd[tid] and rng.percent(t.getChance(self, t)) then
self.talents_cd[tid] = self.talents_cd[tid] - t.getReduction(self, t)
if self.talents_cd[tid] <= 0 then self.talents_cd[tid] = nil end
self.changed = true
end
end
end
end
load("/data/talents/gifts/summon-melee.lua")
load("/data/talents/gifts/summon-distance.lua")
load("/data/talents/gifts/summon-utility.lua")
load("/data/talents/gifts/summon-augmentation.lua")
load("/data/talents/gifts/summon-advanced.lua")
load("/data/talents/gifts/mindstar-mastery.lua")
load("/data/talents/gifts/earthen-power.lua")
load("/data/talents/gifts/earthen-vines.lua")