gambit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +2 -0
- data/CHANGELOG +7 -0
- data/COPYING +340 -0
- data/INSTALL +23 -0
- data/LICENSE +7 -0
- data/README +25 -0
- data/Rakefile +87 -0
- data/TODO +6 -0
- data/examples/bird_wars/game.rb +434 -0
- data/examples/bird_wars/html/chest.rhtml +37 -0
- data/examples/bird_wars/html/combat.rhtml +38 -0
- data/examples/bird_wars/html/fight.rhtml +71 -0
- data/examples/bird_wars/html/fridge.rhtml +31 -0
- data/examples/bird_wars/html/help.rhtml +30 -0
- data/examples/bird_wars/html/house.rhtml +36 -0
- data/examples/bird_wars/html/images/albatross.jpg +0 -0
- data/examples/bird_wars/html/images/alka_seltzer_small.png +0 -0
- data/examples/bird_wars/html/images/bazooka_small.png +0 -0
- data/examples/bird_wars/html/images/bb_gun_small.png +0 -0
- data/examples/bird_wars/html/images/cat_small.png +0 -0
- data/examples/bird_wars/html/images/combat.png +0 -0
- data/examples/bird_wars/html/images/crossbow_small.png +0 -0
- data/examples/bird_wars/html/images/cuckoo.jpg +0 -0
- data/examples/bird_wars/html/images/fridge.png +0 -0
- data/examples/bird_wars/html/images/gull.jpg +0 -0
- data/examples/bird_wars/html/images/house.jpg +0 -0
- data/examples/bird_wars/html/images/items.png +0 -0
- data/examples/bird_wars/html/images/not_found.png +0 -0
- data/examples/bird_wars/html/images/note.jpg +0 -0
- data/examples/bird_wars/html/images/oil_small.png +0 -0
- data/examples/bird_wars/html/images/one_stone_small.png +0 -0
- data/examples/bird_wars/html/images/owl.jpg +0 -0
- data/examples/bird_wars/html/images/poisoned_seeds_small.png +0 -0
- data/examples/bird_wars/html/images/rice_small.png +0 -0
- data/examples/bird_wars/html/images/shotgun_small.png +0 -0
- data/examples/bird_wars/html/images/slingshot_small.png +0 -0
- data/examples/bird_wars/html/images/soda_rings_small.png +0 -0
- data/examples/bird_wars/html/images/spear_small.png +0 -0
- data/examples/bird_wars/html/images/stork.jpg +0 -0
- data/examples/bird_wars/html/images/weapons.png +0 -0
- data/examples/bird_wars/html/images/woodpecker.jpg +0 -0
- data/examples/bird_wars/html/images/you.jpg +0 -0
- data/examples/bird_wars/html/index.rhtml +13 -0
- data/examples/bird_wars/html/weapons.rhtml +35 -0
- data/examples/cli/blackjack.rb +86 -0
- data/examples/cli/go.rb +93 -0
- data/examples/cli/space_trader2/planet_data +12280 -0
- data/examples/cli/space_trader2/space_trader2.rb +248 -0
- data/examples/cli/space_trader2/world.rb +127 -0
- data/examples/cli/spacetrader.rb +262 -0
- data/examples/cli/yahtzee.rb +161 -0
- data/examples/galactic_courier/Rakefile +9 -0
- data/examples/galactic_courier/bin/galactic_courier.rb +44 -0
- data/examples/galactic_courier/html/console.rhtml +15 -0
- data/examples/galactic_courier/html/images/barren.jpg +0 -0
- data/examples/galactic_courier/html/images/industrial.jpg +0 -0
- data/examples/galactic_courier/html/images/jungle.jpg +0 -0
- data/examples/galactic_courier/html/images/oceanic.jpg +0 -0
- data/examples/galactic_courier/html/images/tundra.jpg +0 -0
- data/examples/galactic_courier/html/images/volcanic.jpg +0 -0
- data/examples/galactic_courier/lib/galaxy.rb +64 -0
- data/examples/galactic_courier/lib/planet.rb +30 -0
- data/examples/galactic_courier/lib/sector.rb +84 -0
- data/examples/galactic_courier/lib/station.rb +18 -0
- data/examples/galactic_courier/test/tc_galaxy.rb +24 -0
- data/examples/galactic_courier/test/tc_planet.rb +22 -0
- data/examples/galactic_courier/test/tc_sector.rb +55 -0
- data/examples/galactic_courier/test/ts_all.rb +12 -0
- data/examples/gambit_mail/html/compose.rhtml +39 -0
- data/examples/gambit_mail/html/index.rhtml +3 -0
- data/examples/gambit_mail/html/mailbox.rhtml +47 -0
- data/examples/gambit_mail/html/message.rhtml +34 -0
- data/examples/gambit_mail/mail.rb +75 -0
- data/lib/gambit.rb +10 -0
- data/lib/gambit/server.rb +269 -0
- data/lib/gambit/server/gambiterror.rb +28 -0
- data/lib/gambit/server/game.rb +185 -0
- data/lib/gambit/server/game/eventform.rb +174 -0
- data/lib/gambit/server/message.rb +85 -0
- data/lib/gambit/server/player.rb +40 -0
- data/lib/gambit/tools.rb +13 -0
- data/lib/gambit/tools/board.rb +275 -0
- data/lib/gambit/tools/cards.rb +11 -0
- data/lib/gambit/tools/cards/card.rb +158 -0
- data/lib/gambit/tools/cards/deck.rb +99 -0
- data/lib/gambit/tools/cards/hand.rb +86 -0
- data/lib/gambit/tools/cards/pile.rb +107 -0
- data/lib/gambit/tools/currency.rb +148 -0
- data/lib/gambit/tools/dice.rb +219 -0
- data/lib/gambit/tools/movehistory.rb +164 -0
- data/lib/gambit/tools/scorecard.rb +333 -0
- data/lib/gambit/viewable.rb +71 -0
- data/setup.rb +1360 -0
- data/test/tc_board.rb +167 -0
- data/test/tc_cards.rb +182 -0
- data/test/tc_currency.rb +99 -0
- data/test/tc_dice.rb +83 -0
- data/test/tc_error.rb +34 -0
- data/test/tc_event.rb +367 -0
- data/test/tc_game.rb +29 -0
- data/test/tc_message.rb +35 -0
- data/test/tc_movehistory.rb +38 -0
- data/test/tc_player.rb +60 -0
- data/test/tc_scorecard.rb +112 -0
- data/test/tc_views.rb +353 -0
- data/test/test_game.rb +19 -0
- data/test/test_view.rhtml +2 -0
- data/test/ts_all.rb +12 -0
- data/test/ts_server.rb +14 -0
- data/test/ts_tools.rb +14 -0
- metadata +183 -0
data/TODO
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
#game.rb
|
|
2
|
+
|
|
3
|
+
#Created by Gregory Brown on 2005-06-02
|
|
4
|
+
#Copyright 2005 smtose.org. All Rights Reserved.
|
|
5
|
+
|
|
6
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "..", "..", "lib"))
|
|
7
|
+
require "gambit"
|
|
8
|
+
|
|
9
|
+
class Game < Gambit::Server::Game
|
|
10
|
+
# register_view(:configure, <<-END_CONFIGURE.gsub(/^\t/, ""))
|
|
11
|
+
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
12
|
+
# "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
13
|
+
# <html xmlns="http://www.w3.org/1999/xhtml">
|
|
14
|
+
# <head>
|
|
15
|
+
# <title>Configure Bird Wars</title>
|
|
16
|
+
# </head><body>
|
|
17
|
+
# <%= event(nil, "configure") do
|
|
18
|
+
# text "game_name"
|
|
19
|
+
# menu "owner", Gambit::Server::SERVER.players.keys
|
|
20
|
+
# submit "Create"
|
|
21
|
+
# end %>
|
|
22
|
+
# </body></html>
|
|
23
|
+
# END_CONFIGURE
|
|
24
|
+
|
|
25
|
+
register_view(:info_panel, <<-END_INFO_PANEL.gsub(/^\t/,""))
|
|
26
|
+
<table style="margin-left: auto; margin-right: auto; text-align: left;
|
|
27
|
+
width: 620px; height: 52px;" border="1" cellpadding="2"
|
|
28
|
+
cellspacing="2">
|
|
29
|
+
<tbody>
|
|
30
|
+
<tr>
|
|
31
|
+
<td style="width: 80px; text-align: center; vertical-align: center;
|
|
32
|
+
background-color: rgb(51, 51, 51);">
|
|
33
|
+
<img src="images/
|
|
34
|
+
<%= @player[:weapon].nil? ? "not_found.png" : @player[:weapon] + "_small.png" %>"
|
|
35
|
+
style="width: 75px; height: 75px;"> <br>
|
|
36
|
+
</td>
|
|
37
|
+
<td style="text-align: center; vertical-align: center;
|
|
38
|
+
background-color: rgb(51, 51, 51);"><br>
|
|
39
|
+
<div style="text-align: center;">
|
|
40
|
+
<span style="color: rgb(255, 255, 255);">
|
|
41
|
+
<%= notify %> Health: <%= @player[:health] %> |
|
|
42
|
+
Rons Points: <%= @player[:ron_points] %> | Birds Killed:
|
|
43
|
+
<%= @player[:kills] %><br></span>
|
|
44
|
+
</div>
|
|
45
|
+
</td>
|
|
46
|
+
<td style="width: 80px; text-align: center; vertical-align: center;
|
|
47
|
+
background-color: rgb(51, 51, 51);">
|
|
48
|
+
<img src="images/
|
|
49
|
+
<%= @player[:item].nil? ? "not_found.png" : @player[:item] +
|
|
50
|
+
"_small.png" %>"
|
|
51
|
+
style="width: 75px; height: 75px;"><br>
|
|
52
|
+
</td>
|
|
53
|
+
</tr>
|
|
54
|
+
</tbody>
|
|
55
|
+
</table>
|
|
56
|
+
END_INFO_PANEL
|
|
57
|
+
|
|
58
|
+
def initialize( )
|
|
59
|
+
super
|
|
60
|
+
@enemies = %w[woodpecker gull stork owl cuckoo albatross]
|
|
61
|
+
@enemy_difficulty = %w[trivial easy medium hard insane impossible]
|
|
62
|
+
@weapons = { "one_stone" => 0, "spear" => 50, "slingshot" => 100,
|
|
63
|
+
"crossbow" => 200, "bb_gun" => 400, "shotgun" => 800,
|
|
64
|
+
"bazooka" => 1600
|
|
65
|
+
}
|
|
66
|
+
@weapon_power = @weapons.sort_by {|(k,v)| v }.map {|(key,value)| key }
|
|
67
|
+
@items = %w[alka_seltzer oil rice cat soda_rings poisoned_seeds ]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def do_begin(player, details)
|
|
71
|
+
player.notes << "Welcome to the Casa De Ron!"
|
|
72
|
+
player[:health] = 100
|
|
73
|
+
player[:level] = 0
|
|
74
|
+
player[:weapon] = "one_stone"
|
|
75
|
+
player[:used_items] = []
|
|
76
|
+
player[:ron_points] = 0
|
|
77
|
+
player[:kills] = 0
|
|
78
|
+
player[:combat] = { }
|
|
79
|
+
player[:item] = nil
|
|
80
|
+
return "house.rhtml"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def do_go(player, details)
|
|
84
|
+
messages = {
|
|
85
|
+
"fridge" => "Cold Pizza and Pepsi ... Help yourself",
|
|
86
|
+
"closet" => "Select a weapon to use",
|
|
87
|
+
"combat" => "Select an enemy",
|
|
88
|
+
"chest" => "Select an item for your quest.",
|
|
89
|
+
"house" => "Welcome to the Casa de Ron."
|
|
90
|
+
}
|
|
91
|
+
case(details["place"])
|
|
92
|
+
when "closet"
|
|
93
|
+
if player[:kills] < 2
|
|
94
|
+
player.notes << "You must kill two birds with one stone " +
|
|
95
|
+
"before Ron will let you check out his " +
|
|
96
|
+
"secret stash"
|
|
97
|
+
return "house.rhtml"
|
|
98
|
+
else
|
|
99
|
+
return "weapons.rhtml"
|
|
100
|
+
end
|
|
101
|
+
else
|
|
102
|
+
player.notes << messages[details["place"]]
|
|
103
|
+
return details["place"] + ".rhtml"
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def do_begin_combat(player, details)
|
|
108
|
+
if (player[:combat][:enemy].nil?)
|
|
109
|
+
player.notes << "You have not selected an enemy"
|
|
110
|
+
return "combat.rhtml"
|
|
111
|
+
else
|
|
112
|
+
player[:combat][:poisoned] = false
|
|
113
|
+
player[:combat][:current_turn] = 0
|
|
114
|
+
player[:combat][:can_flee] = true,
|
|
115
|
+
player[:combat][:turn_delay] = 1,
|
|
116
|
+
|
|
117
|
+
player.notes << "Avenge Kevin's Death for Ron!"
|
|
118
|
+
return "fight.rhtml"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def end_combat(player)
|
|
123
|
+
player[:combat] = Hash.new()
|
|
124
|
+
return "house.rhtml"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def do_get_food(player, details)
|
|
128
|
+
case (details["food"])
|
|
129
|
+
when "pizza"
|
|
130
|
+
if player[:ron_points] - 100 >= 0
|
|
131
|
+
player[:ron_points] -= 100
|
|
132
|
+
player[:health] = 100
|
|
133
|
+
player.notes = "Though the pizza fully rejuvinates you,<br>" +
|
|
134
|
+
"Ron is disappointed at your weakness"
|
|
135
|
+
else
|
|
136
|
+
player.notes << "Eating pizza right now would be<br>" +
|
|
137
|
+
"too crushing to Ron's respect of you<br>" +
|
|
138
|
+
"(100 Ron Points Required)"
|
|
139
|
+
end
|
|
140
|
+
when "pepsi"
|
|
141
|
+
if player[:ron_points] - 20 >= 0
|
|
142
|
+
player[:ron_points] -= 20
|
|
143
|
+
player[:health] += 10
|
|
144
|
+
player.notes << "Ron is slightly disappointed, but the soda" +
|
|
145
|
+
"cheers you up some."
|
|
146
|
+
else
|
|
147
|
+
player.notes << "If you're going to drink on the job," +
|
|
148
|
+
"at least DO your job!<br>" +
|
|
149
|
+
"(20 Ron Points = 1 Pepsi)"
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
return "fridge.rhtml"
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def generate_enemy(enemy)
|
|
156
|
+
enemy = { :name => enemy,
|
|
157
|
+
:health => 20 * @enemies.index(enemy) + 1.d(25).sum,
|
|
158
|
+
:item => %w[poop grenade cyanide_egg][rand(3)],
|
|
159
|
+
:poisoned => false,
|
|
160
|
+
:can_flee => true,
|
|
161
|
+
:turn_delay => 1,
|
|
162
|
+
:kill_countdown => nil
|
|
163
|
+
}
|
|
164
|
+
return enemy
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def do_set_enemy(player, details)
|
|
168
|
+
if player[:level] < @enemies.index(details["enemy"])
|
|
169
|
+
player.notes << "You have not unlocked this level yet, " +
|
|
170
|
+
"keep killing!"
|
|
171
|
+
else
|
|
172
|
+
player[:combat][:enemy] = generate_enemy(details["enemy"])
|
|
173
|
+
player.notes << "<small>You have selected the " +
|
|
174
|
+
"#{player[:combat][:enemy][:name]} which has a difficulty rating of: " +
|
|
175
|
+
"<b>" + @enemy_difficulty[@enemies.index(details["enemy"])] +
|
|
176
|
+
"</b></small>"
|
|
177
|
+
end
|
|
178
|
+
return "combat.rhtml"
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def attack(player)
|
|
182
|
+
enemy = player[:combat][:enemy]
|
|
183
|
+
message = ""
|
|
184
|
+
|
|
185
|
+
if (enemy[:poisoned])
|
|
186
|
+
damage = 1.d(5).sum
|
|
187
|
+
enemy[:health] -= damage
|
|
188
|
+
player.notes << "Your poison does #{damage} damage to the " +
|
|
189
|
+
"#{enemy[:name][:name]}<br>"
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
if (player[:combat][:current_turn] % player[:combat][:turn_delay] == 0)
|
|
193
|
+
damage = (@weapon_power.index(player[:weapon]) + 1).d(6).sum
|
|
194
|
+
enemy[:health] -= damage
|
|
195
|
+
player.notes << "You deal #{damage} damage. <br>"
|
|
196
|
+
else
|
|
197
|
+
player.notes << "You are blinded and can't attack<br>"
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def defend(player)
|
|
203
|
+
|
|
204
|
+
if player[:combat][:poisoned]
|
|
205
|
+
damage = 1.d(3).sum
|
|
206
|
+
player[:health] -= damage
|
|
207
|
+
player.notes << "<br> The poison does #{damage} damage to you"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
enemy = player[:combat][:enemy]
|
|
211
|
+
flee_multiplier = enemy[:kill_countdown].nil? ? 11 : 6
|
|
212
|
+
if (1.d(30).sum % 11 == 0 && enemy[:can_flee])
|
|
213
|
+
player.notes << "#{enemy[:name]} spread it's wings and flew away!"
|
|
214
|
+
return "flee"
|
|
215
|
+
end
|
|
216
|
+
if !enemy[:item].nil? and 1.d(10).sum % 5 == 0
|
|
217
|
+
case(enemy[:item])
|
|
218
|
+
when "poop"
|
|
219
|
+
player[:combat][:turn_delay] = 2 + 1.d(3).sum
|
|
220
|
+
player.notes << "The #{enemy[:name]} has pooped in your " +
|
|
221
|
+
"eyes, leaving you blind."
|
|
222
|
+
when "grenade"
|
|
223
|
+
player[:combat][:kill_countdown] = 1.d(5).sum
|
|
224
|
+
player.notes << "The enemy swoops by and drops a grenade! " +
|
|
225
|
+
"Only #{player[:combat][:kill_countdown]} " +
|
|
226
|
+
"turns left!"
|
|
227
|
+
when "cyanide_egg"
|
|
228
|
+
player[:combat][:poisoned] = true
|
|
229
|
+
player.notes << "The bird drops a cynide egg, leaving you " +
|
|
230
|
+
"poisoned!"
|
|
231
|
+
end
|
|
232
|
+
enemy[:item] = nil
|
|
233
|
+
|
|
234
|
+
elsif (player[:combat][:current_turn] % enemy[:turn_delay] == 0)
|
|
235
|
+
damage = enemy[:name].eql?("albatross") ? 10.d(6).sum :
|
|
236
|
+
(@enemies.index(enemy[:name]) + 2).d(6).sum
|
|
237
|
+
player[:health] -= damage
|
|
238
|
+
|
|
239
|
+
player.notes << "The #{enemy[:name]} pecks at you and deals " +
|
|
240
|
+
"#{damage} damage"
|
|
241
|
+
else
|
|
242
|
+
player.notes <<
|
|
243
|
+
"The enemy got caught up in the rings and couldn't attack"
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def do_fight(player, event)
|
|
248
|
+
player[:combat][:current_turn] += 1
|
|
249
|
+
enemy = player[:combat][:enemy]
|
|
250
|
+
|
|
251
|
+
attack(player)
|
|
252
|
+
|
|
253
|
+
unless player[:combat][:kill_countdown].nil?
|
|
254
|
+
if player[:combat][:kill_countdown] > 0
|
|
255
|
+
player[:combat][:kill_countdown] -= 1
|
|
256
|
+
else
|
|
257
|
+
player[:health] = 0
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
unless enemy[:kill_countdown].nil?
|
|
262
|
+
enemy[:kill_countdown] > 0 ? enemy[:kill_countdown] -= 1 :
|
|
263
|
+
enemy[:health] = 0
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
if enemy[:health] > 0 && defend(player).eql?("flee")
|
|
267
|
+
return end_combat(player)
|
|
268
|
+
elsif enemy[:health] <= 0
|
|
269
|
+
player.notes.clear
|
|
270
|
+
if enemy[:kill_countdown].nil? or enemy[:kill_countdown] > 0
|
|
271
|
+
bonus = @enemies.index(enemy[:name])*25 + 2.d(25)
|
|
272
|
+
player[:ron_points] += bonus
|
|
273
|
+
player.notes << "<small>You defeated the #{enemy[:name]} and " +
|
|
274
|
+
"gained #{bonus} of Ron's Admiration Points"
|
|
275
|
+
else
|
|
276
|
+
player.notes << "Bang! The little bugger explodes.<br>" +
|
|
277
|
+
"Ron is angry about the mess. No points."
|
|
278
|
+
end
|
|
279
|
+
player[:kills] += 1
|
|
280
|
+
if @enemies.index(enemy[:name]) == player[:level]
|
|
281
|
+
player[:level] += 1
|
|
282
|
+
player[:used_items] = []
|
|
283
|
+
player.notes << " You have gained a level, good job!"
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
player.notes << "</small>"
|
|
287
|
+
|
|
288
|
+
return end_combat(player)
|
|
289
|
+
|
|
290
|
+
elsif player[:health] <= 0
|
|
291
|
+
player.notes.clear
|
|
292
|
+
if @player[:combat][:kill_countdown].nil? and
|
|
293
|
+
@player[:combat][:kill_countdown] == 0
|
|
294
|
+
player.notes << "Kaboom! You're dead"
|
|
295
|
+
else
|
|
296
|
+
player.notes << "You have been defeated by the mighty " +
|
|
297
|
+
"#{enemy[:name]}<br>You may continue your" +
|
|
298
|
+
" quest, but Ron has lost his faith in you"
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
player[:weapon] = "one_stone"
|
|
302
|
+
player[:ron_points] /= 4
|
|
303
|
+
player[:health] = 50
|
|
304
|
+
return end_combat(player)
|
|
305
|
+
|
|
306
|
+
end
|
|
307
|
+
return "fight.rhtml"
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
def do_flee(player, details)
|
|
311
|
+
player.notes.clear
|
|
312
|
+
player[:combat][:current_turn] += 1
|
|
313
|
+
enemy = player[:combat][:enemy]
|
|
314
|
+
unless player[:combat][:kill_countdown].nil?
|
|
315
|
+
if player[:combat][:kill_countdown] > 0
|
|
316
|
+
player[:combat][:kill_countdown] -= 1
|
|
317
|
+
else
|
|
318
|
+
player[:health] = 0
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
if (1.d(6).sum % 3 == 0)
|
|
322
|
+
player.notes << "You successfully fled from battle"
|
|
323
|
+
return end_combat(player)
|
|
324
|
+
else
|
|
325
|
+
defend(player)
|
|
326
|
+
if player[:health] > 0
|
|
327
|
+
return "fight.rhtml"
|
|
328
|
+
else
|
|
329
|
+
player.notes << "You were killed when running from battle!"
|
|
330
|
+
player[:weapon] = "one_stone"
|
|
331
|
+
player[:ron_points] /= 4
|
|
332
|
+
player[:health] = 50
|
|
333
|
+
return end_combat(player)
|
|
334
|
+
end
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
def do_use_item(player, details)
|
|
339
|
+
enemy = player[:combat][:enemy]
|
|
340
|
+
case(player[:item])
|
|
341
|
+
when "soda_rings"
|
|
342
|
+
if enemy[:name] == "albatross"
|
|
343
|
+
player.notes << "The albatross catches the rings in his beak" +
|
|
344
|
+
"and slices them up"
|
|
345
|
+
else
|
|
346
|
+
enemy[:turn_delay] = 2 + 1.d(3).sum
|
|
347
|
+
player.notes << "The #{enemy[:name]} gets caught in the soda rings"
|
|
348
|
+
end
|
|
349
|
+
when "alka_seltzer"
|
|
350
|
+
if enemy[:name] == "albatross"
|
|
351
|
+
player.notes << "The albatross lets out a giant burp and it poisons" +
|
|
352
|
+
" you"
|
|
353
|
+
player[:poisoned] = true
|
|
354
|
+
else
|
|
355
|
+
enemy[:kill_countdown] = 1.d(5).sum
|
|
356
|
+
player.notes << "The bird has ingested the Alka-seltzer! "+
|
|
357
|
+
"Only #{enemy[:kill_countdown]} turns left!"
|
|
358
|
+
end
|
|
359
|
+
when "rice"
|
|
360
|
+
if enemy[:name] == "albatross"
|
|
361
|
+
damage = 1.d(30).sum
|
|
362
|
+
player.notes << "The albatross takes a mouthful of rice and spits" +
|
|
363
|
+
"it like bullets! #{damage} damage!"
|
|
364
|
+
player[:health] -= damage
|
|
365
|
+
else
|
|
366
|
+
enemy[:kill_countdown] = 1.d(10).sum
|
|
367
|
+
player.notes << "The bird has ingested the rice. Only " +
|
|
368
|
+
"#{enemy[:kill_countdown]} turns left!"
|
|
369
|
+
end
|
|
370
|
+
when "poisoned_seeds"
|
|
371
|
+
if enemy[:name] == "albatross"
|
|
372
|
+
bonus = 1.d(30).sum
|
|
373
|
+
player.notes << "The albatross eats poison seeds for " +
|
|
374
|
+
"breakfast. He gains #{bonus} health"
|
|
375
|
+
enemy[:health] += bonus
|
|
376
|
+
else
|
|
377
|
+
enemy[:poisoned] = true
|
|
378
|
+
player.notes << "The bird swallows the poisonous seeds. Yummy."
|
|
379
|
+
end
|
|
380
|
+
when "cat"
|
|
381
|
+
if enemy[:name] == "albatross"
|
|
382
|
+
player.notes << "The albatross HATES cats. Sayonara, sucker!"
|
|
383
|
+
end_combat(player)
|
|
384
|
+
return "house.rhtml"
|
|
385
|
+
else
|
|
386
|
+
enemy[:health] -= 10
|
|
387
|
+
enemy[:health] = 1 if enemy[:health] <= 0
|
|
388
|
+
player.notes << "The cat attacks!"
|
|
389
|
+
end
|
|
390
|
+
when "oil"
|
|
391
|
+
if enemy[:name] == "albatross"
|
|
392
|
+
player.notes << "The albatross sets the oil on fire, and the " +
|
|
393
|
+
"smoke blinds you"
|
|
394
|
+
@turn_delay = 4
|
|
395
|
+
else
|
|
396
|
+
enemy[:can_flee] = false
|
|
397
|
+
player.notes << "The #{enemy[:name]} has been soaked with oil and " +
|
|
398
|
+
"not cannot flee"
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
player[:used_items] << player[:item]
|
|
402
|
+
player[:item] = nil
|
|
403
|
+
return "fight.rhtml"
|
|
404
|
+
end
|
|
405
|
+
def do_set_item(player, details)
|
|
406
|
+
if player[:used_items].include?(details["item"])
|
|
407
|
+
player.notes << "You have already used this item, try again " +
|
|
408
|
+
"when you level up"
|
|
409
|
+
else
|
|
410
|
+
player[:item] = details["item"]
|
|
411
|
+
player.notes << "You have selected #{player[:item]}"
|
|
412
|
+
end
|
|
413
|
+
return "chest.rhtml"
|
|
414
|
+
end
|
|
415
|
+
def do_set_weapon(player, details)
|
|
416
|
+
if (@weapons[details["weapon"]] > player[:ron_points])
|
|
417
|
+
player.notes << "You need #{@weapons[details['weapon']]} "+
|
|
418
|
+
"Ronpoints for this weapon!"
|
|
419
|
+
else
|
|
420
|
+
player[:weapon] = details["weapon"]
|
|
421
|
+
end
|
|
422
|
+
return "weapons.rhtml"
|
|
423
|
+
end
|
|
424
|
+
def do_reset(player, details)
|
|
425
|
+
do_begin(player, details)
|
|
426
|
+
player.notes << "Game totally reset"
|
|
427
|
+
return "house.rhtml"
|
|
428
|
+
end
|
|
429
|
+
# def do_login(player, details)
|
|
430
|
+
# return "../../" if player.nil?
|
|
431
|
+
# Gambit::Server::SERVER.players.include?(player) ? "index.rhtml" :
|
|
432
|
+
# do_login(nil, nil)
|
|
433
|
+
#end
|
|
434
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta content="text/html; charset=ISO-8859-1"
|
|
5
|
+
http-equiv="content-type">
|
|
6
|
+
<style>
|
|
7
|
+
ul { list-style: none; margin: 0 0 30 0; padding: 0px; height: 25px; }
|
|
8
|
+
</style>
|
|
9
|
+
<title>Ron's Chest O' Items</title>
|
|
10
|
+
</head>
|
|
11
|
+
<body style="background-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"
|
|
12
|
+
alink="#ffffff" link="#ffffff" vlink="#ffffff">
|
|
13
|
+
<div style="text-align: center;"><br>
|
|
14
|
+
<img src="images/items.png" width="600" height="441" border="0" usemap="#map" />
|
|
15
|
+
<map name="map">
|
|
16
|
+
<area shape="rect" coords="138,81,263,206"
|
|
17
|
+
href="<%= event(nil, "set_item", "item" => "alka_seltzer") %>" />
|
|
18
|
+
<area shape="rect" coords="273,78,398,207"
|
|
19
|
+
href="<%= event(nil, "set_item", "item" => "oil") %>" />
|
|
20
|
+
<area shape="rect" coords="412,79,545,211"
|
|
21
|
+
href="<%= event(nil, "set_item", "item" => "rice") %>" />
|
|
22
|
+
<area shape="rect" coords="134,222,267,350"
|
|
23
|
+
href="<%= event(nil, "set_item", "item" => "cat") %>" />
|
|
24
|
+
<area shape="rect" coords="272,218,402,352"
|
|
25
|
+
href="<%= event(nil, "set_item", "item" => "soda_rings") %>" />
|
|
26
|
+
<area shape="rect" coords="414,218,549,357"
|
|
27
|
+
href="<%= event(nil, "set_item", "item" => "poisoned_seeds") %>" />
|
|
28
|
+
<area shape="rect" coords="311,371,394,416"
|
|
29
|
+
href="<%= event(nil, "go", "place" => "house")%>" />
|
|
30
|
+
</map>
|
|
31
|
+
<br>
|
|
32
|
+
<br>
|
|
33
|
+
<%= view(:info_panel) %>
|
|
34
|
+
<br>
|
|
35
|
+
</div>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|