summaryrefslogtreecommitdiff
path: root/npc/013-1_Woodland_hills/sagatha.txt
blob: e2e71cdb42a822bd27bbaa1032becf935582dca5 (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
// Sagatha the witch, expert for nature and ether magic
//----------------------------------------

function	script	QuestSagathaHappy {
        set @unhappiness, (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT;
        if (@unhappiness < @value)
		goto L_zero;

	set @unhappiness, @unhappiness - @value;
        goto L_write;

L_zero:
	set @unhappiness, 0;

L_write:
	set QUEST_MAGIC, (QUEST_MAGIC & ~NIBBLE_3_MASK) | (@unhappiness << NIBBLE_3_SHIFT);
}

//----------------------------------------
function	script	QuestSagathaAnnoy {
        set @unhappiness, (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT;
        if ((@unhappiness + @value) > 15)
		goto L_max;

	set @unhappiness, @unhappiness + @value;
        goto L_write;

L_max:
	set @unhappiness, 15;

L_write:
	set QUEST_MAGIC, (QUEST_MAGIC & ~NIBBLE_3_MASK) | (@unhappiness << NIBBLE_3_SHIFT);
}

function	script SagathaStatus {
	set @has_magic, getskilllv(SKILL_MAGIC);
        set @evil, 0;
        set @good, 0;
        set @unhappy, (QUEST_MAGIC & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT;
        set @mouboo, ((QUEST_MAGIC & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT) & 3;

        if (@mouboo == 3)
		set @good, @good + 1;
	if (@mouboo == 2)
		set @evil, 1;
	if (@mouboo == 1)
		set @evil, 1;

        if (MAGIC_FLAGS & FLAG_DID_CUTTREE)
		set @evil, 1;

        set @druid, (((QUEST_MAGIC & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT) & 12) >> 2;
        if (@druid == 3)
		set @good, @good + 1;
}

//----------------------------------------
013-1.gat,131,24,0	script	Sagatha#_M	167,{
	callfunc "SagathaStatus";

        set @Q_MASK, NIBBLE_4_MASK;
        set @Q_SHIFT, NIBBLE_4_SHIFT;

        set @Q_status, (QUEST_MAGIC & @Q_MASK) >> @Q_SHIFT;

        if (MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA)
		mes "[Sagatha the Witch]";
        if (!(MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA))
		mes "[Witch]";

        if (@evil)
		goto L_evil;

        if (@unhappy > 10)
		goto L_unhappy;

        mes "Before you stands a beautiful woman, dressed in dark purple robes and wearing a witch's hat.";

        if (Sex)
		mes "She looks at you suspiciously.";
        if (!Sex)
		mes "She looks at you impassively.";
        next;

        set MAGIC_FLAGS, MAGIC_FLAGS | MFLAG_KNOWS_SAGATHA;

L_evil:
	mes "The witch's eyes flare up in anger as she notices you, and she turns away from you.";
        mes "Whatever the reason, she doesn't seem to like you.";
        next;
        close;

L_unhappy:
	mes "The witch glares at you in anger.";
        mes "\"I hope you enjoyed killing those innocent forest creatures!\"";
        mes "She turns away, clearly not interested in any discussion.";
        mes "\"Don't come back until you have come to your senses!\"";
        next;
        close;

L_Main:
	menu "What do you know about...", L_Question;
        close;

L_Question:
        set @QQ_ELANORE, 1;
        set @QQ_MANASEED, 2;
        set @QQ_WYARA, 3;
        set @QQ_AULDSBEL, 5;

        setarray @choice$, "", "", "", "", "", "";
        set @choices_nr, 0;
        setarray @choice_idx, 0, 0, 0, 0, 0, 0;

        set @choice$[@choices_nr], "...Elanore the Healer?";
        set @choice_idx[@choices_nr], @QQ_ELANORE;
        set @choices_nr, @choices_nr + 1;

        if (!(MAGIC_FLAGS & (MFLAG_KNOWS_MANASEED | MFLAG_MANASEED_RUMOUR)))
        	goto L_Q_post_manaseed;
        set @choice$[@choices_nr], "...the Mana Seed?";
        set @choice_idx[@choices_nr], @QQ_MANASEED;
        set @choices_nr, @choices_nr + 1;
L_Q_post_manaseed:

        if (!(MAGIC_FLAGS & MFLAG_KNOWS_MANAPOTION))
        	goto L_Q_post_manapotion;
        set @choice$[@choices_nr], "...Mana Potions?";
        set @choice_idx[@choices_nr], @QQ_MANAPOTION;
        set @choices_nr, @choices_nr + 1;
L_Q_post_manapotion:

        if (!(MAGIC_FLAGS & MFLAG_KNOWS_WYARA))
        	goto L_Q_post_wyara;
        set @choice$[@choices_nr], "...Wyara the Witch?";
        set @choice_idx[@choices_nr], @QQ_WYARA;
        set @choices_nr, @choices_nr + 1;
L_Q_post_wyara:

        if (!(MAGIC_FLAGS & MFLAG_KNOWS_SAGATHA))
        	goto L_Q_post_sagatha;
        set @choice$[@choices_nr], "...Sagatha the Witch?";
        set @choice_idx[@choices_nr], @QQ_SAGATHA;
        set @choices_nr, @choices_nr + 1;
L_Q_post_sagatha:

        if (!(MAGIC_FLAGS & MFLAG_KNOWS_AULDSBEL))
        	goto L_Q_post_auldsbel;
        set @choice$[@choices_nr], "...Auldsbel the Wizard?";
        set @choice_idx[@choices_nr], @QQ_AULDSBEL;
        set @choices_nr, @choices_nr + 1;
L_Q_post_auldsbel:

        set @choice$[@choices_nr], "...never mind.";
        set @choice_idx[@choices_nr], 0;
        set @choices_nr, @choices_nr + 1;

        menu @choice$[0], -,
             @choice$[1], -,
             @choice$[2], -,
             @choice$[3], -,
             @choice$[4], -;

        set @menu, @menu - 1;

        if (@menu >= @choices_nr)
		set @menu, 0;
	
        set @c, @choice_idx[@menu];

        if (@c == 0)		goto L_Main;
        if (@c == @QQ_ELANORE)	goto L_Q_elanore;
        if (@c == @QQ_MANASEED)	goto L_Q_manaseed;
        if (@c == @QQ_MANAPOTION)	goto L_Q_manapotion;
        if (@c == @QQ_WYARA)	goto L_Q_wyara;
        if (@c == @QQ_AULDSBEL)	goto L_Q_auldsbel;
        close;

L_Q_elanore:
        mes "[Sagatha the Witch]";
        mes "\"FIXME.\"";
        next;
        goto L_Main;

L_Q_manaseed:
        mes "[Sagatha the Witch]";
        if (!@has_magic && (MAGIC_FLAGS & MFLAG_TOUCHED_MANASEED))
        	goto L_Q_manaseed_unabsorbed;
        if (@has_magic)
		goto L_Q_manaseed_m;
        mes "\"arimasu\"";
        next;
        goto L_Main;

L_Q_manaseed_unabsorbed:
        mes "[Sagatha the Witch]";
        mes "\"...unattuned.\"";
        next;
        goto L_Main;

L_Q_manaseed_m:
        mes "[Sagatha the Witch]";
        mes "\"...\"";
        next;
        goto L_Main;

L_Q_manapotion:
        mes "[Sagatha the Witch]";
        mes "\"Can't make one without a cauldron.\"";
        next;
        goto L_Main;

L_Q_wyara:
        mes "[Sagatha the Witch]";
        mes "\"\"";
        next;
        goto L_Main;

L_Q_auldsbel:
        mes "[Sagatha the Witch]";
        mes "\"\"";
        next;
        goto L_Main;


S_update_var:
	set QUEST_MAGIC,
		(QUEST_MAGIC & ~(@Q_MASK)
		| (@Q_status << @Q_SHIFT));
	return;
}