Fixes casting, default parameters and null propogation in more files.
This commit is contained in:
parent
067dca8393
commit
403e2a8b9d
21 changed files with 328 additions and 523 deletions
|
|
@ -135,7 +135,7 @@ namespace Server.Misc
|
|||
if ( gc < 0.01 )
|
||||
gc = 0.01;
|
||||
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled )
|
||||
if ( @from is BaseCreature creature && creature.Controlled )
|
||||
gc *= 2;
|
||||
|
||||
if ( from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) )
|
||||
|
|
@ -155,7 +155,7 @@ namespace Server.Misc
|
|||
|
||||
if ( value < minSkill )
|
||||
return false; // Too difficult
|
||||
else if ( value >= maxSkill )
|
||||
if ( value >= maxSkill )
|
||||
return true; // No challenge
|
||||
|
||||
double chance = (value - minSkill) / (maxSkill - minSkill);
|
||||
|
|
@ -172,7 +172,7 @@ namespace Server.Misc
|
|||
|
||||
if ( chance < 0.0 )
|
||||
return false; // Too difficult
|
||||
else if ( chance >= 1.0 )
|
||||
if ( chance >= 1.0 )
|
||||
return true; // No challenge
|
||||
|
||||
return CheckSkill( from, skill, target, chance );
|
||||
|
|
@ -183,10 +183,10 @@ namespace Server.Misc
|
|||
if ( Core.AOS && Faction.InSkillLoss( from ) ) //Changed some time between the introduction of AoS and SE.
|
||||
return false;
|
||||
|
||||
if ( AntiMacroCode && from is PlayerMobile && UseAntiMacro[skill.Info.SkillID] )
|
||||
return ((PlayerMobile)from).AntiMacroCheck( skill, obj );
|
||||
else
|
||||
return true;
|
||||
if ( AntiMacroCode && @from is PlayerMobile mobile && UseAntiMacro[skill.Info.SkillID] )
|
||||
return mobile.AntiMacroCheck( skill, obj );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum Stat { Str, Dex, Int }
|
||||
|
|
@ -196,7 +196,7 @@ namespace Server.Misc
|
|||
if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
|
||||
return;
|
||||
|
||||
if ( from is BaseCreature && ((BaseCreature)from).IsDeadPet )
|
||||
if ( @from is BaseCreature creature && creature.IsDeadPet )
|
||||
return;
|
||||
|
||||
if ( skill.SkillName == SkillName.Focus && from is BaseCreature )
|
||||
|
|
@ -226,9 +226,8 @@ namespace Server.Misc
|
|||
}
|
||||
|
||||
#region Scroll of Alacrity
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow )
|
||||
if ( @from is PlayerMobile pm && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow )
|
||||
toGain *= Utility.RandomMinMax(2, 5);
|
||||
#endregion
|
||||
|
||||
|
|
@ -265,7 +264,7 @@ namespace Server.Misc
|
|||
|
||||
public static bool CanRaise( Mobile from, Stat stat )
|
||||
{
|
||||
if ( !(from is BaseCreature && ((BaseCreature)from).Controlled) )
|
||||
if ( !(@from is BaseCreature creature && creature.Controlled) )
|
||||
{
|
||||
if ( from.RawStatTotal >= from.StatCap )
|
||||
return false;
|
||||
|
|
@ -344,8 +343,8 @@ namespace Server.Misc
|
|||
{
|
||||
case Stat.Str:
|
||||
{
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
|
||||
if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
if ( @from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( (creature.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
else if ( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow )
|
||||
|
|
@ -356,8 +355,8 @@ namespace Server.Misc
|
|||
}
|
||||
case Stat.Dex:
|
||||
{
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
|
||||
if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
if ( @from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( (creature.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
else if ( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow )
|
||||
|
|
@ -368,8 +367,8 @@ namespace Server.Misc
|
|||
}
|
||||
case Stat.Int:
|
||||
{
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
|
||||
if ( (from.LastIntGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
if ( @from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( (creature.LastIntGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue