summaryrefslogtreecommitdiff
path: root/npc/functions/dungeon.txt
blob: 0ad6f74e7ef7ff4d7dd7762f7b2677122aeed22f (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
// TMW2 Script
// Authors:
//    Jesusalva
// Description:
//    Dungeon utilities

-	script	#DungeonCore	NPC_HIDDEN,{
    end;

// Main initialization
OnInit:
    setarray .heatmap$, "007-2";
    setarray .cursemap$, "006-4", "006-4-1", "025-1";
    setarray .sickmap$, "029-5";
    setarray .bleedmap$, "006-9";
    end;

/////////////////////////////////////////
// Heartbeat for Heat effects
OnHeat:
    // Did you left?
    .@i=array_find(.heatmap$, getmap());
    if (.@i < 0) {
        @heat$="";
        end;
    }

    // First time seeing this
    if (@heat$ != getmap()) {
        @heat$=getmap();
        dispbottom l("This is a hot map, you're suffering damage over time.");
    }

    // You are in a HEATMAP$, so suffer damage from heat
    if (@coolio > gettimetick(2) || Class == Redy)
        percentheal -1, 0;
    else
        percentheal -5, 0;

    // New tick (dies in 140~180 seconds)
    addtimer2 rand2(7000, 9000), .name$+"::OnHeat";
    end;


/////////////////////////////////////////
// Heartbeat for Cursed Land map effects
OnCurse:
    // Did you left?
    .@i=array_find(.cursemap$, getmap());
    if (.@i < 0) {
        @curse$="";
        end;
    }

    // First time seeing this
    if (@curse$ != getmap()) {
        @curse$=getmap();
        dispbottom l("This is a Cursed Lands map, you'll lose mana over time and may also incurr in debuffs if mana is low (may cause death).");
    }

    // You are in a CURSEMAP$, so suffer damage from the curse
    if (@purifio > gettimetick(2) || Class == Savior)
        heal 0, -1;
    else if (islegendary())
        percentheal 0, -2;
    else
        percentheal 0, -4;

    // MP is below 20%, you'll get cursed
    if (Sp*100 < MaxSp*20)
        SC_Bonus(15, SC_CURSE, 1);

    // MP is below 1%, you'll get start losing HP rapidly
    if (Sp*100 < MaxSp)
        percentheal -9, 0;

    // New tick (cycles every 15 seconds in average)
    addtimer2 rand2(14000, 15000), .name$+"::OnCurse";
    end;

/////////////////////////////////////////
// Heartbeat for Disease effects
OnSick:
    // Did you left?
    .@i=array_find(.sickmap$, getmap());
    if (.@i < 0) {
        if (@forced_sick$ != getmap()) {
            @sick$="";
            end;
        }
    }

    // First time seeing this
    if (@sick$ != getmap()) {
        @sick$=getmap();
        dispbottom l("This map contains poisonous gas and may cause diseases.");
    }

    // The effect is based on HP
    if (Hp*10 > MaxHp*7)
        .@eff = SC_BLOODING;
    else if (Hp*10 > MaxHp*4)
        .@eff = SC_POISON;
    else
        .@eff = SC_DPOISON;

    // You are in a SICKMAP$, so suffer damage from disease
    if (@sickio > gettimetick(2)) {
        heal -50, 0;
    } else {
        heal -rand2(50, 200), 0;
        SC_Bonus(10, .@eff, 1);
    }

    // New tick (10 seconds fixed cycle)
    addtimer2 10000, .name$+"::OnSick";
    end;


/////////////////////////////////////////
// Heartbeat for Bleed effects
OnBleed:
    // Did you left?
    .@i=array_find(.bleedmap$, getmap());
    if (.@i < 0) {
        @bleed$="";
        end;
    }

    // First time seeing this
    if (@bleed$ != getmap()) {
        @bleed$=getmap();
        dispbottom l("This is a bleeding map, HP won't recover naturally, and bleeding may start.");
    }

    // You are in a BLEEDMAP$, HP regeneration is disabled
    if (@bleedio > gettimetick(2))
        sc_end SC_HALT_REGENERATION;
    else
        SC_Bonus(15, SC_HALT_REGENERATION, 1);

    // You may bleed at 2% chance per 15 seconds
    if (rand2(50) == 25)
        SC_Bonus(15, SC_BLOODING, 1);

    // New tick (15 seconds fixed cycle)
    addtimer2 15000, .name$+"::OnBleed";
    end;


}


//////////////////////////////
007-2	mapflag	nosave	007-1,99,189
006-4	mapflag	nosave	006-3,54,36
006-4-1	mapflag	nosave	006-3,54,36
029-5	mapflag	nosave	029-4,21,97
006-9	mapflag	nosave	006-6,46,27