Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[bin/crypt] can't see the helmet in darkness

  • Loading branch information...
commit 0287a471826dbb117408fe4bad00a01966d6550b 1 parent ecf3cab
@masak authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 bin/crypt
View
21 bin/crypt
@@ -643,6 +643,12 @@ class Adventure::Engine {
die X::Adventure::PlayerNowhere.new()
unless defined $!player_location;
+ my $pitch_black = %!dark_rooms{$!player_location}
+ && !self!shining_thing_here($!player_location);
+
+ die X::Adventure::PitchBlack.new(:action<see>)
+ if $pitch_black;
+
die X::Adventure::NoSuchThingHere.new(:$thing)
unless self!is_thing_in($thing, $!player_location);
@@ -2383,6 +2389,21 @@ multi MAIN('test') {
};
}
+ {
+ my $game = game_from_hall();
+
+ throws_exception
+ { $game.examine('helmet') },
+ X::Adventure::PitchBlack,
+ 'examining the helmet (-) pitch black',
+ {
+ is .action, 'see', '.action attribute';
+ is .message,
+ "You cannot see anything, because it is pitch black",
+ '.message attribute';
+ };
+ }
+
done;
}
Please sign in to comment.
Something went wrong with that request. Please try again.