Trying to pull errors out of the following mess which used to be "Inner Demons" talent ... while not knowing what I am doing

newTalent{
name = "Must Kill Another",
--code altered from Inner Demons
type = {"race/Chrono_Xorn", 1},
points = 1,
mode = "passive",
require = racial_req1,
cooldown = 0,
paradox = 0,
range = 1000000,
direct_hit = true,
requires_target = true,
getChance = function(self, t)
return 50
end,
on_kill = function(self, t, target)
summon_inner_demons = function(self, target, t)
-- Find space
local x, y = util.findFreeGrid(target.x, target.y, 1, true, {[Map.ACTOR]=true})
if not x then
return
end
--if target:attr("summon_time") then return end
local m = target:cloneFull{
shader = "shadow_simulacrum",
shader_args = { color = {0.6, 0.0, 0.3}, base = 0.6, time_factor = 1500 },
no_drops = false, keep_inven_on_death = false,
faction = "enemies",
summoner = self, summoner_gain_exp=false,
summon_time = 1000000,
ai_target = {actor=target},
ai = "summoned", ai_real = "tactical",
name = ""..target.name.."'s more dangerous self from another timeline",
desc = [[A temporal clone that resembles the creature it came from but seems more dangerous.]],
}
m:removeAllMOs()
m.make_escort = nil
m.on_added_to_level = nil
m.on_added = nil
mod.class.NPC.castAs(m)
engine.interface.ActorAI.init(m, m)
m.exp_worth = 1
m.energy.value = 1
m.player = nil
m.max_life = m.max_life / 4 / m.rank
m.life = util.bound(m.life, 0, m.max_life)
m.inc_damage.all = (m.inc_damage.all or 0) - 50
m.forceLevelup = function() end
m.on_die = nil
m.die = nil
m.puuid = nil
m.on_acquire_target = nil
m.no_inventory_access = true
m.on_takehit = nil
m.seen_by = nil
m.can_talk = nil
m.clone_on_hit = nil
m.self_resurrect = nil
--if m.talents.T_SUMMON then m.talents.T_SUMMON = nil end
--if m.talents.T_MULTIPLY then m.talents.T_MULTIPLY = nil end
-- Inner Demon's never flee
m.ai_tactic = m.ai_tactic or {}
m.ai_tactic.escape = 0
-- Remove some talents
local tids = {}
for tid, _ in pairs(m.talents) do
local t = m:getTalentFromId(tid)
if t.no_npc_use then tids[#tids+1] = t end
end
for i, t in ipairs(tids) do
if t.mode == "sustained" and m:isTalentActive(t.id) then m:forceUseTalent(t.id, {ignore_energy=true}) end
m.talents[t.id] = nil
end
-- remove detrimental timed effects
local effs = {}
for eff_id, p in pairs(m.tmp) do
local e = m.tempeffect_def[eff_id]
if e.status == "detrimental" then
effs[#effs+1] = {"effect", eff_id}
end
end
while #effs > 0 do
local eff = rng.tableRemove(effs)
if eff[1] == "effect" then
m:removeEffect(eff[2])
end
end
-- make more dangerous
-- inc_stats = { str=20, mag=20, wil=20, cun=20, dex=20, con=20, lck=20 },
game.zone:addEntity(game.level, m, "actor", x, y)
game.level.map:particleEmitter(x, y, 1, "generic_teleport", {rm=60, rM=130, gm=20, gM=110, bm=90, bM=130, am=70, aM=180})
game.logSeen(target, "#F53CBE#%s's more survivable self from another timeline manifests!", target.name:capitalize())
end,
action = function(self, t)
--[THE CURRENT ERROR says there is an unexpected symbol near the above '=', but this code I did not even change so what does the error mean? This error wont let the race screen load.]--
local tg = {type="hit", range=self:getTalentRange(t), talent=t}
local x, y = self:getTarget(tg)
if not x or not y then return nil end
local _ _, x, y = self:canProject(tg, x, y)
if not x or not y then return nil end
local target = game.level.map(x, y, Map.ACTOR)
if not target then return nil end
end
end,
info = function(self, t)
return ([[When you kill a creature, you have a 50 percent chance to summon its clone from another timeline, one that is more likely to survive.]])
end,
}