line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Pokemon::Go::Relation::Single; |
2
|
7
|
|
|
7
|
|
3640
|
use 5.008001; |
|
7
|
|
|
|
|
26
|
|
3
|
7
|
|
|
7
|
|
42
|
use Carp; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
469
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
41
|
use Moose; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
50
|
|
6
|
7
|
|
|
7
|
|
46192
|
use Moose::Util::TypeConstraints; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
63
|
|
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
|
|
15916
|
no Moose; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
33
|
|
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
|
46481
|
|
|
46481
|
0
|
72524
|
my $self = shift; |
28
|
46481
|
|
|
|
|
1049218
|
my $type = $self->types()->[0]; |
29
|
46481
|
|
|
|
|
78011
|
my $data = $relations->{$type}; |
30
|
46481
|
50
|
|
|
|
84688
|
return @{ $data->{effective} || [] } if $data->{effective}; |
|
46481
|
50
|
|
|
|
154932
|
|
31
|
0
|
|
|
|
|
0
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub invalid { |
35
|
196442
|
|
|
196442
|
0
|
296620
|
my $self = shift; |
36
|
196442
|
|
|
|
|
4292276
|
my $type = $self->types()->[0]; |
37
|
196442
|
|
|
|
|
300892
|
my $data = $relations->{$type}; |
38
|
196442
|
50
|
|
|
|
218108
|
my @list = @{ $data->{invalid} || [] }; |
|
196442
|
|
|
|
|
489008
|
|
39
|
196442
|
50
|
|
|
|
339606
|
unshift @list, @{ $data->{void} } if $data->{void}; |
|
0
|
|
|
|
|
0
|
|
40
|
196442
|
50
|
|
|
|
555255
|
return @list if @list; |
41
|
0
|
|
|
|
|
0
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub advantage { |
45
|
51901
|
|
|
51901
|
0
|
86932
|
my $self = shift; |
46
|
51901
|
|
|
|
|
1149530
|
my $type = $self->types()->[0]; |
47
|
51901
|
|
|
|
|
85525
|
my $data = $ref_advantage->{$type}; |
48
|
51901
|
50
|
|
|
|
61874
|
my @list = @{ $data->{invalid} || [] }; |
|
51901
|
|
|
|
|
135332
|
|
49
|
51901
|
100
|
|
|
|
67987
|
unshift @list, @{ $data->{void} || [] }; |
|
51901
|
|
|
|
|
146133
|
|
50
|
51901
|
|
|
|
|
73396
|
my $i = 0; |
51
|
51901
|
|
|
|
|
71400
|
foreach my $value (@list) { |
52
|
168614
|
|
|
|
|
271408
|
foreach my $type ( $self->invalid() ){ |
53
|
640723
|
100
|
|
|
|
1000646
|
splice @list, $i, 1 if $type eq $value; |
54
|
|
|
|
|
|
|
} |
55
|
168614
|
|
|
|
|
241126
|
$i++; |
56
|
|
|
|
|
|
|
} |
57
|
51901
|
|
|
|
|
128591
|
return @list; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub disadvantage { |
61
|
51884
|
|
|
51884
|
0
|
69998
|
my $self = shift; |
62
|
51884
|
|
|
|
|
1130664
|
my $type = $self->types()->[0]; |
63
|
51884
|
|
|
|
|
81130
|
my $data = $ref_advantage->{$type}; |
64
|
51884
|
100
|
|
|
|
55904
|
return @{ $data->{effective} || [] }; |
|
51884
|
|
|
|
|
160475
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub recommended { |
68
|
748
|
|
|
748
|
0
|
6293
|
my $self = shift; |
69
|
748
|
|
|
|
|
1362
|
my @recommended = (); |
70
|
748
|
|
|
|
|
1906
|
foreach my $type1 ( $self->effective() ){ |
71
|
1910
|
|
|
|
|
5063
|
foreach my $type2 ( $self->advantage() ){ |
72
|
6532
|
100
|
33
|
|
|
24403
|
push @recommended, $type1 if $type1 && $type2 and $type1 eq $type2; |
|
|
|
66
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
748
|
100
|
|
|
|
4015
|
return @recommended if @recommended; |
76
|
|
|
|
|
|
|
|
77
|
118
|
|
|
|
|
357
|
@recommended = $self->effective(), $self->advantage(); |
78
|
118
|
|
|
|
|
375
|
for( my $i = 0; $i <= @recommended; $i++ ) { |
79
|
236
|
100
|
|
|
|
623
|
next unless $recommended[$i]; |
80
|
118
|
|
|
|
|
304
|
foreach my $type ( $self->disadvantage() ) { |
81
|
0
|
0
|
|
|
|
0
|
splice @recommended, $i, 1 if $type eq $recommended[$i]; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
118
|
|
|
|
|
612
|
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
|
|
|
|
|
|
|
|