// Snake Lord script 011-5.gat,37,124,0 script SnakeLord 0,20,50{ onTouch: if ($@SNAKELORD_LEVEL == 0) goto L_CLEAN_UP; end; onStartBattle: set $@SNAKELORD_TICK_DAMAGE, -50; set $@SNAKELORD_LEVEL, 1; set $@SNAKELORD_TIMER, 0; set $@SNAKELORD_ROOM_A, 0; set $@SNAKELORD_ROOM_B, 0; set $@SNAKELORD_ROOM_C, 0; set $@SNAKELORD_ROOM_D, 0; setnpctimer 0; // Spawn the Snake Lord monster "011-5.gat", 31, 82, "", 1039, 1, "SnakeLord::onWin"; end; onTick: if(isdead(0)) end; set $@SNAKELORD_PLAYER_COUNT, ($@SNAKELORD_PLAYER_COUNT + 1); specialeffect2 6; heal $@SNAKELORD_TICK_DAMAGE, 0; end; onRandomRoom: if (isdead(0) == 1 || rand(15) != 0) end; areaannounce "011-5.gat", 18, 76, 56, 171, "Snake Lord: Go play with my pets!", 0; set @TEMP_RAND, rand(4); if(@TEMP_RAND == 0) goto L_SEND_ROOM_A; if(@TEMP_RAND == 1) goto L_SEND_ROOM_B; if(@TEMP_RAND == 2) goto L_SEND_ROOM_C; if(@TEMP_RAND == 3) goto L_SEND_ROOM_D; L_SEND_ROOM_A: warp "011-5.gat", 23, 166; // Grass areamonster "011-5.gat", 18, 162, 27, 121, "", 1034, 2, "SnakeLord::onRoomA"; set $@SNAKELORD_ROOM_A, ($@SNAKELORD_ROOM_A + 2); end; L_SEND_ROOM_B: warp "011-5.gat", 23, 111; // Mountain areamonster "011-5.gat", 18, 106, 28, 115, "", 1026, 3, "SnakeLord::onRoomB"; set $@SNAKELORD_ROOM_B, ($@SNAKELORD_ROOM_B + 3); end; L_SEND_ROOM_C: warp "011-5.gat", 22, 140; // Snake areamonster "011-5.gat", 18, 136, 26, 145, "", 1010, 4, "SnakeLord::onRoomC"; set $@SNAKELORD_ROOM_C, ($@SNAKELORD_ROOM_C + 4); end; L_SEND_ROOM_D: warp "011-5.gat", 51, 140; // Cave areamonster "011-5.gat", 46, 136, 56, 145, "", 1021, 5, "SnakeLord::onRoomD"; set $@SNAKELORD_ROOM_D, ($@SNAKELORD_ROOM_D + 5); end; onRoomA: set $@SNAKELORD_ROOM_A, ($@SNAKELORD_ROOM_A - 1); if ($@SNAKELORD_ROOM_A > 0) end; areawarp "011-5.gat", 18, 162, 27, 121, "011-5.gat", 31, 78; end; onRoomB: set $@SNAKELORD_ROOM_B, ($@SNAKELORD_ROOM_B - 1); if ($@SNAKELORD_ROOM_B > 0) end; areawarp "011-5.gat", 18, 106, 28, 115, "011-5.gat", 31, 78; end; onRoomC: set $@SNAKELORD_ROOM_C, ($@SNAKELORD_ROOM_C - 1); if ($@SNAKELORD_ROOM_C > 0) end; areawarp "011-5.gat", 18, 136, 26, 145, "011-5.gat", 31, 78; end; onRoomD: set $@SNAKELORD_ROOM_D, ($@SNAKELORD_ROOM_D - 1); if ($@SNAKELORD_ROOM_D > 0) end; areawarp "011-5.gat", 46, 136, 56, 145, "011-5.gat", 31, 78; end; OnTimer5000: setnpctimer 0; if ($@SNAKELORD_LEVEL == 0) goto L_CLEAN_UP; set $@SNAKELORD_TIMER, ($@SNAKELORD_TIMER + 5); if ($@SNAKELORD_PLAYER_COUNT < 1 || $@SNAKELORD_TIMER >= 420) goto YOU_LOSE; if ($@SNAKELORD_TIMER >= 300) goto L_ENRAGED; L_TIMER_A: if (rand(20) == 0) goto L_PETS; L_TIMER_B: goto L_DEATH_CHECK; L_TIMER_C: set $@SNAKELORD_PLAYER_LAST_COUNT, $@SNAKELORD_PLAYER_COUNT; set $@SNAKELORD_PLAYER_COUNT, 0; areatimer "011-5.gat", 18, 76, 56, 171, 10, "SnakeLord::onTick"; areatimer "011-5.gat", 22, 76, 40, 87, 20, "SnakeLord::onRandomRoom"; end; L_ENRAGED: set $@SNAKELORD_TICK_DAMAGE, ($@SNAKELORD_TICK_DAMAGE - 50); if ($@SNAKELORD_LEVEL == 2) goto L_TIMER_A; areaannounce "011-5.gat", 18, 76, 56, 171, "Snake Lord: You are starting to become bothersome!", 0; set $@SNAKELORD_LEVEL, 2; goto L_TIMER_A; L_PETS: areaannounce "011-5.gat", 18, 76, 56, 171, "Snake Lord: Come to me my pets!", 0; areamonster "011-5.gat", 22, 76, 40, 87, "", 1034, 1, "SnakeLord::onPetDeath"; // Grass areamonster "011-5.gat", 22, 76, 40, 87, "", 1026, 2, "SnakeLord::onPetDeath"; // Mountain areamonster "011-5.gat", 22, 76, 40, 87, "", 1010, 3, "SnakeLord::onPetDeath"; // Snake areamonster "011-5.gat", 22, 76, 40, 87, "", 1021, 4, "SnakeLord::onPetDeath"; // Cave set $@SNAKELORD_TICK_DAMAGE, ($@SNAKELORD_TICK_DAMAGE - 100); goto L_TIMER_B; L_DEATH_CHECK: if ($@SNAKELORD_PLAYER_COUNT >= $@SNAKELORD_PLAYER_LAST_COUNT) goto L_TIMER_C; set $@SNAKELORD_PLAYER_LAST_COUNT, ($@SNAKELORD_PLAYER_LAST_COUNT - 1); set $@SNAKELORD_TICK_DAMAGE, ($@SNAKELORD_TICK_DAMAGE - 50); areaannounce "011-5.gat", 18, 76, 56, 171, "Snake Lord: Your soul gives me more POWER!", 0; goto L_DEATH_CHECK; onPetDeath: set $@SNAKELORD_TICK_DAMAGE, ($@SNAKELORD_TICK_DAMAGE + 10); end; onWin: areaannounce "011-5.gat", 18, 76, 56, 171, "Snake Lord: What!?! How could this had happend!", 0; //TODO: Areawarp to rewards here goto L_CLEAN_UP; YOU_LOSE: areaannounce "011-5.gat", 18, 76, 56, 171, "Snake Lord: My pets will feed for weeks!", 0; goto L_CLEAN_UP; L_CLEAN_UP: set $@SNAKELORD_LEVEL, 0; killmonster "011-5.gat", "SnakeLord::onWin"; killmonster "011-5.gat", "SnakeLord::onPetDeath"; killmonster "011-5.gat", "SnakeLord::onRoomA"; killmonster "011-5.gat", "SnakeLord::onRoomB"; killmonster "011-5.gat", "SnakeLord::onRoomC"; killmonster "011-5.gat", "SnakeLord::onRoomD"; areawarp "011-5.gat", 18, 76, 56, 171, "011-5.gat", 30, 31; end; onInit: initnpctimer; startnpctimer; }