package Enemy; use Moos; has wounds => (); has att_type => (); has def_type => (); sub BUILDARGS { my ($self, $type) = @_; my %monster = ( 'Rat' => { wounds => 1, att_type => 'light', def_type => 'dodge', }, ); die "Unknown monster type" unless exists $monster{$type}; $monster{$type}{'type'} = $type; return $monster{$type}; } 1; } my $monster = Enemy->new('Rat'); #### my %attack = ( basic_light => { type => 'light', damage => '1', defmod => { block => '0', dodge => '0' } }, basic_heavy => { type => 'heavy', damage => '2', defmod => { block => '0', dodge => '10' } }, ); #### $a = $attacker->choose_attack(); # with the intention of # $a == { type => 'light', damage => '1', defmod => { block => '0', dodge => '0' } }