Talent tree - Magical Training - Generic
Posted: Sat Sep 17, 2011 9:10 am
I've been fiddling about with magical classes and they could use a tree to invest generic points such as combat training. This would be a starter generic tree for Mages, Anorithils, Corruptors and Paradox Mages and probably an unlockable for Arcane Blades, Shadowblades, Paladins, Reavers and Wardens.
(I haven't tested this yet but the syntax looks clean so it should be ok. This uses 2 talents from "Staff Combat" so this one would be superfluous.)
(I haven't tested this yet but the syntax looks clean so it should be ok. This uses 2 talents from "Staff Combat" so this one would be superfluous.)
Code: Select all
newTalent{
name = "Magical Endurance",
type = {"spell/magical-training", 1},
mode = "passive",
points = 5,
require = { stat = { mag=function(level) return 14 + level * 9 end }, },
on_learn = function(self, t)
self.max_mana = self.max_mana + 18
self.max_vim = self.max_vim + 10
self.max_positive = self.max_positive + 10
self.max_negative = self.max_negative + 10
end,
on_unlearn = function(self, t)
self.max_mana = self.max_mana - 18
self.max_vim = self.max_vim - 10
self.max_positive = self.max_positive - 10
self.max_negative = self.max_negative - 10
end,
info = function(self, t)
return ([[Increases your maximum mana by %d and your maximum vim, positive and negative energy by %d.]]):format(18 * t, 10 * t)
end,
}
newTalent{
name = "???",
type = {"spell/magical-training", 2},
mode = "passive",
points = 5,
require = { stat = { mag=function(level) return 14 + level * 9 end }, },
on_learn = function(self, t)
self.silence_immune = (self.silence_immune or 0) + self:getTalentlevel(t) / 10
end,
on_unlearn = function(self, t)
self.silence_immune = self.silence_immune - self:getTalentlevel(t) / 10
end,
info = function(self, t)
local silenceres = self:getTalentlevel(t) * 10
return ([[Increases your resistance to silence effects by %d%%.]]):format(silenceres)
end,
}
newTalent{
name = "Channel Staff",
type = {"spell/magical-training", 3},
points = 5,
tactical = { ATTACK = 1 },
range = 8,
reflectable = true,
proj_speed = 20,
requires_target = true,
target = function(self, t)
return {type="bolt", range=self:getTalentRange(t), talent=t, display = {particle=particle, trail=trail}, friendlyfire=false,
-- Like a normal block_path, but goes over friendlies. Also, cannot gain additional range by firing over friendlies.
block_path = function(typ, lx, ly, for_highlights)
-- use default 'block_path'
local dummy_typ = engine.Target:getType({type="bolt"})
local block, hit, hit_radius = dummy_typ.block_path(typ, lx, ly, for_highlights)
local a = game.level.map(lx, ly, engine.Map.ACTOR)
local block_from_range = false
if typ.range and typ.start_x then
local dist = core.fov.distance(typ.start_x, typ.start_y, lx, ly)
if math.floor(dist - typ.range + 0.5) > 0 then block_from_range = true end
elseif typ.range and typ.source_actor and typ.source_actor.x then
local dist = core.fov.distance(typ.source_actor.x, typ.source_actor.y, lx, ly)
if math.floor(dist - typ.range + 0.5) > 0 then block_from_range = true end
end
if a then return block_from_range or (self and self:reactionToward(a) < 0), hit, hit_radius
else return block, hit, hit_radius end
end,
}
end,
getDamageMod = function(self, t) return self:combatTalentWeaponDamage(t, 0.4, 1.1) end,
action = function(self, t)
local weapon = self:hasStaffWeapon()
if not weapon then
game.logPlayer(self, "You need a staff to use this spell.")
return
end
local combat = weapon.combat
local trail = "firetrail"
local particle = "bolt_fire"
local explosion = "flame"
local damtype = combat.damtype
if damtype == DamageType.FIRE then explosion = "flame" particle = "bolt_fire" trail = "firetrail"
elseif damtype == DamageType.COLD then explosion = "freeze" particle = "ice_shards" trail = "icetrail"
elseif damtype == DamageType.ACID then explosion = "acid" particle = "bolt_acid" trail = "acidtrail"
elseif damtype == DamageType.LIGHTNING then explosion = "lightning_explosion" particle = "bolt_lightning" trail = "lightningtrail"
elseif damtype == DamageType.LIGHT then explosion = "light" particle = "bolt_light" trail = "lighttrail"
elseif damtype == DamageType.DARKNESS then explosion = "dark" particle = "bolt_dark" trail = "darktrail"
elseif damtype == DamageType.NATURE then explosion = "slime" particle = "bolt_slime" trail = "slimetrail"
elseif damtype == DamageType.BLIGHT then explosion = "slime" particle = "bolt_slime" trail = "slimetrail"
elseif damtype == DamageType.PHYSICAL then explosion = "dark" particle = "stone_shards" trail = "earthtrail"
else explosion = "manathrust" particle = "bolt_arcane" trail = "arcanetrail" damtype = DamageType.ARCANE
end
local tg = self:getTalentTarget(t)
local x, y = self:getTarget(tg)
if not x or not y then return nil end
-- Compute damage
local dam = self:combatDamage(combat)
local damrange = self:combatDamageRange(combat)
dam = rng.range(dam, dam * damrange)
dam = self:spellCrit(dam)
dam = dam * t.getDamageMod(self, t)
self:projectile(tg, x, y, damtype, dam, {type=explosion})
game:playSoundNear(self, "talents/arcane")
return true
end,
info = function(self, t)
local damagemod = t.getDamageMod(self, t)
return ([[Channel raw mana through your staff, projecting a bolt of your staff's damage type doing %d%% staff damage. The bolt will only hurt hostile targets and pass safely through friendly ones. This attack always has a 100%% chance to hit and ignores target armour.]]):format(damagemod * 100)
end,
}
newTalent{
name = "Staff Mastery",
type = {"spell/magical-training", 4},
mode = "passive",
points = 5,
getDamage = function(self, t) return math.sqrt(self:getTalentLevel(t) / 10) end,
info = function(self, t)
local damage = t.getDamage(self, t)
return ([[Increases damage done with staves by %d%%.]]):format(100 * damage)
end,
}