Renamed 'Classes' class, use class methods
This commit is contained in:
parent
3e5cab4aee
commit
30c4f4929d
@ -1,15 +1,15 @@
|
|||||||
package OSRIC::Character;
|
package OSRIC::Character;
|
||||||
|
|
||||||
use OSRIC::Classes;
|
use OSRIC::Class;
|
||||||
use OSRIC::Classes::Assassin;
|
use OSRIC::Class::Assassin;
|
||||||
use OSRIC::Classes::Cleric;
|
use OSRIC::Class::Cleric;
|
||||||
use OSRIC::Classes::Druid;
|
use OSRIC::Class::Druid;
|
||||||
use OSRIC::Classes::Fighter;
|
use OSRIC::Class::Fighter;
|
||||||
use OSRIC::Classes::Illusionist;
|
use OSRIC::Class::Illusionist;
|
||||||
use OSRIC::Classes::MagicUser;
|
use OSRIC::Class::MagicUser;
|
||||||
use OSRIC::Classes::Paladin;
|
use OSRIC::Class::Paladin;
|
||||||
use OSRIC::Classes::Ranger;
|
use OSRIC::Class::Ranger;
|
||||||
use OSRIC::Classes::Thief;
|
use OSRIC::Class::Thief;
|
||||||
|
|
||||||
use OSRIC::Util qw/d/;
|
use OSRIC::Util qw/d/;
|
||||||
use JSON qw/encode_json/;
|
use JSON qw/encode_json/;
|
||||||
@ -20,9 +20,9 @@ sub new
|
|||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $character =
|
my $character =
|
||||||
{
|
{
|
||||||
|
irc => "", # The player's irc nick, not found on the character sheet.
|
||||||
personal =>
|
personal =>
|
||||||
{
|
{
|
||||||
irc => "", # The player's irc nick, not found on the character sheet.
|
|
||||||
name => "",
|
name => "",
|
||||||
classes => [ ],
|
classes => [ ],
|
||||||
alignment => "",
|
alignment => "",
|
||||||
@ -82,11 +82,12 @@ sub generate_gold
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
# Get the classes and sort by the highest starting gold (see page 28):
|
# Get the classes and sort by the highest starting gold (see page 28):
|
||||||
my @sorted = sort { $a->max_starting_gold <=> $b->max_starting_gold }
|
my @sorted = sort { "OSRIC::Class::$a"->max_starting_gold <=>
|
||||||
|
"OSRIC::Class::$b"->max_starting_gold }
|
||||||
@{$self->{personal}->{classes}};
|
@{$self->{personal}->{classes}};
|
||||||
|
|
||||||
# Generate the starting gold:
|
# Generate the starting gold:
|
||||||
$self->{wealth}->{coins} = $classes[0]->get_gold;
|
$self->{wealth}->{coins} = "OSRIC::Class::$classes[0]"->get_gold;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Encodes the character to JSON:
|
# Encodes the character to JSON:
|
||||||
|
Loading…
Reference in New Issue
Block a user