summaryrefslogtreecommitdiff
path: root/bloodfields.stage
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-02 00:26:29 -0700
committerMike Buland <eichlan@xagasoft.com>2012-01-02 00:26:29 -0700
commit0433eb31936fc72486e9a81732d5bcd38cf5808a (patch)
tree01f2a53e300af872350b700dbe8d4a0fa7fac38d /bloodfields.stage
parent55e6f570f5760e970c6523458914b5e4c63a6ce4 (diff)
downloadstage-0433eb31936fc72486e9a81732d5bcd38cf5808a.tar.gz
stage-0433eb31936fc72486e9a81732d5bcd38cf5808a.tar.bz2
stage-0433eb31936fc72486e9a81732d5bcd38cf5808a.tar.xz
stage-0433eb31936fc72486e9a81732d5bcd38cf5808a.zip
Variables upconvert on add now.
It's not perfect, but it's decent for now, and early testing.
Diffstat (limited to '')
-rw-r--r--bloodfields.stage162
1 files changed, 162 insertions, 0 deletions
diff --git a/bloodfields.stage b/bloodfields.stage
new file mode 100644
index 0000000..81ff6e1
--- /dev/null
+++ b/bloodfields.stage
@@ -0,0 +1,162 @@
1game.title = "Bloodfields";
2
3global
4{
5 command: "quit"
6 {
7 exit();
8 }
9}
10
11situation <<start>>
12{
13 setup
14 {
15 player.hpMax = 10;
16 player.hpCur = player.hpMax;
17 player.xp = 0;
18 player.attack = 3;
19
20 global.bJustTravelled = false;
21
22 goto( <<field>> );
23 }
24}
25
26function status()
27{
28 display('You have ' + player.hpCur + ' of ' + player.hpMax + ' hp.');
29}
30
31function look()
32{
33 if( exists(global.enemy) )then
34 {
35 display('''You are standing in a field of wheat. You see a ''' +
36 global.enemy['name'] + ''' in front of you.''');
37 }
38 else
39 {
40 display('''You are standing in a field of wheat.''');
41 }
42// status();
43}
44
45function mkEnemy()
46{
47 global.enemy = {
48 'name': 'Snail',
49 'weapon': 'Tooth',
50 'attack': 3,
51 'hp': 5
52 };
53}
54
55function rollAttack( attack )
56{
57 return( random( attack-attack/3, attack+attack/3 ) );
58}
59
60function playerAttack()
61{
62 damage = rollAttack( player.attack );
63 global.enemy['hp'] = global.enemy['hp'] - damage;
64 display('You strike the ' + global.enemy['name'] + ' for ' + damage +
65 ' damage.');
66 if global.enemy['hp'] <= 0 then
67 {
68 display('You killed the ' + global.enemy['name'] + '!');
69 delete( global.enemy );
70 }
71}
72
73function enemyAttack()
74{
75 damage = rollAttack( global.enemy['attack'] );
76 player.hpCur -= damage;
77 display("The " + global.enemy['name'] + ' strikes you for ' + damage +
78 ' damage.');
79 if player.hpCur <= 0 then
80 {
81 display('The ' + global.enemy['name'] + ' killed you!');
82 exit();
83 }
84}
85
86situation <<travel>>
87{
88 enter
89 {
90 delete( global.enemy );
91
92 display('You wander aimlessly through the seemingly endless field of wheat.');
93
94 select = random(1,3);
95 if select == 1 then
96 {
97 mkEnemy();
98 display('''There's a ''' + global.enemy['name'] + ''' here!''');
99 }
100
101 global.bJustTravelled = true;
102
103 goto( <<field>> );
104 }
105}
106
107situation <<field>>
108{
109 command: "attack"
110 {
111 if exists(global.enemy) then
112 {
113 playerAttack();
114 goto( <<field>> );
115 }
116 else
117 {
118 display('''There's nothing here to attack...''');
119 }
120 }
121
122 command: "look"
123 {
124 look();
125 }
126
127 command: "walk"
128 {
129 if not exists(global.enemy) then
130 {
131 goto( <<travel>> );
132 }
133 else
134 {
135 display("You can't walk around with an enemy in front of you!
136 You can try to flee if you'd like...");
137 }
138 }
139
140 setup
141 {
142 look();
143 }
144
145 enter
146 {
147 if not global.bJustTravelled then
148 {
149 if exists( global.enemy ) then
150 {
151 enemyAttack();
152 }
153 status();
154// look();
155 }
156 else
157 {
158 }
159 global.bJustTravelled = false;
160 }
161}
162