-- 终极任务Include("\\script\\missions\\maze\\tas k.lua")
Include("\\script\\global\\dlgnpc_list.lua")
Include("\\script\\global\\fightnpc_list.lua")
Include("\\script\\lib\\timerlist.lua")
IL("NPCINFO")
NPCID_YULONGHUFA = 1628 -- 钰龙护法
NPCID_YULONGBOY = 1629 -- 钰龙男弟子
NPCID_YULONGGIRL = 1630 -- 钰龙女弟子
NPCID_DIALOGBOSS = 1625 -- 龙九天(对话)
NPCID_CUP = 1627 -- 酒杯
NPCID_FIGHTBOSS = 1657 -- 龙九天(战斗)
NPCID_FENGLINGLONG = 1626 -- 凤玲珑
DEATH_YULONGDIZI = 1
STR_YULONGHUFA = "Mu鑞 g苝 頲 Trang Ch?b総 bu閏 ph秈 bc qua c鯽 c馻 ta trc, xin h穣 ra tay 甶!"
pTask = Task:New(49)
function pTask:InitStep()
end
-- 第一步
-- 开始:出现钰龙护法和男女钰龙弟子
-- 完成:击败所有男女钰龙弟子
Step1 = Step:New()
Step1.m_Yulongdizi = {}
Step1.m_DiziCount = 0
function Step1:Start(task)
local pos = task:GetPosition()
local index = DlgNpcManager:AddNpc("Ng鋍 Long H?Ph竝",
NPCID_YULONGHUFA,
task:GetMapId(),
pos.yulonghufa.x,
pos.yulonghufa.y,
self)
if (index > 0) then
local nNpcIndex = DlgNpcManager:GetNpcIndex(index)
SetNpcKind(nNpcIndex, 3)
self.m_NpcIndex = index
end
self.m_Task = task
self.m_SayOnce = 0
end
function Step1:Close(task)
self:ClearNpc()
end
function Step1
estroy()
self:ClearNpc()
end
function Step1:ClearNpc()
if (self.m_NpcIndex > 0) then
DlgNpcManager
elNpc(self.m_NpcIndex)
self.m_NpcIndex = 0
end
if (self.m_Yulongdizi ~= nil) then
for i = 1, getn(self.m_Yulongdizi) do
local nIndex = self.m_Yulongdizi[i]
if (nIndex > 0) then
FightNpcManager
elNpc(nIndex)
end
end
self.m_Yulongdizi = nil
self.m_DiziCount = 0
end
end
function Step1:AddYulongdizi(pts, name, npcid)
local mapid = self.m_Task:GetMapId()
for i = 1, 10 do
local pt = pts[i]
local nParam = getn(self.m_Yulongdizi) + 1
local nIndex = FightNpcManager:AddNpc(name, npcid, mapid, pt.x, pt.y, self, nParam, 1, 1)
tinsert(self.m_Yulongdizi, nIndex)
if (nIndex > 0) then
self.m_DiziCount = self.m_DiziCount + 1
end
end
end
function Step1:Say(player)
player:Say("Mu鑞 g苝 頲 Trang Ch?b総 bu閏 ph秈 bc qua c鯽 c馻 ta trc, xin h穣 ra tay 甶!")
if (self.m_SayOnce == 0) then
local pos = self.m_Task:GetPosition()
self:AddYulongdizi(pos.yulongboys, "Ng鋍 Long Nam е T?, NPCID_YULONGBOY)
self:AddYulongdizi(pos.yulonggirls, "Ng鋍 Long N?е T?, NPCID_YULONGGIRL)
self.m_SayOnce = 1
end
end
function Step1:OnDeath(nKilled, pPlayer, nParam)
self.m_Yulongdizi[nParam] = 0
self.m_DiziCount = self.m_DiziCount - 1
if (self.m_DiziCount <= 0) then
self.m_Task
roceed()
end
end
-- 第二步
-- 开始:龙九天变为战斗NPC(龙老虎技� �)
-- 完成:打到低于50%生命
Step2 = Step:New()
function Step2:Start(task)
local mapid = task:GetMapId()
local pos = task:GetPosition()
local boss = FightNpcManager:AddNpc("Long C鰑 Thi猲", NPCID_DIALOGBOSS, mapid, pos.boss.x, pos.boss.y, self, nil, 1, 1)
if (boss > 0) then
local nNpcIndex = FightNpcManager:GetNpcIndex(boss)
SyncNpc(nNpcIndex)
NpcChat(nNpcIndex, "<color=yellow>C竎 v?qu?l?nh﹏ trung long phng, qu?nhi猲 c?th?vt qua 頲 tr飊g tr飊g nguy hi觤 n y g苝 ta. Hi謓 t筰 c竎 v?產ng ph禝 i m苩 v韎 th?luy謓 cu鑙 c飊g, ch?c莕 nh b筰 ta v?Th?T?c馻 ta, th?c?th?nh薾 頲 trang b?c鵦 ph萴 nh蕋 v?c?uy danh cao qu?nh蕋. <color>")
self.m_Boss = boss
self.m_Timer = TimerList:AddTimer(self, 9)
end
self.m_Task = task
self.m_MapId = mapid
end
function Step2:Close(task)
self:Clear()
self.m_Task = nil
end
function Step2
estroy()
self:Clear()
end
function Step2:OnDeath()
self.m_Boss = nil
self:Clear()
if (self.m_Task ~= nil) then
self.m_Task
roceed()
end
end
function Step2:OnTime()
if (self.m_Boss ~= nil and self.m_Task ~= nil) then
local nNpcIndex = FightNpcManager:GetNpcIndex(self.m_Boss)
local cur_life = NPCINFO_GetNpcCurrentLife(nNpcIndex)
local max_life = NPCINFO_GetNpcCurrentMaxLife(nNpcIndex)
if (cur_life < max_life * 0.5) then
self.m_Timer = nil
self.m_Task
roceed()
return 0
end
end
return 1
end
function Step2:Clear()
if (self.m_Timer ~= nil) then
TimerList
elTimer(self.m_Timer)
self.m_Timer = nil
end
if (self.m_Boss ~= nil) then
FightNpcManager
elNpc(self.m_Boss)
self.m_Boss = nil
end
end
-- 第三步
-- 开始:出现3个一模一样的龙九天(龙� ��虎技能),其中随机一个是真的
-- 完成:把真的打到40%的血时才会进入� �一步
Step3 = Step:New()
function Step3:Start(task)
local mapid = task:GetMapId()
local pos = task:GetPosition()
local tb = {}
self.m_BossIndex = random(1, 3)
for i = 1, 3 do
local idx = self:AddBoss("Long C鰑 Thi猲", mapid, pos.bosses[i], i)
tinsert(tb, idx)
end
self.m_Bosses = tb
self.m_Timer = TimerList:AddTimer(self, 9)
self.m_Task = task
self.m_MapId = mapid
end
function Step3:Close(task)
self:Clear()
end
function Step3
estroy()
self:Clear()
end
function Step3:Clear()
if (self.m_Bosses ~= nil) then
for i = 1, getn(self.m_Bosses) do
local nIndex = self.m_Bosses[i]
if (nIndex > 0) then
FightNpcManager
elNpc(nIndex)
end
end
self.m_Bosses = nil
end
if (self.m_Timer ~= nil) then
TimerList
elTimer(self.m_Timer)
self.m_Timer = nil
end
self.m_BossIndex = nil
end
function Step3:OnTime()
if (self.m_BossIndex ~= nil) then
local npc = self.m_Bosses[self.m_BossIndex]
local nNpcIndex = FightNpcManager:GetNpcIndex(npc)
local cur_life = NPCINFO_GetNpcCurrentLife(nNpcIndex)
local max_life = NPCINFO_GetNpcCurrentMaxLife(nNpcIndex)
if (cur_life < max_life * 0.4) then
self.m_Timer = nil
self.m_Task
roceed()
return 0
end
end
return 1
end
function Step3:OnDeath(killed, player, index)
self.m_Bosses[index] = 0
if (index == self.m_BossIndex) then
if (self.m_Timer ~= nil) then
TimerList
elTimer(self.m_Timer)
self.m_Timer = nil
end
self.m_BossIndex = nil
self.m_Task
roceed()
end
end
function Step3:AddBoss(name, mapid, pt, param)
local boss = FightNpcManager:AddNpc(name, NPCID_DIALOGBOSS, mapid, pt.x, pt.y, self, param, 1, 1)
if (boss > 0) then
local nNpcIndex = FightNpcManager:GetNpcIndex(boss)
SyncNpc(nNpcIndex)
NpcChat(nNpcIndex, "<color=yellow>Xem ra ta b筰 di tay c馻 c竎 ngi r錳, h穣 xem ' B竎h Bi課 Ma Th﹏' c馻 ta y ! <color>")
return boss
else
return 0
end
end
-- 第四步
-- 开始:龙九天(对话NPC)说话,凤玲� �出现
-- 完成:显示完对话N秒后
Step4 = Step:New()
function Step4:Start(task)
local pos = task:GetPosition()
local mapid = task:GetMapId()
local boss = FightNpcManager:AddNpc("Long C鰑 Thi猲", NPCID_DIALOGBOSS, mapid, pos.boss.x, pos.boss.y, self, nil, 1, 1)
if (boss > 0) then
local nNpcIndex = FightNpcManager:GetNpcIndex(boss)
SetNpcKind(nNpcIndex, 3)
SyncNpc(nNpcIndex)
local delay = 4
local seconds = 0
NpcChat(nNpcIndex, "<color=yellow>C竎 v?qu?l?nh鱪g cao th?m?tr╩ n╩ ta m韎 頲 g苝 m閠 l莕, qu?nhi猲 nh b筰 頲 B竎h Bi課 Ma Th﹏ c馻 ta. Kh玭g gi蕌 g?c竎 v? Ch?nh﹏ ch th鵦 c馻 Ng鋍 Long S琻 Trang ch輓h l?Qu鑓 Vng c馻 Чi Kim, Tri襲 T鑞gs韒 mu閚 c騨g b?di謙 vong ch?l?chuy謓 c馻 th阨 gian m?th玦, c竎 v?h?t蕋 ph秈 hy sinh m閠 c竎h v?輈h nh?v藋 chi b籲g gia nh藀 v祇 B鎛 S琻 Trang m?gi髉 s鴆 ph?tr?Чi Kim, sau n祔 th祅h i nghi謕 th?ti襫 t礽 ph?qu?s?thu閏 v?c竎 v? Kh玭g bi誸 ?c馻 c竎 v?th?n祇? <color>")
seconds = seconds + delay
NpcChat(nNpcIndex, "<color=yellow>N誹 nh?c竎 v?v蒼 c鴑g u c?ch蕄 nh?v藋, th?ng c?tr竎h ta h?th?kh玭g l璾 t譶h, c竎 ngi b?ta h?m閠 c c?g鋓 l?Kim T祄 Tuy謙 M謓h C? ch?c莕 Th?T?c馻 ta v蓎 tay m閠 c竔 th?C?чc s?ph竧 ra, n l骳 c竎 ngi s鑞g kh玭g b籲g s鑞g ch誸 kh玭g b籲g ch誸, ha ha ha! <color>", seconds)
seconds = seconds + delay
NpcChat(nNpcIndex, "<color=yellow>Linh Lung, ra tay 甶, h穣 cho c竔 b鋘 ngi ngoan c?n祔 n誱 m飅 l頸 h筰 c馻 ta! <color>", seconds)
seconds = seconds + delay
NpcChat(nNpcIndex, "<color=yellow>Lung Linh, Lung Linh, ngi u r錳 c遪 kh玭g ra tay 甶? nhanh ph竧 ng C?чc c馻 ngi 甶, ta ch辵 kh玭g n鏸 b鋘 ngi n祔 n鱝 r錳! <color>", seconds)
self.m_Timer = TimerList:AddTimer(self, (seconds + 1) * 18, 1)
self.m_Boss = boss
self.m_Task = task
self.m_MapId = mapid
self.m_Pos = pos
end
end
function Step4:Close(task)
self:Clear()
end
function Step4
estroy()
self:Clear()
end
function Step4:Clear()
if (self.m_Timer ~= nil) then
TimerList
elTimer(self.m_Timer)
self.m_Timer = nil
end
if (self.m_Boss ~= nil) then
FightNpcManager
elNpc(self.m_Boss)
self.m_Boss = nil
end
if (self.m_Girl ~= nil) then
DlgNpcManager
elNpc(self.m_Girl)
self.m_Girl = nil
end
end
function Step4:OnTime(id)
if (id == 1) then
local girl = DlgNpcManager:AddNpc("Phng Lung Linh", NPCID_FENGLINGLONG, self.m_MapId, self.m_Pos.fenglinglong.x, self.m_Pos.fenglinglong.y)
if (girl > 0) then
self.m_Girl = girl
local nGirlIndex = DlgNpcManager:GetNpcIndex(girl)
SetNpcKind(nGirlIndex, 3)
SyncNpc(nGirlIndex)
NpcChat(nGirlIndex, "<color=yellow>Thi猲 Ca, t筰 sao huynh c遪 ch璦 t豱h ng?l筰, bao n╩ nay huynh lu玭 l蕐 nh鱪g trang b?t鑤 d?d?c竎 h穙 h竛 giang h? l蕐 Ki誱 Gia l祄 vang danh thi猲 h? gi誸 h筰 kh玭g bi誸 bao nhi猽 v?l﹎ cao th? v?sao huynh v蒼 c?su鑤 i l祄 ch?d蒼 阯g cho b鋘 ngi Kim nh?v藋? H玬 nay mu閕 kh玭g th?ti誴 t鬰 cho huynh ph秈 t閕 l筰 ch錸g l猲 t閕 頲 n鱝<color>")
local nBoyIndex = FightNpcManager:GetNpcIndex(self.m_Boss)
NpcChat(nBoyIndex, "<color=yellow>Linh Lung, ngi, ngi ! 厖<color>")
end
self.m_Timer = TimerList:AddTimer(self, 2 * 18, 2)
return 0
elseif (id == 2) then
FightNpcManager
elNpc(self.m_Boss)
self.m_Boss = FightNpcManager:AddNpc("Long C鰑 Thi猲", NPCID_FIGHTBOSS, self.m_MapId, self.m_Pos.boss.x, self.m_Pos.boss.y, self, nil, 1, 1)
self.m_Timer = TimerList:AddTimer(self, 18 * 5, 3)
return 0
elseif (id == 3) then
-- 给玩家加血
self.m_Task:IterPlayers(self, self.AddBlood)
return 1
else
return 0
end
end
function Step4:AddBlood(player)
-- 慈航普渡
player:CastSkill(93, 20)
end
function Step4:OnDeath()
if (self.m_Timer ~= nil) then
TimerList
elTimer(self.m_Timer)
self.m_Timer = nil
end
self.m_Boss = nil
self.m_Task
roceed()
end
pTask:AddStep(clone(Step1))
pTask:AddStep(clone(Step2))
pTask:AddStep(clone(Step3))
pTask:AddStep(clone(Step4))