Robert Eaglestone > Games-Traveller-Animals-0.50 > Games::Traveller::Animals

Download:
Games-Traveller-Animals-0.50.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.50   Source  

NAME ^

   Games::Traveller::Animals -- the Traveller Animal Encounter matrix

SYNOPSIS ^

   use Games::Traveller::UWP;
   use Games::Traveller::Animals;
   use Games::Traveller::Animals::AnimalEncounter;
   
   my $uwp1 = new Games::Traveller::UWP;

   $uwp1->readUwp( 'Reference 0140 A887887-A B Ri Cp      323 Im K7 V' );

   my $at = new Games::Traveller::Animals;

   #
   #   Given a world's physical data, generate an animal table.
   #
   $at->generateAnimalTable( $uwp1->size, $uwp1->atmosphere, $uwp1->hydrosphere );
   
   #
   #   Fetch the list of terrain types.
   #
   print $at->terrainTypes, "\n";

   #
   #   Dump the encounter tables in ASCII.
   #
   print $at->toString();
   
   #
   #   Access the data individually.
   #
   my @terrainTypes = $at->terrainTypes;
   
   foreach my $terrain (@terrainTypes)
   {
      print "$terrain\n";
      my @encounterTable = @{$at->terrainTables->{$terrain}};
      
      foreach my $encounter (@encounterTable)
      {
         #
         #  $encounter is of type Games::Traveller::Animals::AnimalEncounter,
         #  which has a bunch of convenient accessors in it.
         #
         printf ("%2d%2s %-14s %4s %3.3s/%-2.2s %9.9s %3.3s %-7s %s\n", 
                 $self->index,
                 $self->attribute || '',
                 $self->category, 
                 $self->mass,
                 $self->hits,
                 $self->dead,
                 $self->weapon,
                 $self->damageMod,
                 $self->armor,
                 $self->behaviour);

      }
   }

AUTHOR ^

  Pasuuli Immuguna

COPYRIGHT ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AVAILABILITY ^

The latest version of this library is likely to be available from CPAN.

syntax highlighting: