Page 1 of 1

[1.6.4] Magnetism tree lacks definition of shield_combat

Posted: Wed Dec 04, 2019 9:37 pm
by zczczc1680
To perform a shield attack, the game usually do sth like this(example: Shield of Light)

Code: Select all

callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam)
		[b]local shield = self:hasShield()[/b]
		if hitted and not target.dead and shield and not self.turn_procs.shield_of_light then
			self.turn_procs.shield_of_light = true
			self:attackTargetWith(target, [b]shield.special_combat[/b], DamageType.LIGHT, t.getShieldDamage(self, t))
		end
	end,
That codes allready causes nil weapon type(actually the same bug) if a steamsaw is considered to be a shield(so we get wrong damage if we dual wield steamsaw and trigger Shield_of_Light shield attack).

or better like this (damage of Lightning_Web)

Code: Select all

newDamageType{
	name = "lightning web", type = "LIGHTNING_WEB",
	projector = function(src, x, y, type, dam, state)
		state = initState(state)
		useImplicitCrit(src, state)
		local target = game.level.map(x, y, Map.ACTOR)
		if target then
			if src:reactionToward(target) < 0 then
				[b]local shield, shield_combat = src:hasShield()[/b]
				if not shield then return nil end
				src:attackTargetWith(target,[b] shield_combat[/b], DamageType.LIGHTNING, dam.dam)
			else
				target:setEffect(target.EFF_LIGHTNING_WEB, 1, { src=src, power=dam.block } )
			end
		end
	end,
}

Unfortunately, the whole Magnetism talent tree except the example above lacks definition of shield_combat while using it as a parameter.
The following codes are a part of the definition of talent Magnetic Field

Code: Select all

	action = function(self, t)
		local tg = self:getTalentTarget(t)
		[b]if not self:hasShield() then return end[/b]
		self:project(tg, self.x, self.y, function(px, py)
			local target = game.level.map(px, py, Map.ACTOR)
			if not target then return end
			self:attackTargetWith(target, [b]shield_combat[/b], DamageType.LIGHTNING, t.getDamage(self,t))
			if target:canBe("knockback") then target:knockback(self.x, self.y, self:getTalentRadius(t)) end
		end)
Unlike previous examples, the variable shield_combat has not been defined.

To prove what I said, you can try play a adventurer character with a steamsaw(can be considered as a shield) in mainhand and with the tentacle talent. You will see that the attacks from Static Shock wont trigger tentacle attacks(but they do trigger other procs, and the same with attacks from Shield of Light), since there is an extra condition check for tentacle attacks:

Code: Select all

local attackTargetWith = _M.attackTargetWith
function _M:attackTargetWith(target, weapon, damtype, ...)
	local speed, hit, dam = attackTargetWith(self, target, weapon, damtype, ...)

	[b]if weapon[/b] and self:knowTalent(self.T_MUTATED_HAND) and not self:attr("tentacle_hand_prevent") and self:callTalent(self.T_MUTATED_HAND, "canTentacleCombat") and weapon.talented ~= "tentacles" then
It confirms that shield_combat = nil in attacks from Static Shock.

Re: [1.6.4] Magnetism tree lacks definition of shield_combat

Posted: Sun Dec 29, 2019 6:07 pm
by Steven Aus
Yeah, definitely a bug.

Re: [1.6.4] Magnetism tree lacks definition of shield_combat

Posted: Mon Aug 24, 2020 10:27 am
by Horken
This bug is still present in 1.6.7, all Magnetism tree shield attacks do not attack with equipped shield

Re: [1.6.4] Magnetism tree lacks definition of shield_combat

Posted: Wed Aug 26, 2020 2:00 pm
by darkgod
fixed for 1.7