| 1 | package RPG::Traveller::Person; | ||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use RPG::Dice; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use RPG::Traveller::Person::Constants qw/ :all /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | our $VERSION = "1.011"; | |
| 7 | |||
| 8 | # ------------------------------------------------------------------------- | ||
| 9 | #The Traveller game in all forms is owned by Far Future Enterprises. | ||
| 10 | #Copyright 1977 - 2008 Far Future Enterprises. Traveller is a registered | ||
| 11 | #trademark of Far Future Enterprises. The contents of this code is for personal, | ||
| 12 | #non-commercial use only. Any use of Far Future Enterprise's copyrighted | ||
| 13 | #material or trademarks anywhere in this code and its resources should not be | ||
| 14 | #viewed as a challenge to those copyrights or trademarks. For the full FAIR | ||
| 15 | #USE POLICY please refer to http://www.farfuture.net/FFEFairUsePolicy2008.pdf | ||
| 16 | # ------------------------------------------------------------------------- | ||
| 17 | |||
| 18 | # ABSTRACT: Base class for a family of (Mega)Traveller character generation modules | ||
| 19 | |||
| 20 | 2 | has 'strength' => ( is => "rw", isa => "Int" ); | |
| 21 | 2 | has 'dexterity' => ( is => "rw", isa => "Int" ); | |
| 22 | 2 | has 'endurance' => ( is => "rw", isa => "Int" ); | |
| 23 | 2 | has 'intelligence' => ( is => "rw", isa => "Int" ); | |
| 24 | 2 | has 'education' => ( is => "rw", isa => "Int" ); | |
| 25 | 2 | has 'social_standing' => ( is => "rw", isa => "Int" ); | |
| 26 | 2 | has 'age' => ( is => "rw", isa => "Int" ); | |
| 27 | 2 | has 'career' => ( is => "rw", isa => "Int" ); | |
| 28 | 2 | has 'skills' => ( is => "rw", isa => "HashRef" ); | |
| 29 | |||
| 30 | # | ||
| 31 | # This method will be moved to a utility module | ||
| 32 | |||
| 33 | 1 | ▶ | sub initUPP { |
|
Subroutine
initUPP: called CC=1 SCAR=0.0
Pod
documented
| |||
| 34 | 1 | my $self = shift; | |
| 35 | 1 | my $d2 = RPG::Dice->new('2d6'); | |
| 36 | 1 | $self->strength( $d2->roll() ); | |
| 37 | 1 | $self->dexterity( $d2->roll() ); | |
| 38 | 1 | $self->endurance( $d2->roll() ); | |
| 39 | 1 | $self->intelligence( $d2->roll() ); | |
| 40 | 1 | $self->education( $d2->roll() ); | |
| 41 | 1 | $self->social_standing( $d2->roll() ); | |
| 42 | 1 | $self->age(18); | |
| 43 | |||
| 44 | } | ||
| 45 | |||
| 46 | 2 | ▶ | sub upp2string { |
|
Subroutine
upp2string: called CC=1 SCAR=0.0
Pod
documented
| |||
| 47 | 2 | my $self = shift; | |
| 48 | |||
| 49 | 2 | return sprintf( | |
| 50 | "%s%s%s%s%s%s Age: %d", | ||
| 51 | int2alpha( $self->strength() ), | ||
| 52 | int2alpha( $self->dexterity() ), | ||
| 53 | int2alpha( $self->endurance() ), | ||
| 54 | int2alpha( $self->intelligence() ), | ||
| 55 | int2alpha( $self->education() ), | ||
| 56 | int2alpha( $self->social_standing() ), | ||
| 57 | $self->age() | ||
| 58 | ); | ||
| 59 | } | ||
| 60 | |||
| 61 | 1 | ▶ | sub toString { # This needs to be overloaded in subordinate modules |
|
Subroutine
toString: called CC=1 SCAR=0.0
Pod
documented
| |||
| 62 | 1 | my $self = shift; | |
| 63 | 1 | return $self->upp2string(); | |
| 64 | } | ||
| 65 | 2 | 1; | |
| 66 | |||
| 67 | __END__ | ||