Skip to content
Snippets Groups Projects
Commit 8d29eb2c authored by Eric Wykoff's avatar Eric Wykoff
Browse files

0 duration paradox clones don't clone inventories or particles

parent 58d7976e
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,6 @@ newTalent{
local damage = t.getDamage(self, t) * 100
local duration = t.getDuration(self, t)
return ([[Attack with your melee weapons for %d%% weapon damage as physical and temporal (warp) damage. If either attack hits you may stun, blind, pin, or confuse the target for %d turns.
The bonus damage scales with your Spellpower.
Blade Threading talents will freely swap to your dual-weapons when activated if you have them in your secondary slots. Additionally you may use the Attack talent in a similar manner.]])
:format(damage, duration)
......
......@@ -45,15 +45,9 @@ newTalent{
-- Grab our target so we can spawn clones
local tg = self:getTalentTarget(t)
local x, y, target = self:getTarget(tg)
if not x or not y or not target then if swap == true then doWardenWeaponSwap(self, t, "blade") end return nil end
if not x or not y or not target or not self:hasLOS(x, y) then if swap == true then doWardenWeaponSwap(self, t, "blade") end return nil end
local __, x, y = self:canProject(tg, x, y)
-- Don't cheese arrow stitching through walls
if not self:hasLOS(x, y) then
game.logSeen(self, "You do not have line of sight.")
return nil
end
local targets = self:archeryAcquireTargets(self:getTalentTarget(t), {one_shot=true, x=x, y=y, no_energy = true})
if not targets then return end
self:archeryShoot(targets, t, {type="bolt", friendlyfire=false, friendlyblock=false}, {mult=t.getDamage(self, t)})
......@@ -61,7 +55,7 @@ newTalent{
-- Summon our clones
if not self.arrow_stitching_done then
for i = 1, 2 do
local m = makeParadoxClone(self, self, 2)
local m = makeParadoxClone(self, self, 0)
m.arrow_stitched_target = target
m.generic_damage_penalty = m.generic_damage_penalty or 0 + t.getDamagePenalty(self, t)
m:attr("archery_pass_friendly", 1)
......
-- ToME - Tales of Maj'Eyal
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2015 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
......@@ -263,9 +264,20 @@ end
-- Spell functions
makeParadoxClone = function(self, target, duration)
-- Don't clone particles or inventory on short lived clones
local restore = false
local old_particles, old_inven
if duration == 0 then
old_particles = target.__particles
old_inventory = target.inven[target.INVEN_INVEN]
target.__particles = {}
target.inven[target.INVEN_INVEN] = nil
restore = true
end
-- Clone them
local m = target:cloneFull{
shader = "shadow_simulacrum",
shader_args = { color = {0.6, 0.6, 0.2}, base = 0.8, time_factor = 1500 },
no_drops = true,
faction = target.faction,
summoner = target, summoner_gain_exp=true,
......@@ -275,6 +287,14 @@ makeParadoxClone = function(self, target, duration)
name = ""..target.name.."'s temporal clone",
desc = [[A creature from another timeline.]],
}
-- restore values if needed
if restore then
target.__particles = old_particles
target.inven[target.INVEN_INVEN] = old_inventory
end
-- remove some values
m:removeAllMOs()
m.make_escort = nil
m.on_added_to_level = nil
......@@ -283,6 +303,7 @@ makeParadoxClone = function(self, target, duration)
mod.class.NPC.castAs(m)
engine.interface.ActorAI.init(m, m)
-- change some values
m.exp_worth = 0
m.energy.value = 0
m.player = nil
......@@ -306,10 +327,6 @@ makeParadoxClone = function(self, target, duration)
if m.talents.T_SUMMON then m.talents.T_SUMMON = nil end
if m.talents.T_MULTIPLY then m.talents.T_MULTIPLY = nil end
-- We use this function... a lot!!
-- So don't duplicate the inventory
if m.inven then m.inven[m.INVEN_INVEN] = nil end
-- Clones never flee because they're awesome
m.ai_tactic = m.ai_tactic or {}
m.ai_tactic.escape = 0
......
......@@ -258,7 +258,7 @@ newTalent{
for x, yy in pairs(grids) do for y, _ in pairs(grids[x]) do
local target_type = Map.ACTOR
local a = game.level.map(x, y, Map.ACTOR)
if a and self:reactionToward(a) < 0 and self:hasLOS(a.x, a.y) then
if a and not a.dead and self:reactionToward(a) < 0 and self:hasLOS(a.x, a.y) then
tgts[#tgts+1] = a
end
end end
......@@ -274,7 +274,7 @@ newTalent{
end
-- Make our clone
local m = makeParadoxClone(self, self, 2)
local m = makeParadoxClone(self, self, 0)
m.generic_damage_penalty = (m.generic_damage_penalty or 0) + t.getDamagePenalty(self, t)
doWardenWeaponSwap(m, t, "blade")
m.on_added_to_level = function(self)
......@@ -296,12 +296,12 @@ newTalent{
end
if not m.blended_target then
local tgts= t.findTarget(self, t)
local attempts = 10
local attempts = 5
while #tgts > 0 and attempts > 0 do
local a, id = rng.tableRemove(tgts)
-- look for space
local tx, ty = util.findFreeGrid(a.x, a.y, 1, true, {[Map.ACTOR]=true})
if tx and ty and not a.dead then
if tx and ty then
m.blended_target = a
game.zone:addEntity(game.level, m, "actor", tx, ty)
break
......@@ -321,7 +321,7 @@ newTalent{
end
-- Make our clone
local m = makeParadoxClone(self, self, 2)
local m = makeParadoxClone(self, self, 0)
m.generic_damage_penalty = (m.generic_damage_penalty or 0) + t.getDamagePenalty(self, t)
m:attr("archery_pass_friendly", 1)
doWardenWeaponSwap(m, t, "bow")
......@@ -370,8 +370,10 @@ newTalent{
if #tgts > 0 then
local a, id = rng.tableRemove(tgts)
local tx, ty = find_space(self, target, m)
m.blended_target = a
game.zone:addEntity(game.level, m, "actor", tx, ty)
if tx and ty then
m.blended_target = a
game.zone:addEntity(game.level, m, "actor", tx, ty)
end
end
end
end
......
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