Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imp Aggro Behavior #6227

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions scripts/mixins/families/imp_aggro.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require('scripts/globals/mixins')
-----------------------------------
xi = xi or {}
xi.mix = xi.mix or {}
xi.mix.imp_aggro = xi.mix.imp_aggro or {}

g_mixins = g_mixins or {}
g_mixins.families = g_mixins.families or {}

local function updateAggro(mob, hour)
mob:setLocalVar('hour', hour)

if hour >= 18 or hour < 6 then
mob:setMobMod(xi.mobMod.DETECTION, bit.bor(xi.detects.SIGHT, xi.detects.HEARING))
elseif hour < 18 and hour >= 6 then
mob:setMobMod(xi.mobMod.DETECTION, xi.detects.HEARING)
end
end

g_mixins.families.imp_aggro = function(mob)
mob:addListener('SPAWN', 'IMP_AGGRO_SPAWN', function(imp)
updateAggro(imp, VanadielHour())
end)

mob:addListener('ROAM_TICK', 'IMP_AGGRO_ROAM_TICK', function(imp)
local hour = VanadielHour()
if hour ~= imp:getLocalVar('hour') then
updateAggro(imp, hour)
end
end)
end

return g_mixins.families.imp_aggro
2 changes: 1 addition & 1 deletion scripts/zones/Caedarva_Mire/mobs/Heraldic_Imp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Area: Caedarva Mire
-- Mob: Heraldic Imp
-----------------------------------
mixins = { require('scripts/mixins/families/imp') }
mixins = { require('scripts/mixins/families/imp'), require('scripts/mixins/families/imp_aggro') }
-----------------------------------
---@type TMobEntity
local entity = {}
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Caedarva_Mire/mobs/Orderly_Imp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Area: Caedarva Mire
-- Mob: Orderly Imp
-----------------------------------
mixins = { require('scripts/mixins/families/imp') }
mixins = { require('scripts/mixins/families/imp'), require('scripts/mixins/families/imp_aggro') }
-----------------------------------
---@type TMobEntity
local entity = {}
Expand Down
6 changes: 6 additions & 0 deletions sql/mob_family_mods.sql
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,17 @@ INSERT INTO `mob_family_mods` VALUES (165,10,13,1); -- SUBLINK: 13
INSERT INTO `mob_family_mods` VALUES (165,29,24,0); -- MDEF: 24
INSERT INTO `mob_family_mods` VALUES (165,36,50,1); -- ROAM_COOL: 50
INSERT INTO `mob_family_mods` VALUES (165,51,3,1); -- ROAM_TURNS: 3
INSERT INTO `mob_family_mods` VALUES (165,56,-1,1); -- HP_STANDBACK: -1
INSERT INTO `mob_family_mods` VALUES (165,4,10,1); -- SIGHT_RANGE: 10
INSERT INTO `mob_family_mods` VALUES (165,5,5,1); -- SOUND_RANGE: 5

-- Imp
INSERT INTO `mob_family_mods` VALUES (166,10,13,1); -- SUBLINK: 13
INSERT INTO `mob_family_mods` VALUES (166,36,50,1); -- ROAM_COOL: 50
INSERT INTO `mob_family_mods` VALUES (166,51,3,1); -- ROAM_TURNS: 3
INSERT INTO `mob_family_mods` VALUES (166,56,-1,1); -- HP_STANDBACK: -1
INSERT INTO `mob_family_mods` VALUES (166,4,10,1); -- SIGHT_RANGE: 10
INSERT INTO `mob_family_mods` VALUES (166,5,5,1); -- SOUND_RANGE: 5

-- Kindred
INSERT INTO `mob_family_mods` VALUES (169,10,1,1); -- SUBLINK: 1
Expand Down
4 changes: 2 additions & 2 deletions sql/mob_family_system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ INSERT INTO `mob_family_system` VALUES (162,'HybridElemental-Water',87,'Hybrid_E

INSERT INTO `mob_family_system` VALUES (163,'Hydra',88,'Hydra',10,'Dragon',4.00,40,90,90,2,3,1,2,1,5,3,1,2,1,3,6.0,2,0);
INSERT INTO `mob_family_system` VALUES (164,'Hydra',88,'Hydra',10,'Dragon',4.00,40,90,90,2,3,1,2,1,5,3,1,2,1,3,6.0,2,0);
INSERT INTO `mob_family_system` VALUES (165,'Imp',89,'Imp',9,'Demon',0.00,50,70,140,6,3,4,3,1,5,4,1,3,1,5,8.0,1,0);
INSERT INTO `mob_family_system` VALUES (166,'Imp',89,'Imp',9,'Demon',0.00,50,70,140,6,3,4,3,1,5,4,1,3,1,5,8.0,1,0);
INSERT INTO `mob_family_system` VALUES (165,'Imp',89,'Imp',9,'Demon',0.00,50,70,140,6,3,4,3,1,5,4,1,3,1,5,8.0,3,0);
INSERT INTO `mob_family_system` VALUES (166,'Imp',89,'Imp',9,'Demon',0.00,50,70,140,6,3,4,3,1,5,4,1,3,1,5,8.0,3,0);
INSERT INTO `mob_family_system` VALUES (167,'Karakul',90,'Sheep',6,'Beast',1.00,40,90,110,3,4,4,4,5,4,4,1,3,1,3,4.0,1,1);
INSERT INTO `mob_family_system` VALUES (168,'Khimaira',91,'Khimaira',3,'Arcana',3.00,40,90,90,4,3,3,3,4,6,5,1,3,1,3,5.0,3,0);
INSERT INTO `mob_family_system` VALUES (169,'Kindred',92,'Kindred',9,'Demon',0.00,50,110,140,1,2,4,4,1,2,4,1,3,1,3,8.0,257,0);
Expand Down
Loading