Merge lp:~stefanor/ibid/mexican-shootout into lp:~ibid-core/ibid/old-trunk-pack-0.92
- mexican-shootout
- Merge into old-trunk-pack-0.92
Proposed by
Stefano Rivera
Status: | Merged |
---|---|
Approved by: | Stefano Rivera |
Approved revision: | 677 |
Merged at revision: | 675 |
Proposed branch: | lp:~stefanor/ibid/mexican-shootout |
Merge into: | lp:~ibid-core/ibid/old-trunk-pack-0.92 |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~stefanor/ibid/mexican-shootout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jonathan Hitchcock | Approve | ||
Michael Gorven | Approve | ||
Review via email: mp+8095@code.launchpad.net |
This proposal supersedes a proposal from 2009-06-27.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Stefano Rivera (stefanor) wrote : Posted in a previous version of this proposal | # |
Revision history for this message
Jonathan Hitchcock (vhata) wrote : Posted in a previous version of this proposal | # |
<3
review:
Approve
- 673. By Stefano Rivera
-
More acceptance commands
- 674. By Stefano Rivera
-
The agressor can't confirm
- 675. By Stefano Rivera
-
Spelling
- 676. By Stefano Rivera
-
Capitalise names on start
- 677. By Stefano Rivera
-
3 spelling errors
Revision history for this message
Jonathan Hitchcock (vhata) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ibid/plugins/core.py' | |||
2 | --- ibid/plugins/core.py 2009-05-08 16:21:03 +0000 | |||
3 | +++ ibid/plugins/core.py 2009-07-01 16:59:59 +0000 | |||
4 | @@ -85,6 +85,7 @@ | |||
5 | 85 | class Address(Processor): | 85 | class Address(Processor): |
6 | 86 | 86 | ||
7 | 87 | processed = True | 87 | processed = True |
8 | 88 | addressed = False | ||
9 | 88 | acknowledgements = Option('acknowledgements', 'Responses for positive acknowledgements', | 89 | acknowledgements = Option('acknowledgements', 'Responses for positive acknowledgements', |
10 | 89 | (u'Okay', u'Sure', u'Done', u'Righto', u'Alrighty', u'Yessir')) | 90 | (u'Okay', u'Sure', u'Done', u'Righto', u'Alrighty', u'Yessir')) |
11 | 90 | refusals = Option('refusals', 'Responses for negative acknowledgements', | 91 | refusals = Option('refusals', 'Responses for negative acknowledgements', |
12 | 91 | 92 | ||
13 | === added file 'ibid/plugins/games.py' | |||
14 | --- ibid/plugins/games.py 1970-01-01 00:00:00 +0000 | |||
15 | +++ ibid/plugins/games.py 2009-07-01 17:54:10 +0000 | |||
16 | @@ -0,0 +1,392 @@ | |||
17 | 1 | import datetime | ||
18 | 2 | import logging | ||
19 | 3 | from random import choice, gauss, random | ||
20 | 4 | import re | ||
21 | 5 | import time | ||
22 | 6 | |||
23 | 7 | import ibid | ||
24 | 8 | from ibid.plugins import Processor, match, handler | ||
25 | 9 | from ibid.config import Option, IntOption, BoolOption, FloatOption | ||
26 | 10 | from ibid.utils import ibid_version | ||
27 | 11 | |||
28 | 12 | help = {} | ||
29 | 13 | log = logging.getLogger('plugins.games') | ||
30 | 14 | |||
31 | 15 | help['duel'] = u"Duel at dawn, between channel members" | ||
32 | 16 | class Duel(Processor): | ||
33 | 17 | u"""I challenge <user> to a duel [over <something>] | ||
34 | 18 | I demand satisfaction from <user> [over <something>] | ||
35 | 19 | I throw the gauntlet down at <user>'s feet [over <something>] | ||
36 | 20 | draw [my <weapon>] | ||
37 | 21 | bam|pew|bang|kapow|pewpew|holyhandgrenadeofantioch""" | ||
38 | 22 | feature = 'duel' | ||
39 | 23 | |||
40 | 24 | addressed = BoolOption('addressed', 'Must the bot be addressed', True) | ||
41 | 25 | |||
42 | 26 | extremities = Option('extremities', u'Extremities that can be hit', ( | ||
43 | 27 | u'toe', u'foot', u'leg', u'thigh', u'finger', u'hand', u'arm', | ||
44 | 28 | u'elbow', u'shoulder', u'ear', u'nose', u'stomach', | ||
45 | 29 | )) | ||
46 | 30 | |||
47 | 31 | vitals = Option('vitals', 'Vital parts of the body that can be hit', ( | ||
48 | 32 | u'head', u'groin', u'chest', u'heart', u'neck', | ||
49 | 33 | )) | ||
50 | 34 | |||
51 | 35 | happy_endings = Option('happy_endings', 'Both survive', ( | ||
52 | 36 | u'walk off into the sunset', u'go for a beer', u'call it quits', | ||
53 | 37 | )) | ||
54 | 38 | |||
55 | 39 | weapons = Option('weapons', 'Weapons that can be used: name: (chance, damage)', { | ||
56 | 40 | u'bam': (0.75, 50), | ||
57 | 41 | u'pew': (0.75, 50), | ||
58 | 42 | u'fire': (0.75, 70), | ||
59 | 43 | u'bang': (0.75, 70), | ||
60 | 44 | u'kapow': (0.75, 90), | ||
61 | 45 | u'pewpew': (0.75, 110), | ||
62 | 46 | u'holyhandgrenadeofantioch': (1.0, 200), | ||
63 | 47 | }) | ||
64 | 48 | |||
65 | 49 | draw_required = BoolOption('draw_required', 'Must you draw your weapon before firing?', True) | ||
66 | 50 | accept_timeout = FloatOption('accept_timeout', 'How long do we wait for acceptance?', 60.0) | ||
67 | 51 | start_delay = IntOption('start_delay', 'Time between acceptance and start of duel (rounded down to the highest minute)', 30) | ||
68 | 52 | timeout = FloatOption('timeout', 'How long is a duel on for', 10.0) | ||
69 | 53 | extratime = FloatOption('extratime', 'How much more time to grant after every shot fired?', 1.0) | ||
70 | 54 | |||
71 | 55 | duels = {} | ||
72 | 56 | |||
73 | 57 | class Duel(object): | ||
74 | 58 | pass | ||
75 | 59 | |||
76 | 60 | @match(r'^(?:I\s+)throw\s+(?:down\s+(?:the|my)\s+gauntlet|(?:the|my)\s+gauntlet\s+down)\s+' | ||
77 | 61 | r'at\s+(\S+?)(?:\'s\s+feet)?(?:\s+(?:over|because|for)\s+.+)?$') | ||
78 | 62 | def initiate_gauntlet(self, event, recipient): | ||
79 | 63 | self.initiate(event, recipient) | ||
80 | 64 | |||
81 | 65 | @match(r'^(?:I\s+)?demand\s+satisfaction\s+from\s+(\S+)(?:\s+(?:over|because|for)\s+.+)?$') | ||
82 | 66 | def initiate_satisfaction(self, event, recipient): | ||
83 | 67 | self.initiate(event, recipient) | ||
84 | 68 | |||
85 | 69 | @match(r'^(?:I\s+)?challenge\s+(\S+)(?:\s+to\s+a\s+duel)?(?:\s+(?:over|because|for)\s+.+)?$') | ||
86 | 70 | def initiate(self, event, recipient): | ||
87 | 71 | if not event.addressed: | ||
88 | 72 | return | ||
89 | 73 | |||
90 | 74 | if not event.public: | ||
91 | 75 | event.addresponse(choice(( | ||
92 | 76 | u"All duels must take place in public places, by decree of the bot", | ||
93 | 77 | u"How do you expect to fight %(recipient)s, when he is not present?", | ||
94 | 78 | u"Your challenge must be made in public, Sir Knight", | ||
95 | 79 | )), { | ||
96 | 80 | 'recipient': recipient | ||
97 | 81 | }) | ||
98 | 82 | return | ||
99 | 83 | |||
100 | 84 | if (event.source, event.channel) in self.duels: | ||
101 | 85 | event.addresponse(choice(( | ||
102 | 86 | u"We already have a war in here. Take your fight outside", | ||
103 | 87 | u"Isn't one fight enough? You may wait your turn", | ||
104 | 88 | ))) | ||
105 | 89 | return | ||
106 | 90 | |||
107 | 91 | aggressor = event.sender['nick'] | ||
108 | 92 | |||
109 | 93 | if recipient.lower() == aggressor.lower(): | ||
110 | 94 | # Yes I know schizophrenia isn't the same as DID, but this sounds better :P | ||
111 | 95 | event.addresponse(choice(( | ||
112 | 96 | u"Are you schizophrenic?", | ||
113 | 97 | u"Um, How exactly do you plan on fighting yourself?", | ||
114 | 98 | ))) | ||
115 | 99 | return | ||
116 | 100 | |||
117 | 101 | if recipient.lower() in [name.lower() for name in ibid.config.plugins['core']['names']]: | ||
118 | 102 | event.addresponse(choice(( | ||
119 | 103 | u"I'm a peaceful bot", | ||
120 | 104 | u"The ref can't take part in the battle", | ||
121 | 105 | u"You just want me to die. No way", | ||
122 | 106 | ))) | ||
123 | 107 | return | ||
124 | 108 | |||
125 | 109 | duel = self.Duel() | ||
126 | 110 | self.duels[(event.source, event.channel)] = duel | ||
127 | 111 | |||
128 | 112 | duel.hp = { | ||
129 | 113 | aggressor.lower(): 100.0, | ||
130 | 114 | recipient.lower(): 100.0, | ||
131 | 115 | } | ||
132 | 116 | duel.names = { | ||
133 | 117 | aggressor.lower(): aggressor, | ||
134 | 118 | recipient.lower(): recipient, | ||
135 | 119 | } | ||
136 | 120 | duel.drawn = { | ||
137 | 121 | aggressor.lower(): False, | ||
138 | 122 | recipient.lower(): False, | ||
139 | 123 | } | ||
140 | 124 | |||
141 | 125 | duel.started = False | ||
142 | 126 | duel.confirmed = False | ||
143 | 127 | duel.aggressor = event.sender['nick'].lower() | ||
144 | 128 | duel.recipient = recipient.lower() | ||
145 | 129 | |||
146 | 130 | duel.cancel_callback = ibid.dispatcher.call_later(self.accept_timeout, self.cancel, event) | ||
147 | 131 | |||
148 | 132 | event.addresponse({'reply': (u'%(recipient)s: ' + choice(( | ||
149 | 133 | u"The gauntlet has been thrown at your feet. Do you accept?", | ||
150 | 134 | u"You have been challenged. Do you accept?", | ||
151 | 135 | u"%(aggressor)s wishes to meet you at dawn on the field of honour. Do you accept?", | ||
152 | 136 | ))) % { | ||
153 | 137 | 'recipient': recipient, | ||
154 | 138 | 'aggressor': event.sender['nick'], | ||
155 | 139 | }}) | ||
156 | 140 | |||
157 | 141 | def cancel(self, event): | ||
158 | 142 | duel = self.duels[(event.source, event.channel)] | ||
159 | 143 | del self.duels[(event.source, event.channel)] | ||
160 | 144 | |||
161 | 145 | event.addresponse(choice(( | ||
162 | 146 | u"%(recipient)s appears to has fled the country during the night", | ||
163 | 147 | u"%(recipient)s refuses to meet your challenge and accepts dishonour", | ||
164 | 148 | u"Your challenge was not met. I suggest anger management councelling", | ||
165 | 149 | )), { | ||
166 | 150 | 'recipient': duel.names[duel.recipient], | ||
167 | 151 | }) | ||
168 | 152 | |||
169 | 153 | @match(r'^.*\b(?:ok|yes|I\s+do|sure|accept|hit\s+me)\b.*$') | ||
170 | 154 | def confirm(self, event): | ||
171 | 155 | if not event.addressed: | ||
172 | 156 | return | ||
173 | 157 | |||
174 | 158 | if (event.source, event.channel) not in self.duels: | ||
175 | 159 | return | ||
176 | 160 | |||
177 | 161 | duel = self.duels[(event.source, event.channel)] | ||
178 | 162 | |||
179 | 163 | if event.sender['nick'].lower() not in duel.names: | ||
180 | 164 | return | ||
181 | 165 | |||
182 | 166 | # Correct capitalisation | ||
183 | 167 | duel.names[event.sender['nick'].lower()] = event.sender['nick'] | ||
184 | 168 | |||
185 | 169 | duel.confirmed = True | ||
186 | 170 | duel.cancel_callback.cancel() | ||
187 | 171 | |||
188 | 172 | now = datetime.datetime.now() | ||
189 | 173 | starttime = now + datetime.timedelta(seconds=self.start_delay + ((30 - now.second) % 30)) | ||
190 | 174 | starttime = datetime.datetime(starttime.year, starttime.month, starttime.day, | ||
191 | 175 | starttime.hour, starttime.minute, starttime.second) | ||
192 | 176 | delay = starttime - now | ||
193 | 177 | delay = delay.seconds + (delay.microseconds / 10.**6) | ||
194 | 178 | |||
195 | 179 | duel.start_callback = ibid.dispatcher.call_later(delay, self.start, event) | ||
196 | 180 | |||
197 | 181 | event.addresponse({'reply': ( | ||
198 | 182 | u"%(aggressor)s, %(recipient)s: " | ||
199 | 183 | u"The duel shall begin on the stroke of %(starttime)s %(timezone)s (in %(delay)s seconds). " | ||
200 | 184 | + choice(( | ||
201 | 185 | u"You may clean your pistols.", | ||
202 | 186 | u"Prepare yourselves.", | ||
203 | 187 | u"Get ready", | ||
204 | 188 | )) | ||
205 | 189 | ) % { | ||
206 | 190 | 'aggressor': duel.names[duel.aggressor], | ||
207 | 191 | 'recipient': duel.names[duel.recipient], | ||
208 | 192 | 'starttime': starttime.time().isoformat(), | ||
209 | 193 | 'timezone': time.tzname[0], | ||
210 | 194 | 'delay': (starttime - now).seconds, | ||
211 | 195 | }}) | ||
212 | 196 | |||
213 | 197 | def start(self, event): | ||
214 | 198 | duel = self.duels[(event.source, event.channel)] | ||
215 | 199 | |||
216 | 200 | duel.started = True | ||
217 | 201 | duel.timeout_callback = ibid.dispatcher.call_later(self.timeout, self.end, event) | ||
218 | 202 | |||
219 | 203 | event.addresponse({'reply': | ||
220 | 204 | u"%s, %s: %s" % (duel.aggressor, duel.recipient, choice(( | ||
221 | 205 | u'aaaand ... go!', | ||
222 | 206 | u'5 ... 4 ... 3 ... 2 ... 1 ... fire!', | ||
223 | 207 | u'match on!', | ||
224 | 208 | u'ready ... aim ... fire!' | ||
225 | 209 | )))}) | ||
226 | 210 | |||
227 | 211 | def setup(self): | ||
228 | 212 | self.fire.im_func.pattern = re.compile( | ||
229 | 213 | r'^(%s)(?:[\s,.!:;].*)?$' % '|'.join(self.weapons.keys()), | ||
230 | 214 | re.I | re.DOTALL) | ||
231 | 215 | |||
232 | 216 | @match(r'^draw(?:s\s+h(?:is|er)\s+.*|\s+my\s+.*)?$') | ||
233 | 217 | def draw(self, event): | ||
234 | 218 | if (event.source, event.channel) not in self.duels: | ||
235 | 219 | if event.addressed: | ||
236 | 220 | event.addresponse(choice(( | ||
237 | 221 | u"We do not permit drawn weapons here", | ||
238 | 222 | u"You may only draw a weapon on the field of honour", | ||
239 | 223 | ))) | ||
240 | 224 | return | ||
241 | 225 | |||
242 | 226 | duel = self.duels[(event.source, event.channel)] | ||
243 | 227 | |||
244 | 228 | shooter = event.sender['nick'] | ||
245 | 229 | if shooter.lower() not in duel.names: | ||
246 | 230 | event.addresponse(choice(( | ||
247 | 231 | u"Spectators are not permitted to draw weapons", | ||
248 | 232 | u"Do you think you are %(fighter)s?", | ||
249 | 233 | )), {'fighter': choice(duel.names.values())}) | ||
250 | 234 | return | ||
251 | 235 | |||
252 | 236 | if not duel.started: | ||
253 | 237 | event.addresponse(choice(( | ||
254 | 238 | u"Now now, not so fast!", | ||
255 | 239 | u"Did I say go yet?", | ||
256 | 240 | u"Put that AWAY!", | ||
257 | 241 | ))) | ||
258 | 242 | return | ||
259 | 243 | |||
260 | 244 | duel.drawn[shooter.lower()] = True | ||
261 | 245 | event.addresponse(True) | ||
262 | 246 | |||
263 | 247 | @handler | ||
264 | 248 | def fire(self, event, weapon): | ||
265 | 249 | shooter = event.sender['nick'].lower() | ||
266 | 250 | if (event.source, event.channel) not in self.duels: | ||
267 | 251 | return | ||
268 | 252 | |||
269 | 253 | duel = self.duels[(event.source, event.channel)] | ||
270 | 254 | |||
271 | 255 | if shooter not in duel.names: | ||
272 | 256 | event.addresponse(choice(( | ||
273 | 257 | u"You aren't in a war", | ||
274 | 258 | u'You are a non-combatant', | ||
275 | 259 | u'You are a spectator', | ||
276 | 260 | ))) | ||
277 | 261 | return | ||
278 | 262 | |||
279 | 263 | enemy = set(duel.names.keys()) | ||
280 | 264 | enemy.remove(shooter) | ||
281 | 265 | enemy = enemy.pop() | ||
282 | 266 | |||
283 | 267 | if self.draw_required and not duel.drawn[shooter]: | ||
284 | 268 | recipient = shooter | ||
285 | 269 | else: | ||
286 | 270 | recipient = enemy | ||
287 | 271 | |||
288 | 272 | if not duel.started or not duel.confirmed: | ||
289 | 273 | if self.draw_required: | ||
290 | 274 | message = choice(( | ||
291 | 275 | u"%(shooter)s tried to escape his duel by shooting himself in the foot. The duel has been cancelled, but his honour is forfiet", | ||
292 | 276 | u"%(shooter)s shot himself while preparing for his duel. The funeral will be held on the weekend", | ||
293 | 277 | )) | ||
294 | 278 | elif not duel.started: | ||
295 | 279 | message = choice(( | ||
296 | 280 | u"FOUL! %(shooter)s fired before my mark. Just as well you didn't hit anything. I refuse to referee under these conditions", | ||
297 | 281 | u"FOUL! %(shooter)s injures %(enemy)s before the match started and is marched away in handcuffs", | ||
298 | 282 | u"FOUL! %(shooter)s killed %(enemy)s before the match started and was shot by the referee before he could hurt anyone else", | ||
299 | 283 | )) | ||
300 | 284 | else: | ||
301 | 285 | message = choice(( | ||
302 | 286 | u"FOUL! The duel is not yet confirmed. %(shooter)s is marched away in handcuffs", | ||
303 | 287 | u"FOUL! Arrest %(shooter)s! Firing a weapon within city limits is not permitted", | ||
304 | 288 | )) | ||
305 | 289 | event.addresponse({'reply': message % { | ||
306 | 290 | 'shooter': duel.names[shooter], | ||
307 | 291 | 'enemy': duel.names[enemy], | ||
308 | 292 | }}) | ||
309 | 293 | del self.duels[(event.source, event.channel)] | ||
310 | 294 | if duel.cancel_callback.active(): | ||
311 | 295 | duel.cancel_callback.cancel() | ||
312 | 296 | if duel.start_callback.active(): | ||
313 | 297 | duel.start_callback.cancel() | ||
314 | 298 | return | ||
315 | 299 | |||
316 | 300 | chance, power = self.weapons[weapon.lower()] | ||
317 | 301 | |||
318 | 302 | if random() < chance: | ||
319 | 303 | damage = max(gauss(power, power/2.0), 0) | ||
320 | 304 | duel.hp[recipient] -= damage | ||
321 | 305 | if duel.hp[recipient] <= 0.0: | ||
322 | 306 | del self.duels[(event.source, event.channel)] | ||
323 | 307 | duel.timeout_callback.cancel() | ||
324 | 308 | else: | ||
325 | 309 | duel.timeout_callback.delay(self.extratime) | ||
326 | 310 | |||
327 | 311 | params = { | ||
328 | 312 | 'shooter': duel.names[shooter], | ||
329 | 313 | 'enemy': duel.names[enemy], | ||
330 | 314 | 'part': u'foot', | ||
331 | 315 | } | ||
332 | 316 | if shooter == recipient: | ||
333 | 317 | message = u"TRAGEDY: %(shooter)s shoots before drawing his weapon. " | ||
334 | 318 | if damage > 100.0: | ||
335 | 319 | message += choice(( | ||
336 | 320 | u"The explosion killed him", | ||
337 | 321 | u"There was little left of him", | ||
338 | 322 | )) | ||
339 | 323 | elif duel.hp[recipient] <= 0.0: | ||
340 | 324 | message += choice(( | ||
341 | 325 | u"Combined with his other injuries, he didn't stand a chance", | ||
342 | 326 | u"He died during field surgary", | ||
343 | 327 | )) | ||
344 | 328 | else: | ||
345 | 329 | message += choice(( | ||
346 | 330 | u"Luckily, it was only a flesh wound", | ||
347 | 331 | u"He narrowly missed his femoral artery", | ||
348 | 332 | )) | ||
349 | 333 | |||
350 | 334 | elif damage > 100.0: | ||
351 | 335 | message = u'VICTORY: ' + choice(( | ||
352 | 336 | u'%(shooter)s blows %(enemy)s away', | ||
353 | 337 | u'%(shooter)s destroys %(enemy)s', | ||
354 | 338 | )) | ||
355 | 339 | elif duel.hp[enemy] <= 0.0: | ||
356 | 340 | message = u'VICTORY: ' + choice(( | ||
357 | 341 | u'%(shooter)s kills %(enemy)s with a shot to the %(part)s', | ||
358 | 342 | u'%(shooter)s shoots %(enemy)s killing him with a fatal shot to the %(part)s', | ||
359 | 343 | )) | ||
360 | 344 | params['part'] = choice(self.vitals) | ||
361 | 345 | else: | ||
362 | 346 | message = choice(( | ||
363 | 347 | u'%(shooter)s hits %(enemy)s in the %(part)s, wounding him', | ||
364 | 348 | u'%(shooter)s shoots %(enemy)s in the %(part)s, but %(enemy)s can still fight', | ||
365 | 349 | )) | ||
366 | 350 | params['part'] = choice(self.extremities) | ||
367 | 351 | |||
368 | 352 | event.addresponse({'reply': message % params}) | ||
369 | 353 | |||
370 | 354 | elif shooter == recipient: | ||
371 | 355 | event.addresponse({'reply': choice(( | ||
372 | 356 | u"%s forget to draw his weapon. Luckily he missed his foot", | ||
373 | 357 | u"%s fires a holstered weapon. Luckily it only put a hole in his jacket", | ||
374 | 358 | u"%s won't win at this rate. He forgot to draw before firing. He missed himself too", | ||
375 | 359 | )) % duel.names[shooter]}) | ||
376 | 360 | else: | ||
377 | 361 | event.addresponse({'reply': choice(( | ||
378 | 362 | u'%s misses', | ||
379 | 363 | u'%s aims wide', | ||
380 | 364 | u'%s is useless with a weapon' | ||
381 | 365 | )) % duel.names[shooter]}) | ||
382 | 366 | |||
383 | 367 | def end(self, event): | ||
384 | 368 | duel = self.duels[(event.source, event.channel)] | ||
385 | 369 | del self.duels[(event.source, event.channel)] | ||
386 | 370 | |||
387 | 371 | winner, loser = duel.names.keys() | ||
388 | 372 | if duel.hp[winner] < duel.hp[loser]: | ||
389 | 373 | winner, loser = loser, winner | ||
390 | 374 | |||
391 | 375 | if duel.hp[loser] == 100.0: | ||
392 | 376 | message = u"DRAW: %(winner)s and %(loser)s shake hands and %(ending)s" | ||
393 | 377 | elif duel.hp[winner] < 50.0: | ||
394 | 378 | message = u"DRAW: %(winner)s and %(loser)s bleed to death together" | ||
395 | 379 | elif duel.hp[loser] < 50.0: | ||
396 | 380 | message = u"VICTORY: %(loser)s bleeds to death" | ||
397 | 381 | elif duel.hp[winner] < 100.0: | ||
398 | 382 | message = u"DRAW: %(winner)s and %(loser)s hobble off together. Satisfaction is obtained" | ||
399 | 383 | else: | ||
400 | 384 | message = u"VICTORY: %(loser)s hobbles off while %(winner)s looks victorious" | ||
401 | 385 | |||
402 | 386 | event.addresponse({'reply': message % { | ||
403 | 387 | 'loser': duel.names[loser], | ||
404 | 388 | 'winner': duel.names[winner], | ||
405 | 389 | 'ending': choice(self.happy_endings), | ||
406 | 390 | }}) | ||
407 | 391 | |||
408 | 392 | # vi: set et sta sw=4 ts=4: |
Do we want this? The #compsci guys use it when drunk.