69 lines
1.4 KiB
Perl
69 lines
1.4 KiB
Perl
package LasTres::Race;
|
|
|
|
use v5.36.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use feature 'signatures';
|
|
|
|
use Moo::Role;
|
|
|
|
requires
|
|
qw/spawn identifier name name_selection description is_playable base_stats experience_drop_base/;
|
|
## IMPLEMENTORS MUST IMPLEMENT
|
|
#
|
|
# sub spawn($self);
|
|
#
|
|
# Must return a LasTres::Location or
|
|
# undef, only needed for PJ races.
|
|
#
|
|
# sub identifier($self);
|
|
#
|
|
# Must return a unique string across
|
|
# races.
|
|
#
|
|
# sub name($self);
|
|
#
|
|
# Must return a string.
|
|
#
|
|
# sub name_selection($self);
|
|
#
|
|
# Must return an string, can be an empty one,
|
|
# this is the name shown in the pj creation,
|
|
# so it is unneeded in non pj races, but not
|
|
# implementing it will result in a error.
|
|
#
|
|
# sub description($self);
|
|
#
|
|
# A string must be returned.
|
|
#
|
|
# sub is_playable($self);
|
|
#
|
|
# If true value a pj can be created of this
|
|
# race, otherwise you cannot create
|
|
# a PJ of this race.
|
|
#
|
|
# sub base_stats($self);
|
|
#
|
|
# A LasTres::Stats object must be
|
|
# returned.
|
|
#
|
|
# sub experience_drop_base($self);
|
|
#
|
|
# A number greater than 0 must be returned.
|
|
# Otherwise you will trigger undefined
|
|
# behavior.
|
|
|
|
## DO NOT EXTEND NOT SUPPORTED.
|
|
sub hash ($self) {
|
|
return {
|
|
identifier => $self->identifier,
|
|
name => $self->name,
|
|
name_selection => $self->name_selection,
|
|
description => $self->description,
|
|
is_playable => !!$self->is_playable,
|
|
};
|
|
}
|
|
1;
|