diff options
-rw-r--r-- | maps/re/006-8.mcache | bin | 148 -> 179 bytes | |||
-rw-r--r-- | npc/006-8/kage.txt | 253 |
2 files changed, 253 insertions, 0 deletions
diff --git a/maps/re/006-8.mcache b/maps/re/006-8.mcache Binary files differindex 56cae2f17..8299d2aa7 100644 --- a/maps/re/006-8.mcache +++ b/maps/re/006-8.mcache diff --git a/npc/006-8/kage.txt b/npc/006-8/kage.txt index 7a35a4c80..f6284cd46 100644 --- a/npc/006-8/kage.txt +++ b/npc/006-8/kage.txt @@ -2,7 +2,9 @@ // Author: // Jesusalva +// Mapflags 006-8 mapflag zone MMO No Revive +006-8 mapflag battleground 006-8,44,68,0 script #OutOf0068 NPC_HIDDEN,0,0,{ end; @@ -13,3 +15,254 @@ OnTouch: end; } +006-8,38,58,0 script #Abort0068A NPC_HIDDEN,0,1,{ + end; + +OnTouch: + if (!$@CAPTURE_FLAG) { + slide 40, 64; + bg_leave(); + } + end; +} + +006-8,51,58,0 script #Abort0068B NPC_HIDDEN,0,1,{ + end; + +OnTouch: + if (!$@CAPTURE_FLAG) { + slide 49, 64; + bg_leave(); + } + end; +} + +006-8,40,62,0 script #Signin0068A NPC_HIDDEN,1,0,{ + end; + +OnTouch: + if ($@CAPTURE_INSC) + bgjoin($@CAPTURE_T1, "006-8", 37, 58); + end; +} + +006-8,48,62,0 script #Signin0068B NPC_HIDDEN,1,0,{ + end; + +OnTouch: + if ($@CAPTURE_INSC) + bgjoin($@CAPTURE_T2, "006-8", 52, 58); + end; +} + +006-8,45,65,0 script Kage NPC_CRUSADER,{ + function getmobid; + if ($@CAPTURE_FLAG) { + npctalk l("A game is currently going on, please wait for it to finish."); + end; + } + mesn; + mesq l("This a simple game; Choose one of the shrines - west or east. The one at west is %s, the one at east is %s.", b(l("Magenta")), b(l("Yellow"))); + next; + mesn; + mesq l("You can enter when clock ticks :15, and the game begin when the clock ticks :25 if anyone is around. This is to match with Call of Dusty event."); + next; + mesn; + mesq l("Once it begins (you can fight against an AI), kill the most of enemy sparks you can, while preventing your own sparks of being killed. Wins whoever has more sparks after %s minutes.", l(b("five"))); + next; + mesn; + mesq l("Keep in mind this is a PvP area - So try to avoid being butchered, because revival spells are disabled here! Hahaha!"); + close; + +OnForfeit1: + .@s=true; +OnForfeit2: + bg_leave(); + mapannounce "006-8", sprintf("%s (%s side) is down!", strcharinfo(0), (.@s ? b("Magenta") : b("Yellow"))), 0; + end; + +OnSpark1: + .sp1 += 1; end; +OnSpark2: + .sp2 += 1; end; + end; +OnSkip: + end; + +OnInit: + .distance=4; + .sp1 = 0; // Sparks killed by Team 1 + .sp2 = 0; // Sparks killed by Team 2 + $@CAPTURE_FLAG = false; + $@CAPTURE_INSC = false; + $@CAPTURE_T1 = bgnew("006-8", 34, 28, "Kage::OnForfeit1", "Kage::OnForfeit1"); + $@CAPTURE_T2 = bgnew("006-8", 55, 28, "Kage::OnForfeit2", "Kage::OnForfeit2"); + end; + +function getmobid { + .@lv = getarg(0); + if (.@lv <= 5) + return HouseMaggot; + else if (.@lv <= 11) + return AngryScorpion; + else if (.@lv <= 15) + return CaveMaggot; + else if (.@lv <= 20) + return AngryBat; + else if (.@lv <= 26) + return Bandit; + else if (.@lv <= 30) + return Bluepar; + else if (.@lv <= 35) + return RobinBandit; + else if (.@lv <= 40) + return Snake; + else if (.@lv <= 46) + return Wolvern; + else if (.@lv <= 52) + return HoodedNinja; + else if (.@lv <= 60) + return FrostiaGuard; + else if (.@lv <= 65) + return Scar; + else if (.@lv <= 75) + return Forain; + else if (.@lv <= 80) + return Terranite; + else if (.@lv <= 85) + return GoboBear; + else if (.@lv <= 90) + return TerraniteProtector; + else if (.@lv <= 100) + return Reaper; + else if (.@lv <= 107) + return Snail; + else if (.@lv <= 115) + return Mandragora; + else if (.@lv <= 120) + return PinkieMaximus; + else if (.@lv <= 125) + return Junglefowl; + else if (.@lv <= 130) + return Tengu; + else if (.@lv <= 135) + return SuperiorShroom; + else if (.@lv <= 140) + return Nutcracker; + else if (.@lv <= 150) + return Golem; + else if (.@lv <= 160) + return EarthElement; + else if (.@lv <= 175) + return EpiphanyWisp; + // If all else fails, pick the strongest aggro mob + return EpiphanyWisp; +} + +OnMinute15: + $@CAPTURE_INSC = true; + mapannounce "006-8", "Kage : Inscriptions are open! The event will begin in ##B10 minutes!##b", 0; + end; + +OnMinute24: + mapannounce "006-8", "Kage : Inscriptions are about to close! The event will begin in ##B1 minute!##b", 0; + end; + +OnMinute25: + $@CAPTURE_INSC = false; + $@CAPTURE_FLAG = true; + /* Prepare the teams */ + setbgteam $@CAPTURE_T1, 1; + setbgteam $@CAPTURE_T2, 2; + /* Validate difficulty */ + .@t1p = bg_get_data($@CAPTURE_T1, 0); + .@t2p = bg_get_data($@CAPTURE_T2, 0); + .@t1lv = 0; .@t2lv = 0; + /* Optional Reinforcements when unbalanced */ + freeloop(true); + .@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, "006-8", 30, 20, 60, 60); + for (.@i = 0; .@i < .@c; .@i++) { + .@id = .@pcs[.@i]; + .@n$ = strcharinfo(0, "", .@id); + .@bg = getcharid(4, .@n$); + if (.@bg < 1) { consolewarn("Invalid bg for %s (%d): %d",.@m$, .@id, .@bg); continue; } // TODO: Get rid of them + if (.@bg == $@CAPTURE_T1) + .@t1lv += readparam(BaseLevel, .@id); + else if (.@bg == $@CAPTURE_T2) + .@t2lv += readparam(BaseLevel, .@id); + else + consolebug("BG %d is not valid (%d, %d)", .@bg, $@CAPTURE_T1, $@CAPTURE_T2); + } + // Calc. averages + .@t1a = .@t1lv / .@t1p; + .@t2a = .@t2lv / .@t2p; + /* Spawn guards as needed... */ + // Normalize player count + while (.@t1p < .@t2p) { + .@t1p += 1; + bg_monster($@CAPTURE_T1, "006-8", 32, rand2(24, 32), "Magenta Ally", getmobid(.@t1a), "Kage::OnSkip"); + } + while (.@t2p < .@t1p) { + .@t2p += 1; + bg_monster($@CAPTURE_T2, "006-8", 53, rand2(24, 32), "Yellow Ally", getmobid(.@t2a), "Kage::OnSkip"); + } + // Apply a buff on the teams, based on level difference + .@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, "006-8", 30, 20, 60, 60); + .@t1b = .@t2a - .@t1a; // Team 1 Boost + .@t2b = .@t1a - .@t2a; // Team 2 Boost + for (.@i = 0; .@i < .@c; .@i++) { + .@id = .@pcs[.@i]; + .@n$ = strcharinfo(0, "", .@id); + .@bg = getcharid(4, .@n$); + if (.@bg == $@CAPTURE_T1 && .@t1b > 0) { + sc_start SC_INCMHP, 300000, .@t1b * 1000, 10000, SCFLAG_NOAVOID, .@id; + sc_start SC_INCATKRATE, 300000, .@t1b, 10000, SCFLAG_NOAVOID, .@id; + sc_start SC_INCHITRATE, 300000, .@t1b, 10000, SCFLAG_NOAVOID, .@id; + sc_start SC_INCFLEERATE, 300000, .@t1b, 10000, SCFLAG_NOAVOID, .@id; + } else if (.@bg == $@CAPTURE_T2 && .@t2b > 0) { + sc_start SC_INCMHP, 300000, .@t2b * 1000, 10000, SCFLAG_NOAVOID, .@id; + sc_start SC_INCATKRATE, 300000, .@t2b, 10000, SCFLAG_NOAVOID, .@id; + sc_start SC_INCHITRATE, 300000, .@t2b, 10000, SCFLAG_NOAVOID, .@id; + sc_start SC_INCFLEERATE, 300000, .@t2b, 10000, SCFLAG_NOAVOID, .@id; + } + } + freeloop(false); + // FALLTHROUGH +OnMinute26: +OnMinute27: +OnMinute28: +OnMinute29: + /* New wave of sparks */ + .@am = 7 + getmapusers("006-8"); + // TODO (and a loop) + freeloop(true); + for (.@i=0; .@i < .@am; .@i++) { + bg_monster($@CAPTURE_T1, "006-8", rand2(31, 44), rand2(21, 35), "Magenta Spark", MagentaSpark, "Kage::OnSpark1"); + bg_monster($@CAPTURE_T2, "006-8", rand2(45, 58), rand2(21, 35), "Yellow Spark", YellowSpark, "Kage::OnSpark2"); + + } + freeloop(false); + end; + +OnMinute30: + /* Finish the duel! */ + if (.sp2 > .sp1) { + // More spark 2 killed than spark 1 + mapannounce "006-8", "Kage : ##BMagenta Team##b is the victor!", 0; + } else if (.sp1 > .sp2) { + mapannounce "006-8", "Kage : ##BYellow Team##b is the victor!", 0; + } else { + mapannounce "006-8", "Kage : ##BDraw##b! No one has won!", 0; + } + // TODO: Rewards & Victor + /* Cleanup */ + $@CAPTURE_FLAG = false; + .sp1 = 0; + .sp2 = 0; + end; + +} + + + + |