line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Pokemon::Go::Relation::Single; |
2
|
7
|
|
|
7
|
|
3664
|
use 5.008001; |
|
7
|
|
|
|
|
25
|
|
3
|
7
|
|
|
7
|
|
39
|
use Carp; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
418
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
39
|
use Moose; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
44
|
|
6
|
7
|
|
|
7
|
|
44330
|
use Moose::Util::TypeConstraints; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
57
|
|
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
|
|
15821
|
no Moose; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
29
|
|
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
|
46502
|
|
|
46502
|
0
|
68043
|
my $self = shift; |
28
|
46502
|
|
|
|
|
1014057
|
my $type = $self->types()->[0]; |
29
|
46502
|
|
|
|
|
74471
|
my $data = $relations->{$type}; |
30
|
46502
|
50
|
|
|
|
81271
|
return @{ $data->{effective} || [] } if $data->{effective}; |
|
46502
|
50
|
|
|
|
145365
|
|
31
|
0
|
|
|
|
|
0
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub invalid { |
35
|
196515
|
|
|
196515
|
0
|
277598
|
my $self = shift; |
36
|
196515
|
|
|
|
|
4144429
|
my $type = $self->types()->[0]; |
37
|
196515
|
|
|
|
|
282280
|
my $data = $relations->{$type}; |
38
|
196515
|
50
|
|
|
|
204248
|
my @list = @{ $data->{invalid} || [] }; |
|
196515
|
|
|
|
|
453918
|
|
39
|
196515
|
50
|
|
|
|
318230
|
unshift @list, @{ $data->{void} } if $data->{void}; |
|
0
|
|
|
|
|
0
|
|
40
|
196515
|
50
|
|
|
|
542056
|
return @list if @list; |
41
|
0
|
|
|
|
|
0
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub advantage { |
45
|
51924
|
|
|
51924
|
0
|
77776
|
my $self = shift; |
46
|
51924
|
|
|
|
|
1109713
|
my $type = $self->types()->[0]; |
47
|
51924
|
|
|
|
|
78298
|
my $data = $ref_advantage->{$type}; |
48
|
51924
|
50
|
|
|
|
55241
|
my @list = @{ $data->{invalid} || [] }; |
|
51924
|
|
|
|
|
125603
|
|
49
|
51924
|
100
|
|
|
|
66762
|
unshift @list, @{ $data->{void} || [] }; |
|
51924
|
|
|
|
|
138940
|
|
50
|
51924
|
|
|
|
|
68660
|
my $i = 0; |
51
|
51924
|
|
|
|
|
69274
|
foreach my $value (@list) { |
52
|
168681
|
|
|
|
|
252984
|
foreach my $type ( $self->invalid() ){ |
53
|
640982
|
100
|
|
|
|
987896
|
splice @list, $i, 1 if $type eq $value; |
54
|
|
|
|
|
|
|
} |
55
|
168681
|
|
|
|
|
237411
|
$i++; |
56
|
|
|
|
|
|
|
} |
57
|
51924
|
|
|
|
|
119820
|
return @list; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub disadvantage { |
61
|
51898
|
|
|
51898
|
0
|
66000
|
my $self = shift; |
62
|
51898
|
|
|
|
|
1096795
|
my $type = $self->types()->[0]; |
63
|
51898
|
|
|
|
|
75897
|
my $data = $ref_advantage->{$type}; |
64
|
51898
|
100
|
|
|
|
55852
|
return @{ $data->{effective} || [] }; |
|
51898
|
|
|
|
|
153466
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub recommended { |
68
|
752
|
|
|
752
|
0
|
6270
|
my $self = shift; |
69
|
752
|
|
|
|
|
1157
|
my @recommended = (); |
70
|
752
|
|
|
|
|
1732
|
foreach my $type1 ( $self->effective() ){ |
71
|
1922
|
|
|
|
|
4573
|
foreach my $type2 ( $self->advantage() ){ |
72
|
6568
|
100
|
33
|
|
|
23577
|
push @recommended, $type1 if $type1 && $type2 and $type1 eq $type2; |
|
|
|
66
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
752
|
100
|
|
|
|
3842
|
return @recommended if @recommended; |
76
|
|
|
|
|
|
|
|
77
|
118
|
|
|
|
|
328
|
@recommended = $self->effective(), $self->advantage(); |
78
|
118
|
|
|
|
|
340
|
for( my $i = 0; $i <= @recommended; $i++ ) { |
79
|
236
|
100
|
|
|
|
577
|
next unless $recommended[$i]; |
80
|
118
|
|
|
|
|
279
|
foreach my $type ( $self->disadvantage() ) { |
81
|
0
|
0
|
|
|
|
0
|
splice @recommended, $i, 1 if $type eq $recommended[$i]; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
118
|
|
|
|
|
637
|
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
|
|
|
|
|
|
|
|