Skip to content

Commit 3666a4e

Browse files
carlosrpgchrisinajar
authored andcommitted
Fix Morphling interaction with Sohei Dash (#2261)
1 parent 60336dd commit 3666a4e

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

game/scripts/vscripts/abilities/sohei/sohei_dash.lua

+28-12
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ if IsServer() then
2121
if not modifier_charges then
2222
modifier_charges = caster:AddNewModifier( self:GetCaster(), self, "modifier_sohei_dash_charges", {} )
2323
modifier_charges:SetStackCount( chargesMax )
24-
elseif modifier_charges:GetStackCount() < chargesMax then
24+
elseif modifier_charges:GetStackCount() < chargesMax then
25+
-- Reset the cooldown on the modifier
2526
modifier_charges:SetDuration( self:GetChargeRefreshTime(), true )
26-
modifier_charges:StartIntervalThink( 0.1 )
27+
modifier_charges:StartIntervalThink( 0.1 )
28+
if modifier_charges:GetStackCount() < 1 then
29+
self:StartCooldown( modifier_charges:GetRemainingTime() )
30+
end
2731
end
2832
end
2933

@@ -76,16 +80,28 @@ if IsServer() then
7680
self:EndCooldown()
7781

7882
if modifier_charges and not modifier_charges:IsNull() then
79-
-- Perform the dash if there is at least one charge remaining
80-
if modifier_charges:GetStackCount() >= 1 then
81-
modifier_charges:SetStackCount( modifier_charges:GetStackCount() - 1 )
82-
83-
local shortCD = dashDistance / dashSpeed
84-
if self:GetCooldownTimeRemaining() < shortCD then
85-
self:EndCooldown()
86-
self:StartCooldown( dashDistance / dashSpeed )
87-
end
88-
end
83+
-- Perform the dash if there is at least one charge remaining
84+
local currentStackCount = modifier_charges:GetStackCount()
85+
if currentStackCount >= 1 then
86+
if currentStackCount > 1 then
87+
-- enable short cooldown if has enough charges for the next dash
88+
local shortCD = dashDistance / dashSpeed
89+
if self:GetCooldownTimeRemaining() < shortCD then
90+
self:EndCooldown()
91+
self:StartCooldown( dashDistance / dashSpeed )
92+
end
93+
else
94+
-- if does not have charges for the next dash, set the cd to the remain time of the modifier
95+
self:StartCooldown( modifier_charges:GetRemainingTime() )
96+
end
97+
modifier_charges:SetStackCount( currentStackCount - 1 )
98+
else
99+
-- should not enter here, but if it does :
100+
-- set the cd to the remain time of the modifier
101+
self:StartCooldown( modifier_charges:GetRemainingTime() )
102+
-- and return without performing the spell action (this will still consume resources)
103+
return
104+
end
89105
else
90106
caster:AddNewModifier( caster, self, "modifier_sohei_dash_charges", {
91107
duration = self:GetChargeRefreshTime()

0 commit comments

Comments
 (0)