summaryrefslogtreecommitdiff
path: root/bloodfields.stage
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-03 00:08:48 -0700
committerMike Buland <eichlan@xagasoft.com>2012-01-03 00:08:48 -0700
commit8b9a15a755ebc6681ff6be808615e375cb567080 (patch)
treec836f3a7a338e6bcc1fe88fe1207819005b92a83 /bloodfields.stage
parent340de5ebabbc60727b2aeb85b9faa72a75f1628b (diff)
downloadstage-8b9a15a755ebc6681ff6be808615e375cb567080.tar.gz
stage-8b9a15a755ebc6681ff6be808615e375cb567080.tar.bz2
stage-8b9a15a755ebc6681ff6be808615e375cb567080.tar.xz
stage-8b9a15a755ebc6681ff6be808615e375cb567080.zip
New functions, fixes, and a working bloodfields.
Diffstat (limited to 'bloodfields.stage')
-rw-r--r--bloodfields.stage152
1 files changed, 133 insertions, 19 deletions
diff --git a/bloodfields.stage b/bloodfields.stage
index 7b61dd4..91bee08 100644
--- a/bloodfields.stage
+++ b/bloodfields.stage
@@ -6,6 +6,11 @@ global
6 { 6 {
7 exit(); 7 exit();
8 } 8 }
9
10 command: "exit"
11 {
12 exit();
13 }
9} 14}
10 15
11situation <<start>> 16situation <<start>>
@@ -14,19 +19,19 @@ situation <<start>>
14 { 19 {
15 global.enemyTypes = { 20 global.enemyTypes = {
16 1: { 21 1: {
17 'name': 'Snail', 22 'name': 'snail',
18 'action': 'bites', 23 'action': 'oozes on',
19 'hp': 3, 24 'hp': 3,
20 'attack': 2 25 'attack': 2
21 }, 26 },
22 2: { 27 2: {
23 'name': 'Wolf', 28 'name': 'wolf',
24 'action': 'bites', 29 'action': 'bites',
25 'hp': 7, 30 'hp': 7,
26 'attack': 3 31 'attack': 3
27 }, 32 },
28 3: { 33 3: {
29 'name': 'Snake', 34 'name': 'snake',
30 'action': 'strikes at', 35 'action': 'strikes at',
31 'hp': 3, 36 'hp': 3,
32 'attack': 3 37 'attack': 3
@@ -35,17 +40,17 @@ situation <<start>>
35 40
36 global.enemyMods = { 41 global.enemyMods = {
37 1: { 42 1: {
38 'name': 'Pathetic', 43 'name': 'pathetic',
39 'hp': 0, 44 'hp': 0,
40 'attack': 0 45 'attack': 0
41 }, 46 },
42 2: { 47 2: {
43 'name': 'Sickly', 48 'name': 'sickly',
44 'hp': 3, 49 'hp': 3,
45 'attack': 1 50 'attack': 1
46 }, 51 },
47 3: { 52 3: {
48 'name': 'Wimpy', 53 'name': 'wimpy',
49 'hp': 5, 54 'hp': 5,
50 'attack': 2 55 'attack': 2
51 } 56 }
@@ -54,7 +59,9 @@ situation <<start>>
54 player.hpMax = 10; 59 player.hpMax = 10;
55 player.hpCur = player.hpMax; 60 player.hpCur = player.hpMax;
56 player.xp = 0; 61 player.xp = 0;
62 player.level = 1;
57 player.attack = 3; 63 player.attack = 3;
64 player.potions = 1;
58 65
59 global.bJustTravelled = false; 66 global.bJustTravelled = false;
60 67
@@ -64,16 +71,23 @@ situation <<start>>
64 71
65function status() 72function status()
66{ 73{
74 display('You have ' + (100-player.xp) + ' xp until your next level.');
67 display('You have ' + player.hpCur + ' of ' + player.hpMax + ' hp.'); 75 display('You have ' + player.hpCur + ' of ' + player.hpMax + ' hp.');
76 display('You are carrying ' + player.potions + ' potions.');
68} 77}
69 78
70function look() 79function look()
71{ 80{
72 if( exists(global.enemy) )then 81 if exists(global.enemy) then
73 { 82 {
74 display('''You are standing in a field of wheat. You see a ''' + 83 display('''You are standing in a field of wheat. You see a ''' +
75 global.enemy['name'] + ''' in front of you.'''); 84 global.enemy['name'] + ''' in front of you.''');
76 } 85 }
86 else if exists( global.treasure ) then
87 {
88 display('''You are standing in a field of wheat. You find a ''' +
89 global.treasure['name'] + ''' lying here!''');
90 }
77 else 91 else
78 { 92 {
79 display('''You are standing in a field of wheat.'''); 93 display('''You are standing in a field of wheat.''');
@@ -86,12 +100,24 @@ function mkEnemy()
86 eid = random( 1, 3 ); 100 eid = random( 1, 3 );
87 global.enemy = global.enemyTypes[eid]; 101 global.enemy = global.enemyTypes[eid];
88 102
89 mod = 1; 103 mod = player.level;
104 if mod > 3 then
105 {
106 mod = 3;
107 }
90 global.enemy['name'] = global.enemyMods[mod]['name'] + ' ' + 108 global.enemy['name'] = global.enemyMods[mod]['name'] + ' ' +
91 global.enemy['name']; 109 global.enemy['name'];
92 global.enemy['attack'] = global.enemy['attack'] + 110 global.enemy['attack'] = global.enemy['attack'] +
93 global.enemyMods[mod]['attack']; 111 global.enemyMods[mod]['attack'];
94 global.enemy['hp'] = global.enemy['hp'] + global.enemyMods[mod]['hp']; 112 global.enemy['hp'] = global.enemy['hp'] + global.enemyMods[mod]['hp'];
113 global.enemy['level'] = mod;
114}
115
116function mkTreasure()
117{
118 global.treasure = {
119 'name': 'potion'
120 };
95} 121}
96 122
97function rollAttack( attack ) 123function rollAttack( attack )
@@ -107,7 +133,26 @@ function playerAttack()
107 ' damage.'); 133 ' damage.');
108 if global.enemy['hp'] <= 0 then 134 if global.enemy['hp'] <= 0 then
109 { 135 {
110 display('You killed the ' + global.enemy['name'] + '!'); 136 xp = 10;
137 display('You killed the ' + global.enemy['name'] + '! You gained ' +
138 xp + ' experience points.');
139 player.xp += xp;
140 if player.xp >= 100 then
141 {
142 player.xp -= 100;
143 player.level += 1;
144 player.hpMax += integer(random(0.25,0.75)*player.hpMax);
145 player.hpCur = player.hpMax;
146 display("You have leveled! Welcome to level " + player.level );
147 }
148
149 select = random(1, 3);
150 if select == 1 then
151 {
152 display('It looks like the ' + global.enemy['name'] +
153 ' dropped something...');
154 mkTreasure();
155 }
111 delete( global.enemy ); 156 delete( global.enemy );
112 } 157 }
113} 158}
@@ -123,22 +168,37 @@ function enemyAttack()
123 display('The ' + global.enemy['name'] + ' killed you!'); 168 display('The ' + global.enemy['name'] + ' killed you!');
124 exit(); 169 exit();
125 } 170 }
171 else
172 {
173 display('''You have ''' + player.hpCur + ''' hp left.''');
174 }
126} 175}
127 176
128situation <<travel>> 177situation <<travel>>
129{ 178{
179 command: "hi"
180 {
181 display("Yup, you're in travel.");
182 }
183
130 enter 184 enter
131 { 185 {
132 delete( global.enemy ); 186 delete( global.enemy );
133 187
134 display('You wander aimlessly through the seemingly endless field of wheat.'); 188 display('You wander aimlessly through the seemingly endless field of wheat.');
135 189
136 select = random(1,3); 190 select = random(1,6);
137 if select == 1 then 191 if select <= 4 then // 66% of the time, enemy!
138 { 192 {
139 mkEnemy(); 193 mkEnemy();
140 display('''There's a ''' + global.enemy['name'] + ''' here!'''); 194 display('''There's a ''' + global.enemy['name'] + ''' here!''');
141 } 195 }
196 else if select == 6 then // 16% of the time, treasure!
197 {
198 mkTreasure();
199 display('''You find a ''' + global.treasure['name'] +
200 ''' lying here!''');
201 }
142 202
143 global.bJustTravelled = true; 203 global.bJustTravelled = true;
144 204
@@ -161,11 +221,64 @@ situation <<field>>
161 } 221 }
162 } 222 }
163 223
224 command: "take"
225 {
226 if exists(global.treasure) then
227 {
228 if global.treasure['name'] == 'potion' then
229 {
230 display('''You pickup the ''' + global.treasure['name'] +
231 ''' and put it in your pocket.''');
232 player.potions += 1;
233 delete( global.treasure );
234 }
235 }
236 else
237 {
238 display('''There's nothing here to take...''');
239 }
240 }
241
242 command: 'drink'
243 {
244 if player.potions == 0 then
245 {
246 display('''You don't have anything to drink!''');
247 }
248 else
249 {
250 if player.hpCur == player.hpMax then
251 {
252 display('''You're already as healthy as can be!
253 Save the potions for when you're more injured.''');
254 }
255 else
256 {
257 player.potions -= 1;
258 gain = integer( random( 0.25, 0.5 ) * player.hpMax );
259 player.hpCur += gain;
260 if player.hpCur > player.hpMax then
261 {
262 gain -= player.hpCur - player.hpMax;
263 player.hpCur = player.hpMax;
264 }
265 display('''That really hit the spot! The potion restored ''' +
266 gain + ''' hp!''');
267 goto( <<field>> );
268 }
269 }
270 }
271
164 command: "look" 272 command: "look"
165 { 273 {
166 look(); 274 look();
167 } 275 }
168 276
277 command: "status"
278 {
279 status();
280 }
281
169 command: "walk" 282 command: "walk"
170 { 283 {
171 if not exists(global.enemy) then 284 if not exists(global.enemy) then
@@ -174,11 +287,17 @@ situation <<field>>
174 } 287 }
175 else 288 else
176 { 289 {
177 display("You can't walk around with an enemy in front of you! 290 display("You can't leave, the " + global.enemy['name'] +
178 You can try to flee if you'd like..."); 291 ' is blocking your path.');
179 } 292 }
180 } 293 }
181 294
295 command: "help"
296 {
297 display("Available commands are: walk, status, look, attack, take,
298 drink");
299 }
300
182 setup 301 setup
183 { 302 {
184 look(); 303 look();
@@ -192,11 +311,6 @@ situation <<field>>
192 { 311 {
193 enemyAttack(); 312 enemyAttack();
194 } 313 }
195 status();
196// look();
197 }
198 else
199 {
200 } 314 }
201 global.bJustTravelled = false; 315 global.bJustTravelled = false;
202 } 316 }