Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] taking the butterfly triggers an alarm

  • Loading branch information...
commit cf18e6e8b457feb3a459fd9f5e45d3e93a08673f 1 parent 5255b46
Carl Mäsak authored July 28, 2012
38  bin/crypt
@@ -556,6 +556,9 @@ class Adventure::Engine {
556 556
                 if %!containers{$thing}
557 557
                 && (!%!openable_things{$thing} || %!open_things{$thing})
558 558
                 && self.thing_is_in($sought, "contents:$thing");
  559
+            return True
  560
+                if %!platforms{$thing}
  561
+                && self.thing_is_in($sought, "contents:$thing");
559 562
         }
560 563
         return False;
561 564
     }
@@ -1206,6 +1209,19 @@ class Crypt::Game {
1206 1209
                     }
1207 1210
                 };
1208 1211
 
  1212
+            # Things in crypt
  1213
+            .place_thing: 'pedestal', 'crypt';
  1214
+            .make_thing_a_platform: 'pedestal';
  1215
+            .on_remove_from:
  1216
+                'pedestal',
  1217
+                -> $_ {
  1218
+                    when 'butterfly' | 'small disk' {
  1219
+                        $!engine.remark('alarm-starts');
  1220
+                    }
  1221
+                };
  1222
+            .place_thing: 'butterfly', 'contents:pedestal';
  1223
+            .make_thing_carryable: 'butterfly';
  1224
+
1209 1225
             .place_player: $!player_location = 'clearing';
1210 1226
         }
1211 1227
 
@@ -2746,6 +2762,28 @@ multi MAIN('test') {
2746 2762
             'putting out a fuse so it does not activate';
2747 2763
     }
2748 2764
 
  2765
+    sub game_from_crypt {
  2766
+        my $game = game_after_putting_out_the_water();
  2767
+
  2768
+        $game.walk('northwest');
  2769
+        return $game;
  2770
+    }
  2771
+
  2772
+    {
  2773
+        my $game = game_from_crypt();
  2774
+
  2775
+        is $game.take('butterfly'),
  2776
+            [
  2777
+                Adventure::PlayerTook.new(
  2778
+                    :thing<butterfly>,
  2779
+                ),
  2780
+                Adventure::GameRemarked.new(
  2781
+                    :remark<alarm-starts>,
  2782
+                ),
  2783
+            ],
  2784
+            'taking the butterfly triggers an alarm';
  2785
+    }
  2786
+
2749 2787
     done;
2750 2788
 }
2751 2789
 
3  game-data/descriptions
@@ -98,3 +98,6 @@ The fire wanes and dies out.
98 98
 
99 99
 == remark:walk-past-fire-too-hot
100 100
 You try to walk past the fire, but it's too hot!
  101
+
  102
+== remark:alarm-starts
  103
+An alarm starts sounding in the whole cavern.

0 notes on commit cf18e6e

Please sign in to comment.
Something went wrong with that request. Please try again.