Skip to content
Snippets Groups Projects
Commit 764fe06b authored by DarkGod's avatar DarkGod
Browse files

Auto hit/auto crit attacks now use a better mechanism that is not affected by...

Auto hit/auto crit attacks now use a better mechanism that is not affected by actualy hit/crit chance
parent 30543d5a
No related branches found
No related tags found
No related merge requests found
......@@ -399,12 +399,11 @@ function _M:attackTargetWith(target, weapon, damtype, mult, force_dam)
elseif self:checkEvasion(target) then
evaded = true
self:logCombat(target, "#Target# evades #Source#.")
elseif self:checkHit(atk, def) and (self:canSee(target) or self:attr("blind_fight") or rng.chance(3)) then
elseif self.turn_procs.auto_melee_hit or (self:checkHit(atk, def) and (self:canSee(target) or self:attr("blind_fight") or rng.chance(3))) then
local pres = util.bound(target:combatArmorHardiness() / 100, 0, 1)
if target.knowTalent and target:hasEffect(target.EFF_DUAL_WEAPON_DEFENSE) then
local deflect = math.min(dam, target:callTalent(target.T_DUAL_WEAPON_DEFENSE, "doDeflect"))
if deflect > 0 then
-- self:logCombat(target, "#Target# parries %d damage from #Source#'s attack.", deflect)
game:delayedLogDamage(self, target, 0, ("%s(%d parried#LAST#)"):format(DamageType:get(damtype).text_color or "#aaaaaa#", deflect), false)
dam = math.max(dam - deflect,0)
print("[ATTACK] after DUAL_WEAPON_DEFENSE", dam)
......@@ -412,7 +411,6 @@ function _M:attackTargetWith(target, weapon, damtype, mult, force_dam)
end
if target.knowTalent and target:hasEffect(target.EFF_GESTURE_OF_GUARDING) and not target:attr("encased_in_ice") then
local deflected = math.min(dam, target:callTalent(target.T_GESTURE_OF_GUARDING, "doGuard")) or 0
-- if deflected > 0 then self:logCombat(target, "#Target# dismisses %d damage from #Source#'s attack with a sweeping gesture.", deflected) end
if deflected > 0 then
game:delayedLogDamage(self, target, 0, ("%s(%d gestured#LAST#)"):format(DamageType:get(damtype).text_color or "#aaaaaa#", deflected), false)
dam = dam - deflected
......@@ -1614,8 +1612,8 @@ function _M:physicalCrit(dam, weapon, target, atk, def, add_chance, crit_power_a
chance = util.bound(chance, 0, 100)
print("[PHYS CRIT %]", chance)
if rng.percent(chance) then
print("[PHYS CRIT %]", self.turn_procs.auto_phys_crit and 100 or chance)
if self.turn_procs.auto_phys_crit or rng.percent(chance) then
if target:hasEffect(target.EFF_OFFGUARD) then
crit_power_add = crit_power_add + 0.1
end
......@@ -1650,8 +1648,8 @@ function _M:spellCrit(dam, add_chance, crit_power_add)
crit_power_add = crit_power_add + self:callTalent(self.T_SHADOWSTRIKE,"getMultiplier")
end
print("[SPELL CRIT %]", chance)
if rng.percent(chance) then
print("[SPELL CRIT %]", self.turn_procs.auto_spell_crit and 100 or chance)
if self.turn_procs.auto_spell_crit or rng.percent(chance) then
self.turn_procs.is_crit = "spell"
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)
......@@ -1698,8 +1696,8 @@ function _M:mindCrit(dam, add_chance, crit_power_add)
crit_power_add = crit_power_add + self:callTalent(self.T_SHADOWSTRIKE,"getMultiplier")
end
print("[MIND CRIT %]", chance)
if rng.percent(chance) then
print("[MIND CRIT %]", self.turn_procs.auto_mind_crit and 100 or chance)
if self.turn_procs.auto_mind_crit or rng.percent(chance) then
self.turn_procs.is_crit = "mind"
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)
......
......@@ -173,9 +173,9 @@ newTalent{
local speed1, hit1 = self:attackTargetWith(target, weapon.combat, DamageType.DARKNESS, self:combatTalentWeaponDamage(t, 0.6, 1.4))
if hit1 then
self.combat_physcrit = self.combat_physcrit + 100
self.turn_procs.auto_phys_crit = true
local speed2, hit2 = self:attackTargetWith(target, offweapon.combat, DamageType.BLIGHT, self:getOffHandMult(offweapon.combat, self:combatTalentWeaponDamage(t, 0.6, 1.4)))
self.combat_physcrit = self.combat_physcrit - 100
self.turn_procs.auto_phys_crit = nil
if hit2 and target:canBe("blind") then
target:setEffect(target.EFF_BLINDED, 4, {apply_power=self:combatPhysicalpower()})
else
......
......@@ -46,9 +46,9 @@ local function makeGolem(self)
canWearObjectCustom = function(self, o)
if o.type ~= "gem" then return end
if not self.summoner then return "Golem has no master" end
if not self.summoner:knowTalent(self.summoner.T_GEM_GOLEM) then return "Runic Golem talent required" end
if not self.summoner:knowTalent(self.summoner.T_GEM_GOLEM) then return "Master must know the Gem Golem talent" end
if not o.material_level then return "impossible to use this gem" end
if o.material_level > self.summoner:getTalentLevelRaw(self.summoner.T_GEM_GOLEM) then return "Runic Golem talent too low for this gem" end
if o.material_level > self.summoner:getTalentLevelRaw(self.summoner.T_GEM_GOLEM) then return "Master's Gem Golem talent too low for this gem" end
end,
equipdoll = "alchemist_golem",
infravision = 10,
......
......@@ -159,9 +159,9 @@ newTalent{
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
if core.fov.distance(self.x, self.y, x, y) > 1 then return nil end
if self:getTalentLevel(t) >= 5 then self.combat_atk = self.combat_atk + 1000 end
if self:getTalentLevel(t) >= 5 then self.turn_procs.auto_melee_hit = true end
local speed, hit = self:attackTargetWith(target, weapon.combat, nil, t.getDamage(self, t))
if self:getTalentLevel(t) >= 5 then self.combat_atk = self.combat_atk - 1000 end
if self:getTalentLevel(t) >= 5 then self.turn_procs.auto_melee_hit = nil end
-- Try to stun !
if hit then
......
......@@ -175,15 +175,14 @@ newTalent{
if self:getTalentLevel(t) >= 4 then
self.combat_dam = self.combat_dam + inc
end
self.combat_physcrit = self.combat_physcrit + 100
self.turn_procs.auto_phys_crit = true
local speed, hit = self:attackTargetWith(target, weapon.combat, nil, self:combatTalentWeaponDamage(t, 0.8, 1.3))
if self:getTalentLevel(t) >= 4 then
self.combat_dam = self.combat_dam - inc
self:incStamina(-self.stamina / 2)
end
self.combat_physcrit = self.combat_physcrit - 100
self.turn_procs.auto_phys_crit = nil
-- Try to insta-kill
if hit then
......
......@@ -165,10 +165,10 @@ newTalent{
-- Second & third attack with weapon
if hit then
self.combat_physcrit = self.combat_physcrit + 1000
self.turn_procs.auto_phys_crit = true
self:attackTarget(target, nil, self:combatTalentWeaponDamage(t, 1, 1.5), true)
self:attackTarget(target, nil, self:combatTalentWeaponDamage(t, 1, 1.5), true)
self.combat_physcrit = self.combat_physcrit - 1000
self.turn_procs.auto_phys_crit = nil
end
return true
......
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