hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 7 +use TAEB::Spoilers::Sokoban; hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 65 + my $sokoban = defined $l->branch && $l->branch eq 'sokoban'; hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 85 - if($tile->has_boulder - && (!defined $l->branch || $l->branch ne 'sokoban')) {{ + if($tile->has_boulder && !$sokoban) {{ hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 90 - my $beyond = $l->at_safe($x+$dx,$y+$dy); - my $plantype = (safe_boulder_square($tile, $ai) ? - "PushBoulderRisky" : "PushBoulder"); - if(defined $beyond and $beyond->type eq 'unexplored') { - $self->generate_plan($tme,$plantype,$tile); - } + my $beyond = $l->at_safe($x+$dx,$y+$dy); + my $plantype = (safe_boulder_square($tile, $ai) ? + "PushBoulderRisky" : "PushBoulder"); + if(defined $beyond and $beyond->type eq 'unexplored') { + $self->generate_plan($tme,$plantype,$tile); + } hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 112 - if(defined $beyond && !$beyond->has_boulder && - !$beyond->is_inherently_unwalkable(1,1)) { - $self->generate_plan($tme,$plantype,$tile); - } + if(defined $beyond && !$beyond->has_boulder && + !$beyond->is_inherently_unwalkable(1,1)) { + $self->generate_plan($tme,$plantype,$tile); + } hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 179 + # In Sokoban, mimics are pathable by waking and killing them. + if($sokoban && $tile->has_boulder && + !TAEB::Spoilers::Sokoban->probably_has_genuine_boulder($tile)) { + $self->generate_plan($tme,"ViaMimic",$tile); + } hunk ./lib/TAEB/AI/Planar/Plan/MoveTo.pm 195 - 'Tunnel']; + 'Tunnel','ViaMimic']; addfile ./lib/TAEB/AI/Planar/Plan/ViaMimic.pm hunk ./lib/TAEB/AI/Planar/Plan/ViaMimic.pm 1 +#!/usr/bin/env perl +package TAEB::AI::Planar::Plan::ViaMimic; +use TAEB::OO; +extends 'TAEB::AI::Planar::Plan::Tactical'; + +has tile => ( + isa => 'Maybe[TAEB::World::Tile]', + is => 'rw', + default => undef, +); +sub set_additional_args { + my $self = shift; + $self->tile(shift); +} + +sub calculate_risk { + my $self = shift; + my $tme = shift; + my $tile = $self->tile; + $self->cost("Time",2); + $self->cost("Hitpoints",20); # estimate for fighting a giant mimic + $self->level_step_danger($tile->level); # is this accurate? +} + +sub check_possibility_inner { + my $self = shift; + my $tme = shift; + my $tile = $self->tile; + return unless $tile->has_boulder; # at least, looks like it does + $self->add_possible_move($tme,$tile->x,$tile->y,$tile->level); +} + +sub replaceable_with_travel { 0 } +sub action { + my $self = shift; + my $tile = $self->tile; + return TAEB::Action->new_action('search', iterations => 1); +} + +sub succeeded { + my $self = shift; + # We succeeded if we uncloaked a mimic. + return $self->tile->glyph eq 'm'; +} + +use constant description => 'Waking a mimic so we can move past it'; + +__PACKAGE__->meta->make_immutable; +no Moose; + +1; hunk ./lib/TAEB/AI/Planar/Plan/SokobanPrize.pm 24 + # Pick up the item, if we can see it. hunk ./lib/TAEB/AI/Planar/Plan/SokobanPrize.pm 35 + # Look for the item, if we can't. + for my $door ($sokotop->tiles_of(qw/opendoor closeddoor/)) { + my $tile = $door->at_direction('h'); + next if $tile->stepped_on; + next unless TAEB::Spoilers::Sokoban-> + is_sokoban_reward_tile($tile); + $self->depends(1,'LookAt',$tile); + } hunk ./lib/TAEB/AI/Planar/Plan/SokobanPrize.pm 47 -use constant references => ['PickupItem']; +use constant references => ['PickupItem','LookAt']; hunk ./lib/TAEB/AI/Planar/Plan/Drop.pm 22 + # Don't drop items on the Sokoban prize tile. + my $plan = TAEB->ai->get_plan("SokobanPrize"); + return undef if $plan->prizetile + && $plan->prizetile == TAEB->current_tile; hunk ./lib/TAEB/AI/Planar/Plan/SokobanPrize.pm 18 - $self->prizetile(undef); hunk ./lib/TAEB/AI/Planar/Plan/SokobanPrize.pm 29 + next unless $tile; # we might not be looking at that level hunk ./lib/TAEB/AI/Planar.pm 987 + if ($algorithm eq 'chokepoint' && + TAEB->inventory->find(['pick-axe', 'dwarvish mattock'])) { + # No mathematical reason not to use chokepoint here; it's just + # that with that amount of routing involved, level is just faster. + # TODO: I'm pretty sure there's an algo faster than either if + # tunneling is allowed... + $algorithm = 'level'; + }