line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
524
|
use 5.16.0; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
74
|
|
2
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
97
|
|
3
|
|
|
|
|
|
|
package Games::Nintendo::Mario::Hearts 0.208; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1590
|
use parent qw(Games::Nintendo::Mario); |
|
2
|
|
|
|
|
625
|
|
|
2
|
|
|
|
|
10
|
|
6
|
2
|
|
|
2
|
|
1825
|
use Hash::Util::FieldHash qw(fieldhash); |
|
2
|
|
|
|
|
2109
|
|
|
2
|
|
|
|
|
671
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
sub _states { qw[normal] } |
9
|
1
|
|
|
1
|
|
18
|
sub _items { qw[heart] } |
10
|
3
|
|
|
3
|
|
13
|
sub _other_defaults { ( max_hearts => 3 ) } |
11
|
3
|
|
|
3
|
|
13
|
sub __default_hearts { 1 }; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
5
|
sub _goto_hash { {} } # not used by base Hearts class |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub max_hearts { |
16
|
10
|
|
|
10
|
1
|
47
|
return $_[0]->{max_hearts} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
fieldhash my %hearts; |
20
|
|
|
|
|
|
|
sub hearts { |
21
|
41
|
|
|
41
|
1
|
43
|
my ($self) = @_; |
22
|
41
|
|
66
|
|
|
155
|
$hearts{ $self } //= $self->__default_hearts; |
23
|
41
|
|
|
|
|
141
|
return $hearts{ $self }; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub powerup { |
27
|
5
|
|
|
5
|
1
|
7
|
my $plumber = shift; |
28
|
5
|
|
|
|
|
7
|
my $item = shift; |
29
|
|
|
|
|
|
|
|
30
|
5
|
50
|
66
|
|
|
18
|
if (($item eq 'heart') and ($plumber->hearts) and ($plumber->hearts < $plumber->max_hearts)) { |
|
|
|
66
|
|
|
|
|
31
|
2
|
|
|
|
|
6
|
$hearts{ $plumber }++; |
32
|
|
|
|
|
|
|
} |
33
|
5
|
|
|
|
|
24
|
$plumber->SUPER::powerup($item); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub damage { |
37
|
4
|
|
|
4
|
1
|
7
|
my $self = shift; |
38
|
4
|
|
|
|
|
6
|
my $item = shift; |
39
|
|
|
|
|
|
|
|
40
|
4
|
50
|
|
|
|
8
|
if ($self->hearts) { |
41
|
4
|
100
|
|
|
|
15
|
$self->{state} = 'dead' unless --$hearts{ $self }; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
21
|
$self->SUPER::damage; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub games { |
48
|
0
|
|
|
0
|
1
|
|
return (); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
"It's-a me! Mario!"; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |