| 1 | 2 | ▶ | use 5.16.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package Games::Nintendo::Mario::SMB2 0.208; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use base qw(Games::Nintendo::Mario::Hearts); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | sub _names { qw[Mario Luigi Peach Toad] } | ||||||||||||||||||||||||||
|
Subroutine
_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | sub _states { qw[normal] } # super isn't listed to prevent creation-as-super | ||||||||||||||||||||||||||
|
Subroutine
_states: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 4 | ▶ | sub _items { qw[mushroom heart] } | ||||||||||||||||||||||||||
|
Subroutine
_items: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 6 | ▶ | sub _goto_hash { {} } | ||||||||||||||||||||||||||
|
Subroutine
_goto_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | sub _char_attr { | ||||||||||||||||||||||||||||
| 14 | { | ||||||||||||||||||||||||||||
| 15 | 0 | ▶ | Mario => { | ||||||||||||||||||||||||||
|
Subroutine
_char_attr: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 16 | power => 4, | ||||||||||||||||||||||||||||
| 17 | speed => 4, | ||||||||||||||||||||||||||||
| 18 | jump => 4 | ||||||||||||||||||||||||||||
| 19 | }, | ||||||||||||||||||||||||||||
| 20 | Luigi => { | ||||||||||||||||||||||||||||
| 21 | power => 3, | ||||||||||||||||||||||||||||
| 22 | speed => 3, | ||||||||||||||||||||||||||||
| 23 | jump => 5 | ||||||||||||||||||||||||||||
| 24 | }, | ||||||||||||||||||||||||||||
| 25 | Peach => { | ||||||||||||||||||||||||||||
| 26 | power => 2, | ||||||||||||||||||||||||||||
| 27 | speed => 2, | ||||||||||||||||||||||||||||
| 28 | jump => 3 | ||||||||||||||||||||||||||||
| 29 | }, | ||||||||||||||||||||||||||||
| 30 | Toad => { | ||||||||||||||||||||||||||||
| 31 | power => 5, | ||||||||||||||||||||||||||||
| 32 | speed => 5, | ||||||||||||||||||||||||||||
| 33 | jump => 2 | ||||||||||||||||||||||||||||
| 34 | } } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub state { ## no critic Homonym | ||||||||||||||||||||||||||||
| 38 | 13 | ▶ | my $hero = shift; | ||||||||||||||||||||||||||
|
Subroutine
state: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 13 | ▶ | if ($hero->hearts < 1) { return "dead" } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 11 | ▶ | if ($hero->hearts > 1) { return "super" } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 8 | else { return "normal" } | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | ▶ | sub name { $_[0]->{name} } | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | sub powerup { | ||||||||||||||||||||||||||||
| 47 | 4 | ▶ | my $hero = shift; | ||||||||||||||||||||||||||
|
Subroutine
powerup: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 4 | my $item = shift; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 4 | ▶ | if (($item eq 'mushroom') and ($hero->max_hearts < 5)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$item eq "mushroom" and $hero->max_hearts < 5
MC/DC100%2/2
$item eq "mushroom" and $hero->max_hearts < 5
$item eq "mushroom"
$hero->max_hearts < 5
Truth table100%3/3
A and B
A= $item eq "mushroom"B= $hero->max_hearts < 5
| |||||||||||||||||||||||||||||
| 51 | 2 | $hero->{max_hearts}++; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 4 | $hero->SUPER::powerup($item); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub power { $_[0]->_char_attr->{$_[0]->name}->{power} } | ||||||||||||||||||||||||||
|
Subroutine
power: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub speed { $_[0]->_char_attr->{$_[0]->name}->{speed} } | ||||||||||||||||||||||||||
|
Subroutine
speed: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub jump { $_[0]->_char_attr->{$_[0]->name}->{jump} } | ||||||||||||||||||||||||||
|
Subroutine
jump: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub games { | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | return ('Super Mario Bros. 2'); | ||||||||||||||||||||||||||
|
Subroutine
games: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 2 | "It's-a me! Mario!"; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||