-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.rb
213 lines (172 loc) · 3.28 KB
/
example.rb
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
# #--- Forest1
# puts "You enter a dark forest. The wind is howling."
# puts "1. Walk to the right."
# puts "2. Walk forward."
# puts "3. Initiate battle with Bossman."
# puts "4. Open the chest."
# choice = gets.chomp.to_i
# case choice
# when 1 then
# puts ""
# when 2 then
# puts "You won!"
# when 3 then
# puts "You has been slain!"
# when 4 then
# puts "The Bossman shouts at you: DIE"
# end
# #-- Forest2
# puts "You enter a house."
# puts "1. Walk to the left."
# puts "3. Go to the previous location."
# puts "4. Open the chest."
# choice = gets.chomp.to_i
# case choice
# when 1 then
# go Forest2
# when 2 then
# puts "You won!"
# when 3 then
# puts "You has been slain!"
# when 4 then
# puts "The Bossman shouts at you: DIE"
# end
# name = "Boss"
# name = "Boss 2"
# name = "Boss3"
#
# class Char (name, attack, agi){
# if name
# name = name
# stats = {"attack" = attack, "agi" = agi}
# }
type Kratos()
{
attack = -8
agility = 5
health = 20
inventory = []
weapon = {"name": Sword}
slots = {"sword" = RustySword, "helmet" = nil, "chest" = nil}
}
type Sword
{
attack = 8
agi = 1
}
object.new(2,3,4)
class object
blablab
object.new("boss", stats{:name = 2, :agi = 15, :hp = 100})
for i in range(1, 10)
object Boss(n)
{
name = n
agility = 2
attack = 15
health = 100
}
event Battle1(num_of_bosses) {
enemies = []
run
{
for i in range(num_of_bosses)
{
enemies.add Boss.new("Boss " + i)
}
while len(enemies) > 0 {
for enemy in enemies {
Kratos.health -= enemy.attack
}
}
}
}
class object
{
}
object RustySword
{
agility = 5
geartype = "sword"
}
RustySword.new()
RustySword = object.new()
event Forest1()
{
chest_opened = False
chest_locked = True
option_list = ["Walk to the right.", "Walk forward.", "Initiate battle with Bossman.", " Open the chest."]
run
{
write("You enter a dark forest. The wind is howling.")
# write("1. Walk to the right.")
# write("2. Walk forward.")
# write("3. Initiate battle with Bossman.")
# write("4. Open the chest.")
counter = 0
for option in option_list
{
write(counter + " " + option)
counter += 1
}
choice = read()
case choice
when 1
{
run(Forest2)
}
when 2
{
write("You won!")
return False
}
when 3
{
run(Battle1)
}
when 4
{
write("You got rusty sword which gives you +5 agility!")
Kratos.agility += 5
chest_opened = True
stay
}
}
event Battle1
{
#Boss.new("Bossman")
$minion_damage = 10
boss_hp = 10
boss_damage = 5
run
{
write("The Bossman shouts at you: DIE!")
while boss_hp > 0
{
write ("1. Attack.")
choice = read()
case choice
when 1
{
boss_hp -= Kratos.damage
Kratos.hp -= boss_damage
if Kratos.hp < 0
write("You have been slain...")
False
else if boss_hp < 0
Forest1
else
stay
}
}
}
}
#----- Huvudprogram -----
#current_event = Forest1
run(Forest1)
# while True do
# {
# current_event = current_event.run()
# if not current_event
# exit
# }