package LasTres::Planet::Bahdder::BosqueDelHeroe::TribuDeLaLima;

use v5.36.0;

use strict;
use warnings;

use feature 'signatures';

use LasTres::EnemyArea;

use Module::Pluggable
  search_path => ['LasTres::Planet::Bahdder::BosqueDelHeroe::TribuDeLaLima'],
  instantiate => 'instance',
  on_require_error => sub ( $plugin, $error ) {
    die $error;
  };

use Moo;
use LasTres::Planet::Bahdder::BosqueDelHeroe;

with 'LasTres::Area';

sub can_explore {
    return 0;
}

sub get_auto_discover ($self) {
    return 1;
}

sub frames_to_move {
    return 3;
}

sub has_movement_auto_combat ($self) {
    return 1;
}

sub max_enemies_per_head ( $self, $pj = undef ) {
    if ( defined $pj && $pj->level >= 7 ) {
        return 2;
    }
    return 1;
}

sub list_of_enemies ( $self, $pj = undef ) {
    my @enemies;
    push @enemies,
      LasTres::EnemyArea->new(
        race  => 'conejo',
        nick  => 'Conejo rabioso',
        level => 2,
      );
    if ( defined $pj && $pj->level >= 6 ) {
        push @enemies,
          LasTres::EnemyArea->new(
            race  => 'conejo',
            nick  => 'Conejo rabioso',
            level => 3,
          );
    }

    return \@enemies;
}

sub identifier {
    return 'tribu_de_la_lima';
}

sub locations {
    my $self      = shift;
    my $hash      = {};
    my @locations = $self->plugins();
    for my $location (@locations) {
        $hash->{ $location->identifier } = $location;
    }
    return $hash;
}

sub name {
    return 'Tribu de la Lima';
}

sub parent {
    return LasTres::Planet::Bahdder::BosqueDelHeroe->instance;
}

my $singleton;

sub instance {
    my $class = shift;
    if ( !defined $singleton ) {
        $singleton = $class->new(@_);
    }
    return $singleton;
}
1;
