2016-01-16 01:26:33 -05:00
|
|
|
-----------------------------------
|
2021-04-01 15:10:15 -04:00
|
|
|
-- xi.effect.DYNAMIS
|
2016-01-16 01:26:33 -05:00
|
|
|
-----------------------------------
|
2024-08-24 21:26:29 -04:00
|
|
|
---@type TEffect
|
2022-10-06 17:22:04 +03:00
|
|
|
local effectObject = {}
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectGain = function(target, effect)
|
2023-08-28 21:02:28 -04:00
|
|
|
target:setLocalVar('dynamis_lasttimeupdate', effect:getTimeRemaining() / 1000)
|
2020-02-22 19:37:33 -08:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectTick = function(target, effect)
|
2021-04-01 15:10:15 -04:00
|
|
|
if target:getCurrentRegion() == xi.region.DYNAMIS then
|
2023-08-28 21:02:28 -04:00
|
|
|
local lastTimeUpdate = target:getLocalVar('dynamis_lasttimeupdate')
|
2020-06-08 01:45:24 -04:00
|
|
|
local remainingTimeLimit = effect:getTimeRemaining() / 1000
|
|
|
|
|
local message = 0
|
2018-07-29 19:20:29 -06:00
|
|
|
|
2020-06-08 01:45:24 -04:00
|
|
|
if lastTimeUpdate > 600 and remainingTimeLimit < 600 then
|
|
|
|
|
message = 600
|
|
|
|
|
elseif lastTimeUpdate > 300 and remainingTimeLimit < 300 then
|
|
|
|
|
message = 300
|
|
|
|
|
elseif lastTimeUpdate > 60 and remainingTimeLimit < 60 then
|
|
|
|
|
message = 60
|
|
|
|
|
elseif lastTimeUpdate > 30 and remainingTimeLimit < 30 then
|
|
|
|
|
message = 30
|
|
|
|
|
elseif lastTimeUpdate > 10 and remainingTimeLimit < 10 then
|
|
|
|
|
message = 10
|
2018-10-01 23:32:12 -06:00
|
|
|
end
|
2020-06-08 01:45:24 -04:00
|
|
|
|
|
|
|
|
if message ~= 0 then
|
|
|
|
|
local time = message
|
|
|
|
|
local minutes = 0
|
|
|
|
|
if time >= 60 then
|
|
|
|
|
minutes = 1
|
|
|
|
|
time = time / 60
|
|
|
|
|
end
|
2022-11-22 14:42:58 -05:00
|
|
|
|
2020-06-08 01:45:24 -04:00
|
|
|
if time == 1 then
|
|
|
|
|
target:messageSpecial(zones[target:getZoneID()].text.DYNAMIS_TIME_UPDATE_1, time, minutes)
|
|
|
|
|
else
|
|
|
|
|
target:messageSpecial(zones[target:getZoneID()].text.DYNAMIS_TIME_UPDATE_2, time, minutes)
|
|
|
|
|
end
|
2022-11-22 14:42:58 -05:00
|
|
|
|
2023-08-28 21:02:28 -04:00
|
|
|
target:setLocalVar('dynamis_lasttimeupdate', message)
|
2018-10-01 23:32:12 -06:00
|
|
|
end
|
2020-06-08 01:45:24 -04:00
|
|
|
else
|
2021-04-01 15:10:15 -04:00
|
|
|
target:delStatusEffectSilent(xi.effect.DYNAMIS)
|
2018-07-29 19:20:29 -06:00
|
|
|
end
|
2020-02-22 19:37:33 -08:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
effectObject.onEffectLose = function(target, effect)
|
2021-04-01 15:10:15 -04:00
|
|
|
target:delKeyItem(xi.ki.CRIMSON_GRANULES_OF_TIME)
|
|
|
|
|
target:delKeyItem(xi.ki.AZURE_GRANULES_OF_TIME)
|
|
|
|
|
target:delKeyItem(xi.ki.AMBER_GRANULES_OF_TIME)
|
|
|
|
|
target:delKeyItem(xi.ki.ALABASTER_GRANULES_OF_TIME)
|
|
|
|
|
target:delKeyItem(xi.ki.OBSIDIAN_GRANULES_OF_TIME)
|
|
|
|
|
if target:getCurrentRegion() == xi.region.DYNAMIS then
|
2020-06-08 01:45:24 -04:00
|
|
|
if effect:getTimeRemaining() == 0 then
|
|
|
|
|
target:messageSpecial(zones[target:getZoneID()].text.DYNAMIS_TIME_EXPIRED)
|
|
|
|
|
target:disengage()
|
2022-01-07 18:06:06 +01:00
|
|
|
target:startCutscene(100)
|
2020-06-08 01:45:24 -04:00
|
|
|
end
|
2017-11-15 20:38:41 -07:00
|
|
|
end
|
2020-02-22 19:37:33 -08:00
|
|
|
end
|
2016-01-16 01:26:33 -05:00
|
|
|
|
2022-10-06 17:22:04 +03:00
|
|
|
return effectObject
|