From 764fe06bcbd0cc7c2c900bfebd5f84530aa7b183 Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Tue, 28 Jan 2014 00:50:26 +0100 Subject: [PATCH] Auto hit/auto crit attacks now use a better mechanism that is not affected by actualy hit/crit chance --- game/modules/tome/class/interface/Combat.lua | 16 +++++++--------- .../tome/data/talents/corruptions/scourge.lua | 4 ++-- .../tome/data/talents/spells/golemancy.lua | 4 ++-- .../tome/data/talents/spells/staff-combat.lua | 4 ++-- .../tome/data/talents/techniques/2hweapon.lua | 5 ++--- .../data/talents/techniques/weaponshield.lua | 4 ++-- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua index c398dbb5a6..d1a631abde 100644 --- a/game/modules/tome/class/interface/Combat.lua +++ b/game/modules/tome/class/interface/Combat.lua @@ -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) diff --git a/game/modules/tome/data/talents/corruptions/scourge.lua b/game/modules/tome/data/talents/corruptions/scourge.lua index f7c45e9070..48360328ae 100644 --- a/game/modules/tome/data/talents/corruptions/scourge.lua +++ b/game/modules/tome/data/talents/corruptions/scourge.lua @@ -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 diff --git a/game/modules/tome/data/talents/spells/golemancy.lua b/game/modules/tome/data/talents/spells/golemancy.lua index 85111d484b..6a994e4387 100644 --- a/game/modules/tome/data/talents/spells/golemancy.lua +++ b/game/modules/tome/data/talents/spells/golemancy.lua @@ -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, diff --git a/game/modules/tome/data/talents/spells/staff-combat.lua b/game/modules/tome/data/talents/spells/staff-combat.lua index 8237c3cda4..fbd5b7eebd 100644 --- a/game/modules/tome/data/talents/spells/staff-combat.lua +++ b/game/modules/tome/data/talents/spells/staff-combat.lua @@ -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 diff --git a/game/modules/tome/data/talents/techniques/2hweapon.lua b/game/modules/tome/data/talents/techniques/2hweapon.lua index 2a4ac3b66d..ffd254f913 100644 --- a/game/modules/tome/data/talents/techniques/2hweapon.lua +++ b/game/modules/tome/data/talents/techniques/2hweapon.lua @@ -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 diff --git a/game/modules/tome/data/talents/techniques/weaponshield.lua b/game/modules/tome/data/talents/techniques/weaponshield.lua index a274a50b8a..57198ec94c 100644 --- a/game/modules/tome/data/talents/techniques/weaponshield.lua +++ b/game/modules/tome/data/talents/techniques/weaponshield.lua @@ -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 -- GitLab