view Card.pm @ 6:4246c7ef6487 boosterpack

[svn r8] bug fix -- holos need to be one int three compared to rares
author robert
date Tue, 08 Sep 2009 17:20:52 -0400
parents 477258d09353
children 8c6d2ce90677
line wrap: on
line source
1 package Card;
2 use List::Util qw(first max maxstr min minstr reduce shuffle sum);
4 sub new
5 {
6 my $class = shift;
8 my $hashREF =
9 {
10 _tags => {},
11 _pix => ""
12 };
14 $objectREF = bless($hashREF, $class);
16 return $objectREF;
18 }
21 sub getTags
22 {
23 $bull = @_[0]->{'_tags'};
24 return keys(%$bull);
25 };
26 sub addTags
27 {
28 $object = shift;
29 @add = @_;
30 if (@add)
31 {
32 @ohYeah = ($object->getTags(),@add);
33 foreach(@ohYeah){$object->{_tags}{$_} = "";}
34 }
35 return $object->getTags();
36 };
39 sub hasTags
40 {
41 $card = shift;
42 @rest = @_;
43 @test = $card->getTags();
44 foreach $e(@rest){if (! (first {$e eq $_} @test)){return 0;}}
45 return 1;
46 }
49 sub setPix { $_[0]->{_pix} = $_[1]; }
50 sub getPix {return $_[0]->{_pix} ; }
53 1;