line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BalanceOfPower::Player::Role::Hitman; |
2
|
|
|
|
|
|
|
$BalanceOfPower::Player::Role::Hitman::VERSION = '0.400115'; |
3
|
13
|
|
|
13
|
|
5585
|
use strict; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
366
|
|
4
|
13
|
|
|
13
|
|
127
|
use v5.10; |
|
13
|
|
|
|
|
36
|
|
5
|
13
|
|
|
13
|
|
51
|
use Moo::Role; |
|
13
|
|
|
|
|
19
|
|
|
13
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
3191
|
use BalanceOfPower::Constants ':all'; |
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
12575
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has targets => ( |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
default => sub { [] } |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
has mission_points => ( |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
default => 0 |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub no_targets |
22
|
|
|
|
|
|
|
{ |
23
|
10
|
|
|
10
|
0
|
16
|
my $self = shift; |
24
|
10
|
|
|
|
|
19
|
return @{$self->targets} <= 0; |
|
10
|
|
|
|
|
63
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
sub add_target |
27
|
|
|
|
|
|
|
{ |
28
|
3
|
|
|
3
|
0
|
8
|
my $self = shift; |
29
|
3
|
|
|
|
|
7
|
my $target = shift; |
30
|
3
|
|
|
|
|
7
|
push @{$self->targets}, $target; |
|
3
|
|
|
|
|
35
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
sub check_targets |
33
|
|
|
|
|
|
|
{ |
34
|
8
|
|
|
8
|
0
|
13
|
my $self = shift; |
35
|
8
|
|
|
|
|
12
|
my $world = shift; |
36
|
8
|
|
|
|
|
16
|
my @not_achieved = (); |
37
|
8
|
|
|
|
|
17
|
for( @{$self->targets}) |
|
8
|
|
|
|
|
21
|
|
38
|
|
|
|
|
|
|
{ |
39
|
8
|
|
|
|
|
11
|
my $t = $_; |
40
|
8
|
100
|
|
|
|
34
|
if($t->achieved($self)) |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
|
|
5
|
$self->point; |
43
|
1
|
|
|
|
|
5
|
$self->register_event("ACHIEVED TARGET: " . $t->name); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else |
46
|
|
|
|
|
|
|
{ |
47
|
7
|
|
|
|
|
34
|
push @not_achieved, $t; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
8
|
|
|
|
|
2125
|
$self->targets(\@not_achieved); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
sub click_targets |
53
|
|
|
|
|
|
|
{ |
54
|
8
|
|
|
8
|
0
|
11
|
my $self = shift; |
55
|
8
|
|
|
|
|
14
|
my $world = shift; |
56
|
8
|
|
|
|
|
13
|
my @not_passed = (); |
57
|
8
|
|
|
|
|
12
|
for( @{$self->targets}) |
|
8
|
|
|
|
|
27
|
|
58
|
|
|
|
|
|
|
{ |
59
|
7
|
|
|
|
|
11
|
my $t = $_; |
60
|
7
|
50
|
|
|
|
36
|
if($t->click) |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
0
|
$self->register_event("TIME EXPIRED FOR TARGET: " . $t->name); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else |
65
|
|
|
|
|
|
|
{ |
66
|
7
|
|
|
|
|
17
|
push @not_passed, $t; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
8
|
|
|
|
|
43
|
$self->targets(\@not_passed); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
sub point |
72
|
|
|
|
|
|
|
{ |
73
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
74
|
1
|
|
|
|
|
6
|
$self->mission_points($self->mission_points + 1); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
sub dump_targets |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
my $io = shift; |
80
|
0
|
|
|
|
|
|
my $indent = shift; |
81
|
0
|
|
|
|
|
|
for(@{$self->targets}) |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
|
$_->dump($io, $indent); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
sub load_targets |
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
89
|
0
|
|
|
|
|
|
my $extracted_data = shift; |
90
|
0
|
|
|
|
|
|
my $world = shift; |
91
|
0
|
|
|
|
|
|
my @targets; |
92
|
0
|
|
|
|
|
|
for(split "\n", $extracted_data) |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
|
|
|
my $target = BalanceOfPower::Targets::Fall->load($_); |
95
|
0
|
|
|
|
|
|
$target->load_target($world); |
96
|
0
|
|
|
|
|
|
push @targets, $target; |
97
|
|
|
|
|
|
|
} |
98
|
0
|
|
|
|
|
|
return \@targets; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|