summaryrefslogtreecommitdiff
path: root/npc/007-1/torches.txt
blob: 5dd82e21738795426c8ef7abbd9cf0d16f771fbc (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
// TMW-2 script.
// Author:
//    Crazyfefe
//    Jesusalva
// Description:
//    Torches
// Variables:
//    TulimsharQuest_DarkInvocator
// Values:
//    0    Default.
//    1    Quest Found.
//    2    Quest Accepted.
//    3    Bomb Defused.
//    4    Quest Completed.


function	script	CheckTorch	{
    @torch_count = 0;
    @count_tmp = 0;
    if ($@GM_OVERRIDE)
        npctalk3 l("Hello, I am T-@@, of the @@ order.", @torch, $@TorchBits[@torch]);
    if (getq2(TulimsharQuest_DarkInvocator) & $@TorchBits[@torch])
        goto L_Empty;
    if (countitem(EverburnPowder) <= 0) {
        dispbottom(l("I do not have Everburn Powder to lit the torch."));
        end;
    }
    setq2 TulimsharQuest_DarkInvocator, getq2(TulimsharQuest_DarkInvocator) | $@TorchBits[@torch];

    goto L_Loop;

L_TorchTally:
    specialeffect(62);
    specialeffect(54);
    getmapxy(@m$, .@x, .@y, 0);

    switch (@torch_count) {
        case 1:
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 4, "Zarkor::OnMonster";
            break;
        case 2:
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 5, "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 1, "Zarkor::OnMonster";
            break;
        case 3:
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 6, "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 5, "Zarkor::OnMonster";
            break;
        case 4:
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Black Scorpion", BlackScorpion, 1, "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, 6, "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, 7, "Zarkor::OnMonster";
            break;
        case 5:
            areamonster @m$, .@x-3, .@y-3, .@x+3, .@y+3, "Black Scorpion", BlackScorpion, 3, "Zarkor::OnMonster";
            areamonster @m$, .@x-3, .@y-3, .@x+3, .@y+3, "Magic Maggot", CaveMaggot, 8, "Zarkor::OnMonster";
            areamonster @m$, .@x-3, .@y-3, .@x+3, .@y+3, "Magic Goblin", MagicGoblin, 10, "Zarkor::OnMonster";
            break;
        default:
            dispbottom l("BUG, Please report: TorchTally, err_val @@", @torch_count);
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Black Scorpion", BlackScorpion, rand(1,2), "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Maggot", CaveMaggot, rand(1,3), "Zarkor::OnMonster";
            areamonster @m$, .@x-2, .@y-2, .@x+2, .@y+2, "Magic Goblin", MagicGoblin, rand(1,5), "Zarkor::OnMonster";
    }

    delitem EverburnPowder, 1;
    if (@torch_count == 5) {
        message strcharinfo(0), l("All torches are lit!");
        //killmonsterall("007-1");
        setq1 TulimsharQuest_DarkInvocator, 6;
    }

    return;

L_Loop:
    while (@count_tmp < 5) {
        @count_tmp = (@count_tmp + 1);
        if (getq2(TulimsharQuest_DarkInvocator) & $@TorchBits[@count_tmp])
            @torch_count = (@torch_count + 1);
    }
    goto L_TorchTally;

L_Empty:
    message strcharinfo(0), l("This torch is already lit.");
    return;

}

007-1,171,145,0	script	Torch#1	NPC_NO_SPRITE,{
    @torch = 1;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
        npctalk(l("What is @@ doing?", strcharinfo(0)), "Miner#SkyDG");
    }
    end;
OnInit:
    // Remember: array start at zero, but barrels count start at 1. "Fixing" may break torch 5!
    setarray $@TorchBits, (1 << 1), (1 << 2), (1 << 3), (1 << 4), (1 << 5), (1 << 6);
    .sex = G_OTHER;
    .distance = 1;
    end;
}

007-1,70,116,0	script	Torch#2	NPC_NO_SPRITE,{
    @torch = 2;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}

007-1,67,133,0	script	Torch#3	NPC_NO_SPRITE,{
    @torch = 3;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}
007-1,40,125,0	script	Torch#4	NPC_NO_SPRITE,{
    @torch = 4;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}
007-1,144,24,0	script	Torch#5	NPC_NO_SPRITE,{
    @torch = 5;
    .@q = getq(TulimsharQuest_DarkInvocator);
    if (.@q == 5) {
        CheckTorch();
    }
    end;
OnInit:
    .sex = G_OTHER;
    .distance = 1;
    end;
}