Skip to content

Commit 4974216

Browse files
committed
[lua] Implement BST Ability "Killer Instinct"
1 parent b6f3ed6 commit 4974216

3 files changed

Lines changed: 64 additions & 1 deletion

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-----------------------------------
2+
-- Ability: Killer Instinct
3+
-- Grants your pet's Killer Effect to party members within area of effect.
4+
-- Obtained: Beastmaster Level 75 (Merit)
5+
-- Recast Time: 5:00
6+
-- Duration: 3:00
7+
-----------------------------------
8+
local abilityObject = {}
9+
10+
abilityObject.onAbilityCheck = function(player, target, ability)
11+
return xi.job_utils.beastmaster.onAbilityCheckKillerInstinct(player, target, ability)
12+
end
13+
14+
abilityObject.onUseAbility = function(player, target, ability)
15+
return xi.job_utils.beastmaster.onUseAbilityKillerInstinct(player, target, ability)
16+
end
17+
18+
return abilityObject

scripts/effects/killer_instinct.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@
55
local effectObject = {}
66

77
effectObject.onEffectGain = function(target, effect)
8+
-- onUseAbilityKillerInstinct in BST job_utils assigns the pet's ecosystem Enum as the effect subPower.
9+
-- subPower is then used to grant the corresponding killer effect.
10+
local ecosystemCorrelationMap =
11+
{
12+
-- Pet Ecosystem(subPower), Corresponding killer modifier
13+
[xi.ecosystem.AMORPH] = xi.mod.BIRD_KILLER,
14+
[xi.ecosystem.AQUAN] = xi.mod.AMORPH_KILLER,
15+
[xi.ecosystem.BEAST] = xi.mod.LIZARD_KILLER,
16+
[xi.ecosystem.BIRD] = xi.mod.AQUAN_KILLER,
17+
[xi.ecosystem.LIZARD] = xi.mod.VERMIN_KILLER,
18+
[xi.ecosystem.PLANTOID] = xi.mod.BEAST_KILLER,
19+
[xi.ecosystem.VERMIN] = xi.mod.PLANTOID_KILLER,
20+
}
21+
22+
local mod = ecosystemCorrelationMap[effect:getSubPower()]
23+
24+
if mod then
25+
effect:addMod(mod, effect:getPower())
26+
end
827
end
928

1029
effectObject.onEffectTick = function(target, effect)

scripts/globals/job_utils/beastmaster.lua

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ xi.job_utils.beastmaster.onAbilityCheckFight = function(player, target, ability)
508508
return 0, 0
509509
end
510510

511-
-- On Ability Use Stay
511+
-- On Ability Use Fight
512512
xi.job_utils.beastmaster.onUseAbilityFight = function(player, target, ability)
513513
local pet = player:getPet()
514514

@@ -521,6 +521,32 @@ xi.job_utils.beastmaster.onUseAbilityFight = function(player, target, ability)
521521
end
522522
end
523523

524+
-- On Ability Check Killer Instinct
525+
xi.job_utils.beastmaster.onAbilityCheckKillerInstinct = function(player, target, ability)
526+
local pet = player:getPet()
527+
528+
if
529+
pet == nil or -- No pet currently spawned
530+
(not player:hasJugPet() and pet:getObjType() ~= xi.objType.MOB) -- The pet spawned is not a jug pet or charmed mob
531+
then
532+
return xi.msg.basic.REQUIRES_A_PET, 0
533+
end
534+
535+
return 0, 0
536+
end
537+
538+
-- On Ability Use Killer Instinct
539+
xi.job_utils.beastmaster.onUseAbilityKillerInstinct = function(player, target, ability)
540+
-- Notes: Pet ecosystem is assigned to the subPower, then mapped to the correct killer mod in the effect script.
541+
local pet = player:getPet()
542+
local petEcosystem = pet:getEcosystem()
543+
local power = 10
544+
local duration = 180 + (player:getMerit(xi.merit.KILLER_INSTINCT) - 10)
545+
-- TODO: Is there gear/mods that enhance power/duration?
546+
547+
target:addStatusEffect(xi.effect.KILLER_INSTINCT, power, 0, duration, 0, petEcosystem)
548+
end
549+
524550
local function getCharmDuration(charmer, target)
525551
local charmDuration = 0
526552

0 commit comments

Comments
 (0)