Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,151 +1,153 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Spells.Necromancy;
|
||||
using Server.Spells.Ninjitsu;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class PoisonImpl : Poison
|
||||
{
|
||||
[CallPriority( 10 )]
|
||||
public static void Configure()
|
||||
{
|
||||
if ( Core.AOS )
|
||||
{
|
||||
Register( new PoisonImpl( "Lesser", 0, 4, 16, 7.5, 3.0, 2.25, 10, 4 ) );
|
||||
Register( new PoisonImpl( "Regular", 1, 8, 18, 10.0, 3.0, 3.25, 10, 3 ) );
|
||||
Register( new PoisonImpl( "Greater", 2, 12, 20, 15.0, 3.0, 4.25, 10, 2 ) );
|
||||
Register( new PoisonImpl( "Deadly", 3, 16, 30, 30.0, 3.0, 5.25, 15, 2 ) );
|
||||
Register( new PoisonImpl( "Lethal", 4, 20, 50, 35.0, 3.0, 5.25, 20, 2 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Register( new PoisonImpl( "Lesser", 0, 4, 26, 2.500, 3.5, 3.0, 10, 2 ) );
|
||||
Register( new PoisonImpl( "Regular", 1, 5, 26, 3.125, 3.5, 3.0, 10, 2 ) );
|
||||
Register( new PoisonImpl( "Greater", 2, 6, 26, 6.250, 3.5, 3.0, 10, 2 ) );
|
||||
Register( new PoisonImpl( "Deadly", 3, 7, 26, 12.500, 3.5, 4.0, 10, 2 ) );
|
||||
Register( new PoisonImpl( "Lethal", 4, 9, 26, 25.000, 3.5, 5.0, 10, 2 ) );
|
||||
}
|
||||
}
|
||||
public class PoisonImpl : Poison
|
||||
{
|
||||
private int m_Count, m_MessageInterval;
|
||||
|
||||
public static Poison IncreaseLevel( Poison oldPoison )
|
||||
{
|
||||
Poison newPoison = ( oldPoison == null ? null : GetPoison( oldPoison.Level + 1 ) );
|
||||
// Timers
|
||||
private TimeSpan m_Delay;
|
||||
private TimeSpan m_Interval;
|
||||
|
||||
return newPoison ?? oldPoison;
|
||||
}
|
||||
// Info
|
||||
|
||||
// Info
|
||||
// Damage
|
||||
private int m_Minimum, m_Maximum;
|
||||
private double m_Scalar;
|
||||
|
||||
// Damage
|
||||
private int m_Minimum, m_Maximum;
|
||||
private double m_Scalar;
|
||||
public PoisonImpl(string name, int level, int min, int max, double percent, double delay, double interval, int count,
|
||||
int messageInterval)
|
||||
{
|
||||
Name = name;
|
||||
Level = level;
|
||||
m_Minimum = min;
|
||||
m_Maximum = max;
|
||||
m_Scalar = percent * 0.01;
|
||||
m_Delay = TimeSpan.FromSeconds(delay);
|
||||
m_Interval = TimeSpan.FromSeconds(interval);
|
||||
m_Count = count;
|
||||
m_MessageInterval = messageInterval;
|
||||
}
|
||||
|
||||
// Timers
|
||||
private TimeSpan m_Delay;
|
||||
private TimeSpan m_Interval;
|
||||
private int m_Count, m_MessageInterval;
|
||||
public override string Name{ get; }
|
||||
|
||||
public PoisonImpl( string name, int level, int min, int max, double percent, double delay, double interval, int count, int messageInterval )
|
||||
{
|
||||
Name = name;
|
||||
Level = level;
|
||||
m_Minimum = min;
|
||||
m_Maximum = max;
|
||||
m_Scalar = percent * 0.01;
|
||||
m_Delay = TimeSpan.FromSeconds( delay );
|
||||
m_Interval = TimeSpan.FromSeconds( interval );
|
||||
m_Count = count;
|
||||
m_MessageInterval = messageInterval;
|
||||
}
|
||||
public override int Level{ get; }
|
||||
|
||||
public override string Name { get; }
|
||||
[CallPriority(10)]
|
||||
public static void Configure()
|
||||
{
|
||||
if (Core.AOS)
|
||||
{
|
||||
Register(new PoisonImpl("Lesser", 0, 4, 16, 7.5, 3.0, 2.25, 10, 4));
|
||||
Register(new PoisonImpl("Regular", 1, 8, 18, 10.0, 3.0, 3.25, 10, 3));
|
||||
Register(new PoisonImpl("Greater", 2, 12, 20, 15.0, 3.0, 4.25, 10, 2));
|
||||
Register(new PoisonImpl("Deadly", 3, 16, 30, 30.0, 3.0, 5.25, 15, 2));
|
||||
Register(new PoisonImpl("Lethal", 4, 20, 50, 35.0, 3.0, 5.25, 20, 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
Register(new PoisonImpl("Lesser", 0, 4, 26, 2.500, 3.5, 3.0, 10, 2));
|
||||
Register(new PoisonImpl("Regular", 1, 5, 26, 3.125, 3.5, 3.0, 10, 2));
|
||||
Register(new PoisonImpl("Greater", 2, 6, 26, 6.250, 3.5, 3.0, 10, 2));
|
||||
Register(new PoisonImpl("Deadly", 3, 7, 26, 12.500, 3.5, 4.0, 10, 2));
|
||||
Register(new PoisonImpl("Lethal", 4, 9, 26, 25.000, 3.5, 5.0, 10, 2));
|
||||
}
|
||||
}
|
||||
|
||||
public override int Level { get; }
|
||||
public static Poison IncreaseLevel(Poison oldPoison)
|
||||
{
|
||||
Poison newPoison = oldPoison == null ? null : GetPoison(oldPoison.Level + 1);
|
||||
|
||||
public class PoisonTimer : Timer
|
||||
{
|
||||
private PoisonImpl m_Poison;
|
||||
private Mobile m_Mobile;
|
||||
private int m_LastDamage;
|
||||
private int m_Index;
|
||||
return newPoison ?? oldPoison;
|
||||
}
|
||||
|
||||
public Mobile From { get; set; }
|
||||
public override Timer ConstructTimer(Mobile m)
|
||||
{
|
||||
return new PoisonTimer(m, this);
|
||||
}
|
||||
|
||||
public PoisonTimer( Mobile m, PoisonImpl p ) : base( p.m_Delay, p.m_Interval )
|
||||
{
|
||||
From = m;
|
||||
m_Mobile = m;
|
||||
m_Poison = p;
|
||||
}
|
||||
public class PoisonTimer : Timer
|
||||
{
|
||||
private int m_Index;
|
||||
private int m_LastDamage;
|
||||
private Mobile m_Mobile;
|
||||
private PoisonImpl m_Poison;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( (Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation( m_Mobile, typeof( VampiricEmbraceSpell ) )) ||
|
||||
(m_Poison.Level < 3 && OrangePetals.UnderEffect( m_Mobile )) ||
|
||||
AnimalForm.UnderTransformation( m_Mobile, typeof( Unicorn ) ) )
|
||||
{
|
||||
if ( m_Mobile.CurePoison( m_Mobile ) )
|
||||
{
|
||||
m_Mobile.LocalOverheadMessage( MessageType.Emote, 0x3F, true,
|
||||
"* You feel yourself resisting the effects of the poison *" );
|
||||
public PoisonTimer(Mobile m, PoisonImpl p) : base(p.m_Delay, p.m_Interval)
|
||||
{
|
||||
From = m;
|
||||
m_Mobile = m;
|
||||
m_Poison = p;
|
||||
}
|
||||
|
||||
m_Mobile.NonlocalOverheadMessage( MessageType.Emote, 0x3F, true,
|
||||
$"* {m_Mobile.Name} seems resistant to the poison *");
|
||||
public Mobile From{ get; set; }
|
||||
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (Core.AOS && m_Poison.Level < 4 &&
|
||||
TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell)) ||
|
||||
m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile) ||
|
||||
AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
|
||||
if (m_Mobile.CurePoison(m_Mobile))
|
||||
{
|
||||
m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
|
||||
"* You feel yourself resisting the effects of the poison *");
|
||||
|
||||
if ( m_Index++ == m_Poison.m_Count )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 502136 ); // The poison seems to have worn off.
|
||||
m_Mobile.Poison = null;
|
||||
m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
|
||||
$"* {m_Mobile.Name} seems resistant to the poison *");
|
||||
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
int damage;
|
||||
if (m_Index++ == m_Poison.m_Count)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off.
|
||||
m_Mobile.Poison = null;
|
||||
|
||||
if ( !Core.AOS && m_LastDamage != 0 && Utility.RandomBool() )
|
||||
{
|
||||
damage = m_LastDamage;
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( damage < m_Poison.m_Minimum )
|
||||
damage = m_Poison.m_Minimum;
|
||||
else if ( damage > m_Poison.m_Maximum )
|
||||
damage = m_Poison.m_Maximum;
|
||||
int damage;
|
||||
|
||||
m_LastDamage = damage;
|
||||
}
|
||||
if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
|
||||
{
|
||||
damage = m_LastDamage;
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
|
||||
|
||||
From?.DoHarmful( m_Mobile, true );
|
||||
if (damage < m_Poison.m_Minimum)
|
||||
damage = m_Poison.m_Minimum;
|
||||
else if (damage > m_Poison.m_Maximum)
|
||||
damage = m_Poison.m_Maximum;
|
||||
|
||||
if ( m_Mobile is IHonorTarget honorTarget )
|
||||
honorTarget.ReceivedHonorContext?.OnTargetPoisoned();
|
||||
m_LastDamage = damage;
|
||||
}
|
||||
|
||||
AOS.Damage( m_Mobile, From, damage, 0, 0, 0, 100, 0 );
|
||||
From?.DoHarmful(m_Mobile, true);
|
||||
|
||||
if ( 0.60 <= Utility.RandomDouble() ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
|
||||
m_Mobile.RevealingAction();
|
||||
if (m_Mobile is IHonorTarget honorTarget)
|
||||
honorTarget.ReceivedHonorContext?.OnTargetPoisoned();
|
||||
|
||||
if ( (m_Index % m_Poison.m_MessageInterval) == 0 )
|
||||
m_Mobile.OnPoisoned( From, m_Poison, m_Poison );
|
||||
}
|
||||
}
|
||||
AOS.Damage(m_Mobile, From, damage, 0, 0, 0, 100, 0);
|
||||
|
||||
public override Timer ConstructTimer( Mobile m )
|
||||
{
|
||||
return new PoisonTimer( m, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0.60 <= Utility.RandomDouble()
|
||||
) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
|
||||
m_Mobile.RevealingAction();
|
||||
|
||||
if (m_Index % m_Poison.m_MessageInterval == 0)
|
||||
m_Mobile.OnPoisoned(From, m_Poison, m_Poison);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue