Page 1 of 1

Possible bug with Dismayed

Posted: Tue Dec 04, 2012 9:19 pm
by Hachem_Muche
If you have a high crit rate against a DISMAYED target that has crit reduction, you can actually have less chance to crit than if the target was not DISMAYED. They way it's calculated now, crit bonuses from talents are added, then Dismayed is checked, possibly cancelling the bonuses, and then crit reductions are applied. So for example:

Base 55%
Bonus 60%
== 115%

DISMAYED 100% (overwrite)

Crit red -50%
Net Crit 50%

Instead of

Base 55%
DISMAYED 100% (overwrite)

Bonus 60%
== 115%

Crit red -50%
Net Crit 65%

Moving the DISMAYED check solves the problem:

Code: Select all

-- Computes physical crit for a damage
function _M:physicalCrit(dam, weapon, target, atk, def, add_chance, crit_power_add)
	self.turn_procs.is_crit = nil

	local tier_diff = self:getTierDiff(atk, def)

	local chance = self:combatCrit(weapon) + (add_chance or 0)
	crit_power_add = crit_power_add or 0

-- Move check to here to avoid cancelling bonuses
	if target:hasEffect(target.EFF_DISMAYED) then
		chance = 100
	end

	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_crit_vulnerable") then
		chance = chance + target:attr("combat_crit_vulnerable")
	end
	if target:hasEffect(target.EFF_SET_UP) then
		local p = target:hasEffect(target.EFF_SET_UP)
		if p and p.src == self then
			chance = chance + p.power
		end
	end

	chance = chance - target:combatCritReduction()

--	if target:hasEffect(target.EFF_DISMAYED) then
--		chance = 100
--	end

	-- Scoundrel's Strategies
	if self:attr("cut") and target:knowTalent(self.T_SCOUNDREL) then
		chance = chance - (5 + (target:getTalentLevel(self.T_SCOUNDREL)*5))
	end

	if self:isTalentActive(self.T_STEALTH) and self:knowTalent(self.T_SHADOWSTRIKE) then
		chance = 100
		crit_power_add = crit_power_add + self:getTalentLevel(self.T_SHADOWSTRIKE) / 7
	end

	chance = util.bound(chance, 0, 100)

	print("[PHYS CRIT %]", chance)
	if rng.percent(chance) then
		if target:hasEffect(target.EFF_OFFGUARD) then
			crit_power_add = crit_power_add + 0.1
		end
		self.turn_procs.is_crit = "physical"
		self.turn_procs.crit_power = (1.5 + crit_power_add + (self.combat_critical_power or 0) / 100)
		dam = dam * (1.5 + crit_power_add + (self.combat_critical_power or 0) / 100)
		crit = true

		if self:knowTalent(self.T_EYE_OF_THE_TIGER) then self:triggerTalent(self.T_EYE_OF_THE_TIGER, nil, "physical") end
	end
	return dam, crit
end

Re: Possible bug with Dismayed

Posted: Tue Dec 04, 2012 9:37 pm
by darkgod
fixed