Jerome Quelin > Games-Pandemic-1.120510 > Games::Pandemic::Player

Download:
Games-Pandemic-1.120510.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.120510   Source  

NAME ^

Games::Pandemic::Player - pandemic game player

VERSION ^

version 1.120510

SYNOPSIS ^

    use Games::Pandemic::Player;
    my $role = 'Games::Pandemic::Role::Medic';
    my $player = Games::Pandemic::Player->new_with_traits(traits=>[$role]);

DESCRIPTION ^

This is a class implementing a player.

Among other things, a player has a role. In fact, it is consuming one of the Games::Pandemic::Role::* roles, which is applied as a trait during object construction.

Therefore, to create a player, use the new_with_traits() method (as is done in the synopsis section).

METHODS ^

my $color = $player->color;

Return the $color (html notation) to be used for this player.

my $role = $player->role;

Return the (localized) name of $player's role.

my $bool = $player->auto_clean_on_cure;

Return true if the $player applies automatically a cure by just being in the city.

my $bool = $player->can_build_anywhere;

Return true if the $player can build a research station in a city even if she doesn't have the city card.

my $bool = $player->can_join_others;

Return true if the $player can move till a city where there's another player.

my $bool = $player->can_move_others;

Return true if the $player can move the other's pawns during her turn.

my $bool = $player->can_share_anywhere;

Return true if the $player can give a card to another player even if it isn't the card of the city in which they are.

my $nb = $player->cards_needed;

Return the number of cards of the same color that the $player needs to find a cure for a disease.

my $bool = $player->treat_all;

Return true if the $player treats all the disease cubes in a city in one go, even if the cure for the disease has not been discovered yet.

my $max = $player->max_cards;

Return the maximum number of cards that a player can have in her hands.

my $path = $player->image( $what, $size );

Return the C$<path> to an image for the player role. $what can be either icon or pawn. $size can be one of orig, or 32 or 16. Note that not all combinations are possible.

my @cards = $player->all_cards;

Return the list of cards owned by $player. The list is sorted by type of card, then by disease and by name.

my $card = $player->owns_city_card( $city );

Return the $card representing $city if the $player owns it, undef otherwise.

$player->gain_card( $card )

$player gains a new $card.

my $bool = $player->is_move_possible;

Return true if $player can move, starting from her current location. Always true. Included here for the sake of completeness.

my $bool = $player->is_flight_possible;

Return true if $player can fly (regular flight) starting from her current location. Flight is possible if the player has at least one city card, which is not the card representing the city in which the player is.

my $bool = $player->is_charter_possible;

my $bool = $player->is_shuttle_possible;

my $bool = $player->is_join_possible;

my $bool = $player->is_build_possible;

Return true if $player can build a research station in her current location. It is possible if she owns the card of the city, or if she is the operation expert. Of course it is impossible if there's already a station in the city.

my $disease = $player->is_discover_possible;

Return the $disease that $player can cure, that is, if she owns enough city cards of this disease and she is in a city with a research station. Return undef otherwise.

my $bool = $player->is_treat_possible;

Return true if $player can treat a disease. It is possible if her current location is infected by one (or more) disease.

my $bool = $player->is_share_possible;

Return true if $player can share a card in her current location. It is possible if she owns the card of the city, or if she is the researcher. Of course it is impossible if player's alone in the city.

my $bool = $player->is_pass_possible;

Return true if $player can pass. Always true. Included here for the sake of completeness.

my $bool = $player->is_drop_possible;

Return true if $player can drop a card. True if she has at least one card.

my $bool = $player->can_travel_to($city);

Return true if $player can travel to $city by proximity. This means that $player is in a location next to $city.

my $bool = $player->can_shuttle_to($city);

Return true if $player can shuttle through research station to $city. This means that both current player location and remote $city have a research station. Of course, return value is false if $player is currently located in <$city>.

my $bool = $player->can_join_to($city);

AUTHOR ^

Jerome Quelin

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2009 by Jerome Quelin.

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991
syntax highlighting: