summaryrefslogtreecommitdiff
path: root/world/map/npc/026-2/werewolf.txt
blob: 79701dbb47764f30abc0fc52756a2f86dd54c017 (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
// author: Jenalya

026-2,30,23,0|script|Wolfgang|305
{
    set @Graveyard_Inn_MASK, NIBBLE_5_MASK;
    set @Graveyard_Inn_SHIFT, NIBBLE_5_SHIFT;

    set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT);

    set @ANIMALBONES_AMOUNT, 30;
    set @ANIMALBONES_EXP, 40000;
    set @money, 1000;
    set @minLevel, 80;

    if (@state > 1) goto L_Happy;
    if (@state == 1) goto L_Bones;

    mes "[Wolfgang]";
    mes "\"What a nice place here, isn't it?\"";
    next;
    mes "\"Just the stuff they call 'food' in here is awful, bah.\"";
    if (BaseLevel < @minLevel)
        goto L_Close;
    next;
    mes "\"I like bones from big animals, the best would be with some raw flesh on it. But just the bones are fine too.\"";
    next;
    mes "\"Can you bring me " + @ANIMALBONES_AMOUNT + " of them?\"";
    set @state, 1;
    callsub S_Update_Mask;
    goto L_Close;

L_Bones:
    mes "[Wolfgang]";
    mes "\"Do you have " + @ANIMALBONES_AMOUNT + " bones of an animal for me?\"";
    next;
    if ((countitem("Bone") > 0)
        && (countitem("AnimalBones") >= @ANIMALBONES_AMOUNT))
            menu
                "Yes, here they are.",L_Bring,
                "What about this normal bone?",L_Human,
                "Not yet.",L_Close;
    if (countitem("Bone") > 0)
        menu
            "What about this normal bone?",L_Human,
            "Not yet.",L_Close;
    if (countitem("AnimalBones") >= @ANIMALBONES_AMOUNT)
        menu
            "Yes, here they are.",L_Bring,
            "Not yet.",L_Close;
    menu
        "Not yet.",L_Close;

L_Bring:
    if (countitem("AnimalBones") < @ANIMALBONES_AMOUNT)
        goto L_Not_Enough;
    delitem "AnimalBones", @ANIMALBONES_AMOUNT;
    getexp @ANIMALBONES_EXP, 0;
    mes "[Wolfgang]";
    mes "\"Ah! Wonderful! Thank you.\"";
    set @state, 2;
    callsub S_Update_Mask;
    goto L_Close;

L_Human:
    mes "[Wolfgang]";
    mes "\"What?! That's a humans bone! I don't eat humans. That brings only trouble.\"";
    next;
    mes "\"Besides, from that I heard, they taste bad.\"";
    goto L_Close;

L_Not_Enough:
    mes "[Wolfgang]";
    mes "\"Are you trying to kid me? I can count.\"";
    goto L_Close;

L_Happy:
    mes "You see the werewolf happily crunching the bones you brought him.";
    mes "[Wolfgang]";
    mes "\"Delicious. Thanks again.\"";
    next;
    mes "\"By the way... would you be interested in a little round of blackjack?\"";
    mes "He pulls a deck of cards out of his pocket.";
    next;
    mes "[Wolfgang]";
    mes "\"You will need " + @money + " GP.\"";
    menu
        "Sure, why not?",L_Game,
        "No, thanks.",L_Close;

//The game mechanics is copied from casino.txt
L_Game:
    if (Zeny < @money)
        goto L_No_Money;
    mes "[Wolfgang]";
    mes "\"Very nice. Let's start.\"";
    mes "He shuffles the cards.";
    next;
    set Zeny, Zeny - @money;
    set @croupier, rand(0, 4);
    set @croupier, @croupier + 17;
    set @player, rand(4, 21);
    mes "\"You got " + @player + " with your cards.";
    if (@player == 21)
        goto L_End;
    mes "Do you want another card?\"";
    next;
    menu
        "Yes.", L_Another,
        "No.", L_End;

L_Another:
    set @tempace, rand(2, 11);
    if (@tempace == 11)
        goto L_Ace;
    set @player, @player + @tempace;
    if (@player > 21)
        goto L_Lost;
    if (@player == 21)
        goto L_End;
    mes "\"You got " + @player + " with your cards.";
    mes "Do you want another card?\"";
    next;
    menu
        "Yes", L_Another,
        "No", L_End;

L_End:
    if (@player <= @croupier)
        goto L_Lost;
    mes "\"You won! Hrm, here is your money.\"";
    set Zeny, Zeny + (3 * @money);
    goto L_Close;

L_No_Money:
    mes "\"You need at least " + @money + " GP.\"";
    goto L_Close;

L_Lost:
    mes "[Wolfgang]";
    mes "\"Fine! I won!";
    mes "You got " + @player + " with your cards.";
    mes "I had " + @croupier + ".\"";
    goto L_Close;

L_Ace:
    set @player, @player + 11;
    if (@player > 21)
        set @player, @player - 10;
    if (@player > 21)
        goto L_Lost;
    if (@player == 21)
        goto L_End;
    mes "You got " + @player + " with your cards.";
    mes "Do you want another card?";
    next;
    menu
        "Yes", L_Another,
        "No", L_End;

L_Close:
    set @Graveyard_Inn_MASK, 0;
    set @Graveyard_Inn_SHIFT, 0;
    set @state, 0;
    set @ANIMALBONES_AMOUNT, 0;
    set @ANIMALBONES_EXP, 0;
    set @money, 0;
    set @minLevel, 0;

    set @croupier, 0;
    set @player, 0;
    set @tempace, 0;
    close;

S_Update_Mask:
    set QUEST_Graveyard_Inn,
        (QUEST_Graveyard_Inn & ~(@Graveyard_Inn_MASK))
            | (@state << @Graveyard_Inn_SHIFT);
    return;
}