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');