File Coverage

blib/lib/Traveller/System/Classic/MPTS.pm
Criterion Covered Total %
statement 3 21 14.2
branch 0 30 0.0
condition 0 63 0.0
subroutine 1 2 50.0
pod 0 1 0.0
total 4 117 3.4


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2             # Copyright (C) 2009-2021 Alex Schroeder
3             # Copyright (C) 2020 Christian Carey
4             #
5             # This program is free software: you can redistribute it and/or modify it under
6             # the terms of the GNU General Public License as published by the Free Software
7             # Foundation, either version 3 of the License, or (at your option) any later
8             # version.
9             #
10             # This program is distributed in the hope that it will be useful, but WITHOUT
11             # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12             # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13             #
14             # You should have received a copy of the GNU General Public License along with
15             # this program. If not, see .
16              
17             package Traveller::System::Classic::MPTS;
18 2     2   531 use Mojo::Base 'Traveller::System::Classic';
  2         203736  
  2         21  
19              
20             sub compute_tradecodes {
21 0     0 0   my $self = shift;
22 0           my $tradecodes = '';
23 0 0 0       $tradecodes .= ' Ag' if $self->atmosphere >= 4 and $self->atmosphere <= 9
      0        
      0        
      0        
      0        
24             and $self->hydro >= 4 and $self->hydro <= 8
25             and $self->population >= 5 and $self->population <= 7;
26 0 0 0       $tradecodes .= ' As' if $self->size == 0
      0        
27             and $self->atmosphere == 0
28             and $self->hydro == 0;
29 0 0 0       $tradecodes .= ' Ba' if $self->population == 0
      0        
30             and $self->government == 0
31             and $self->law == 0;
32 0 0 0       $tradecodes .= ' De' if $self->atmosphere >= 2 and $self->hydro == 0;
33 0 0 0       $tradecodes .= ' Fl' if $self->atmosphere =~ /^[ABC]$/ # erratum
34             and $self->hydro >= 1;
35 0 0         $tradecodes .= ' Hi' if $self->population >= 9;
36 0 0 0       $tradecodes .= ' Ic' if $self->atmosphere <= 1 and $self->hydro >= 1;
37 0 0 0       $tradecodes .= ' In' if $self->atmosphere =~ /^[012479]$/ and $self->population >= 9;
38 0 0         $tradecodes .= ' Lo' if $self->population <= 3;
39 0 0 0       $tradecodes .= ' Na' if $self->atmosphere <= 3 and $self->hydro <= 3
      0        
40             and $self->population >= 6;
41 0 0         $tradecodes .= ' Ni' if $self->population <= 6;
42 0 0 0       $tradecodes .= ' Po' if $self->atmosphere >= 2 and $self->atmosphere <= 5
      0        
43             and $self->hydro <= 3;
44 0 0 0       $tradecodes .= ' Ri' if $self->atmosphere =~ /^[68]$/
      0        
      0        
      0        
45             and $self->population >= 6 and $self->population <= 8
46             and $self->government >= 4 and $self->government <= 9;
47 0 0         $tradecodes .= ' Va' if $self->atmosphere == 0;
48 0 0         $tradecodes .= ' Wa' if $self->hydro == 10;
49 0           return $tradecodes;
50             }
51              
52             1;