| 1 | 4 | ▶ | use 5.16.0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | package Games::Nintendo::Mario::Hearts 0.208; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use parent qw(Games::Nintendo::Mario); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Hash::Util::FieldHash qw(fieldhash); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | sub _states { qw[normal] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_states: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | sub _items { qw[heart] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_items: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | sub _other_defaults { ( max_hearts => 3 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_other_defaults: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | sub __default_hearts { 1 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__default_hearts: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | sub _goto_hash { {} } # not used by base Hearts class | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_goto_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | sub max_hearts { | ||||||||||||||||||||||||||||||||||||||||||
| 16 | return $_[0]->{max_hearts} | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_hearts: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | fieldhash my %hearts; | |||||||||||||||||||||||||||||||||||||||||
| 20 | sub hearts { | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 41 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hearts: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 41 | ▶ | $hearts{ $self } //= $self->__default_hearts; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$hearts{$self} //= $self->__default_hearts
MC/DC0%0/2
$hearts{$self} //= $self->__default_hearts
$hearts{$self}
$self->__default_hearts
Truth table66%2/3
A //= B
A= $hearts{$self}B= $self->__default_hearts
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 41 | return $hearts{ $self }; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | sub powerup { | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | my $plumber = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
powerup: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | my $item = shift; | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | if (($item eq 'heart') and ($plumber->hearts) and ($plumber->hearts < $plumber->max_hearts)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$item eq "heart" and $plumber->hearts and $plumber->hearts < $plumber->max_hearts
$item eq "heart" and $plumber->hearts
MC/DC33%1/3
$item eq "heart" and $plumber->hearts and $plumber->hearts < $plumber->max_hearts
$item eq "heart"
$plumber->hearts
$plumber->hearts < $plumber->max_hearts
Truth table50%2/4
A and B and C
A= $item eq "heart"B= $plumber->heartsC= $plumber->hearts < $plumber->max_hearts
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | $hearts{ $plumber }++; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | $plumber->SUPER::powerup($item); | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | sub damage { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
damage: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | my $item = shift; | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | ▶ | if ($self->hearts) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | $self->{state} = 'dead' unless --$hearts{ $self }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | $self->SUPER::damage; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | sub games { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | return (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
games: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 4 | "It's-a me! Mario!"; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||||||||||||||||