Passives with callbacks break on unlearning

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
PureQuestion
Master Artificer
Posts: 726
Joined: Fri Feb 03, 2012 3:53 am

Passives with callbacks break on unlearning

#1 Post by PureQuestion »

Code: Select all

Lua Error: /mod/class/Actor.lua:3605: attempt to index a nil value
	At [C]:-1 __newindex
	At /mod/class/Actor.lua:3605 unlearnTalent
	At /mod/dialogs/LevelupDialog.lua:335 learnTalent
	At /mod/dialogs/LevelupDialog.lua:896 onUseTalent
	At /mod/dialogs/LevelupDialog.lua:664 on_use
	At /mod/dialogs/elements/TalentTrees.lua:163 onUse
	At /mod/dialogs/elements/TalentTrees.lua:119 fct
	At /engine/Mouse.lua:52 receiveMouse
	At /engine/Mouse.lua:90 delegate
	At /engine/ui/Dialog.lua:533 mouseEvent
	At /engine/ui/Dialog.lua:312 fct
	At /engine/Mouse.lua:52 

Code: Select all

newTalent{
	name = "Incinerating Blows",
	type = {"corruption/demonic-strength", 1},
	require = str_corrs_req1,
	points = 5,
	mode = "passive",
	radius = function(self, t)
		return  math.floor(self:combatTalentScale(t, 1, 3.2))
	end,
	getChance = function(self, t) 
		if self:attr("is_destroyer") then
			return 25 + (10 * self.is_destroyer)
		else
			return 25
		end
	end,
	getPowerbonus = function(self, t) 
		return 5 * self:getTalentLevel(t)
	end,
	damBonus = function(self, t) return self:combatTalentSpellDamage(t, 25, 90) end,
	bigBonus = function(self, t) return self:combatTalentSpellDamage(t, 25, 160) end,
	callbackOnMeleeAttack = function(self, t, target, hitted)
		local tt = self:isTalentActive(t.id)
		if not tt then return end
		if not hitted then return end
		local tg = {type="hit", range=10, talent=t}
		local dam = self:spellCrit(t.damBonus(self, t))
		self:project(tg, target.x, target.y, DamageType.FIREBURN, dam)
		local procchance = t.getChance(self, t)
		if not rng.percent(procchance) then return end
		local tg = {type="ball", 10, radius=self:getTalentRadius(t), friendlyfire=false}
		local dam = t.bigBonus(self, t)
		self:attr("combat_spellpower", t.getPowerbonus(self, t))
		self:project(tg, target.x, target.y, DamageType.FLAMESHOCK, {dur=2, dam=self:spellCrit(dam)})
		self:attr("combat_spellpower", -t.getPowerbonus(self, t))
		game.level.map:particleEmitter(target.x, target.y, tg.radius, "ball_fire", {radius=tg.radius})
		return
	end,
	info = function(self, t)
		return ([[The power of the Fearscape infuses your weapons: Your melee attacks will deal %0.2f fire damage, spread over 3 turns.
		Additionally, every time you attack, there is a %d%% chance of releasing a burst of powerful fire that will deal %0.2f fire damage to all enemies in radius %d, while also stunning for 2 turns.
		For the purposes of applying the stun, you have %d bonus spellpower.
		The damage will increase with your Spellpower.]]):
		format(
			damDesc(self, DamageType.FIRE, t.damBonus(self, t)),
			t.getChance(self, t),
			damDesc(self, DamageType.FIRE, t.bigBonus(self, t)),
			self:getTalentRadius(t),
			t.getPowerbonus(self, t)
		)
	end,
}
The talent works fine as a sustain, but not as a passive (this one will probably stay sustained but I WANT THEM TO BE POSSIBLE). Plz fix.

Post Reply