File Coverage

blib/lib/Games/AssaultCube/Log/Line/AutoBalance.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             # Declare our package
2             package Games::AssaultCube::Log::Line::AutoBalance;
3              
4             # import the Moose stuff
5 1     1   2418 use Moose;
  0            
  0            
6              
7             # Initialize our version
8             use vars qw( $VERSION );
9             $VERSION = '0.04';
10              
11             extends 'Games::AssaultCube::Log::Line::Base';
12              
13             # TODO improve validation for everything here, ha!
14              
15             has 'target' => (
16             isa => 'Int',
17             is => 'ro',
18             required => 1,
19             );
20              
21             has 'players' => (
22             isa => 'HashRef[Int]',
23             is => 'ro',
24             required => 1,
25             );
26              
27             has 'pick' => (
28             isa => 'Int',
29             is => 'ro',
30             required => 1,
31             );
32              
33             has 'tostr' => (
34             isa => 'Str',
35             is => 'ro',
36             lazy => 1,
37             default => sub {
38             my $self = shift;
39             return "Autobalance: forcing " . $self->pick . " to the other team based on target " . $self->target;
40             },
41             );
42              
43             no Moose;
44             __PACKAGE__->meta->make_immutable;
45              
46             1;
47             __END__
48             =head1 NAME
49              
50             Games::AssaultCube::Log::Line::AutoBalance - Describes the AutoBalance event in a log line
51              
52             =head1 ABSTRACT
53              
54             Describes the AutoBalance event in a log line
55              
56             =head1 DESCRIPTION
57              
58             This module holds the "AutoBalance" event data from a log line. Normally, you would not use this class directly
59             but via the L<Games::AssaultCube::Log::Line> class.
60              
61             This line is emitted when the AC server is selecting a player to move to the other team for balancing.
62              
63             =head2 Attributes
64              
65             Those attributes hold information about the event. As this class extends the L<Games::AssaultCube::Log::Line::Base>
66             class, you can also use it's attributes too.
67              
68             =head3 target
69              
70             The target player "value" the server wants to select
71              
72             =head3 players
73              
74             A hashref of player connection numbers and their "value" as fields
75              
76             =head3 pick
77              
78             The connection number of the player the server selected for balancing
79              
80             =head1 AUTHOR
81              
82             Apocalypse E<lt>apocal@cpan.orgE<gt>
83              
84             Props goes to the BS clan for the support!
85              
86             This project is sponsored by L<http://cubestats.net>
87              
88             =head1 COPYRIGHT AND LICENSE
89              
90             Copyright 2009 by Apocalypse
91              
92             This library is free software; you can redistribute it and/or modify
93             it under the same terms as Perl itself.
94              
95             =cut