Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[bin/crypt] can take the tiny disk from hanoi

  • Loading branch information...
commit 07222ec4f5360b67bde31915e854359b5167cb9b 1 parent acf6aef
@masak authored
Showing with 29 additions and 1 deletion.
  1. +29 −1 bin/crypt
View
30 bin/crypt
@@ -1191,6 +1191,7 @@ class Crypt::Game {
};
# Things in hall
+ .make_thing_carryable: 'tiny disk';
.place_thing: 'helmet', 'hall';
.make_thing_carryable: 'helmet';
.make_thing_a_container: 'helmet';
@@ -1257,7 +1258,13 @@ class Crypt::Game {
}
method take($thing) {
- return $!engine.take($thing);
+ my @events;
+ if $thing eq 'tiny disk' {
+ @events.push:
+ $!hanoi.remove('tiny disk'),
+ $!engine.place_thing('tiny disk', 'hall');
+ }
+ return @events, $!engine.take($thing);
}
method drop($thing) {
@@ -2807,6 +2814,27 @@ multi MAIN('test') {
'not getting out in time before the cavern collapses';
}
+ {
+ my $game = game_from_hall();
+
+ $game.use('flashlight');
+ is $game.take('tiny disk'),
+ [
+ Hanoi::DiskRemoved.new(
+ :disk('tiny disk'),
+ :source<left>,
+ ),
+ Adventure::ThingPlaced.new(
+ :thing('tiny disk'),
+ :room<hall>,
+ ),
+ Adventure::PlayerTook.new(
+ :thing('tiny disk'),
+ ),
+ ],
+ 'can take the tiny disk from the hanoi game';
+ }
+
done;
}
Please sign in to comment.
Something went wrong with that request. Please try again.