Commit a0fc70a720195ade3a31d0dd29a4e80c7990e36b
1 parent
5b44a60b
gem golem
git-svn-id: http://svn.net-core.org/repos/t-engine4@2330 51575b47-30f0-44d4-a5cc-537603b46e54
Showing
6 changed files
with
81 additions
and
64 deletions
... | ... | @@ -53,6 +53,26 @@ local change_armour = function(npc, player) |
53 | 53 | end) |
54 | 54 | end |
55 | 55 | |
56 | +local change_gem = function(npc, player, gemid) | |
57 | + local inven = player:getInven("INVEN") | |
58 | + player:showInventory("Select a gem for your golem.", inven, function(o) return o.type == "gem" and o.material_level and o.material_level <= player:getTalentLevelRaw(player.T_GEM_GOLEM) end, function(o, item) | |
59 | + player:removeObject(inven, item, true) | |
60 | + local gems = golem:getInven("GEM") | |
61 | + local old = golem:removeObject(gems, gemid, true) | |
62 | + if old then player:addObject(inven, old) end | |
63 | + | |
64 | + -- Force "wield" | |
65 | + golem:addObject(gems, o) | |
66 | + game.logSeen(player, "%s sockets %s with %s.", player.name:capitalize(), golem.name, o:getName{do_color=true}:a_an()) | |
67 | + | |
68 | + player:sortInven() | |
69 | + player:useEnergy() | |
70 | + return true | |
71 | + end) | |
72 | +end | |
73 | +local change_gem1 = function(npc, player) return change_gem(npc, player, 1) end | |
74 | +local change_gem2 = function(npc, player) return change_gem(npc, player, 2) end | |
75 | + | |
56 | 76 | local change_name = function(npc, player) |
57 | 77 | local d = require("engine.dialogs.GetText").new("Change your golem's name", "Name", 2, 25, function(name) |
58 | 78 | if name then |
... | ... | @@ -63,15 +83,24 @@ local change_name = function(npc, player) |
63 | 83 | game:registerDialog(d) |
64 | 84 | end |
65 | 85 | |
86 | +local ans = { | |
87 | + {"I want to change your weapon.", action=change_weapon}, | |
88 | + {"I want to change your armour.", action=change_armour}, | |
89 | + {"I want to change your name.", action=change_name}, | |
90 | + {"Nothing, let's go."}, | |
91 | +} | |
92 | + | |
93 | +if player:knowTalent(player.T_GEM_GOLEM) then | |
94 | + local gem1 = golem:getInven("GEM")[1] | |
95 | + local gem2 = golem:getInven("GEM")[2] | |
96 | + table.insert(ans, 3, {("I want to change your first gem%s."):format(gem1 and "(currently: "..gem1:getName{}..")" or ""), action=change_gem1}) | |
97 | + table.insert(ans, 4, {("I want to change your second gem%s."):format(gem2 and "(currently: "..gem2:getName{}..")" or ""), action=change_gem2}) | |
98 | +end | |
99 | + | |
66 | 100 | newChat{ id="welcome", |
67 | 101 | text = [[#LIGHT_GREEN#*The golem talks in a monotonous voice*#WHITE# |
68 | 102 | Yes master.]], |
69 | - answers = { | |
70 | - {"I want to change your weapon.", action=change_weapon}, | |
71 | - {"I want to change your armour.", action=change_armour}, | |
72 | - {"I want to change your name.", action=change_name}, | |
73 | - {"Nothing, let's go."}, | |
74 | - } | |
103 | + answers = ans | |
75 | 104 | } |
76 | 105 | |
77 | 106 | return "welcome" | ... | ... |
... | ... | @@ -16,63 +16,44 @@ |
16 | 16 | -- |
17 | 17 | -- Nicolas Casalini "DarkGod" |
18 | 18 | -- darkgod@te4.org |
19 | +local Chat = require "engine.Chat" | |
19 | 20 | |
20 | 21 | newTalent{ |
21 | 22 | name = "Mana Tap", |
22 | 23 | type = {"spell/advanced-golemancy", 1}, |
23 | - mode = "passive", | |
24 | 24 | require = spells_req_high1, |
25 | 25 | points = 5, |
26 | - on_learn = function(self, t) | |
27 | - self.alchemy_golem:learnTalent(Talents.T_WEAPON_COMBAT, true) | |
28 | - self.alchemy_golem:learnTalent(Talents.T_WEAPONS_MASTERY, true) | |
29 | - end, | |
30 | - on_unlearn = function(self, t) | |
31 | - self.alchemy_golem:unlearnTalent(Talents.T_WEAPON_COMBAT, true) | |
32 | - self.alchemy_golem:unlearnTalent(Talents.T_WEAPONS_MASTERY, true) | |
26 | + mana = 0, | |
27 | + cooldown = 14, | |
28 | + getPower = function(self, t) return 40 + self:combatTalentSpellDamage(t, 15, 150) end, | |
29 | + action = function(self, t) | |
30 | + local mover, golem = getGolem(self) | |
31 | + if not golem then | |
32 | + game.logPlayer(self, "Your golem is currently inactive.") | |
33 | + return | |
34 | + end | |
35 | + | |
36 | + local power = math.min(t.getPower(self, t), golem:getMana()) | |
37 | + golem:incMana(-power) | |
38 | + self:incMana(power) | |
39 | + game:playSoundNear(self, "talents/arcane") | |
40 | + return true | |
33 | 41 | end, |
34 | 42 | info = function(self, t) |
35 | - local attack = self:getTalentFromId(Talents.T_WEAPON_COMBAT).getAttack(self, t) | |
36 | - local damage = self:getTalentFromId(Talents.T_WEAPONS_MASTERY).getDamage(self, t) | |
37 | - return ([[Improves your golem proficiency with weapons. Increasing its attack by %d and damage by %d%%.]]): | |
38 | - format(attack, 100 * damage) | |
43 | + local power=t.getPower(self, t) | |
44 | + return ([[You tap into your golem's mana pool to replenish your own. Drains %d mana.]]): | |
45 | + format(power) | |
39 | 46 | end, |
40 | 47 | } |
41 | 48 | |
42 | 49 | newTalent{ |
43 | 50 | name = "Life Tap", short_name = "GOLEMANCY_LIFE_TAP", |
44 | 51 | type = {"spell/advanced-golemancy", 2}, |
45 | - mode = "passive", | |
46 | 52 | require = spells_req_high2, |
47 | 53 | points = 5, |
48 | - on_learn = function(self, t) | |
49 | - self.alchemy_golem:learnTalent(Talents.T_HEALTH, true) | |
50 | - self.alchemy_golem:learnTalent(Talents.T_HEAVY_ARMOUR_TRAINING, true) | |
51 | - self.alchemy_golem:learnTalent(Talents.T_MASSIVE_ARMOUR_TRAINING, true) | |
52 | - end, | |
53 | - on_unlearn = function(self, t) | |
54 | - self.alchemy_golem:unlearnTalent(Talents.T_HEALTH, true) | |
55 | - self.alchemy_golem:unlearnTalent(Talents.T_HEAVY_ARMOUR_TRAINING, true) | |
56 | - self.alchemy_golem:unlearnTalent(Talents.T_MASSIVE_ARMOUR_TRAINING, true) | |
57 | - end, | |
58 | - info = function(self, t) | |
59 | - local health = self:getTalentFromId(Talents.T_HEALTH).getHealth(self, t) | |
60 | - local heavyarmor = self:getTalentFromId(Talents.T_HEAVY_ARMOUR_TRAINING).getArmor(self, t) | |
61 | - local massivearmor = self:getTalentFromId(Talents.T_MASSIVE_ARMOUR_TRAINING).getArmor(self, t) | |
62 | - return ([[Improves your golem armour training and health. Increases armor by %d when wearing heavy armor or by %d when wearing massive armor also increases health by %d.]]): | |
63 | - format(heavyarmor, massivearmor, health) | |
64 | - end, | |
65 | -} | |
66 | - | |
67 | - | |
68 | -newTalent{ | |
69 | - name = "Gem Golem", | |
70 | - type = {"spell/advanced-golemancy",3}, | |
71 | - require = spells_req3, | |
72 | - points = 5, | |
73 | - mana = 10, | |
74 | - cooldown = 20, | |
75 | - no_npc_use = true, | |
54 | + mana = 25, | |
55 | + cooldown = 12, | |
56 | + getPower = function(self, t) return 70 + self:combatTalentSpellDamage(t, 15, 450) end, | |
76 | 57 | action = function(self, t) |
77 | 58 | local mover, golem = getGolem(self) |
78 | 59 | if not golem then |
... | ... | @@ -80,28 +61,34 @@ newTalent{ |
80 | 61 | return |
81 | 62 | end |
82 | 63 | |
83 | - -- Find space | |
84 | - local x, y = util.findFreeGrid(self.x, self.y, 5, true, {[Map.ACTOR]=true}) | |
85 | - if not x then | |
86 | - game.logPlayer(self, "Not enough space to invoke!") | |
87 | - return | |
88 | - end | |
89 | - | |
90 | - golem:setEffect(golem.EFF_MIGHTY_BLOWS, 5, {power=t.getPower(self, t)}) | |
91 | - if golem == mover then | |
92 | - golem:move(x, y, true) | |
93 | - end | |
64 | + local power = math.min(t.getPower(self, t), golem.life) | |
65 | + golem.life = golem.life - power -- Direct hit, bypass all checks | |
66 | + golem.changed = true | |
67 | + self:heal(power) | |
94 | 68 | game:playSoundNear(self, "talents/arcane") |
95 | 69 | return true |
96 | 70 | end, |
97 | 71 | info = function(self, t) |
98 | - power=t.getPower(self, t) | |
99 | - return ([[You invoke your golem to your side, granting it a temporary melee power increase of %d for 5 turns.]]): | |
72 | + local power=t.getPower(self, t) | |
73 | + return ([[You tap into your golem's life energies to replenish your own. Drains %d life.]]): | |
100 | 74 | format(power) |
101 | 75 | end, |
102 | 76 | } |
103 | 77 | |
104 | 78 | newTalent{ |
79 | + name = "Gem Golem", | |
80 | + type = {"spell/advanced-golemancy",3}, | |
81 | + require = spells_req3, | |
82 | + mode = "passive", | |
83 | + points = 5, | |
84 | + info = function(self, t) | |
85 | + return ([[Insert a pair of gems into your golem, providing it with the gem bonuses and changing its melee attack damage type. | |
86 | + Gem level usable: %d | |
87 | + Gem changing is done when refitting your golem (use Refit Golem at full life).]]):format(self:getTalentLevelRaw(t)) | |
88 | + end, | |
89 | +} | |
90 | + | |
91 | +newTalent{ | |
105 | 92 | name = "Runic Golem", |
106 | 93 | type = {"spell/advanced-golemancy",4}, |
107 | 94 | require = spells_req_high4, | ... | ... |
... | ... | @@ -36,7 +36,7 @@ local function makeGolem() |
36 | 36 | |
37 | 37 | combat = { dam=10, atk=10, apr=0, dammod={str=1} }, |
38 | 38 | |
39 | - body = { INVEN = 50, MAINHAND=1, OFFHAND=1, BODY=1,}, | |
39 | + body = { INVEN = 1000, MAINHAND=1, BODY=1, GEM=2 }, | |
40 | 40 | infravision = 20, |
41 | 41 | rank = 3, |
42 | 42 | size_category = 4, |
... | ... | @@ -169,7 +169,7 @@ newTalent{ |
169 | 169 | |
170 | 170 | -- talk to the golem |
171 | 171 | if game.level:hasEntity(self.alchemy_golem) and self.alchemy_golem.life >= self.alchemy_golem.max_life then |
172 | - local chat = Chat.new("alchemist-golem", self.alchemy_golem, self) | |
172 | + local chat = Chat.new("alchemist-golem", self.alchemy_golem, self, {golem=self.alchemy_golem, player=self}) | |
173 | 173 | chat:invoke() |
174 | 174 | |
175 | 175 | -- heal the golem |
... | ... | @@ -263,7 +263,6 @@ newTalent{ |
263 | 263 | end, |
264 | 264 | } |
265 | 265 | |
266 | - | |
267 | 266 | newTalent{ |
268 | 267 | name = "Invoke Golem", |
269 | 268 | type = {"spell/golemancy",3}, |
... | ... | @@ -295,7 +294,7 @@ newTalent{ |
295 | 294 | return true |
296 | 295 | end, |
297 | 296 | info = function(self, t) |
298 | - power=t.getPower(self, t) | |
297 | + local power=t.getPower(self, t) | |
299 | 298 | return ([[You invoke your golem to your side, granting it a temporary melee power increase of %d for 5 turns.]]): |
300 | 299 | format(power) |
301 | 300 | end, | ... | ... |
... | ... | @@ -81,6 +81,7 @@ ActorInventory:defineInventory("HANDS", "On hands", true, "Various gloves can be |
81 | 81 | ActorInventory:defineInventory("FEET", "On feet", true, "Sandals or boots can be worn on your feet.") |
82 | 82 | ActorInventory:defineInventory("TOOL", "Tool", true, "This is your readied tool, always available immediately.") |
83 | 83 | ActorInventory:defineInventory("QUIVER", "Quiver", true, "Your readied ammo.") |
84 | +ActorInventory:defineInventory("GEM", "Socketed Gems", true, "Socketed gems.") | |
84 | 85 | ActorInventory:defineInventory("MOUNT", "Mount", false, "Your mount.") |
85 | 86 | ActorInventory:defineInventory("QS_MAINHAND", "Second weapon set: In main hand", false, "Weapon Set 2: Most weapons are wielded in the main hand. Press 'x' to switch weapon sets.", true) |
86 | 87 | ActorInventory:defineInventory("QS_OFFHAND", "Second weapon set: In off hand", false, "Weapon Set 2: You can use shields or a second weapon in your off-hand, if you have the talents for it. Press 'x' to switch weapon sets.", true) | ... | ... |
No preview for this file type
-
Please register or login to post a comment