Skip to content

Commit 46094f3

Browse files
committed
[lua] [sql] Troll Automaton Mixin
Adds a mixin to randomize troll automatons.
1 parent 8dc4550 commit 46094f3

12 files changed

Lines changed: 228 additions & 17 deletions

File tree

scripts/actions/mobskills/arcuballista.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-----------------------------------
22
-- Arcuballista
33
-- Family: Automaton
4-
-- Description: Delivers a single ranged attack. Damage varies with TP.
4+
-- Description: Delivers a ranged attack. Damage varies with TP.
55
-----------------------------------
66
---@type TMobSkill
77
local mobskillObject = {}
@@ -17,7 +17,6 @@ mobskillObject.onMobWeaponSkill = function(mob, target, skill, action)
1717
params.numHits = 1
1818
params.fTP = { 2.5, 3.0, 4.0 }
1919
params.accuracyModifier = { 100, 100, 100 }
20-
params.dex_wSC = 0.5
2120
params.attackType = xi.attackType.RANGED
2221
params.damageType = xi.damageType.PIERCING
2322
params.shadowBehavior = xi.mobskills.shadowBehavior.NUMSHADOWS_1

scripts/enum/mob_skill.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ xi.mobSkill =
10051005
STRING_CLIPPER = 1941,
10061006
ARCUBALLISTA = 1942,
10071007
SLAPSTICK = 1943,
1008+
SHIELD_BASH = 1944,
10081009
SHIELD_BASH_AUTOMATON = 1944, -- Used by the trust Mnejing but may also be used by mobs.
10091010
PROVOKE_AUTOMATON = 1945, -- Used by the trust Mnejing but may also be used by mobs.
10101011
FLASHBULB_AUTOMATON = 1947, -- Used by the trust Mnejing but may also be used by mobs.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
-----------------------------------
2+
require('scripts/globals/mixins')
3+
-----------------------------------
4+
xi = xi or {}
5+
xi.mix = xi.mix or {}
6+
xi.mix.trollAutomaton = xi.mix.trollAutomaton or {}
7+
8+
g_mixins = g_mixins or {}
9+
g_mixins.families = g_mixins.families or {}
10+
11+
local automatonTypes =
12+
{
13+
{
14+
name = 'Harlequin',
15+
job = xi.job.RDM,
16+
modelId = 1977,
17+
isCaster = true,
18+
spellList = 567,
19+
},
20+
21+
{
22+
name = 'Valoredge',
23+
job = xi.job.PLD,
24+
modelId = 1983,
25+
doubleAttack = 15,
26+
},
27+
28+
{
29+
name = 'Sharpshot',
30+
job = xi.job.RNG,
31+
modelId = 1990,
32+
isRanged = true,
33+
standbackHp = 70,
34+
specialCool = 12,
35+
specialSkill = xi.mobSkill.RANGED_ATTACK_1,
36+
rangedAttackRange = 13,
37+
},
38+
39+
{
40+
name = 'Stormwalker',
41+
job = xi.job.RDM,
42+
modelId = 1994,
43+
isCaster = true,
44+
spellList = 566,
45+
standbackHp = 70,
46+
},
47+
}
48+
49+
g_mixins.families.Troll_Automaton = function(automatonMob)
50+
automatonMob:addListener('SPAWN', 'TROLL_AUTOMATON_SPAWN', function(mob)
51+
xi.mix.trollAutomaton.setupAutomaton(mob, automatonTypes[math.random(1, #automatonTypes)])
52+
end)
53+
end
54+
55+
xi.mix.trollAutomaton.setupAutomaton = function(mob, automatonType)
56+
mob:setLocalVar('automatonTypeModelId', automatonType.modelId)
57+
mob:setModelId(automatonType.modelId)
58+
mob:changeJob(automatonType.job)
59+
mob:setDelay(270) -- All Frames (Waiting for delay conversion PR to be merged)
60+
mob:setMod(xi.mod.DOUBLE_ATTACK, automatonType.doubleAttack or 0) -- Valoredge Frame
61+
mob:setMobMod(xi.mobMod.MAGIC_COOL, 27) -- Harlequin and Stormwalker
62+
mob:setMobMod(xi.mobMod.MAGIC_DELAY, math.random(3, 7)) -- Harlequin and Stormwalker
63+
mob:setSpellList(automatonType.spellList or 0) -- Harlequin and Stormwalker
64+
mob:setMagicCastingEnabled(automatonType.isCaster or false) -- Harlequin & Stormwalker
65+
mob:setBehavior(bit.band(mob:getBehavior(), bit.bnot(xi.behavior.STANDBACK))) -- Sharpshot and Stormwalker
66+
mob:setMobMod(xi.mobMod.HP_STANDBACK, automatonType.standbackHp or 0) -- Sharpshot and Stormwalker
67+
mob:setMobMod(xi.mobMod.SPECIAL_COOL, automatonType.specialCool or 0) -- Sharpshot Frame
68+
mob:setMobMod(xi.mobMod.SPECIAL_SKILL, automatonType.specialSkill or 0) -- Sharpshot Frame
69+
mob:setMobMod(xi.mobMod.RANGED_ATTACK_RANGE, automatonType.rangedAttackRange or 0) -- Sharpshot Frame
70+
71+
return automatonType
72+
end
73+
74+
xi.mix.trollAutomaton.onMobMobskillChoose = function(mob, target)
75+
local modelId = mob:getModelId()
76+
local skillList = {}
77+
78+
switch(modelId): caseof
79+
{
80+
[1977] = function() -- Harlequin
81+
table.insert(skillList, xi.mobSkill.SLAPSTICK)
82+
end,
83+
84+
[1983] = function() -- Valoredge
85+
table.insert(skillList, xi.mobSkill.CHIMERA_RIPPER)
86+
table.insert(skillList, xi.mobSkill.STRING_CLIPPER)
87+
table.insert(skillList, xi.mobSkill.SHIELD_BASH)
88+
end,
89+
90+
[1990] = function() -- Sharpshot
91+
table.insert(skillList, xi.mobSkill.SLAPSTICK)
92+
table.insert(skillList, xi.mobSkill.ARCUBALLISTA)
93+
end,
94+
95+
[1994] = function() -- Stormwalker
96+
table.insert(skillList, xi.mobSkill.SLAPSTICK)
97+
end,
98+
}
99+
100+
return skillList[math.random(1, #skillList)]
101+
end
102+
103+
return g_mixins.families.Troll_Automaton
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----------------------------------
2+
-- Area: Al Zahbi
3+
-- Mob: Troll's Automaton
4+
-----------------------------------
5+
mixins = { require('scripts/mixins/families/Troll_Automaton') }
6+
-----------------------------------
7+
---@type TMobEntity
8+
local entity = {}
9+
10+
entity.onMobMobskillChoose = function(mob, target, skillId)
11+
return xi.mix.trollAutomaton.onMobMobskillChoose(mob, target)
12+
end
13+
14+
return entity
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----------------------------------
2+
-- Area: Bhaflau Remnants
3+
-- Mob: Troll's Automaton
4+
-----------------------------------
5+
mixins = { require('scripts/mixins/families/Troll_Automaton') }
6+
-----------------------------------
7+
---@type TMobEntity
8+
local entity = {}
9+
10+
entity.onMobMobskillChoose = function(mob, target, skillId)
11+
return xi.mix.trollAutomaton.onMobMobskillChoose(mob, target)
12+
end
13+
14+
return entity
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----------------------------------
2+
-- Area: Bhaflau Thickets
3+
-- Mob: Troll's Automaton
4+
-----------------------------------
5+
mixins = { require('scripts/mixins/families/Troll_Automaton') }
6+
-----------------------------------
7+
---@type TMobEntity
8+
local entity = {}
9+
10+
entity.onMobMobskillChoose = function(mob, target, skillId)
11+
return xi.mix.trollAutomaton.onMobMobskillChoose(mob, target)
12+
end
13+
14+
return entity
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----------------------------------
2+
-- Area: Halvung
3+
-- Mob: Troll's Automaton
4+
-----------------------------------
5+
mixins = { require('scripts/mixins/families/Troll_Automaton') }
6+
-----------------------------------
7+
---@type TMobEntity
8+
local entity = {}
9+
10+
entity.onMobMobskillChoose = function(mob, target, skillId)
11+
return xi.mix.trollAutomaton.onMobMobskillChoose(mob, target)
12+
end
13+
14+
return entity
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----------------------------------
2+
-- Area: Mount Zhayolm
3+
-- Mob: Troll's Automaton
4+
-----------------------------------
5+
mixins = { require('scripts/mixins/families/Troll_Automaton') }
6+
-----------------------------------
7+
---@type TMobEntity
8+
local entity = {}
9+
10+
entity.onMobMobskillChoose = function(mob, target, skillId)
11+
return xi.mix.trollAutomaton.onMobMobskillChoose(mob, target)
12+
end
13+
14+
return entity
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----------------------------------
2+
-- Area: Wajaom Woodlands
3+
-- Mob: Troll's Automaton
4+
-----------------------------------
5+
mixins = { require('scripts/mixins/families/Troll_Automaton') }
6+
-----------------------------------
7+
---@type TMobEntity
8+
local entity = {}
9+
10+
entity.onMobMobskillChoose = function(mob, target, skillId)
11+
return xi.mix.trollAutomaton.onMobMobskillChoose(mob, target)
12+
end
13+
14+
return entity

sql/mob_pools.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4091,7 +4091,7 @@ INSERT INTO `mob_pools` VALUES (4031,'Troll_Speculator','Troll_Speculator',246,0
40914091
INSERT INTO `mob_pools` VALUES (4032,'Troll_Stoneworker','Troll_Stoneworker',246,0x0600B00600000000000000000000000000000000,2,2,1,480,100,0,1,0,1,0,0,0,184,131,1,0,0,0,0,246,246,1,17);
40924092
INSERT INTO `mob_pools` VALUES (4033,'Troll_Stormer','Troll_Stormer',246,0x0600AC0600000000000000000000000000000000,5,5,4,230,100,0,1,0,0,0,0,0,9,131,0,0,3,0,0,246,246,1,17);
40934093
INSERT INTO `mob_pools` VALUES (4034,'Troll_Surveillant','Troll_Surveillant',246,0x0600B00600000000000000000000000000000000,18,18,7,230,100,0,1,0,1,0,0,0,126,131,0,0,0,0,0,246,246,1,17);
4094-
INSERT INTO `mob_pools` VALUES (4035,'Trolls_Automaton','Trolls_Automaton',28,0x0600B90700000000000000000000000000000000,3,3,11,320,100,0,0,0,1,0,0,0,1,131,0,0,3,0,0,28,28,2,8);
4094+
INSERT INTO `mob_pools` VALUES (4035,'Trolls_Automaton','Trolls_Automaton',28,0x0600B90700000000000000000000000000000000,3,3,11,320,100,0,0,0,1,0,0,0,1,131,0,0,567,0,0,363,28,2,8);
40954095
INSERT INTO `mob_pools` VALUES (4036,'Troll_Targeteer','Troll_Targeteer',246,0x06009B0600000000000000000000000000000000,7,7,2,280,100,0,1,0,1,0,0,0,1,133,0,0,4,0,0,247,246,2,20);
40964096
INSERT INTO `mob_pools` VALUES (4037,'Troll_Velites','Troll_Velites',246,0x0600B00600000000000000000000000000000000,2,2,1,480,100,0,1,0,0,0,0,0,10,131,0,0,0,0,0,246,246,1,17);
40974097
INSERT INTO `mob_pools` VALUES (4038,'Trombe','Trombe',242,0x0000340100000000000000000000000000000000,1,1,7,240,100,0,1,0,1,0,0,0,330,129,0,0,0,0,0,242,242,0,22);

0 commit comments

Comments
 (0)