Skip to content

Commit

Permalink
When we fail to push a boulder, mark the opposing tile as rock if une…
Browse files Browse the repository at this point in the history
…xplored
  • Loading branch information
sorear committed Jul 17, 2009
1 parent b31832f commit 677400f
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lib/TAEB/Action/Move.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,34 @@ sub done {
return;
}

return if $self->hit_obscured_monster;
return if $self->hit_immobile_boulder;

my $dir = substr($self->directions, 0, 1);
my ($dx, $dy) = vi2delta($dir);

$self->handle_blocking_wall($dx, $dy)
if $self->hit_immobile_boulder;

return if $self->hit_obscured_monster;
return if $self->hit_immobile_boulder;

$self->handle_obscured_doors($dx, $dy);
$self->handle_items_in_rock($dx, $dy);
}

sub handle_blocking_wall {
my $self = shift;
my $dx = shift;
my $dy = shift;

my $opposed = TAEB->current_level->at_safe(TAEB->x + $dx*2,
TAEB->y + $dy*2);

if ($opposed && $opposed->type eq 'unexplored') {
$opposed->change_type('rock' => ' ');
} elsif ($opposed && $opposed->is_walkable) {
TAEB->log->action("Weird. Something blocked the boulder, but what?");
}
}

sub handle_items_in_rock {
my $self = shift;
my $dx = shift;
Expand Down

0 comments on commit 677400f

Please sign in to comment.