summaryrefslogtreecommitdiff
path: root/npc/023-2/mk.txt
blob: 0fdfb01540ef1eb72b8fa44f422ed2b3d5eee67b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Nivalis Liberation Day

// The Walking Monster King
023-2,121,35,0	script	The Monster King#NLib	NPC_MONSTERKING,{
    end;

OnTouch:
    percentheal -100, -100;
    end;

OnInit:
    .sex = G_MALE;
    .distance = 5;

OnHour00:
    if (!$NLIB_DAY) {
        disablenpc .name$;
        end;
    }
    switch ($NLIB_DAY) {
        case 1:
            movenpc(.name$, 121, 35, DIR_WEST); break;
        case 2:
            movenpc(.name$, 105, 37, DIR_NORTH); break;
        case 3:
            movenpc(.name$, 105, 51, DIR_SOUTH); break;
        case 4:
            movenpc(.name$, 102, 63, DIR_WEST); break;
        case 5:
            movenpc(.name$, 81, 59, DIR_NORTH); break;
        case 6:
            movenpc(.name$, 53, 53, DIR_SOUTH); break;
        case 7:
            movenpc(.name$, 36, 99, DIR_SOUTH); break;
        default:
            channelmes("#world", "A bug happened: Monster King # Nivalis Liberation Day - Value Out of Range."); disablenpc .name$; break;
    }

    end;

// Event Handler

L_Finish:
    // Just being bigger is not enough. Must be over the double for the advantage draw (about 1 player for 10m)
    if (.victory_count > (.defeat_count*2)) {
        announce "The fight ends in draw! The Monster King did accomplish what he set, though...", bc_all|bc_npc;
        $MANA_BINT-=1;
        $MANA_BLVL-=1;
        $MANA_JLVL+=1;
    } else if (.victory_count < 100) { // 1 player for 5 minutes is enough to prevent this loss
        announce "The Monster King, after moping the floor with the players, accomplish what he set, and left...", bc_all|bc_npc;
        $MANA_BINT+=1;
        $MANA_BLVL+=1;
        $MANA_JLVL+=1;
    } else  {
        announce "The fight ends in draw, with advantage to the Monster King...", bc_all|bc_npc;
        $MANA_BINT+=1;
        $MANA_BLVL-=1;
        $MANA_JLVL+=1;
    }
L_Finish2:
    killmonsterall("023-2");
    .wcycle=0;
    maptimer("023-2", 10, "The Monster King#NLib::OnReturn");
    stopnpctimer;
    end;

OnTimer3000:
    .wcycle+=3;
    .@pl=getareausers("023-2", 21, 109, 31, 114);
    .@pla=getmapusers("023-2");
    if (.@pl <= 0 && .@pla > 0)
        mapannounce "023-2", "##1WARNING: Players outside the Monster King room counts toward DEFEAT count!", 0;
    .victory_count+=.@pl;

    // Processment
    if (.@pl <= 0) {
        .defeat_count+=1;
    } else if (.wcycle % 30 == 3) {
        areamonster "023-2", 21, 109, 31, 114, "Monster", any(AngryScorpion, BlackSlime, BlackScorpion, Wolvern, BlueSlime, SlimeBlast, CaveMaggot), .@pl;
    } else if (.wcycle % 30 == 18) {
        areamonster "023-2", 21, 109, 31, 114, "Monster", any(BlackSlime, BlueSlime, SlimeBlast), 1; // PS. Drop “Demure Dark Soul” ¬.¬
    }
    if (.wcycle >= 900) goto L_Finish;
    initnpctimer;
    end;

OnVictory:
    announce "Players have defeated the Monster King! He fleed from the cave after leaving a decoy!", bc_all|bc_npc;
    $MANA_BINT-=10;
    $MANA_BLVL-=10;
    $MANA_JLVL-=5;
    goto L_Finish2;
    end;

OnBegin:
    .defeat_count=0;
    .victory_count=0;
    .wcycle=0;
    announce "The fight against the Monster King ends in 15 minutes. If he is forced to flee, that'll result as victory.", bc_all|bc_npc;
    announce "Each cycle there are players fighting against him will result in victory points. The opposite will result in defeat points.", bc_all|bc_npc;
    announce "More players fighting will result in more victory points. This may affect drastically the result.", bc_all|bc_npc;
    movenpc(.name$, 0, 0);
    monster("023-2", 24, 111, "The Monster King", MonsterKing, 1, "The Monster King#NLib::OnVictory");
    monster("023-2", 30, 109, "Andrei Sakar", AndreiSakar, 1);
    areamonster "023-2", 21, 109, 31, 114, "Monster", AngryScorpion, 1;
    areamonster "023-2", 21, 109, 31, 114, "Monster", BlackSlime, 2;
    areamonster "023-2", 21, 109, 31, 114, "Monster", BlueSlime, 1;
    areamonster "023-2", 21, 109, 31, 114, "Monster", CaveMaggot, 1;
    initnpctimer;
    end;

OnReturn:
    warp "019-2", 43, 55;
    end;
}


// Floor triggers
023-2,121,35,0	script	#NLIB_T01	NPC_HIDDEN,1,2,{

OnTouch:
    if ($NLIB_DAY == 1) {
        @QNL3=1;
        dispbottom l("I've found the Monster King.");
    }
    end;
}


023-2,110,36,0	script	#NLIB_T02	NPC_HIDDEN,2,2,{

OnTouch:
    if ($NLIB_DAY == 2) {
        @QNL3=1;
        dispbottom l("I've found the Monster King.");
    } else if ($NLIB_DAY < 2) {
        slide 114, 36;
        dispbottom l("I should not veer off too much the path.");
    }
    end;
}

023-2,105,50,0	script	#NLIB_T03	NPC_HIDDEN,2,2,{

OnTouch:
    if ($NLIB_DAY == 3) {
        @QNL3=1;
        dispbottom l("I've found the Monster King.");
    } else if ($NLIB_DAY < 3) {
        slide 104, 48;
        dispbottom l("I should not veer off too much the path.");
    }
    end;
}

023-2,104,62,0	script	#NLIB_T04	NPC_HIDDEN,0,0,{

OnTouch:
    if ($NLIB_DAY == 4) {
        @QNL3=1;
        dispbottom l("I've found the Monster King.");
    } else if ($NLIB_DAY < 4) {
        slide 104, 61;
        dispbottom l("I should not veer off too much the path.");
    }
    end;
}

023-2,86,59,0	script	#NLIB_T05	NPC_HIDDEN,2,5,{

OnTouch:
    if ($NLIB_DAY == 5) {
        @QNL3=1;
        dispbottom l("I've found the Monster King.");
    } else if ($NLIB_DAY < 5) {
        slide 91, 61;
        dispbottom l("I should not veer off too much the path.");
    }
    end;
}

023-2,53,49,0	script	#NLIB_T06	NPC_HIDDEN,0,5,{

OnTouch:
    if ($NLIB_DAY == 6) {
        @QNL3=1;
        dispbottom l("I've found the Monster King.");
    } else if ($NLIB_DAY < 6) {
        slide 55, 48;
        dispbottom l("I should not veer off too much the path.");
    }
    end;
}

023-2,35,90,0	script	#NLIB_T07	NPC_HIDDEN,0,2,{

OnTouch:
    if (gettime(2) < 25 || gettime(2) > 35) {
        slide 39, 89;
        dispbottom l("I should not go ahead... yet.");
    }
    end;
}