line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Pokemon::Go::Relation::Single; |
2
|
7
|
|
|
7
|
|
2927
|
use 5.008001; |
|
7
|
|
|
|
|
20
|
|
3
|
7
|
|
|
7
|
|
31
|
use Carp; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
353
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
32
|
use Moose; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
39
|
|
6
|
7
|
|
|
7
|
|
36448
|
use Moose::Util::TypeConstraints; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Data::Pokemon::Go::Role::Types'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# accessor methods ======================================================== |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
subtype 'Types' => as 'ArrayRef[Type]'; |
13
|
|
|
|
|
|
|
coerce 'Types' |
14
|
|
|
|
|
|
|
=> from 'Type' |
15
|
|
|
|
|
|
|
=> via {[$_]}; |
16
|
|
|
|
|
|
|
has types => ( is => 'ro', isa => 'Types', coerce => 1, required => 1 ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
19
|
7
|
|
|
7
|
|
13124
|
no Moose; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
26
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $relations = $Data::Pokemon::Go::Role::Types::Relations; |
22
|
|
|
|
|
|
|
my $ref_advantage = $Data::Pokemon::Go::Role::Types::Ref_Advantage; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# subroutine ============================================================== |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub effective { |
27
|
46520
|
|
|
46520
|
0
|
58539
|
my $self = shift; |
28
|
46520
|
|
|
|
|
859220
|
my $type = $self->types()->[0]; |
29
|
46520
|
|
|
|
|
60087
|
my $data = $relations->{$type}; |
30
|
46520
|
50
|
|
|
|
68467
|
return @{ $data->{effective} || [] } if $data->{effective}; |
|
46520
|
50
|
|
|
|
124497
|
|
31
|
0
|
|
|
|
|
0
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub invalid { |
35
|
196542
|
|
|
196542
|
0
|
234616
|
my $self = shift; |
36
|
196542
|
|
|
|
|
3530092
|
my $type = $self->types()->[0]; |
37
|
196542
|
|
|
|
|
231014
|
my $data = $relations->{$type}; |
38
|
196542
|
50
|
|
|
|
174176
|
my @list = @{ $data->{invalid} || [] }; |
|
196542
|
|
|
|
|
379337
|
|
39
|
196542
|
50
|
|
|
|
273947
|
unshift @list, @{ $data->{void} } if $data->{void}; |
|
0
|
|
|
|
|
0
|
|
40
|
196542
|
50
|
|
|
|
458926
|
return @list if @list; |
41
|
0
|
|
|
|
|
0
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub advantage { |
45
|
51921
|
|
|
51921
|
0
|
67540
|
my $self = shift; |
46
|
51921
|
|
|
|
|
944500
|
my $type = $self->types()->[0]; |
47
|
51921
|
|
|
|
|
63882
|
my $data = $ref_advantage->{$type}; |
48
|
51921
|
50
|
|
|
|
47648
|
my @list = @{ $data->{invalid} || [] }; |
|
51921
|
|
|
|
|
108149
|
|
49
|
51921
|
100
|
|
|
|
54667
|
unshift @list, @{ $data->{void} || [] }; |
|
51921
|
|
|
|
|
116196
|
|
50
|
51921
|
|
|
|
|
56991
|
my $i = 0; |
51
|
51921
|
|
|
|
|
61545
|
foreach my $value (@list) { |
52
|
168705
|
|
|
|
|
218450
|
foreach my $type ( $self->invalid() ){ |
53
|
640991
|
100
|
|
|
|
844353
|
splice @list, $i, 1 if $type eq $value; |
54
|
|
|
|
|
|
|
} |
55
|
168705
|
|
|
|
|
199632
|
$i++; |
56
|
|
|
|
|
|
|
} |
57
|
51921
|
|
|
|
|
101402
|
return @list; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub disadvantage { |
61
|
51913
|
|
|
51913
|
0
|
54305
|
my $self = shift; |
62
|
51913
|
|
|
|
|
926843
|
my $type = $self->types()->[0]; |
63
|
51913
|
|
|
|
|
64275
|
my $data = $ref_advantage->{$type}; |
64
|
51913
|
100
|
|
|
|
44879
|
return @{ $data->{effective} || [] }; |
|
51913
|
|
|
|
|
127614
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub recommended { |
68
|
746
|
|
|
746
|
0
|
5167
|
my $self = shift; |
69
|
746
|
|
|
|
|
1148
|
my @recommended = (); |
70
|
746
|
|
|
|
|
1431
|
foreach my $type1 ( $self->effective() ){ |
71
|
1906
|
|
|
|
|
3646
|
foreach my $type2 ( $self->advantage() ){ |
72
|
6524
|
100
|
33
|
|
|
19968
|
push @recommended, $type1 if $type1 && $type2 and $type1 eq $type2; |
|
|
|
66
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
746
|
100
|
|
|
|
3216
|
return @recommended if @recommended; |
76
|
|
|
|
|
|
|
|
77
|
118
|
|
|
|
|
297
|
@recommended = $self->effective(), $self->advantage(); |
78
|
118
|
|
|
|
|
301
|
for( my $i = 0; $i <= @recommended; $i++ ) { |
79
|
236
|
100
|
|
|
|
511
|
next unless $recommended[$i]; |
80
|
118
|
|
|
|
|
220
|
foreach my $type ( $self->disadvantage() ) { |
81
|
0
|
0
|
|
|
|
0
|
splice @recommended, $i, 1 if $type eq $recommended[$i]; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
118
|
|
|
|
|
534
|
return @recommended; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
__END__ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=encoding utf-8 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 NAME |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Data::Pokemon::Go::Relation::Single - It's new $module |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SYNOPSIS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
use Data::Pokemon::Go::Relation::Single; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 DESCRIPTION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Data::Pokemon::Go::Relation::Single is ... |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Copyright (C) Yuki Yoshida. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
109
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Yuki Yoshida E<lt>worthmine@gmail.comE<gt> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|