From 84bcc9959ae3d83d7c0767fc7934983e4b9c4513 Mon Sep 17 00:00:00 2001 From: ElTata <eltata@firemail.cc> Date: Mon, 21 Oct 2019 15:55:30 +0200 Subject: [PATCH] bug fixes - fixed conditions for classes - fixed steal failure 5% (from truncate to round) - fixed points repartition --- Irpg/Action.pm | 4 ++-- Irpg/Classes/Apprentice.pm | 2 +- Irpg/Classes/Barbarian.pm | 4 ++-- Irpg/Classes/Bargainer.pm | 2 +- Irpg/Classes/Burly.pm | 6 +++--- Irpg/Classes/Cunning.pm | 2 +- Irpg/Classes/Educated.pm | 2 +- Irpg/Classes/Elite_Warrior.pm | 6 +++--- Irpg/Classes/Enchanter.pm | 2 +- Irpg/Classes/Enlightened.pm | 2 +- Irpg/Classes/Fighter.pm | 6 +++--- Irpg/Classes/Godfather.pm | 2 +- Irpg/Classes/High_Mage.pm | 2 +- Irpg/Classes/Mage.pm | 2 +- Irpg/Classes/Master_Enchanter.pm | 2 +- Irpg/Classes/Merchant.pm | 2 +- Irpg/Classes/Officer.pm | 6 +++--- Irpg/Classes/Old_Wizard.pm | 2 +- Irpg/Classes/Rookie.pm | 6 +++--- Irpg/Classes/Shadow.pm | 2 +- Irpg/Classes/Shrewd.pm | 2 +- Irpg/Classes/Sneaky.pm | 2 +- Irpg/Classes/Soldier.pm | 4 ++-- Irpg/Classes/Swindler.pm | 2 +- Irpg/Classes/Thief.pm | 2 +- Irpg/Classes/Tribe_Chief.pm | 6 +++--- Irpg/Classes/Warrior.pm | 6 +++--- Irpg/Classes/Wizard.pm | 2 +- Irpg/Main.pm | 2 +- Irpg/Users.pm | 9 +++++---- 30 files changed, 51 insertions(+), 50 deletions(-) diff --git a/Irpg/Action.pm b/Irpg/Action.pm index 28f2dc9..7b0c6b5 100644 --- a/Irpg/Action.pm +++ b/Irpg/Action.pm @@ -99,7 +99,7 @@ sub fight_result { $gain = $rps->{$p1}{class}->real_gain($gain); $rps->{$p1}{next} += $gain; push(@queue, - duration($gain)." is removed from $p1\'s clock."); + duration($gain)." is added to $p1\'s clock."); } $queue[0] .= " $p1 reaches next level in ".duration($rps->{$p1}{next})."."; return \@queue; @@ -221,7 +221,7 @@ sub steal_result { "pair of boots"); my $type = $items[rand(@items)]; my ($val, $suffix) = ($rps->{$p1}{item}{$type} =~ /(\d+)(\D?)$/); - $rps->{$p1}{item}{$type} = int($val * .95); + $rps->{$p1}{item}{$type} = int(($val * .95)+0.5); $rps->{$p1}{item}{$type} .= $suffix; push(@queue, "$p1 did a false move, and damaged ". diff --git a/Irpg/Classes/Apprentice.pm b/Irpg/Classes/Apprentice.pm index bdba423..8ef0e9d 100644 --- a/Irpg/Classes/Apprentice.pm +++ b/Irpg/Classes/Apprentice.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 5) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 7) { return undef; } diff --git a/Irpg/Classes/Barbarian.pm b/Irpg/Classes/Barbarian.pm index cc51718..8d07317 100644 --- a/Irpg/Classes/Barbarian.pm +++ b/Irpg/Classes/Barbarian.pm @@ -9,14 +9,14 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 9) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 11) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Barbarian'; - $self->{MOD_STR} = $pl_stats->{str}*1.5; + $self->{MOD_STR} = 1.5; return $self; } diff --git a/Irpg/Classes/Bargainer.pm b/Irpg/Classes/Bargainer.pm index 1b5cf58..db2f96f 100644 --- a/Irpg/Classes/Bargainer.pm +++ b/Irpg/Classes/Bargainer.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 9) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 11) { return undef; } diff --git a/Irpg/Classes/Burly.pm b/Irpg/Classes/Burly.pm index cea857b..5eb7e9f 100644 --- a/Irpg/Classes/Burly.pm +++ b/Irpg/Classes/Burly.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 3) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 5) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Burly'; - $self->{MOD_STR} = $pl_stats->{str}*1.1; - $self->{MOD_CON} = $pl_stats->{con}*1.1; + $self->{MOD_STR} = 1.1; + $self->{MOD_CON} = 1.1; return $self; } diff --git a/Irpg/Classes/Cunning.pm b/Irpg/Classes/Cunning.pm index e7ee862..0364943 100644 --- a/Irpg/Classes/Cunning.pm +++ b/Irpg/Classes/Cunning.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 7) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 9) { return undef; } diff --git a/Irpg/Classes/Educated.pm b/Irpg/Classes/Educated.pm index 29b303b..3660136 100644 --- a/Irpg/Classes/Educated.pm +++ b/Irpg/Classes/Educated.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 3) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 5) { return undef; } diff --git a/Irpg/Classes/Elite_Warrior.pm b/Irpg/Classes/Elite_Warrior.pm index 70c6ec6..775ead7 100644 --- a/Irpg/Classes/Elite_Warrior.pm +++ b/Irpg/Classes/Elite_Warrior.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 11) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 13) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Elite Warrior'; - $self->{MOD_STR} = $pl_stats->{str}*1.5; - $self->{MOD_CON} = $pl_stats->{con}*1.5; + $self->{MOD_STR} = 1.5; + $self->{MOD_CON} = 1.5; return $self; } diff --git a/Irpg/Classes/Enchanter.pm b/Irpg/Classes/Enchanter.pm index 220cac6..f40c598 100644 --- a/Irpg/Classes/Enchanter.pm +++ b/Irpg/Classes/Enchanter.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 9) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 11) { return undef; } diff --git a/Irpg/Classes/Enlightened.pm b/Irpg/Classes/Enlightened.pm index 3d884c4..bfdc56a 100644 --- a/Irpg/Classes/Enlightened.pm +++ b/Irpg/Classes/Enlightened.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 7) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 9) { return undef; } diff --git a/Irpg/Classes/Fighter.pm b/Irpg/Classes/Fighter.pm index 7d141b8..262d040 100644 --- a/Irpg/Classes/Fighter.pm +++ b/Irpg/Classes/Fighter.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 7) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 9) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Fighter'; - $self->{MOD_STR} = $pl_stats->{str}*1.3; - $self->{MOD_CON} = $pl_stats->{con}*1.3; + $self->{MOD_STR} = 1.3; + $self->{MOD_CON} = 1.3; return $self; } diff --git a/Irpg/Classes/Godfather.pm b/Irpg/Classes/Godfather.pm index e445931..b991bbd 100644 --- a/Irpg/Classes/Godfather.pm +++ b/Irpg/Classes/Godfather.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 11) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 13) { return undef; } diff --git a/Irpg/Classes/High_Mage.pm b/Irpg/Classes/High_Mage.pm index dd09730..93b94fb 100644 --- a/Irpg/Classes/High_Mage.pm +++ b/Irpg/Classes/High_Mage.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 11) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 13) { return undef; } diff --git a/Irpg/Classes/Mage.pm b/Irpg/Classes/Mage.pm index 70c4e34..57c8dae 100644 --- a/Irpg/Classes/Mage.pm +++ b/Irpg/Classes/Mage.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 9) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 11) { return undef; } diff --git a/Irpg/Classes/Master_Enchanter.pm b/Irpg/Classes/Master_Enchanter.pm index 4d334a5..000d7fb 100644 --- a/Irpg/Classes/Master_Enchanter.pm +++ b/Irpg/Classes/Master_Enchanter.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 11) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 13) { return undef; } diff --git a/Irpg/Classes/Merchant.pm b/Irpg/Classes/Merchant.pm index 1e7b5ee..d30b8c2 100644 --- a/Irpg/Classes/Merchant.pm +++ b/Irpg/Classes/Merchant.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 11) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 13) { return undef; } diff --git a/Irpg/Classes/Officer.pm b/Irpg/Classes/Officer.pm index 3694eda..9318c1d 100644 --- a/Irpg/Classes/Officer.pm +++ b/Irpg/Classes/Officer.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 11) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 13) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Officer'; - $self->{MOD_STR} = $pl_stats->{con}*1.2; - $self->{MOD_CON} = $pl_stats->{con}*1.8; + $self->{MOD_STR} = 1.2; + $self->{MOD_CON} = 1.8; return $self; } diff --git a/Irpg/Classes/Old_Wizard.pm b/Irpg/Classes/Old_Wizard.pm index 26f3c6c..5d85a61 100644 --- a/Irpg/Classes/Old_Wizard.pm +++ b/Irpg/Classes/Old_Wizard.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 11) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 13) { return undef; } diff --git a/Irpg/Classes/Rookie.pm b/Irpg/Classes/Rookie.pm index 38a0e67..f709c38 100644 --- a/Irpg/Classes/Rookie.pm +++ b/Irpg/Classes/Rookie.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 5) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 7) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Rookie'; - $self->{MOD_STR} = $pl_stats->{str}*1.2; - $self->{MOD_CON} = $pl_stats->{con}*1.2; + $self->{MOD_STR} = 1.2; + $self->{MOD_CON} = 1.2; return $self; } diff --git a/Irpg/Classes/Shadow.pm b/Irpg/Classes/Shadow.pm index e181fbd..9a85b4c 100644 --- a/Irpg/Classes/Shadow.pm +++ b/Irpg/Classes/Shadow.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 11) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 13) { return undef; } diff --git a/Irpg/Classes/Shrewd.pm b/Irpg/Classes/Shrewd.pm index d01b719..0b0b41a 100644 --- a/Irpg/Classes/Shrewd.pm +++ b/Irpg/Classes/Shrewd.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 3) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 5) { return undef; } diff --git a/Irpg/Classes/Sneaky.pm b/Irpg/Classes/Sneaky.pm index dd155cb..6494d28 100644 --- a/Irpg/Classes/Sneaky.pm +++ b/Irpg/Classes/Sneaky.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 5) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 7) { return undef; } diff --git a/Irpg/Classes/Soldier.pm b/Irpg/Classes/Soldier.pm index f29ea4f..8efd012 100644 --- a/Irpg/Classes/Soldier.pm +++ b/Irpg/Classes/Soldier.pm @@ -9,14 +9,14 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 9) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 11) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Soldier'; - $self->{MOD_CON} = $pl_stats->{con}*1.5; + $self->{MOD_CON} = 1.5; return $self; } diff --git a/Irpg/Classes/Swindler.pm b/Irpg/Classes/Swindler.pm index 0ece6ae..670b2ef 100644 --- a/Irpg/Classes/Swindler.pm +++ b/Irpg/Classes/Swindler.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 9) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 11) { return undef; } diff --git a/Irpg/Classes/Thief.pm b/Irpg/Classes/Thief.pm index fae3202..233876e 100644 --- a/Irpg/Classes/Thief.pm +++ b/Irpg/Classes/Thief.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['cha'] + $pl_stats->['dex'] >= 9) { + if ($pl_stats->{'cha'} + $pl_stats->{'dex'} < 11) { return undef; } diff --git a/Irpg/Classes/Tribe_Chief.pm b/Irpg/Classes/Tribe_Chief.pm index 6264fae..ae34a68 100644 --- a/Irpg/Classes/Tribe_Chief.pm +++ b/Irpg/Classes/Tribe_Chief.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 11) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 13) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Tribe Chief'; - $self->{MOD_STR} = $pl_stats->{str}*1.8; - $self->{MOD_CON} = $pl_stats->{str}*1.2; + $self->{MOD_STR} = 1.8; + $self->{MOD_CON} = 1.2; return $self; } diff --git a/Irpg/Classes/Warrior.pm b/Irpg/Classes/Warrior.pm index 9f93b26..5c004c8 100644 --- a/Irpg/Classes/Warrior.pm +++ b/Irpg/Classes/Warrior.pm @@ -9,15 +9,15 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['str'] + $pl_stats->['con'] >= 9) { + if ($pl_stats->{'str'} + $pl_stats->{'con'} < 11) { return undef; } my $self = $class->SUPER::new($pl_stats); bless $self, $class; $self->{NAME} = 'Warrior'; - $self->{MOD_STR} = $pl_stats->{str}*1.4; - $self->{MOD_CON} = $pl_stats->{con}*1.4; + $self->{MOD_STR} = 1.4; + $self->{MOD_CON} = 1.4; return $self; } diff --git a/Irpg/Classes/Wizard.pm b/Irpg/Classes/Wizard.pm index 0caddcc..a0cd2ab 100644 --- a/Irpg/Classes/Wizard.pm +++ b/Irpg/Classes/Wizard.pm @@ -9,7 +9,7 @@ sub new { my ($class, $pl_stats) = @_; # condition to enter the class - if ($pl_stats->['int'] + $pl_stats->['wis'] >= 9) { + if ($pl_stats->{'int'} + $pl_stats->{'wis'} < 11) { return undef; } diff --git a/Irpg/Main.pm b/Irpg/Main.pm index 0044b4e..4ff791d 100644 --- a/Irpg/Main.pm +++ b/Irpg/Main.pm @@ -563,7 +563,7 @@ sub help { my ($userhost, $usernick, $username, $source, @arg) = @_; my $ctxt = $source =~ m/^#/ ? 'pub' : 'prv'; my $ret = ''; - my $isadmin = $rps->{username}{isadmin}; + my $isadmin = $rps->{$username}{isadmin}; if (!exists($arg[0])) { $ret = "Available commands : ". join(', ', grep({ $commands{$_}->{$ctxt} diff --git a/Irpg/Users.pm b/Irpg/Users.pm index ed451eb..7f66d5e 100644 --- a/Irpg/Users.pm +++ b/Irpg/Users.pm @@ -295,7 +295,7 @@ sub gender { if (!defined($username)) { Irpg::Irc::notice("You are not logged in.", $usernick); } - elsif (!defined($arg[0]) || $arg[0] =~ /[^MFN]/) { + elsif (!defined($arg[0]) || $arg[0] =~ /[^MFNmfn]/) { Irpg::Irc::notice("Try: GENDER <F[emale]|N[eutral]|M[ale]>",$usernick); } else { @@ -374,6 +374,7 @@ sub points { return; } my ($stat, $n) = @arg; + $stat = lc($stat); if ($n > $rps->{$username}{points}) { Irpg::Irc::privmsg("You do not have that much points to spend.", $source); return; @@ -385,7 +386,7 @@ sub points { $rps->{$username}{stats}{$stat} += $n; $rps->{$username}{points} -= $n; - Irpg::Irc::privmsg("Ok!", $usernick); + Irpg::Irc::privmsg("You sure feel more competent now!", $usernick); } sub class { @@ -401,7 +402,7 @@ sub class { Irpg::Irc::privmsg("You are a".($cname =~ m/^[aeiouyæœ].*/ ? 'n':''). " $cname with the following stats: ". join(', ', map { uc($_)." ".eval('$rps->{$username}{class}->'.$_.'()') } - keys($rps->{$username}{stats})).".",$source); + keys($rps->{$username}{stats})).".", $source); return; } my @classes; @@ -434,7 +435,7 @@ sub class { "demanding path ".pronoun(1, $rps->{$username}{gender}). " has chosen, and ".pronoun(2, $rps->{$username}{gender}). " efforts paid back as ".pronoun(1, $rps->{$username}{gender}). - " today rises as proud $cname."); + " today rises as a proud $cname."); } else { Irpg::Irc::privmsg("You tried the best you could, ". -- GitLab