-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement quest Better the Demon You Know
Co-authored-by: jamesbradleym <[email protected]> Co-authored-by: dallano <[email protected]>
- Loading branch information
1 parent
1242529
commit da94a67
Showing
11 changed files
with
302 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
----------------------------------- | ||
-- Substitute | ||
-- Dummy ability used several mobs. | ||
-- | ||
-- Marquis Andrealphus: | ||
-- Uses this ability to warp target player | ||
-- out of the zone | ||
-- | ||
-- BCNM: Die by the Sword | ||
-- Mobs use this ability to switch animation | ||
-- ID as well as physical resistances | ||
----------------------------------- | ||
local mobskillObject = {} | ||
|
||
local resistances = | ||
{ | ||
xi.mod.SLASH_SDT, | ||
xi.mod.PIERCE_SDT, | ||
xi.mod.IMPACT_SDT, | ||
xi.mod.HTH_SDT, | ||
} | ||
|
||
mobskillObject.onMobSkillCheck = function(target, mob, skill) | ||
return 0 | ||
end | ||
|
||
mobskillObject.onMobWeaponSkill = function(target, mob, skill) | ||
-- Marquis Andrealphus | ||
if mob:getPool() == 2571 then | ||
local party = target:getParty() | ||
local control = false | ||
|
||
-- Ability is only used when there is another party | ||
-- member in the party, or party size > 1 | ||
if mob:getPool() == 2571 then | ||
if #party > 1 then | ||
for _, v in ipairs(target:getParty()) do | ||
if v:getZone() == target:getZone() then | ||
control = true | ||
end | ||
end | ||
else | ||
control = true | ||
end | ||
end | ||
|
||
if control then | ||
mob:timer(1000, function(mobArg) | ||
mobArg:injectActionPacket(target:getID(), 4, 261, 0, 0, 0, 10, 1) | ||
mobArg:timer(3000, function(mobArg1) | ||
xi.teleport.escape(target) | ||
end) | ||
end) | ||
end | ||
|
||
-- Die by the Sword BCNM | ||
else | ||
local oldAnim = mob:getAnimationSub() | ||
local newAnim = oldAnim | ||
|
||
while newAnim == oldAnim do | ||
newAnim = math.random(1, 3) | ||
end | ||
|
||
mob:setAnimationSub(newAnim) | ||
|
||
for i = 1, 4 do | ||
if i == newAnim then | ||
mob:setMod(resistances[i], 1000) | ||
else | ||
mob:setMod(resistances[i], -2500) | ||
end | ||
end | ||
|
||
if newAnim == 3 then | ||
mob:setMod(resistances[4], 1000) | ||
else | ||
mob:setMod(resistances[4], -2500) | ||
end | ||
end | ||
|
||
skill:setMsg(xi.msg.basic.NONE) | ||
return 0 | ||
end | ||
|
||
return mobskillObject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
scripts/quests/otherAreas/Better_the_Demon_You_Know.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
----------------------------------- | ||
-- Better the Demon you Know | ||
----------------------------------- | ||
-- Log ID: 4, Quest ID: 105 | ||
-- Koblakiq !pos -64 21 -117 11 | ||
-- qm_demon_you_know !pos 20 -24 15 161 | ||
----------------------------------- | ||
local castleZvahlBaileysID = zones[xi.zone.CASTLE_ZVAHL_BAILEYS] | ||
----------------------------------- | ||
local quest = Quest:new(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.BETTER_THE_DEMON_YOU_KNOW) | ||
|
||
quest.reward = | ||
{ | ||
item = xi.item.GOBLIN_GRENADE, | ||
title = xi.title.APOSTATE_FOR_HIRE | ||
} | ||
|
||
quest.sections = | ||
{ | ||
{ | ||
check = function(player, status, vars) | ||
return status == xi.questStatus.QUEST_AVAILABLE and | ||
player:hasCompletedQuest(xi.questLog.OTHER_AREAS, xi.quest.id.otherAreas.FOR_THE_BIRDS) and | ||
not quest:getMustZone(player) | ||
end, | ||
|
||
[xi.zone.OLDTON_MOVALPOLOS] = | ||
{ | ||
['Koblakiq'] = quest:progressEvent(20, { [1] = xi.item.DEMON_PEN }), | ||
|
||
onEventFinish = | ||
{ | ||
[20] = function(player, csid, option, npc) | ||
quest:begin(player) | ||
end, | ||
}, | ||
}, | ||
}, | ||
{ | ||
check = function(player, status, vars) | ||
return status == xi.questStatus.QUEST_ACCEPTED | ||
end, | ||
|
||
[xi.zone.OLDTON_MOVALPOLOS] = | ||
{ | ||
['Koblakiq'] = | ||
{ | ||
onTrigger = function(player, npc) | ||
local prog = quest:getVar(player, 'Prog') | ||
|
||
if prog == 0 then | ||
return quest:progressEvent(21, { [1] = xi.item.DEMON_PEN }) -- Additional Dialogue | ||
elseif quest:getVar(player, 'Wait') > os.time() then | ||
return quest:progressEvent(23) | ||
elseif | ||
prog == 1 and | ||
quest:getVar(player, 'Wait') < os.time() | ||
then | ||
return quest:progressEvent(24) | ||
elseif prog == 2 then | ||
return quest:progressEvent(25) | ||
elseif player:hasKeyItem(xi.ki.ZEELOZOKS_EARPLUG) then | ||
return quest:progressEvent(26) | ||
end | ||
end, | ||
|
||
onTrade = function(player, npc, trade) | ||
if | ||
quest:getVar(player, 'Prog') == 0 and | ||
npcUtil.tradeHasExactly(trade, { xi.item.DEMON_PEN }) | ||
then | ||
return quest:progressEvent(22) | ||
end | ||
end, | ||
}, | ||
|
||
onEventFinish = | ||
{ | ||
[22] = function(player, csid, option, npc) | ||
player:tradeComplete() | ||
quest:setVar(player, 'Wait', os.time() + 60) -- midnight for era, 1 min for retail | ||
quest:setVar(player, 'Prog', 1) | ||
end, | ||
|
||
[24] = function(player, csid, option, npc) | ||
quest:setVar(player, 'Prog', 2) | ||
end, | ||
|
||
[26] = function(player, csid, option, npc) | ||
if quest:complete(player) then | ||
player:delKeyItem(xi.ki.ZEELOZOKS_EARPLUG) | ||
end | ||
end, | ||
}, | ||
}, | ||
|
||
[xi.zone.CASTLE_ZVAHL_BAILEYS] = | ||
{ | ||
['qm_demon_you_know'] = | ||
{ | ||
onTrigger = function(player, npc) | ||
local mobs = | ||
{ | ||
castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET, | ||
castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 1, | ||
castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 2, | ||
castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 3, | ||
castleZvahlBaileysID.mob.DEMON_YOU_KNOW_OFFSET + 4, | ||
} | ||
|
||
if | ||
quest:getVar(player, 'Prog') == 2 and | ||
npcUtil.popFromQM(player, npc, mobs, { claim = true, hide = 0, }) | ||
then | ||
player:messageSpecial(castleZvahlBaileysID.text.MOBLIN_EARPLUG) | ||
return quest:message(castleZvahlBaileysID.text.MINIONS_ATTACK) | ||
|
||
elseif | ||
quest:getVar(player, 'Prog') == 3 and | ||
not player:hasKeyItem(xi.ki.ZEELOZOKS_EARPLUG) | ||
then | ||
player:addKeyItem(xi.ki.ZEELOZOKS_EARPLUG) | ||
return quest:messageSpecial(castleZvahlBaileysID.text.KEYITEM_OBTAINED, xi.ki.ZEELOZOKS_EARPLUG) | ||
end | ||
end, | ||
}, | ||
|
||
['Marquis_Andrealphus'] = | ||
{ | ||
onMobDeath = function(mob, player, isKiller, firstCall) | ||
if quest:getVar(player, 'Prog') == 2 then | ||
quest:setVar(player, 'Prog', 3) | ||
end | ||
end, | ||
}, | ||
}, | ||
}, | ||
{ | ||
check = function(player, status, vars) | ||
return status == xi.questStatus.QUEST_COMPLETED | ||
end, | ||
|
||
[xi.zone.OLDTON_MOVALPOLOS] = | ||
{ | ||
['Koblakiq'] = quest:event(27):replaceDefault(), | ||
}, | ||
}, | ||
} | ||
|
||
return quest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
local ID = zones[xi.zone.CASTLE_ZVAHL_BAILEYS] | ||
|
||
return { | ||
['Flame_of_Fate'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, | ||
['Shadowy_Pillar'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, | ||
['Flame_of_Fate'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, | ||
['Shadowy_Pillar'] = { messageSpecial = ID.text.NOTHING_OUT_OF_ORDINARY }, | ||
['qm_demon_you_know'] = { messageSpecial = ID.text.YOU_FIND_NOTHING }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
scripts/zones/Castle_Zvahl_Baileys/mobs/Marquis_Andrealphus.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
----------------------------------- | ||
-- Area: Castle Zvahl Baileys | ||
-- NM: Marquis Andrealphus | ||
-- Quest: Better the Demon you Know | ||
----------------------------------- | ||
local ID = zones[xi.zone.CASTLE_ZVAHL_BAILEYS] | ||
----------------------------------- | ||
local entity = {} | ||
|
||
entity.onMobEngaged = function(mob) | ||
-- Blood Weapon Timer | ||
mob:setLocalVar('timer', os.time() + 180) | ||
end | ||
|
||
entity.onMobFight = function(mob, target) | ||
if mob:getLocalVar('timer') < os.time() then | ||
mob:setLocalVar('timer', os.time() + 180) | ||
mob:useMobAbility(695) | ||
end | ||
|
||
-- Escape player with hate out of zone | ||
if mob:getHPP() < 75 and mob:getLocalVar('hpControl1') == 0 then | ||
mob:showText(mob, ID.text.BEGONE) | ||
mob:setLocalVar('hpControl1', 1) | ||
mob:useMobAbility(307, target) | ||
|
||
elseif mob:getHPP() < 25 and mob:getLocalVar('hpControl2') == 0 then | ||
mob:showText(mob, ID.text.BEGONE) | ||
mob:setLocalVar('hpControl2', 1) | ||
mob:useMobAbility(307, target) | ||
end | ||
end | ||
|
||
entity.onMobDeath = function(mob, player, optParams) | ||
end | ||
|
||
return entity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters