Fixes for Last Moved (#194)

This commit is contained in:
Kamron Batman 2020-08-16 06:58:16 -07:00 • committed by GitHub
parent 3a081d5322
commit b476bcfd24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 155 additions and 398 deletions

View file

@ -35,12 +35,7 @@ namespace Server.SkillHandlers
{
if (weap.MaxHitPoints != 0)
{
int hp = (int)(weap.HitPoints / (double)weap.MaxHitPoints * 10);
if (hp < 0)
hp = 0;
else if (hp > 9)
hp = 9;
int hp = Math.Clamp((int)(weap.HitPoints / (double)weap.MaxHitPoints * 10), 0, 9);
from.SendLocalizedMessage(1038285 + hp);
}
@ -52,20 +47,6 @@ namespace Server.SkillHandlers
damage = 0;
else
damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
/*
else if (damage < 6)
damage = 1;
else if (damage < 11)
damage = 2;
else if (damage < 16)
damage = 3;
else if (damage < 21)
damage = 4;
else if (damage < 26)
damage = 5;
else
damage = 6;
* */
WeaponType type = weap.Type;
@ -94,35 +75,12 @@ namespace Server.SkillHandlers
{
if (arm.MaxHitPoints != 0)
{
int hp = (int)(arm.HitPoints / (double)arm.MaxHitPoints * 10);
if (hp < 0)
hp = 0;
else if (hp > 9)
hp = 9;
int hp = Math.Clamp((int)(arm.HitPoints / (double)arm.MaxHitPoints * 10), 0, 9);
from.SendLocalizedMessage(1038285 + hp);
}
from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0));
/*
if (arm.ArmorRating < 1)
from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
else if (arm.ArmorRating < 6)
from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
else if (arm.ArmorRating < 11)
from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
else if (arm.ArmorRating < 16)
from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
else if (arm.ArmorRating < 21)
from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
else if (arm.ArmorRating < 26)
from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
else if (arm.ArmorRating < 31)
from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
else
from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
* */
}
else
{

View file

@ -251,12 +251,7 @@ namespace Server.SkillHandlers
{
if (toSteal.Stackable && toSteal.Amount > 1)
{
int maxAmount = (int)(m_Thief.Skills.Stealing.Value / 10.0 / toSteal.Weight);
if (maxAmount < 1)
maxAmount = 1;
else if (maxAmount > toSteal.Amount)
maxAmount = toSteal.Amount;
int maxAmount = Math.Clamp((int)(m_Thief.Skills.Stealing.Value / 10.0 / toSteal.Weight), 1, toSteal.Amount);
int amount = Utility.RandomMinMax(1, maxAmount);