summaryrefslogtreecommitdiff
path: root/npc/081-3/logic.txt
blob: 6d98fddc0f60ddb928345e4e4268c30d168327cd (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
// TMW Script.
// Author:
//    Jesusalva
// Notes:
//    Christmas 2021 - Boss Chamber #1

081-3,44,36,0	script	Pentagram#Xmas21A	NPC424,{
    .@id = X21ID();
    if ($@XMAS21_BC1[.@id]) end;
    .@n$ = instance_npcname("Pentagram#Xmas21A");
    .@cl = X21BC1_CLEAR();

    mesn;
    mesq l("Should we break the Pentagram?");
    next;
    select
        l("I'm not ready yet."),
        l("Bring it on!"),
        rif(.@cl, l("Make it harder!")),
        rif(.@cl, l("Make it a nightmare!")),
        rif(.@cl, l("Kill me semi-instantly!"));
    mes "";
    if (@menu == 1) {
        closeclientdialog;
        close;
    }

    .BC1ME = getcharid(3);
    .@mg = monster(getmap(), 44, 36, "Existential Crisis", Santaboo, 1, .@n$+"::OnFin"); // FIXME Santaboo => SnowBallMan

    // Prepare the difficulty settings
    // Each difficulty level doubles the nº of players difficulty setting
    // Can go up to 12 * 4 = 48, but we use 16 as the theoretical max
    .@df = max(1, getmap() * ((@menu - 1) * 2));
    .@lv = BaseLevel;

    setunitdata(.@mg, UDT_MAXHP, 5000 + (.@lv * 150) + (1200 * .@df));
    setunitdata(.@mg, UDT_HP,    5000 + (.@lv * 150) + (1200 * .@df));

    setunitdata(.@mg, UDT_ADELAY, 2200 - max(1200, 75 * .@df));
    setunitdata(.@mg, UDT_ATKRANGE, 3);

    /*
    setunitdata(.@mg, UDT_ATKMIN,   .@lv*4+.@df*3);
    setunitdata(.@mg, UDT_ATKMAX,   .@lv*4+.@df*3);
    */
    setunitdata(.@mg, UDT_ATKMIN,   (.@lv+.@df)*5);
    setunitdata(.@mg, UDT_ATKMAX,   (.@lv+.@df)*6);
    setunitdata(.@mg, UDT_DEF,      min(50+.@df, 98));
    setunitdata(.@mg, UDT_MDEF,     min(50+.@df, 98));
    setunitdata(.@mg, UDT_HIT,      9999);

    // Destroy the instance only after half hour has passed
    instance_set_timeout(1800, 1800);
    initnpctimer;
    setnpctimer(29000);
    disablenpc(.@n$);
    $@XMAS21_BC1[.@id] = X21BC1_ON;
    .BC1ID = .@mg;
    close;

OnFin:
    if (playerattached())
        getexp 10000, 0;
    // Attach whoever broke the seal
    if (attachrid(.BC1ME)) {
        if (!X21BC1_CLEAR()) {
            dispbottom l("Whatever that guardian was, the path is now clear, and the gate, open.");
            X21BC1_DOCLEAR();
            getexp 5000, 0;
        }
    }
    stopnpctimer;
    end;

// Pseudo-Magic
OnTimer30000:
    .CYCLE += 1;
    .@m$=getmapinfo(MAPINFO_NAME); // Maybe .map$?
    debugmes "HEARTBEAT";
    debugmes "map$ is %s", .map$;
    debugmes "MAPINFO is %s", .@m$;
    debugmes "-----------------------------------------------\n";
    areamonster(.@m$, 31, 23, 58, 50, "Snowballz", IceElement, 1+getmapusers(.@m$)); // FIXME IceElement => Snowball

    if (.CYCLE % 3 != 0) {
        initnpctimer;
        end;
    }

    // The boss special skill depends on its health
    .@hp = 100 * getunitdata(.BC1ID, UDT_HP) / getunitdata(.BC1ID, UDT_MAXHP);

    // HP > 70%, just some warm-up
    if (.@hp > 70) {
        unittalk(.BC1ID, "Blizzard!");
        rectharm(.BC1ID, 6, 6, rand2(250), Ele_Neutral, "filter_always", BL_PC);

    // HP < 70%, cripple half the attackers
    } else if (.@hp > 40) {
        .@sc = any(SC_SILENCE, SC_BLIND);
        if (.@sc == SC_SILENCE)
            unittalk(.BC1ID, "Silence!");
        else
            unittalk(.BC1ID, "Blind!");
        areasc2(.@m$, 44, 36, 14, rand2(15000), BL_PC, .@sc);

    // HP < 40%, cause great damage
    } else if (.@hp > 15) {
        unittalk(.BC1ID, "Greater Blizzard!");
        rectharm(.BC1ID, 8, 8, 100+rand2(250), Ele_Neutral, "filter_always", BL_PC);

    // HP < 15%, use more dangerous conditions
    } else {
        .@sc = any(SC_POISON, SC_CURSE);
        if (.@sc == SC_SILENCE)
            unittalk(.BC1ID, "Poison!");
        else
            unittalk(.BC1ID, "Curse!");
        areasc2(.@m$, 44, 36, 14, rand2(15000), BL_PC, .@sc);
    }

    // Repeat forever
    initnpctimer;
    end;

OnClean:
    enablenpc(.name$);
    killmonsterall(getmapinfo(MAPINFO_NAME));
OnInit:
    .distance=2;
    .BC1ID = 0;
    .CYCLE = 0;
    .BC1ME = 0;
    end;
}


081-3,44,22,0	script	#0813Nexit	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    if (!X21BC1_CLEAR()) {
        dispbottom l("A strong magic barrier prevents me from using this exit.");
        end;
    }
    .@id = X21ID();
    if ($@XMAS21_BC1[.@id] == X21BC1_ON) end;
    if ($@XMAS21_BC1[.@id] == X21BC1_OFF) {
        mesn;
        mesq l("Should we leave?");
        next;
        if (askyesno() == ASK_YES) {
            // FIXME: Alissa's ED Cutscene
            warp "081-1", 68, 31;
        }
        close;
    }
    end;
}

081-3,44,50,0	script	#0813Sexit	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    if ($@XMAS21_BC1[.@id] == X21BC1_ON) end;
    warp "081-2", 90, 21;
    end;
}