line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1091
|
use 5.16.0; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
77
|
|
2
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
87
|
|
3
|
|
|
|
|
|
|
package Games::Nintendo::Mario::NSMB 0.208; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
742
|
use parent qw(Games::Nintendo::Mario); |
|
2
|
|
|
|
|
288
|
|
|
2
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
76
|
use Carp (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1025
|
|
8
|
|
|
|
|
|
|
|
9
|
10
|
|
|
10
|
|
31
|
sub _names { qw[Mario Luigi] } |
10
|
10
|
|
|
10
|
|
34
|
sub _states { qw[normal super fire shell mini mega] } |
11
|
0
|
|
|
0
|
|
0
|
sub _items { qw[mushroom flower shell mega_mushroom mini_mushroom] } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my %__default_behavior = ( |
14
|
|
|
|
|
|
|
damage => 'dead', |
15
|
|
|
|
|
|
|
mushroom => 'super', |
16
|
|
|
|
|
|
|
flower => 'fire', |
17
|
|
|
|
|
|
|
shell => 'shell', |
18
|
|
|
|
|
|
|
mega_mushroom => 'mega', |
19
|
|
|
|
|
|
|
mini_mushroom => 'mini', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %state = ( |
23
|
|
|
|
|
|
|
normal => { %__default_behavior }, |
24
|
|
|
|
|
|
|
super => { |
25
|
|
|
|
|
|
|
%__default_behavior, |
26
|
|
|
|
|
|
|
damage => 'normal', |
27
|
|
|
|
|
|
|
mushroom => 'save', |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
fire => { |
30
|
|
|
|
|
|
|
%__default_behavior, |
31
|
|
|
|
|
|
|
damage => 'normal', |
32
|
|
|
|
|
|
|
flower => 'save', |
33
|
|
|
|
|
|
|
mushroom => 'save', |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
shell => { |
36
|
|
|
|
|
|
|
%__default_behavior, |
37
|
|
|
|
|
|
|
damage => 'super', |
38
|
|
|
|
|
|
|
mushroom => 'save', |
39
|
|
|
|
|
|
|
flower => 'save', |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
mega => { map { $_ => 'ignore' } keys %__default_behavior }, |
42
|
|
|
|
|
|
|
mini => { %__default_behavior, mini => 'save' }, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub games { |
46
|
0
|
|
|
0
|
1
|
0
|
return ('New Super Mario Bros.'); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _set_state { |
50
|
20
|
|
|
20
|
|
33
|
my ($self, $state, $item) = @_; |
51
|
|
|
|
|
|
|
|
52
|
20
|
100
|
|
|
|
40
|
if ($state eq 'save') { |
53
|
6
|
|
|
|
|
13
|
$self->{saved_item} = $item; |
54
|
|
|
|
|
|
|
} else { |
55
|
14
|
|
|
|
|
26
|
$self->{state} = $state; |
56
|
|
|
|
|
|
|
} |
57
|
20
|
|
|
|
|
87
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub powerup { |
61
|
20
|
|
|
20
|
1
|
30
|
my ($self, $item) = @_; |
62
|
|
|
|
|
|
|
|
63
|
20
|
|
|
|
|
54
|
my $state = $self->state; |
64
|
20
|
50
|
|
|
|
727
|
Carp::confess "current state unknown" |
65
|
|
|
|
|
|
|
unless my $state_info = $state{ $state }; |
66
|
|
|
|
|
|
|
|
67
|
20
|
50
|
|
|
|
54
|
Carp::confess "behavior for $item in $state unknown" |
68
|
|
|
|
|
|
|
unless my $new_state = $state_info->{$item}; |
69
|
20
|
|
|
|
|
50
|
$self->_set_state($new_state, $item); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub damage { |
73
|
6
|
|
|
6
|
1
|
12
|
my ($self) = @_; |
74
|
6
|
|
|
|
|
19
|
$self->powerup('damage'); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
"Go Wigi!"; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |