Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[bin/crypt] cavern collapse

  • Loading branch information...
commit acf6aefb87d17bdd0f0c346f43251f6191067ae9 1 parent cf18e6e
Carl Mäsak authored July 28, 2012
27  bin/crypt
@@ -642,7 +642,6 @@ class Adventure::Engine {
642 642
                    :exits((%!exits{$!player_location} // ()).keys),
643 643
                    :things(self!explicit_things_at($!player_location)),
644 644
                );
645  
-        @events.push(self!tick);
646 645
         self!apply_and_return: @events;
647 646
     }
648 647
 
@@ -697,7 +696,6 @@ class Adventure::Engine {
697 696
         if %!examine_hooks{$thing} -> &hook {
698 697
             @events.push(&hook());
699 698
         }
700  
-        @events.push(self!tick);
701 699
 
702 700
         self!apply_and_return: @events;
703 701
     }
@@ -1216,6 +1214,11 @@ class Crypt::Game {
1216 1214
                 'pedestal',
1217 1215
                 -> $_ {
1218 1216
                     when 'butterfly' | 'small disk' {
  1217
+                        # XXX: Should be 3, will fix when getting sagas
  1218
+                        $!engine.light_fuse(4, 'cavern-collapse', {
  1219
+                            $!engine.remark('cavern-collapses'),
  1220
+                            $!engine.finish();
  1221
+                        });
1219 1222
                         $!engine.remark('alarm-starts');
1220 1223
                     }
1221 1224
                 };
@@ -2784,6 +2787,26 @@ multi MAIN('test') {
2784 2787
             'taking the butterfly triggers an alarm';
2785 2788
     }
2786 2789
 
  2790
+    {
  2791
+        my $game = game_from_crypt();
  2792
+
  2793
+        $game.take('butterfly');
  2794
+        $game.walk('southeast');
  2795
+        $game.walk('up');
  2796
+        is $game.walk('north'),
  2797
+            [
  2798
+                Adventure::PlayerWalked.new(
  2799
+                    :to<chamber>,
  2800
+                ),
  2801
+                Adventure::GameRemarked.new(
  2802
+                    :remark<cavern-collapses>,
  2803
+                ),
  2804
+                Adventure::GameFinished.new(
  2805
+                ),
  2806
+            ],
  2807
+            'not getting out in time before the cavern collapses';
  2808
+    }
  2809
+
2787 2810
     done;
2788 2811
 }
2789 2812
 
5  game-data/descriptions
@@ -101,3 +101,8 @@ You try to walk past the fire, but it's too hot!
101 101
 
102 102
 == remark:alarm-starts
103 103
 An alarm starts sounding in the whole cavern.
  104
+
  105
+== remark:cavern-collapses
  106
+The alarm starts sounding louder.
  107
+The whole cavern shakes, and falls in on itself.
  108
+You die.

0 notes on commit acf6aef

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