| 1 | package RPG::Traveller::Starmap::StarGroup; | ||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use RPG::Traveller::Starmap::Constants qw/ :sgnature /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use RPG::Traveller::Starmap::Star::Primary; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | ▶ | use RPG::Traveller::Starmap::Star::Companion; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use RPG::Dice; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 4 | has nature => ( is => "rw", isa => "Int" ); | |||||||||
| 11 | 4 | has primaryStar => | |||||||||
| 12 | ( is => "rw", isa => "RPG::Traveller::Starmap::Star::Primary" ); | ||||||||||
| 13 | 4 | has companions => ( is => "rw", isa => "ArrayRef" ); | |||||||||
| 14 | |||||||||||
| 15 | # ABSTRACT: Blah...blah...blah.. tell the author to put something here... | ||||||||||
| 16 | |||||||||||
| 17 | 4 | my @natTable = (); | |||||||||
| 18 | 4 | $natTable[$_] = undef foreach ( 0 .. 1 ); | |||||||||
| 19 | 4 | $natTable[$_] = SOLO foreach ( 2 .. 7 ); | |||||||||
| 20 | 4 | $natTable[$_] = BINARY foreach ( 8 .. 11 ); | |||||||||
| 21 | 4 | $natTable[12] = TRINARY; | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub generate { | ||||||||
|
Subroutine
generate: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 24 | 0 | my $self = shift; | |||||||||
| 25 | |||||||||||
| 26 | 0 | my $d = new RPG::Dice('2d6'); | |||||||||
| 27 | 0 | my $nat = $natTable[ $d->roll() ]; | |||||||||
| 28 | |||||||||||
| 29 | 0 | $self->nature($nat); | |||||||||
| 30 | |||||||||||
| 31 | 0 | my @companions = (); | |||||||||
| 32 | 0 | foreach my $i ( 1 .. $nat ) { | |||||||||
| 33 | 0 | ▶ | if ( $nat > SOLO ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | $companions[ $i - 2 ] = new RPG::Traveller::Star::Companion(); | |||||||||
| 35 | } | ||||||||||
| 36 | else { | ||||||||||
| 37 | 0 | $self->primaryStar( new RPG::Traveller::Star::Primary() ); | |||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | 0 | $self->primaryStar->generate(); | |||||||||
| 41 | 0 | ▶ | if ( $nat > SOLO ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | foreach my $i ( 0 .. $#companions ) { | |||||||||
| 43 | 0 | $companions[$i]->generate( $self->primaryStar() ); | |||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 4 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||