Skip to content
Snippets Groups Projects
Commit 0cc995ab authored by dg's avatar dg
Browse files

upadte Crused

git-svn-id: http://svn.net-core.org/repos/t-engine4@1248 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8b643824
No related branches found
No related tags found
No related merge requests found
Showing
with 540 additions and 19 deletions
......@@ -189,6 +189,13 @@ function _M:act()
t.do_regenLife(self, t)
end
self:regenResources()
--if self.hate and self.hate > 0 then
-- -- hate goes down more based on time since last kill
-- self.hate_time_since_kill = math.min((self.hate_time_since_kill or 0) + 1, 130)
-- if self.hate_time_since_kill > 30 then
-- self.hate = math.max(self.hate - (0.015 * (self.hate_time_since_kill - 30) / 100), 0)
-- end
--end
-- Compute timed effects
self:timedEffects()
......@@ -646,6 +653,11 @@ function _M:onTakeHit(value, src)
src:setEffect(src.EFF_BLOODLUST, 1, {})
end
if self:knowTalent(self.T_RAMPAGE) then
local t = self:getTalentFromId(self.T_RAMPAGE)
t:onTakeHit(self, value / self.max_life)
end
return value
end
......@@ -692,6 +704,11 @@ function _M:die(src)
src.blood_frenzy = src.blood_frenzy + src:getTalentLevel(src.T_BLOOD_FRENZY) * 2
end
if src and src.knowTalent and src:knowTalent(src.T_CRUEL_VIGOR) then
local t = src:getTalentFromId(src.T_CRUEL_VIGOR)
t.on_kill(src, t)
end
-- Increase vim
if src and src.attr and src:attr("vim_on_death") and not self:attr("undead") then src:incVim(src:attr("vim_on_death")) end
......@@ -1068,7 +1085,6 @@ end
-- @return true to continue, false to stop
function _M:postUseTalent(ab, ret)
if not ret then return end
if not ab.no_energy then
if ab.type[1]:find("^spell/") then
self:useEnergy(game.energy_to_act * self:combatSpellSpeed())
......@@ -1151,7 +1167,6 @@ function _M:postUseTalent(ab, ret)
self:incEquilibrium(ab.equilibrium)
end
end
if trigger and self:hasEffect(self.EFF_BURNING_HEX) then
local p = self:hasEffect(self.EFF_BURNING_HEX)
DamageType:get(DamageType.FIRE).projector(p.src, self.x, self.y, DamageType.FIRE, p.dam)
......@@ -1159,7 +1174,6 @@ function _M:postUseTalent(ab, ret)
-- Cancel stealth!
if ab.id ~= self.T_STEALTH and ab.id ~= self.T_HIDE_IN_PLAIN_SIGHT then self:breakStealth() end
return true
end
......@@ -1329,6 +1343,16 @@ function _M:canSeeNoCache(actor, def, def_pct)
return false, chance
end
end
-- check cursed pity talent
if actor:knowTalent(self.T_PITY) then
local t = actor:getTalentFromId(self.T_PITY)
if math.floor(core.fov.distance(self.x, self.y, actor.x, actor.y)) >= actor:getTalentRange(t) then
print("* pity: ", math.floor(core.fov.distance(self.x, self.y, actor.x, actor.y)), actor:getTalentRange(t))
return false, 0
end
end
if def ~= nil then
return def, def_pct
else
......
......@@ -553,7 +553,7 @@ function _M:setupCommands()
self:changeLevel(1, "slime-tunnels")
-- self.player:grantQuest("master-jeweler")
end
end,
end
}
self.key:addBinds
{
......
......@@ -487,6 +487,7 @@ function _M:combatSpellpower(mod)
if self:hasEffect(self.EFF_BLOODLUST) then
add = add + self:hasEffect(self.EFF_BLOODLUST).dur
end
return (self.combat_spellpower + add + self:getMag()) * mod
end
......@@ -533,6 +534,10 @@ function _M:physicalCrit(dam, weapon, target)
local chance = self:combatCrit(weapon)
local crit = false
if self:knowTalent(self.T_BACKSTAB) and target:attr("stunned") then chance = chance + self:getTalentLevel(self.T_BACKSTAB) * 10 end
if target:attr("combat_critical") then
chance = chance + target:attr("combat_critical")
end
if target:hasHeavyArmor() and target:knowTalent(target.T_HEAVY_ARMOUR_TRAINING) then
chance = chance - target:getTalentLevel(target.T_HEAVY_ARMOUR_TRAINING) * 1.9
......
......@@ -53,7 +53,9 @@ newBirthDescriptor{
["cursed/endless-hunt"]={true, 0.0},
["cursed/cursed-form"]={true, 0.0},
["technique/combat-training"]={true, 0.3},
["cunning/survival"]={false, 0.0}
["cunning/survival"]={false, 0.0},
["cursed/rampage"]={false, 0.0},
["cursed/dark-figure"]={false, 0.0},
},
talents = {
[ActorTalents.T_UNNATURAL_BODY] = 1,
......
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 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
local toggle = false
return { generator = function()
local ad = rng.range(0, 360)
local a = math.rad(ad)
local dir = math.rad(ad)
local r = rng.range(6, 14)
local dirchance = rng.chance(2)
return {
trail = 1,
life = 35,
size = 7, sizev = -0.08, sizea = 0,
x = r * math.cos(a), xv = 0, xa = 0,
y = r * math.sin(a), yv = 0, ya = 0,
dir = dir, dirv = dirchance and -0.01 or 0.01, dira = 0,
vel = 1.2, velv = 0.04, vela = 0,
r = 16, rv = -0.25, ra = 0,
g = 0, gv = 0, ga = 0,
b = 32, bv = -0.5, ba = 0,
a = rng.range(20, 40) / 255, av = 0, aa = 0,
}
end, },
function(self)
-- toggle = not toggle
-- if toggle then
self.ps:emit(5)
-- end
end,
200
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 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
local toggle = false
return { generator = function()
local ad = rng.range(0, 360)
local a = math.rad(ad)
local r = rng.range(0, 20)
return {
trail = 1,
life = 35,
size = 20, sizev = 0.3, sizea = -0.05,
x = r * math.cos(a) - 10, xv = 0, xa = 0,
y = r * math.sin(a) - 10, yv = 0, ya = 0,
dir = 0, dirv = 0, dira = 0,
vel = 0, velv = 0, vela = 0,
r = 200 / 255, rv = 0, ra = 0,
g = 16 / 255, gv = 0, ga = 0,
b = 17 / 255, bv = 0, ba = 0,
a = rng.range(40, 50) / 255, av = -1 / 255, aa = 0
}
end, },
function(self)
--toggle = not toggle
--if toggle then
self.ps:emit(1)
--end
end,
35
......@@ -83,13 +83,13 @@ newTalent{
return true
end,
do_regenLife = function(self, t)
heal = math.sqrt(self:getTalentLevel(t) * 2) * self.max_life * 0.003
heal = math.sqrt(self:getTalentLevel(t) * 2) * self.max_life * 0.0027
if heal > 0 then
self:heal(heal)
end
end,
info = function(self, t)
heal = math.sqrt(self:getTalentLevel(t) * 2) * self.max_life * 0.003
heal = math.sqrt(self:getTalentLevel(t) * 2) * self.max_life * 0.0027
local level = self:getTalentLevelRaw(t)
if level == 1 then
return ([[The curse has twisted your body into an unnatural form.
......@@ -185,7 +185,7 @@ newTalent{
cooldown = 400,
action = function(self, t)
local increase = 2 + self:getTalentLevel(t) * 0.9
hate = math.min(self.max_hate, self.hate + increase)
self.hate = math.min(self.max_hate, self.hate + increase)
self:incHate(hate)
local damage = self.max_life * 0.25
......
......@@ -22,7 +22,8 @@ newTalentType{ type="cursed/cursed-form", name = "cursed form", description = "Y
newTalentType{ type="cursed/slaughter", name = "slaughter", description = "Your axe yearns for its next victim." }
newTalentType{ type="cursed/endless-hunt", name = "endless hunt", description = "Each day you lift your weary body and begin the unending hunt." }
newTalentType{ type="cursed/gloom", name = "gloom", description = "All those in your sight must share your despair." }
newTalentType{ type="cursed/rampage", name = "rampage", generic = true, description = "Let loose the hate that has grown within." }
newTalentType{ type="cursed/dark-figure", name = "dark figure", generic = true, description = "Life as an outcast has given you time to reflect on your misfortunes." }
-- Generic requires for corruptions based on talent level
cursed_wil_req1 = {
......@@ -71,3 +72,5 @@ load("/data/talents/cursed/cursed-form.lua")
load("/data/talents/cursed/slaughter.lua")
load("/data/talents/cursed/endless-hunt.lua")
load("/data/talents/cursed/gloom.lua")
load("/data/talents/cursed/rampage.lua")
load("/data/talents/cursed/dark-figure.lua")
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 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
local function getHateMultiplier(self, min, max)
return (min + ((max - min) * self.hate / 10))
end
newTalent{
name = "Radiant Fear",
type = {"cursed/dark-figure", 1},
require = cursed_wil_req1,
points = 5,
cooldown = 50,
hate = 0.1,
getRadius = function(self, t) return 3 + math.floor((self:getTalentLevelRaw(t) - 1) / 2) end,
getDuration = function(self, t) return 5 + math.floor(self:getTalentLevel(t) * 2) end,
range = 10,
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t), talent=t}
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
if math.floor(core.fov.distance(self.x, self.y, x, y)) > self:getTalentRange(t) then
game.logPlayer(self, "You are too far to from the target!")
return nil
end
local radius = t.getRadius(self, t)
local duration = t.getDuration(self, t)
target:setEffect(target.EFF_RADIANT_FEAR, duration, { radius = radius, knockback = 1, source = self })
return true
end,
info = function(self, t)
local radius = t.getRadius(self, t)
local duration = t.getDuration(self, t)
return ([[Fear radiates from your target in a radius of %d for %d turns driving all others away.]]):format(radius, duration)
end,
}
newTalent{
name = "Suppression",
type = {"cursed/dark-figure", 2},
mode = "passive",
require = cursed_wil_req2,
points = 5,
on_learn = function(self, t)
end,
on_unlearn = function(self, t)
end,
getPercent = function(self, t) return 15 + math.floor(self:getTalentLevel(t) * 10) end,
info = function(self, t)
local percent = t.getPercent(self, t)
return ([[The time you have spent supressing the curse has taught you self control. The duration of most non-magical effects (physical, mental, poisons, diseases, hexes and curses) are reduced by %d%%.]]):format(percent)
end,
}
newTalent{
name = "Cruel Vigor",
type = {"cursed/dark-figure", 3},
mode = "passive",
require = cursed_wil_req3,
points = 5,
on_learn = function(self, t)
end,
on_unlearn = function(self, t)
end,
on_kill = function(self, t)
local speed = t.getSpeed(self, t)
local duration = t.getDuration(self, t)
self:setEffect(self.EFF_INVIGORATED, duration, { speed = speed })
end,
getSpeed = function(self, t) return 20 + math.floor(self:getTalentLevel(t) * 5) end,
getDuration = function(self, t) return 3 end,
info = function(self, t)
local speed = t.getSpeed(self, t)
local duration = t.getDuration(self, t)
return ([[You are invigorated by the death around you. Each life you take grants %d%% speed for %d more turns.]]):format(100 + speed, duration)
end,
}
--newTalent{
-- name = "Tools of the Trade",
-- type = {"cursed/dark-figure", 3},
-- mode = "passive",
-- require = cursed_wil_req3,
-- points = 5,
-- on_learn = function(self, t)
-- end,
-- on_unlearn = function(self, t)
-- end,
-- identify = function(self, t, object)
-- if object.level_range and object.level_range[1] <= self:getTalentLevel(t) * 10 then
-- object:identify(true)
-- game.logPlayer(self, "You have identified the %s.", object:getName{no_count=true})
-- end
-- end,
-- info = function(self, t)
-- return ([[Your obsessions have lead you to a greater knowlege of the tools of death allowing you to identify weapons and armor that you pick up. You can identify more powerful items as you increase your skill.]])
-- end,
--}
newTalent{
name = "Pity",
type = {"cursed/dark-figure", 4},
mode = "passive",
require = cursed_wil_req4,
points = 5,
on_learn = function(self, t)
end,
on_unlearn = function(self, t)
end,
range = function(self, t) return 16 - math.floor(self:getTalentLevel(t) * 2) end,
info = function(self, t)
local range = t.range(self, t)
return ([[You hide your terrible nature behind a pitiful figure. Those that see you from a distance of %d will ignore you.]]):format(range)
end,
}
......@@ -176,7 +176,7 @@ newTalent{
end
if resetTorment then
self.torment_turns = math.floor(15 - self:getTalentLevelRaw(tTorment))
self.torment_turns = 20
end
-- absorb life
......@@ -220,7 +220,7 @@ newTalent{
local baseDamage = 30 + self:getWil() * 0.4 * self:getTalentLevel(t)
local attackStrength = 0.3 + self:getTalentLevel(t) * 0.12
local effectiveness = getWillFailureEffectiveness(self, 30, 95, attackStrength)
return ([[Your rage builds within you for 12 turns then unleashes itself for %d to %d hate-based blight damage on the first one to enter your gloom. (%d effectiveness)]]):format(baseDamage * .5, baseDamage * 1.5, effectiveness)
return ([[Your rage builds within you for 20 turns then unleashes itself for %d to %d hate-based blight damage on the first one to enter your gloom. (%d effectiveness)]]):format(baseDamage * .5, baseDamage * 1.5, effectiveness)
end,
}
......
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 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
local function getHateMultiplier(self, min, max)
return (min + ((max - min) * self.hate / 10))
end
newTalent{
name = "Rampage",
type = {"cursed/rampage", 1},
require = cursed_str_req1,
points = 5,
cooldown = 475,
hate = 0.1,
action = function(self, t, hateLoss)
local hateLoss = 0
local critical = 0
local damage = 0
local speed = 0
local attack = 0
local evasion = 0
local hateMultiplier = getHateMultiplier(self, 0.1, 1.0)
critical = t.getCritical(self, t) * hateMultiplier
if not hateLoss then
hateLoss = t.getHateLoss(self, t)
end
local duration = 5
local tBrutality = self:getTalentFromId(self.T_BRUTALITY)
if tBrutality then
duration = tBrutality.getDuration(self, tBrutality)
damage = tBrutality.getDamage(self, tBrutality) * hateMultiplier
end
local tReflexes = self:getTalentFromId(self.T_REFLEXES)
if tReflexes then
speed = tReflexes.getSpeed(self, tReflexes) * hateMultiplier
end
local tInstincts = self:getTalentFromId(self.T_INSTINCTS)
if tInstincts then
attack = tInstincts.getAttack(self, tInstincts) * hateMultiplier
evasion = tInstincts.getEvasion(self, tInstincts) * hateMultiplier
end
self:setEffect(self.EFF_RAMPAGE, duration, { critical = critical, damage = damage, speed = speed, attack = attack, evasion = evasion, hateLoss = hateLoss })
return true
end,
getHateLoss = function(self, t) return 0.5 - 0.1 * self:getTalentLevelRaw(t) end,
getCritical = function(self, t) return 8 * self:getTalentLevel(t) end,
onTakeHit = function(t, self, percentDamage)
if percentDamage < 10 then return false end
if self:hasEffect(self.EFF_RAMPAGE) then return false end
if rng.percent(1 + self:getTalentLevel(t) * 0.4) then
action(self, t, 0)
return true
end
end,
info = function(self, t)
local duration = 5
local tBrutality = self:getTalentFromId(self.T_BRUTALITY)
if tBrutality then
duration = tBrutality.getDuration(self, tBrutality)
end
local hateLoss = t.getHateLoss(self, t)
local critical = t.getCritical(self, t)
return ([[You enter into a terrible rampage for %d turns destroying everything in your path. There is a small chance you will rampage when you take significant damage.
(%0.1f hate loss, +%d%% to %d%% hate-based critical chance)]]):format(duration, hateLoss, critical * 0.3, critical * 1.0)
end,
}
newTalent{
name = "Brutality",
type = {"cursed/rampage", 2},
mode = "passive",
require = cursed_str_req2,
points = 5,
on_learn = function(self, t)
end,
on_unlearn = function(self, t)
end,
getDuration = function(self, t) return 5 + math.floor(2 * self:getTalentLevel(t)) end,
getDamage = function(self, t) return 10 + 10 * self:getTalentLevel(t) end,
info = function(self, t)
local duration = t.getDuration(self, t)
local damage = t.getDamage(self, t)
return ([[Add brutality to your rampage.
(Rampage lasts %d turns, +%d%% to %d%% hate-based damage)]]):format(duration, damage * 0.1, damage * 1.0)
end,
}
newTalent{
name = "Reflexes",
type = {"cursed/rampage", 3},
require = cursed_str_req3,
points = 5,
mode = "passive",
on_learn = function(self, t)
local tRampage = self:getTalentFromId(self.T_RAMPAGE)
tRampage.cooldown = tRampage.cooldown - 25
print("* cooldown:", tRampage.cooldown)
end,
on_unlearn = function(self, t)
local tRampage = self:getTalentFromId(self.T_RAMPAGE)
tRampage.cooldown = tRampage.cooldown + 25
print("* cooldown:", tRampage.cooldown)
end,
getCooldown = function(self, t) return 475 - math.floor(25 * self:getTalentLevelRaw(t)) end,
getSpeed = function(self, t) return 15 + 15 * self:getTalentLevel(t) end,
info = function(self, t)
local cooldown = t.getCooldown(self, t)
local speed = t.getSpeed(self, t)
return ([[Add reflexes to your rampage.
(Rampage cooldow is %d turns, +%d%% to %d%% speed)]]):format(cooldown, speed * 0.1, speed * 1.0)
end,
}
newTalent{
name = "Instincts",
type = {"cursed/rampage", 4},
mode = "passive",
require = cursed_str_req4,
points = 5,
on_learn = function(self, t)
end,
on_unlearn = function(self, t)
end,
getAttack = function(self, t) return 10 + 10 * self:getTalentLevel(t) end,
getEvasion = function(self, t) return 6 * self:getTalentLevel(t) end,
info = function(self, t)
local attack = t.getAttack(self, t)
local evasion = t.getEvasion(self, t)
return ([[Add instincts to your rampage.
(+%d%% to %d%% hate-based attack, +%d%% to %d%% hate-based evasion)]]):format(attack * 0.1, attack * 1.0, evasion * 0.1, evasion * 1.0)
end,
}
......@@ -55,7 +55,7 @@ newTalent{
newTalent{
name = "Frenzy",
type = {"cursed/slaughter", 1},
type = {"cursed/slaughter", 2},
require = cursed_str_req2,
points = 5,
random_ego = "attack",
......
......@@ -1267,7 +1267,7 @@ newEffect{
newEffect{
name = "GLOOM_WEAKNESS",
desc = "Gloom Weakness",
type = "physical",
type = "mental",
status = "detrimental",
parameters = { atk=10, dam=10 },
on_gain = function(self, err) return "#F53CBE##Target# is weakened by the gloom." end,
......@@ -1287,7 +1287,7 @@ newEffect{
newEffect{
name = "GLOOM_SLOW",
desc = "Slowed by the gloom",
type = "magical",
type = "mental",
status = "detrimental",
parameters = { power=0.1 },
on_gain = function(self, err) return "#F53CBE##Target# moves reluctantly!", "+Slow" end,
......@@ -1306,7 +1306,7 @@ newEffect{
newEffect{
name = "GLOOM_STUNNED",
desc = "Stunned by the gloom",
type = "physical",
type = "mental",
status = "detrimental",
parameters = {},
on_gain = function(self, err) return "#F53CBE##Target# is paralyzed with fear!", "+Stunned" end,
......@@ -1325,7 +1325,7 @@ newEffect{
newEffect{
name = "GLOOM_CONFUSED",
desc = "Confused by the gloom",
type = "magical",
type = "mental",
status = "detrimental",
parameters = {},
on_gain = function(self, err) return "#F53CBE##Target# is lost in dispair!", "+Confused" end,
......@@ -1344,7 +1344,7 @@ newEffect{
newEffect{
name = "STALKER",
desc = "Stalking",
type = "physical",
type = "mental",
status = "beneficial",
parameters = {},
activate = function(self, eff)
......@@ -1362,7 +1362,7 @@ newEffect{
newEffect{
name = "STALKED",
desc = "Being Stalked",
type = "physical",
type = "mental",
status = "detrimental",
parameters = {},
activate = function(self, eff)
......@@ -1404,7 +1404,7 @@ newEffect{
newEffect{
name = "DOMINATED",
desc = "Dominated",
type = "physical",
type = "mental",
status = "detrimental",
on_gain = function(self, err) return "#F53CBE##Target# has been dominated!", "+Dominated" end,
on_lose = function(self, err) return "#F53CBE##Target# is no longer dominated.", "-Dominated" end,
......@@ -1421,4 +1421,99 @@ newEffect{
self.dominatedDamMult = nil
self:removeParticles(eff.particle)
end,
}
newEffect{
name = "RAMPAGE",
desc = "Rampaging",
type = "physical",
status = "beneficial",
parameters = { hateLoss = 0, critical = 0, damage = 0, speed = 0, attack = 0, evasion = 0 }, -- use percentages not fractions
on_gain = function(self, err) return "#F53CBE##Target# begins rampaging!", "+Rampage" end,
on_lose = function(self, err) return "#F53CBE##Target# is no longer rampaging.", "-Rampage" end,
activate = function(self, eff)
if eff.hateLoss or 0 > 0 then eff.hateLossId = self:addTemporaryValue("hate_regen", -eff.hateLoss) end
if eff.critical or 0 > 0 then eff.criticalId = self:addTemporaryValue("combat_physcrit", eff.critical) end
if eff.damage or 0 > 0 then eff.damageId = self:addTemporaryValue("inc_damage", {[DamageType.PHYSICAL]=eff.damage}) end
if eff.speed or 0 > 0 then eff.speedId = self:addTemporaryValue("energy", {mod=eff.speed * 0.01}) end
if eff.attack or 0 > 0 then eff.attackId = self:addTemporaryValue("combat_atk", self.combat_atk * eff.attack * 0.01) end
if eff.evasion or 0 > 0 then eff.evasionId = self:addTemporaryValue("evasion", eff.evasion) end
eff.particle = self:addParticles(Particles.new("rampage", 1))
end,
deactivate = function(self, eff)
if eff.hateLossId then self:removeTemporaryValue("hate_regen", eff.hateLossId) end
if eff.criticalId then self:removeTemporaryValue("combat_physcrit", eff.criticalId) end
if eff.damageId then self:removeTemporaryValue("inc_damage", eff.damageId) end
if eff.speedId then self:removeTemporaryValue("energy", eff.speedId) end
if eff.attackId then self:removeTemporaryValue("combat_atk", eff.attackId) end
if eff.evasionId then self:removeTemporaryValue("evasion", eff.evasionId) end
self:removeParticles(eff.particle)
end,
}
newEffect{
name = "RADIANT_FEAR",
desc = "Radiating Fear",
type = "mental",
status = "beneficial",
parameters = { knockback = 1, radius = 3 },
on_gain = function(self, err) return "#F53CBE##Target# is surrounded by fear!", "+Radiant Fear" end,
on_lose = function(self, err) return "#F53CBE##Target# is no longer surrounded by fear.", "-Radiant Fear" end,
activate = function(self, eff)
eff.particle = self:addParticles(Particles.new("radiant_fear", 1))
end,
deactivate = function(self, eff)
self:removeParticles(eff.particle)
end,
on_timeout = function(self, eff)
self:project({type="ball", radius=eff.radius, friendlyfire=false}, self.x, self.y, function(xx, yy)
local target = game.level.map(xx, yy, game.level.map.ACTOR)
if target and target ~= self and target ~= eff.source and target:canBe("knockback") then
-- attempt to move target away from self
local currentDistance = core.fov.distance(self.x, self.y, xx, yy)
local bestDistance, bestX, bestY
for i = 0, 8 do
local x = xx + (i % 3) - 1
local y = yy + math.floor((i % 9) / 3) - 1
if x ~= xx or y ~= yy then
local distance = core.fov.distance(self.x, self.y, x, y)
if distance > currentDistance and (not bestDistance or distance > maxDistance) then
-- this is a move away, see if it works
if game.level.map:isBound(x, y) and not game.level.map:checkAllEntities(x, y, "block_move", target) then
bestDistance, bestX, bestY = distance, x, y
break
end
end
end
end
if bestDistance then
target:move(bestX, bestY, true)
if not target.did_energy then target:useEnergy() end
end
end
end)
end,
}
newEffect{
name = "INVIGORATED",
desc = "Invigorated",
type = "mental",
status = "beneficial",
parameters = { speed = 30, duration = 3 },
on_gain = function(self, err) return nil, "+Invigorated" end,
on_lose = function(self, err) return nil, "-Invigorated" end,
activate = function(self, eff)
eff.tmpid = self:addTemporaryValue("energy", {mod=eff.speed * 0.01})
end,
deactivate = function(self, eff)
self:removeTemporaryValue("energy", eff.tmpid)
end,
on_merge = function(self, old_eff, new_eff)
old_eff.dur = math.min(old_eff.dur + new_eff.dur, 15)
return old_eff
end,
}
\ No newline at end of file
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