summaryrefslogtreecommitdiff
path: root/npc/042-11/boss.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/042-11/boss.txt')
-rw-r--r--npc/042-11/boss.txt87
1 files changed, 86 insertions, 1 deletions
diff --git a/npc/042-11/boss.txt b/npc/042-11/boss.txt
index 85ce5861a..1a5a5e261 100644
--- a/npc/042-11/boss.txt
+++ b/npc/042-11/boss.txt
@@ -46,21 +46,106 @@ L_NoAccess:
// Spawns Terogan
OnBegin:
+ .@mob=0;
+ setd("$@GTEMP_"+.@m$, .@mob);
+ setd("$@GTEMP_HP_"+.@m$, 20);
initnpctimer;
end;
// Checks HP ratio again
OnTimer5000:
- // Monks function is: KamelotCaveSpawn(36, 20, 20, 160, 140, .@avg, .@m$);
+ explode(.@map$, .map$, "@");
+ .@g=atoi(.@map$[1]);
+ if (.@g < 1) {
+ debugmes "[ERROR] [KAMELOT] Unable to find Terogan - Kamelot %s", .map$;
+ .@g=0;
+ }
+
+ // Retrieve Terogan's GUID and MAP ID
+ .@m$=instance_mapname("042-11");
+ .@mob=getd("$@GTEMP_"+.@m$);
+
+ .@gcount=$KAMELOT_PC[.@g]+2; // Always at least 3 spawns
+ .@avg=$KAMELOT_MX[.@g]+rand2(22, 27); // Always at least 27 levels above
+
+ // Calculate current HP ratio and the difference
+ .@ratio=getunitdata(.@mob, UDT_HP)*20/getunitdata(.@mob, UDT_MAXHP);
+ .@hplos=getd("$@GTEMP_HP_"+.@m$)-.@ratio;
+
+ //debugmes "Ratio %d/%d", .@ratio, getd("$@GTEMP_HP_"+.@m$);
+ if (.@ratio < getd("$@GTEMP_HP_"+.@m$)) {
+ mapannounce .@m$, "General Terogan : "+any("Charge!", "To the Abyss with you already!", "Kill them already!", "More of them might be coming!", "Minions, ATTACK!", "Muahahaha, Pathetic!"), 0;
+
+ // Unlike Krukan, spawn according to HP loss (no use fast killing)
+ KamelotCaveSpawn(.@gcount*max(1, .@hplos), 20, 20, 57, 40, .@avg, .@m$);
+ }
+ // Always update the ratio - Terogan could have been healed
+ setd("$@GTEMP_HP_"+.@m$, .@ratio);
initnpctimer;
end;
// Monks Rewards
OnKillMob:
+ // Maybe a reward is due
+ .@g=getcharid(2);
+ if (.@g < 1) percentheal -100, -100;
+ getexp $KAMELOT_MX[.@g]*8, $KAMELOT_MX[.@g]*4; // Lower than previously
end;
// Boss rewards
OnKillBoss:
+ if (playerattached()) {
+ // Setup
+ .@g=getcharid(2);
+ .@m$=getmap();
+ .@hero$=strcharinfo(0);
+ // Player Reward for completing this stage
+ getitem GuildCoin, 10;
+ getexp $KAMELOT_MX[.@g]*150, $KAMELOT_MX[.@g]*30;
+ } else {
+ explode(.@map$, .map$, "@");
+ .@g=atoi(.@map$[1]);
+ if (.@g < 1) {
+ debugmes "[ERROR] [KAMELOT] Unable to find Terogan Death %s", .map$;
+ .@g=0;
+ }
+ .@m$=.map$;
+ .@hero$="The guild";
+ }
+
+ // Mark quest as completed
+ $KAMELOT_QUEST[.@g]=$KAMELOT_QUEST[.@g]|64;
+
+ // Get rid of temporary variables
+ setd("$@GTEMP_"+.@m$, 0);
+ setd("$@GTEMP_HP_"+.@m$, 0);
+
+ // Guild Reward for completing this stage
+ .@ggp=2000+$KAMELOT_MX[.@g]*100;
+ .@gxp=$KAMELOT_MX[.@g]*250;
+ $GUILD_BANK[.@g]+=.@ggp;
+ guildgetexp(.@gxp); // Silently fails if no char attached
+
+ // Announce
+ mapannounce .@m$, .@hero$+" has defeated the evil in Kamelot!", 0;
+
+ // Spawn GMGiftBox upon end
+ .@gf=max(30, $KAMELOT_MX[.@g]/5);
+ areamonster(.@m$, 20, 20, 57, 40, strmobinfo(1, GMGiftBox), GMGiftBox, .@gf);
+
+ // Spawn Treasure Chests upon end
+ .@gl=$KAMELOT_MX[.@g];
+ .@gtype=(.@gl > 100 ? SupremeChest : (.@gl > 75 ? PrismChest : (.@gl > 50 ? GoldenChest : (.@gl > 25 ? SilverChest : BronzeChest))));
+ .@gf=$KAMELOT_PC[.@g];
+ areamonster(.@m$, 20, 20, 57, 40, strmobinfo(1, .@gtype), .@gtype, .@gf);
+
+ // Guild Master Notification
+ .@gm$=getguildmaster(.@g);
+ if (!getcharid(3, .@gm$)) end;
+ .@gma=getcharid(3, .@gm$);
+ .@gmb=getcharid(0, .@gm$);
+ if (!isloggedin(.@gma, .@gmb)) end;
+ message .@gm$, strcharinfo(0)+" defeated the boss: Guild GP +"+.@ggp+" Guild XP +"+.@gxp;
end;
// Instance