PangZero/XmasBall.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 43 CC 2 SCAR 10.3
CC
2
Cov
0%
Pop
6.0
SpawnChildren
2.0
GiveMagic
2.0
CRAP 2.8
1 ##########################################################################
2 package Games::PangZero::XmasBall;
3 ##########################################################################
4  
5 @ISA = qw(Games::PangZero::Ball);
6 use strict;
7 use warnings;
8  
9 sub SpawnChildren {
10 return ();
11 }
12  
13 sub Pop {
14 my $self = shift;
15 $self->SUPER::Pop(@_);
16 my $bonusdrop = BonusDrop->new($self);
17 my @collectedSubs = ( \&OnCollectedLife, \&OnCollectedScore, \&OnCollectedScore, \&OnCollectedInvulnerability, \&OnCollectedInvulnerability );
18 if ($Games::PangZero::Game->Rand(2 * scalar @collectedSubs) < scalar @collectedSubs) {
19 $bonusdrop->{desc} = { 'srcRect' => SDL::Rect->new(0, 0, 32, 32), };
20 $bonusdrop->SetOnCollectedSub( $collectedSubs[int $Games::PangZero::Game->Rand(scalar @collectedSubs)] );
21 }
22 push @Games::PangZero::GameObjects, $bonusdrop;
23 }
24  
25 sub GiveMagic {
26 }
27 sub GiveBonus {
28 }
29  
30 sub OnCollectedLife {
31 my ($bonus, $guy) = @_;
32 $guy->{player}->{lives}++;
33 Games::PangZero::PlaySound('bonuslife');
34 }
35  
36 sub OnCollectedScore {
37 my ($bonus, $guy) = @_;
38 $guy->GiveScore(50000);
39 Games::PangZero::PlaySound('score');
40 }
41  
42 sub OnCollectedInvulnerability {
43 my ($bonus, $guy) = @_;
44 $guy->{invincible} = 500;
45 }
46  
47 1;