summaryrefslogtreecommitdiff
path: root/npc/magic/transmigration.txt
blob: bcf4ec987672ebd0d6381290abacc689e97c044b (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
// TMW2 script
// Author: Jesusalva <admin@tmw2.org>
//
// Magic Script: TMW2_TRANSMIGRATION
//
// Attempts to make stuff from other stuff
// This is actually referred as transmutation in human-readable forms, and
// transmigration in scripts.

-	script	sk#mkpot	32767,{
    end;
OnCall:
    // Check cooldown
    if (@mkpot_at > gettimetick(2)) {
        dispbottom l("Skill is in cooldown for @@.", FuzzyTime(@mkpot_at));
        end;
    }

    // Check requisites
    if (!MagicCheck(TMW2_TRANSMIGRATION, 215, -5))
        end;

    .@q=getq(General_Auldsbel);

    do {
        mes ".:: " + l("Transmutation Skill") + " ::.";
        mesc l("What will you transmute today?");
        mes "";
        menuint
            rif(@transmemo, l("Repeat: ")+getitemname(@transmemo)), @transmemo,
            l("Crazy Rum"), CrazyRum,
            l("Coal"), 9901, // 9901 cheat code
            l("Mouboo Figurine"), MoubooFigurine,
            rif(.@q >= 9, l("Downgrade Snake Skin")), SnakeSkin,
            rif(.@q >= 9, l("Downgrade Snake Egg")), SnakeEgg,
            rif(.@q >= 9, l("Downgrade Snake Tongue")), SnakeTongue,
            rif(.@q >= 7, l("Downgrade Scorpion Stinger")), ScorpionStinger,
            rif(.@q >= 7, l("Downgrade Scorpion Claw")), ScorpionClaw,
            l("Downgrade Ore"), IronOre;

        mes "";
        mesc l("Transmutating @@ will require:", getitemlink(@menuret));

        // Requeriments listing
        switch (@menuret) {
        case CrazyRum:
            mesc l("* @@/@@ @@", countitem(Plushroom), 10, getitemlink(Plushroom));
            mesc l("* @@/@@ @@", countitem(Milk), 3, getitemlink(Milk));
            break;
        case 9901: // This is coal
            mesc l("* @@/@@ @@", countitem(WoodenLog), 5, getitemlink(WoodenLog));
            break;
        case MoubooFigurine:
            mesc l("* @@/@@ @@", countitem(WoodenLog), 1, getitemlink(WoodenLog));
            break;
        case SnakeSkin:
            menuint
            l("Black Mamba Skin -> Mountain Snake Skin"), MountainSnakeSkin,
            l("Mountain Snake Skin -> Snake Skin"), SnakeSkin,
            l("Snake Skin -> Cave Snake Skin"), CaveSnakeSkin,
            l("Cancel");
            break;
        case SnakeEgg:
            menuint
            l("Black Mamba Egg -> Mountain Snake Egg"), MountainSnakeEgg,
            l("Mountain Snake Egg -> Snake Egg"), SnakeEgg,
            l("Snake Egg -> Cave Snake Egg"), CaveSnakeEgg,
            l("Cancel");
            break;
        case SnakeTongue:
            menuint
            l("Black Mamba Tongue -> Mountain Snake Tongue"), MountainSnakeTongue,
            l("Mountain Snake Tongue -> Snake Tongue"), SnakeTongue,
            l("Snake Tongue -> Cave Snake Tongue"), CaveSnakeTongue,
            l("Cancel");
            break;
        case ScorpionStinger:
            menuint
            l("Black Scorpion Stinger -> Red Scorpion Stinger"), RedScorpionStinger,
            l("Red Scorpion Stinger -> Scorpion Stinger"), ScorpionStinger,
            l("Cancel");
            break;
        case ScorpionClaw:
            menuint
            l("Golden Scorpion Claw -> Black Scorpion Claw"), BlackScorpionClaw,
            l("Black Scorpion Claw -> Red Scorpion Claw"), RedScorpionClaw,
            l("Red Scorpion Claw -> Scorpion Claw"), ScorpionClaw,
            l("Cancel");
            break;
        case IronOre:
            menuint
            l("Platinum Ore -> Iridium Ore"), IridiumOre,
            l("Iridium Ore -> Titanium Ore"), TitaniumOre,
            l("Titanium Ore -> Lead Ore"), LeadOre,
            l("Lead Ore -> Tin Ore"), TinOre,
            l("Tin Ore -> Gold Ore"), GoldOre,
            l("Gold Ore -> Silver Ore"), SilverOre,
            l("Silver Ore -> Copper Ore"), CopperOre,
            l("Copper Ore -> Iron Ore"), IronOre,
            l("Iron Ore -> Coal"), Coal,
            l("Cancel");
            break;
        default:
            Exception("ERROR, INVALID TRANSMIGRATION OPTION", RB_DEFAULT|RB_SPEECH); @menuret=0; break;
        }
        // Confirmation
        if (@menuret) {
            next;
            mesc l("Transmute?!");
            if (askyesno() == ASK_NO)
                @menuret=0;
        }
    } while (!@menuret);

    // Close the dialog
    closeclientdialog;

    // Check and Consume the reagents
    switch (@menuret) {
        case CrazyRum:
            if (!transcheck(Plushroom, 10, Milk, 3)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case MoubooFigurine:
            if (!transcheck(WoodenLog, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case 9901: // Coal cheat code
            if (!transcheck(WoodenLog, 5)) {
                dispbottom l("Not enough items!");
                end;
            }
            @menuret=Coal;
            break;
        // Snake Skin Chain
        case MountainSnakeSkin:
            if (!transcheck(BlackMambaSkin, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case SnakeSkin:
            if (!transcheck(MountainSnakeSkin, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case CaveSnakeSkin:
            if (!transcheck(SnakeSkin, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        // Snake Egg Chain
        case MountainSnakeEgg:
            if (!transcheck(BlackMambaEgg, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case SnakeEgg:
            if (!transcheck(MountainSnakeEgg, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case CaveSnakeEgg:
            if (!transcheck(SnakeEgg, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        // Snake Tongue Chain
        case MountainSnakeTongue:
            if (!transcheck(BlackMambaTongue, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case SnakeTongue:
            if (!transcheck(MountainSnakeTongue, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case CaveSnakeTongue:
            if (!transcheck(SnakeTongue, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        // Scorpion Stinger Chain
        case RedScorpionStinger:
            if (!transcheck(BlackScorpionStinger, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case ScorpionStinger:
            if (!transcheck(RedScorpionStinger, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        // Scorpion Claw Chain
        case BlackScorpionClaw:
            if (!transcheck(GoldenScorpionClaw, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case RedScorpionClaw:
            if (!transcheck(BlackScorpionClaw, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case ScorpionClaw:
            if (!transcheck(RedScorpionClaw, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        // Ore Chain (the biggest one)
        case IridiumOre:
            if (!transcheck(PlatinumOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case TitaniumOre:
            if (!transcheck(IridiumOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case LeadOre:
            if (!transcheck(TitaniumOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case TinOre:
            if (!transcheck(LeadOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case GoldOre:
            if (!transcheck(TinOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case SilverOre:
            if (!transcheck(GoldOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case CopperOre:
            if (!transcheck(SilverOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case IronOre:
            if (!transcheck(CopperOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;
        case Coal:
            if (!transcheck(IronOre, 1)) {
                dispbottom l("Not enough items!");
                end;
            }
            break;

        default:
            Exception("ERROR, INVALID TRANSMIGRATION REAGENTS", RB_DEFAULT|RB_SPEECH|RB_ISFATAL); break;
    }

    // Do the roll from 1 to 100
    // Base success chance is 0%
    // Each abizit() point gives you 18% success rate (max 90%)
    // Each skill level gives you 1% success rate (max 10%)
    .@r=rand2(1, 100)-abizit()*18-getskilllv(TMW2_TRANSMIGRATION);

    // Backfire chance: 30%
    if (.@r >= 70) {
        dispbottom l("The spell backfires!");
        percentheal -(rand2(5, 15)), 0;
    // Chance for nothing to happen
    } else if (.@r >= 30) {
        dispbottom l("Your reagents vanish into emptiness!");
    // Chance for you getting a junk item
    } else if (.@r > 0) {
        dispbottom l("Your spell takes a mind of its own and shapes in something else!");
        getitem WarpedLog, 1;
    // You were successful
    } else {
        dispbottom l("*plim*");
        getitem @menuret, 1;
    }

    // Store to memory
    @transmemo=@menuret;

    // set cooldown
    @mkpot_at=gettimetick(2);
    @mkpot_at=@mkpot_at+6;

    // Get a few mana experience points (this is NOT used by Mana Stone)
    GetManaExp(TMW2_TRANSMIGRATION, rand2(4,9));
    end;

OnInit:
    bindatcmd "sk-trans", "sk#mkpot::OnCall", 0, 100, 0;
    end;
}