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
|
|
@ -2,32 +2,32 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
public override int DexOffset => 10;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes( 2.0 );
|
||||
public class AgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
[Constructible]
|
||||
public AgilityPotion() : base(PotionEffect.Agility)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public AgilityPotion() : base( PotionEffect.Agility )
|
||||
{
|
||||
}
|
||||
public AgilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public AgilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int DexOffset => 10;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +1,59 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseAgilityPotion : BasePotion
|
||||
{
|
||||
public abstract int DexOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
public abstract class BaseAgilityPotion : BasePotion
|
||||
{
|
||||
public BaseAgilityPotion(PotionEffect effect) : base(0xF08, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseAgilityPotion( PotionEffect effect ) : base( 0xF08, effect )
|
||||
{
|
||||
}
|
||||
public BaseAgilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseAgilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract int DexOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public bool DoAgility( Mobile from )
|
||||
{
|
||||
// TODO: Verify scaled; is it offset, duration, or both?
|
||||
if ( Spells.SpellHelper.AddStatOffset( from, StatType.Dex, Scale( from, DexOffset ), Duration ) )
|
||||
{
|
||||
from.FixedEffect( 0x375A, 10, 15 );
|
||||
from.PlaySound( 0x1E7 );
|
||||
return true;
|
||||
}
|
||||
public bool DoAgility(Mobile from)
|
||||
{
|
||||
// TODO: Verify scaled; is it offset, duration, or both?
|
||||
if (SpellHelper.AddStatOffset(from, StatType.Dex, Scale(from, DexOffset), Duration))
|
||||
{
|
||||
from.FixedEffect(0x375A, 10, 15);
|
||||
from.PlaySound(0x1E7);
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
|
||||
return false;
|
||||
}
|
||||
from.SendLocalizedMessage(502173); // You are already under a similar effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( DoAgility( from ) )
|
||||
{
|
||||
PlayDrinkEffect( from );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (DoAgility(from))
|
||||
{
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,32 +2,32 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterAgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
public override int DexOffset => 20;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes( 2.0 );
|
||||
public class GreaterAgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterAgilityPotion() : base(PotionEffect.AgilityGreater)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterAgilityPotion() : base( PotionEffect.AgilityGreater )
|
||||
{
|
||||
}
|
||||
public GreaterAgilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterAgilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int DexOffset => 20;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,265 +1,265 @@
|
|||
using System;
|
||||
using Server.Engines.Craft;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum PotionEffect
|
||||
{
|
||||
Nightsight,
|
||||
CureLesser,
|
||||
Cure,
|
||||
CureGreater,
|
||||
Agility,
|
||||
AgilityGreater,
|
||||
Strength,
|
||||
StrengthGreater,
|
||||
PoisonLesser,
|
||||
Poison,
|
||||
PoisonGreater,
|
||||
PoisonDeadly,
|
||||
Refresh,
|
||||
RefreshTotal,
|
||||
HealLesser,
|
||||
Heal,
|
||||
HealGreater,
|
||||
ExplosionLesser,
|
||||
Explosion,
|
||||
ExplosionGreater,
|
||||
Conflagration,
|
||||
ConflagrationGreater,
|
||||
MaskOfDeath, // Mask of Death is not available in OSI but does exist in cliloc files
|
||||
MaskOfDeathGreater, // included in enumeration for compatibility if later enabled by OSI
|
||||
ConfusionBlast,
|
||||
ConfusionBlastGreater,
|
||||
Invisibility,
|
||||
Parasitic,
|
||||
Darkglow,
|
||||
}
|
||||
public enum PotionEffect
|
||||
{
|
||||
Nightsight,
|
||||
CureLesser,
|
||||
Cure,
|
||||
CureGreater,
|
||||
Agility,
|
||||
AgilityGreater,
|
||||
Strength,
|
||||
StrengthGreater,
|
||||
PoisonLesser,
|
||||
Poison,
|
||||
PoisonGreater,
|
||||
PoisonDeadly,
|
||||
Refresh,
|
||||
RefreshTotal,
|
||||
HealLesser,
|
||||
Heal,
|
||||
HealGreater,
|
||||
ExplosionLesser,
|
||||
Explosion,
|
||||
ExplosionGreater,
|
||||
Conflagration,
|
||||
ConflagrationGreater,
|
||||
MaskOfDeath, // Mask of Death is not available in OSI but does exist in cliloc files
|
||||
MaskOfDeathGreater, // included in enumeration for compatibility if later enabled by OSI
|
||||
ConfusionBlast,
|
||||
ConfusionBlastGreater,
|
||||
Invisibility,
|
||||
Parasitic,
|
||||
Darkglow
|
||||
}
|
||||
|
||||
public abstract class BasePotion : Item, ICraftable, ICommodity
|
||||
{
|
||||
private PotionEffect m_PotionEffect;
|
||||
public abstract class BasePotion : Item, ICraftable, ICommodity
|
||||
{
|
||||
private PotionEffect m_PotionEffect;
|
||||
|
||||
public PotionEffect PotionEffect
|
||||
{
|
||||
get => m_PotionEffect;
|
||||
set
|
||||
{
|
||||
m_PotionEffect = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
public BasePotion(int itemID, PotionEffect effect) : base(itemID)
|
||||
{
|
||||
m_PotionEffect = effect;
|
||||
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => (Core.ML);
|
||||
Stackable = Core.ML;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041314 + (int)m_PotionEffect;
|
||||
public BasePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BasePotion( int itemID, PotionEffect effect ) : base( itemID )
|
||||
{
|
||||
m_PotionEffect = effect;
|
||||
public PotionEffect PotionEffect
|
||||
{
|
||||
get => m_PotionEffect;
|
||||
set
|
||||
{
|
||||
m_PotionEffect = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
Stackable = Core.ML;
|
||||
Weight = 1.0;
|
||||
}
|
||||
public override int LabelNumber => 1041314 + (int)m_PotionEffect;
|
||||
|
||||
public BasePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public virtual bool RequireFreeHand => true;
|
||||
|
||||
public virtual bool RequireFreeHand => true;
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => Core.ML;
|
||||
|
||||
public static bool HasFreeHand( Mobile m )
|
||||
{
|
||||
Item handOne = m.FindItemOnLayer( Layer.OneHanded );
|
||||
Item handTwo = m.FindItemOnLayer( Layer.TwoHanded );
|
||||
#region ICraftable Members
|
||||
|
||||
if ( handTwo is BaseWeapon )
|
||||
handOne = handTwo;
|
||||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue)
|
||||
{
|
||||
if (craftSystem is DefAlchemy)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if ( handTwo is BaseRanged ranged && ranged.Balanced )
|
||||
return true;
|
||||
if (pack != null)
|
||||
{
|
||||
if ((int)PotionEffect >= (int)PotionEffect.Invisibility)
|
||||
return 1;
|
||||
|
||||
return ( handOne == null || handTwo == null );
|
||||
}
|
||||
List<PotionKeg> kegs = pack.FindItemsByType<PotionKeg>();
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
for (int i = 0; i < kegs.Count; ++i)
|
||||
{
|
||||
PotionKeg keg = kegs[i];
|
||||
|
||||
if ( from.InRange( GetWorldLocation(), 1 ) )
|
||||
{
|
||||
if (!RequireFreeHand || HasFreeHand(from))
|
||||
{
|
||||
if (this is BaseExplosionPotion && Amount > 1)
|
||||
{
|
||||
BasePotion pot = (BasePotion)Activator.CreateInstance(GetType());
|
||||
if (keg == null)
|
||||
continue;
|
||||
|
||||
if (pot != null)
|
||||
{
|
||||
Amount--;
|
||||
if (keg.Held <= 0 || keg.Held >= 100)
|
||||
continue;
|
||||
|
||||
if (from.Backpack != null && !from.Backpack.Deleted)
|
||||
{
|
||||
from.Backpack.DropItem(pot);
|
||||
}
|
||||
else
|
||||
{
|
||||
pot.MoveToWorld(from.Location, from.Map);
|
||||
}
|
||||
pot.Drink( from );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Drink( from );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502138 ); // That is too far away for you to use
|
||||
}
|
||||
}
|
||||
if (keg.Type != PotionEffect)
|
||||
continue;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
++keg.Held;
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
Consume();
|
||||
from.AddToBackpack(new Bottle());
|
||||
|
||||
writer.Write( (int) m_PotionEffect );
|
||||
}
|
||||
return -1; // signal placed in keg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
#endregion
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_PotionEffect = (PotionEffect)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static bool HasFreeHand(Mobile m)
|
||||
{
|
||||
Item handOne = m.FindItemOnLayer(Layer.OneHanded);
|
||||
Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
if ( version == 0 )
|
||||
Stackable = Core.ML;
|
||||
}
|
||||
if (handTwo is BaseWeapon)
|
||||
handOne = handTwo;
|
||||
|
||||
public abstract void Drink( Mobile from );
|
||||
if (handTwo is BaseRanged ranged && ranged.Balanced)
|
||||
return true;
|
||||
|
||||
public static void PlayDrinkEffect( Mobile m )
|
||||
{
|
||||
m.RevealingAction();
|
||||
return handOne == null || handTwo == null;
|
||||
}
|
||||
|
||||
m.PlaySound( 0x2D6 );
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!Movable)
|
||||
return;
|
||||
|
||||
#region Dueling
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( m ) )
|
||||
m.AddToBackpack( new Bottle() );
|
||||
#endregion
|
||||
if (from.InRange(GetWorldLocation(), 1))
|
||||
{
|
||||
if (!RequireFreeHand || HasFreeHand(from))
|
||||
{
|
||||
if (this is BaseExplosionPotion && Amount > 1)
|
||||
{
|
||||
BasePotion pot = (BasePotion)Activator.CreateInstance(GetType());
|
||||
|
||||
if ( m.Body.IsHuman && !m.Mounted )
|
||||
m.Animate( 34, 5, 1, true, false, 0 );
|
||||
}
|
||||
if (pot != null)
|
||||
{
|
||||
Amount--;
|
||||
|
||||
public static int EnhancePotions( Mobile m )
|
||||
{
|
||||
int EP = AosAttributes.GetValue( m, AosAttribute.EnhancePotions );
|
||||
int skillBonus = m.Skills.Alchemy.Fixed / 330 * 10;
|
||||
if (from.Backpack != null && !from.Backpack.Deleted)
|
||||
from.Backpack.DropItem(pot);
|
||||
else
|
||||
pot.MoveToWorld(from.Location, from.Map);
|
||||
pot.Drink(from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Drink(from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502138); // That is too far away for you to use
|
||||
}
|
||||
}
|
||||
|
||||
if ( Core.ML && EP > 50 && m.AccessLevel <= AccessLevel.Player )
|
||||
EP = 50;
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
return ( EP + skillBonus );
|
||||
}
|
||||
writer.Write(1); // version
|
||||
|
||||
public static TimeSpan Scale( Mobile m, TimeSpan v )
|
||||
{
|
||||
if ( !Core.AOS )
|
||||
return v;
|
||||
writer.Write((int)m_PotionEffect);
|
||||
}
|
||||
|
||||
double scalar = 1.0 + ( 0.01 * EnhancePotions( m ) );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
return TimeSpan.FromSeconds( v.TotalSeconds * scalar );
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
|
||||
public static double Scale( Mobile m, double v )
|
||||
{
|
||||
if ( !Core.AOS )
|
||||
return v;
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_PotionEffect = (PotionEffect)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double scalar = 1.0 + ( 0.01 * EnhancePotions( m ) );
|
||||
if (version == 0)
|
||||
Stackable = Core.ML;
|
||||
}
|
||||
|
||||
return v * scalar;
|
||||
}
|
||||
public abstract void Drink(Mobile from);
|
||||
|
||||
public static int Scale( Mobile m, int v )
|
||||
{
|
||||
if ( !Core.AOS )
|
||||
return v;
|
||||
public static void PlayDrinkEffect(Mobile m)
|
||||
{
|
||||
m.RevealingAction();
|
||||
|
||||
return AOS.Scale( v, 100 + EnhancePotions( m ) );
|
||||
}
|
||||
m.PlaySound(0x2D6);
|
||||
|
||||
public override bool StackWith( Mobile from, Item dropped, bool playSound )
|
||||
{
|
||||
return dropped is BasePotion potion && potion.m_PotionEffect == m_PotionEffect &&
|
||||
base.StackWith(from, potion, playSound);
|
||||
}
|
||||
#region Dueling
|
||||
|
||||
#region ICraftable Members
|
||||
if (!DuelContext.IsFreeConsume(m))
|
||||
m.AddToBackpack(new Bottle());
|
||||
|
||||
public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
|
||||
{
|
||||
if ( craftSystem is DefAlchemy )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
#endregion
|
||||
|
||||
if ( pack != null )
|
||||
{
|
||||
if ( (int) PotionEffect >= (int) PotionEffect.Invisibility )
|
||||
return 1;
|
||||
if (m.Body.IsHuman && !m.Mounted)
|
||||
m.Animate(34, 5, 1, true, false, 0);
|
||||
}
|
||||
|
||||
List<PotionKeg> kegs = pack.FindItemsByType<PotionKeg>();
|
||||
public static int EnhancePotions(Mobile m)
|
||||
{
|
||||
int EP = AosAttributes.GetValue(m, AosAttribute.EnhancePotions);
|
||||
int skillBonus = m.Skills.Alchemy.Fixed / 330 * 10;
|
||||
|
||||
for ( int i = 0; i < kegs.Count; ++i )
|
||||
{
|
||||
PotionKeg keg = kegs[i];
|
||||
if (Core.ML && EP > 50 && m.AccessLevel <= AccessLevel.Player)
|
||||
EP = 50;
|
||||
|
||||
if ( keg == null )
|
||||
continue;
|
||||
return EP + skillBonus;
|
||||
}
|
||||
|
||||
if ( keg.Held <= 0 || keg.Held >= 100 )
|
||||
continue;
|
||||
public static TimeSpan Scale(Mobile m, TimeSpan v)
|
||||
{
|
||||
if (!Core.AOS)
|
||||
return v;
|
||||
|
||||
if ( keg.Type != PotionEffect )
|
||||
continue;
|
||||
double scalar = 1.0 + 0.01 * EnhancePotions(m);
|
||||
|
||||
++keg.Held;
|
||||
return TimeSpan.FromSeconds(v.TotalSeconds * scalar);
|
||||
}
|
||||
|
||||
Consume();
|
||||
from.AddToBackpack( new Bottle() );
|
||||
public static double Scale(Mobile m, double v)
|
||||
{
|
||||
if (!Core.AOS)
|
||||
return v;
|
||||
|
||||
return -1; // signal placed in keg
|
||||
}
|
||||
}
|
||||
}
|
||||
double scalar = 1.0 + 0.01 * EnhancePotions(m);
|
||||
|
||||
return 1;
|
||||
}
|
||||
return v * scalar;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
public static int Scale(Mobile m, int v)
|
||||
{
|
||||
if (!Core.AOS)
|
||||
return v;
|
||||
|
||||
return AOS.Scale(v, 100 + EnhancePotions(m));
|
||||
}
|
||||
|
||||
public override bool StackWith(Mobile from, Item dropped, bool playSound)
|
||||
{
|
||||
return dropped is BasePotion potion && potion.m_PotionEffect == m_PotionEffect &&
|
||||
base.StackWith(from, potion, playSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,325 +1,330 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseConflagrationPotion : BasePotion
|
||||
{
|
||||
public abstract int MinDamage{ get; }
|
||||
public abstract int MaxDamage{ get; }
|
||||
public abstract class BaseConflagrationPotion : BasePotion
|
||||
{
|
||||
private List<Mobile> m_Users = new List<Mobile>();
|
||||
|
||||
public override bool RequireFreeHand => false;
|
||||
public BaseConflagrationPotion(PotionEffect effect) : base(0xF06, effect)
|
||||
{
|
||||
Hue = 0x489;
|
||||
}
|
||||
|
||||
public BaseConflagrationPotion( PotionEffect effect ) : base( 0xF06, effect )
|
||||
{
|
||||
Hue = 0x489;
|
||||
}
|
||||
public BaseConflagrationPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseConflagrationPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract int MinDamage{ get; }
|
||||
public abstract int MaxDamage{ get; }
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062725 ); // You can not use that potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
int delay = GetDelay( from );
|
||||
|
||||
if ( delay > 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1072529, $"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
|
||||
return;
|
||||
}
|
||||
|
||||
if ( from.Target is ThrowTarget targ && targ.Potion == this )
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if ( !m_Users.Contains( from ) )
|
||||
m_Users.Add( from );
|
||||
|
||||
from.Target = new ThrowTarget( this );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override bool RequireFreeHand => false;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
|
||||
{
|
||||
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
private List<Mobile> m_Users = new List<Mobile>();
|
||||
int delay = GetDelay(from);
|
||||
|
||||
public void Explode_Callback( object state )
|
||||
{
|
||||
object[] states = (object[]) state;
|
||||
if (delay > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1072529,
|
||||
$"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
|
||||
return;
|
||||
}
|
||||
|
||||
Explode( (Mobile) states[ 0 ], (Point3D) states[ 1 ], (Map) states[ 2 ] );
|
||||
}
|
||||
if (from.Target is ThrowTarget targ && targ.Potion == this)
|
||||
return;
|
||||
|
||||
public virtual void Explode( Mobile from, Point3D loc, Map map )
|
||||
{
|
||||
if ( Deleted || map == null )
|
||||
return;
|
||||
|
||||
Consume();
|
||||
|
||||
// Check if any other players are using this potion
|
||||
for ( int i = 0; i < m_Users.Count; i ++ )
|
||||
{
|
||||
if ( m_Users[ i ].Target is ThrowTarget targ && targ.Potion == this )
|
||||
Target.Cancel( from );
|
||||
}
|
||||
|
||||
// Effects
|
||||
Effects.PlaySound( loc, map, 0x20C );
|
||||
from.RevealingAction();
|
||||
|
||||
for ( int i = -2; i <= 2; i ++ )
|
||||
{
|
||||
for ( int j = -2; j <= 2; j ++ )
|
||||
{
|
||||
Point3D p = new Point3D( loc.X + i, loc.Y + j, loc.Z );
|
||||
if (!m_Users.Contains(from))
|
||||
m_Users.Add(from);
|
||||
|
||||
if ( map.CanFit( p, 12, true, false ) && from.InLOS( p ) )
|
||||
new InternalItem( from, p, map, MinDamage, MaxDamage );
|
||||
}
|
||||
}
|
||||
}
|
||||
from.Target = new ThrowTarget(this);
|
||||
}
|
||||
|
||||
#region Delay
|
||||
private static Hashtable m_Delay = new Hashtable();
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public static void AddDelay( Mobile m )
|
||||
{
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
timer.Stop();
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
m_Delay[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 30 ), new TimerStateCallback( EndDelay_Callback ), m );
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public static int GetDelay( Mobile m )
|
||||
{
|
||||
if ( m_Delay[ m ] is Timer timer && timer.Next > DateTime.UtcNow )
|
||||
return (int) (timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public void Explode_Callback(object state)
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
|
||||
private static void EndDelay_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile mobile )
|
||||
EndDelay( mobile );
|
||||
}
|
||||
Explode((Mobile)states[0], (Point3D)states[1], (Map)states[2]);
|
||||
}
|
||||
|
||||
public static void EndDelay( Mobile m )
|
||||
{
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove( m );
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public virtual void Explode(Mobile from, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted || map == null)
|
||||
return;
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public BaseConflagrationPotion Potion { get; }
|
||||
Consume();
|
||||
|
||||
public ThrowTarget( BaseConflagrationPotion potion ) : base( 12, true, TargetFlags.None )
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
// Check if any other players are using this potion
|
||||
for (int i = 0; i < m_Users.Count; i++)
|
||||
if (m_Users[i].Target is ThrowTarget targ && targ.Potion == this)
|
||||
Target.Cancel(from);
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( Potion.Deleted || Potion.Map == Map.Internal )
|
||||
return;
|
||||
// Effects
|
||||
Effects.PlaySound(loc, map, 0x20C);
|
||||
|
||||
if ( !(targeted is IPoint3D p) || from.Map == null )
|
||||
return;
|
||||
for (int i = -2; i <= 2; i++)
|
||||
for (int j = -2; j <= 2; j++)
|
||||
{
|
||||
Point3D p = new Point3D(loc.X + i, loc.Y + j, loc.Z);
|
||||
|
||||
// Add delay
|
||||
AddDelay( from );
|
||||
if (map.CanFit(p, 12, true, false) && from.InLOS(p))
|
||||
new InternalItem(from, p, map, MinDamage, MaxDamage);
|
||||
}
|
||||
}
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public ThrowTarget(BaseConflagrationPotion potion) : base(12, true, TargetFlags.None)
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
|
||||
from.RevealingAction();
|
||||
public BaseConflagrationPotion Potion{ get; }
|
||||
|
||||
IEntity to;
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Potion.Deleted || Potion.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
if ( p is Mobile mobile )
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
|
||||
if (!(targeted is IPoint3D p) || from.Map == null)
|
||||
return;
|
||||
|
||||
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
|
||||
}
|
||||
}
|
||||
// Add delay
|
||||
AddDelay(from);
|
||||
|
||||
public class InternalItem : Item
|
||||
{
|
||||
private int m_MinDamage;
|
||||
private int m_MaxDamage;
|
||||
private DateTime m_End;
|
||||
private Timer m_Timer;
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
public Mobile From { get; private set; }
|
||||
from.RevealingAction();
|
||||
|
||||
public override bool BlocksFit => true;
|
||||
IEntity to;
|
||||
|
||||
public InternalItem( Mobile from, Point3D loc, Map map, int min, int max ) : base( 0x398C )
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
if (p is Mobile mobile)
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity(Serial.Zero, new Point3D(p), from.Map);
|
||||
|
||||
MoveToWorld( loc, map );
|
||||
Effects.SendMovingEffect(from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.5), new TimerStateCallback(Potion.Explode_Callback),
|
||||
new object[] { from, new Point3D(p), from.Map });
|
||||
}
|
||||
}
|
||||
|
||||
From = from;
|
||||
m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10 );
|
||||
public class InternalItem : Item
|
||||
{
|
||||
private DateTime m_End;
|
||||
private int m_MaxDamage;
|
||||
private int m_MinDamage;
|
||||
private Timer m_Timer;
|
||||
|
||||
SetDamage( min, max );
|
||||
public InternalItem(Mobile from, Point3D loc, Map map, int min, int max) : base(0x398C)
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
m_Timer = new InternalTimer( this, m_End );
|
||||
m_Timer.Start();
|
||||
}
|
||||
MoveToWorld(loc, map);
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
From = from;
|
||||
m_End = DateTime.UtcNow + TimeSpan.FromSeconds(10);
|
||||
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
SetDamage(min, max);
|
||||
|
||||
public InternalItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
m_Timer = new InternalTimer(this, m_End);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public int GetDamage(){ return Utility.RandomMinMax( m_MinDamage, m_MaxDamage ); }
|
||||
public InternalItem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private void SetDamage( int min, int max )
|
||||
{
|
||||
/* new way to apply alchemy bonus according to Stratics' calculator.
|
||||
this gives a mean to values 25, 50, 75 and 100. Stratics' calculator is outdated.
|
||||
Those goals will give 2 to alchemy bonus. It's not really OSI-like but it's an approximation. */
|
||||
public Mobile From{ get; private set; }
|
||||
|
||||
m_MinDamage = min;
|
||||
m_MaxDamage = max;
|
||||
public override bool BlocksFit => true;
|
||||
|
||||
if ( From == null )
|
||||
return;
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
int alchemySkill = From.Skills.Alchemy.Fixed;
|
||||
int alchemyBonus = alchemySkill / 125 + alchemySkill / 250 ;
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
m_MinDamage = Scale( From, m_MinDamage + alchemyBonus );
|
||||
m_MaxDamage = Scale( From, m_MaxDamage + alchemyBonus );
|
||||
}
|
||||
public int GetDamage()
|
||||
{
|
||||
return Utility.RandomMinMax(m_MinDamage, m_MaxDamage);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
private void SetDamage(int min, int max)
|
||||
{
|
||||
/* new way to apply alchemy bonus according to Stratics' calculator.
|
||||
this gives a mean to values 25, 50, 75 and 100. Stratics' calculator is outdated.
|
||||
Those goals will give 2 to alchemy bonus. It's not really OSI-like but it's an approximation. */
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
m_MinDamage = min;
|
||||
m_MaxDamage = max;
|
||||
|
||||
writer.Write( (Mobile) From );
|
||||
writer.Write( (DateTime) m_End );
|
||||
writer.Write( (int) m_MinDamage );
|
||||
writer.Write( (int) m_MaxDamage );
|
||||
}
|
||||
if (From == null)
|
||||
return;
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int alchemySkill = From.Skills.Alchemy.Fixed;
|
||||
int alchemyBonus = alchemySkill / 125 + alchemySkill / 250;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
m_MinDamage = Scale(From, m_MinDamage + alchemyBonus);
|
||||
m_MaxDamage = Scale(From, m_MaxDamage + alchemyBonus);
|
||||
}
|
||||
|
||||
From = reader.ReadMobile();
|
||||
m_End = reader.ReadDateTime();
|
||||
m_MinDamage = reader.ReadInt();
|
||||
m_MaxDamage = reader.ReadInt();
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
m_Timer = new InternalTimer( this, m_End );
|
||||
m_Timer.Start();
|
||||
}
|
||||
writer.Write(0); // version
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( Visible && From != null && (!Core.AOS || m != From) && SpellHelper.ValidIndirectTarget( From, m ) && From.CanBeHarmful( m, false ) )
|
||||
{
|
||||
From.DoHarmful( m );
|
||||
writer.Write(From);
|
||||
writer.Write(m_End);
|
||||
writer.Write(m_MinDamage);
|
||||
writer.Write(m_MaxDamage);
|
||||
}
|
||||
|
||||
AOS.Damage( m, From, GetDamage(), 0, 100, 0, 0, 0 );
|
||||
m.PlaySound( 0x208 );
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
return true;
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private InternalItem m_Item;
|
||||
private DateTime m_End;
|
||||
From = reader.ReadMobile();
|
||||
m_End = reader.ReadDateTime();
|
||||
m_MinDamage = reader.ReadInt();
|
||||
m_MaxDamage = reader.ReadInt();
|
||||
|
||||
public InternalTimer( InternalItem item, DateTime end ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_Item = item;
|
||||
m_End = end;
|
||||
m_Timer = new InternalTimer(this, m_End);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Visible && From != null && (!Core.AOS || m != From) && SpellHelper.ValidIndirectTarget(From, m) &&
|
||||
From.CanBeHarmful(m, false))
|
||||
{
|
||||
From.DoHarmful(m);
|
||||
|
||||
AOS.Damage(m, From, GetDamage(), 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
}
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_Item.Deleted )
|
||||
return;
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private DateTime m_End;
|
||||
private InternalItem m_Item;
|
||||
|
||||
if ( DateTime.UtcNow > m_End )
|
||||
{
|
||||
m_Item.Delete();
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile from = m_Item.From;
|
||||
public InternalTimer(InternalItem item, DateTime end) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Item = item;
|
||||
m_End = end;
|
||||
|
||||
if ( m_Item.Map == null || from == null )
|
||||
return;
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
|
||||
List<Mobile> mobiles = new List<Mobile>();
|
||||
|
||||
foreach( Mobile mobile in m_Item.GetMobilesInRange( 0 ) )
|
||||
mobiles.Add( mobile );
|
||||
|
||||
for( int i = 0; i < mobiles.Count; i++ )
|
||||
{
|
||||
Mobile m = mobiles[i];
|
||||
|
||||
if ( (m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != from) && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
|
||||
{
|
||||
from?.DoHarmful( m );
|
||||
|
||||
AOS.Damage( m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0 );
|
||||
m.PlaySound( 0x208 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if (DateTime.UtcNow > m_End)
|
||||
{
|
||||
m_Item.Delete();
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile from = m_Item.From;
|
||||
|
||||
if (m_Item.Map == null || from == null)
|
||||
return;
|
||||
|
||||
List<Mobile> mobiles = new List<Mobile>();
|
||||
|
||||
foreach (Mobile mobile in m_Item.GetMobilesInRange(0))
|
||||
mobiles.Add(mobile);
|
||||
|
||||
for (int i = 0; i < mobiles.Count; i++)
|
||||
{
|
||||
Mobile m = mobiles[i];
|
||||
|
||||
if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && (!Core.AOS || m != from) &&
|
||||
SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false))
|
||||
{
|
||||
from?.DoHarmful(m);
|
||||
|
||||
AOS.Damage(m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Delay
|
||||
|
||||
private static Hashtable m_Delay = new Hashtable();
|
||||
|
||||
public static void AddDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay[m] is Timer timer)
|
||||
timer.Stop();
|
||||
|
||||
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(30), new TimerStateCallback(EndDelay_Callback), m);
|
||||
}
|
||||
|
||||
public static int GetDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay[m] is Timer timer && timer.Next > DateTime.UtcNow)
|
||||
return (int)(timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void EndDelay_Callback(object obj)
|
||||
{
|
||||
if (obj is Mobile mobile)
|
||||
EndDelay(mobile);
|
||||
}
|
||||
|
||||
public static void EndDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay[m] is Timer timer)
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ConflagrationPotion : BaseConflagrationPotion
|
||||
{
|
||||
public override int MinDamage => 2;
|
||||
public override int MaxDamage => 4;
|
||||
public class ConflagrationPotion : BaseConflagrationPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ConflagrationPotion() : base(PotionEffect.Conflagration)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072095; // a Conflagration potion
|
||||
public ConflagrationPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ConflagrationPotion() : base( PotionEffect.Conflagration )
|
||||
{
|
||||
}
|
||||
public override int MinDamage => 2;
|
||||
public override int MaxDamage => 4;
|
||||
|
||||
public ConflagrationPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1072095; // a Conflagration potion
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterConflagrationPotion : BaseConflagrationPotion
|
||||
{
|
||||
public override int MinDamage => 4;
|
||||
public override int MaxDamage => 8;
|
||||
public class GreaterConflagrationPotion : BaseConflagrationPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterConflagrationPotion() : base(PotionEffect.ConflagrationGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072098; // a Greater Conflagration potion
|
||||
public GreaterConflagrationPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterConflagrationPotion() : base( PotionEffect.ConflagrationGreater )
|
||||
{
|
||||
}
|
||||
public override int MinDamage => 4;
|
||||
public override int MaxDamage => 8;
|
||||
|
||||
public GreaterConflagrationPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1072098; // a Greater Conflagration potion
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,195 +1,197 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
using Server.Spells;
|
||||
using Server.Mobiles;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseConfusionBlastPotion : BasePotion
|
||||
{
|
||||
public abstract int Radius{ get; }
|
||||
public abstract class BaseConfusionBlastPotion : BasePotion
|
||||
{
|
||||
private List<Mobile> m_Users = new List<Mobile>();
|
||||
|
||||
public override bool RequireFreeHand => false;
|
||||
public BaseConfusionBlastPotion(PotionEffect effect) : base(0xF06, effect)
|
||||
{
|
||||
Hue = 0x48D;
|
||||
}
|
||||
|
||||
public BaseConfusionBlastPotion( PotionEffect effect ) : base( 0xF06, effect )
|
||||
{
|
||||
Hue = 0x48D;
|
||||
}
|
||||
public BaseConfusionBlastPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseConfusionBlastPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract int Radius{ get; }
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062725 ); // You can not use that potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
public override bool RequireFreeHand => false;
|
||||
|
||||
int delay = GetDelay( from );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
|
||||
{
|
||||
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( delay > 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1072529, $"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
|
||||
return;
|
||||
}
|
||||
int delay = GetDelay(from);
|
||||
|
||||
if ( from.Target is ThrowTarget targ && targ.Potion == this )
|
||||
return;
|
||||
if (delay > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1072529,
|
||||
$"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
|
||||
return;
|
||||
}
|
||||
|
||||
from.RevealingAction();
|
||||
if (from.Target is ThrowTarget targ && targ.Potion == this)
|
||||
return;
|
||||
|
||||
if ( !m_Users.Contains( from ) )
|
||||
m_Users.Add( from );
|
||||
from.RevealingAction();
|
||||
|
||||
from.Target = new ThrowTarget( this );
|
||||
}
|
||||
if (!m_Users.Contains(from))
|
||||
m_Users.Add(from);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
from.Target = new ThrowTarget(this);
|
||||
}
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
private List<Mobile> m_Users = new List<Mobile>();
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void Explode_Callback( object state )
|
||||
{
|
||||
object[] states = (object[]) state;
|
||||
public void Explode_Callback(object state)
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
|
||||
Explode( (Mobile) states[ 0 ], (Point3D) states[ 1 ], (Map) states[ 2 ] );
|
||||
}
|
||||
Explode((Mobile)states[0], (Point3D)states[1], (Map)states[2]);
|
||||
}
|
||||
|
||||
public virtual void Explode( Mobile from, Point3D loc, Map map )
|
||||
{
|
||||
if ( Deleted || map == null )
|
||||
return;
|
||||
public virtual void Explode(Mobile from, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted || map == null)
|
||||
return;
|
||||
|
||||
Consume();
|
||||
Consume();
|
||||
|
||||
// Check if any other players are using this potion
|
||||
for ( int i = 0; i < m_Users.Count; i ++ )
|
||||
{
|
||||
if ( m_Users[ i ].Target is ThrowTarget targ && targ.Potion == this )
|
||||
Target.Cancel( from );
|
||||
}
|
||||
// Check if any other players are using this potion
|
||||
for (int i = 0; i < m_Users.Count; i++)
|
||||
if (m_Users[i].Target is ThrowTarget targ && targ.Potion == this)
|
||||
Target.Cancel(from);
|
||||
|
||||
// Effects
|
||||
Effects.PlaySound( loc, map, 0x207 );
|
||||
// Effects
|
||||
Effects.PlaySound(loc, map, 0x207);
|
||||
|
||||
Geometry.Circle2D( loc, map, Radius, BlastEffect, 270, 90 );
|
||||
Geometry.Circle2D(loc, map, Radius, BlastEffect, 270, 90);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.3 ), new TimerStateCallback( CircleEffect2 ), new object[] { loc, map } );
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map });
|
||||
|
||||
foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
|
||||
{
|
||||
if ( mobile is BaseCreature mon )
|
||||
{
|
||||
if ( mon.Controlled || mon.Summoned )
|
||||
continue;
|
||||
foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
|
||||
if (mobile is BaseCreature mon)
|
||||
{
|
||||
if (mon.Controlled || mon.Summoned)
|
||||
continue;
|
||||
|
||||
mon.Pacify( from, DateTime.UtcNow + TimeSpan.FromSeconds( 5.0 ) ); // TODO check
|
||||
}
|
||||
}
|
||||
}
|
||||
mon.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(5.0)); // TODO check
|
||||
}
|
||||
}
|
||||
|
||||
#region Effects
|
||||
public virtual void BlastEffect( Point3D p, Map map )
|
||||
{
|
||||
if ( map.CanFit( p, 12, true, false ) )
|
||||
Effects.SendLocationEffect( p, map, 0x376A, 4, 9 );
|
||||
}
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public ThrowTarget(BaseConfusionBlastPotion potion) : base(12, true, TargetFlags.None)
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
|
||||
public void CircleEffect2( object state )
|
||||
{
|
||||
object[] states = (object[]) state;
|
||||
public BaseConfusionBlastPotion Potion{ get; }
|
||||
|
||||
Geometry.Circle2D( (Point3D)states[0], (Map)states[1], Radius, BlastEffect, 90, 270 );
|
||||
}
|
||||
#endregion
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Potion.Deleted || Potion.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
#region Delay
|
||||
private static Hashtable m_Delay = new Hashtable();
|
||||
if (!(targeted is IPoint3D p) || from.Map == null)
|
||||
return;
|
||||
|
||||
public static void AddDelay( Mobile m )
|
||||
{
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
timer.Stop();
|
||||
// Add delay
|
||||
AddDelay(from);
|
||||
|
||||
m_Delay[ m ] = Timer.DelayCall( TimeSpan.FromSeconds( 60 ), new TimerStateCallback( EndDelay_Callback ), m );
|
||||
}
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
public static int GetDelay( Mobile m )
|
||||
{
|
||||
if ( m_Delay[ m ] is Timer timer && timer.Next > DateTime.UtcNow )
|
||||
return (int) (timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
from.RevealingAction();
|
||||
|
||||
return 0;
|
||||
}
|
||||
IEntity to;
|
||||
|
||||
private static void EndDelay_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile mobile )
|
||||
EndDelay( mobile );
|
||||
}
|
||||
if (p is Mobile mobile)
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity(Serial.Zero, new Point3D(p), from.Map);
|
||||
|
||||
public static void EndDelay( Mobile m )
|
||||
{
|
||||
if ( m_Delay[ m ] is Timer timer )
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove( m );
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
Effects.SendMovingEffect(from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(Potion.Explode_Callback),
|
||||
new object[] { from, new Point3D(p), from.Map });
|
||||
}
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public BaseConfusionBlastPotion Potion { get; }
|
||||
#region Effects
|
||||
|
||||
public ThrowTarget( BaseConfusionBlastPotion potion ) : base( 12, true, TargetFlags.None )
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
public virtual void BlastEffect(Point3D p, Map map)
|
||||
{
|
||||
if (map.CanFit(p, 12, true, false))
|
||||
Effects.SendLocationEffect(p, map, 0x376A, 4, 9);
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( Potion.Deleted || Potion.Map == Map.Internal )
|
||||
return;
|
||||
public void CircleEffect2(object state)
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
|
||||
if ( !(targeted is IPoint3D p) || from.Map == null )
|
||||
return;
|
||||
Geometry.Circle2D((Point3D)states[0], (Map)states[1], Radius, BlastEffect, 90, 270);
|
||||
}
|
||||
|
||||
// Add delay
|
||||
AddDelay( from );
|
||||
#endregion
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
#region Delay
|
||||
|
||||
from.RevealingAction();
|
||||
private static Hashtable m_Delay = new Hashtable();
|
||||
|
||||
IEntity to;
|
||||
public static void AddDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay[m] is Timer timer)
|
||||
timer.Stop();
|
||||
|
||||
if ( p is Mobile mobile )
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
|
||||
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(60), new TimerStateCallback(EndDelay_Callback), m);
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int GetDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay[m] is Timer timer && timer.Next > DateTime.UtcNow)
|
||||
return (int)(timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void EndDelay_Callback(object obj)
|
||||
{
|
||||
if (obj is Mobile mobile)
|
||||
EndDelay(mobile);
|
||||
}
|
||||
|
||||
public static void EndDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay[m] is Timer timer)
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ConfusionBlastPotion : BaseConfusionBlastPotion
|
||||
{
|
||||
public override int Radius => 5;
|
||||
public class ConfusionBlastPotion : BaseConfusionBlastPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ConfusionBlastPotion() : base(PotionEffect.ConfusionBlast)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072105; // a Confusion Blast potion
|
||||
public ConfusionBlastPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ConfusionBlastPotion() : base( PotionEffect.ConfusionBlast )
|
||||
{
|
||||
}
|
||||
public override int Radius => 5;
|
||||
|
||||
public ConfusionBlastPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1072105; // a Confusion Blast potion
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterConfusionBlastPotion : BaseConfusionBlastPotion
|
||||
{
|
||||
public override int Radius => 7;
|
||||
public class GreaterConfusionBlastPotion : BaseConfusionBlastPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterConfusionBlastPotion() : base(PotionEffect.ConfusionBlastGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072108; // a Greater Confusion Blast potion
|
||||
public GreaterConfusionBlastPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterConfusionBlastPotion() : base( PotionEffect.ConfusionBlastGreater )
|
||||
{
|
||||
}
|
||||
public override int Radius => 7;
|
||||
|
||||
public GreaterConfusionBlastPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1072108; // a Greater Confusion Blast potion
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,98 +1,100 @@
|
|||
using Server.Engines.ConPVP;
|
||||
using Server.Spells;
|
||||
using Server.Spells.Necromancy;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CureLevelInfo
|
||||
{
|
||||
public Poison Poison { get; }
|
||||
public class CureLevelInfo
|
||||
{
|
||||
public CureLevelInfo(Poison poison, double chance)
|
||||
{
|
||||
Poison = poison;
|
||||
Chance = chance;
|
||||
}
|
||||
|
||||
public double Chance { get; }
|
||||
public Poison Poison{ get; }
|
||||
|
||||
public CureLevelInfo( Poison poison, double chance )
|
||||
{
|
||||
Poison = poison;
|
||||
Chance = chance;
|
||||
}
|
||||
}
|
||||
public double Chance{ get; }
|
||||
}
|
||||
|
||||
public abstract class BaseCurePotion : BasePotion
|
||||
{
|
||||
public abstract CureLevelInfo[] LevelInfo{ get; }
|
||||
public abstract class BaseCurePotion : BasePotion
|
||||
{
|
||||
public BaseCurePotion(PotionEffect effect) : base(0xF07, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseCurePotion( PotionEffect effect ) : base( 0xF07, effect )
|
||||
{
|
||||
}
|
||||
public BaseCurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseCurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract CureLevelInfo[] LevelInfo{ get; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoCure( Mobile from )
|
||||
{
|
||||
bool cure = false;
|
||||
public void DoCure(Mobile from)
|
||||
{
|
||||
bool cure = false;
|
||||
|
||||
CureLevelInfo[] info = LevelInfo;
|
||||
CureLevelInfo[] info = LevelInfo;
|
||||
|
||||
for ( int i = 0; i < info.Length; ++i )
|
||||
{
|
||||
CureLevelInfo li = info[i];
|
||||
for (int i = 0; i < info.Length; ++i)
|
||||
{
|
||||
CureLevelInfo li = info[i];
|
||||
|
||||
if ( li.Poison == from.Poison && Scale( from, li.Chance ) > Utility.RandomDouble() )
|
||||
{
|
||||
cure = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (li.Poison == from.Poison && Scale(from, li.Chance) > Utility.RandomDouble())
|
||||
{
|
||||
cure = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cure && from.CurePoison( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500231 ); // You feel cured of poison!
|
||||
if (cure && from.CurePoison(from))
|
||||
{
|
||||
from.SendLocalizedMessage(500231); // You feel cured of poison!
|
||||
|
||||
from.FixedEffect( 0x373A, 10, 15 );
|
||||
from.PlaySound( 0x1E0 );
|
||||
}
|
||||
else if ( !cure )
|
||||
{
|
||||
from.SendLocalizedMessage( 500232 ); // That potion was not strong enough to cure your ailment!
|
||||
}
|
||||
}
|
||||
from.FixedEffect(0x373A, 10, 15);
|
||||
from.PlaySound(0x1E0);
|
||||
}
|
||||
else if (!cure)
|
||||
{
|
||||
from.SendLocalizedMessage(500232); // That potion was not strong enough to cure your ailment!
|
||||
}
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( TransformationSpellHelper.UnderTransformation( from, typeof( Spells.Necromancy.VampiricEmbraceSpell ) ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1061652 ); // The garlic in the potion would surely kill you.
|
||||
}
|
||||
else if ( from.Poisoned )
|
||||
{
|
||||
DoCure( from );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (TransformationSpellHelper.UnderTransformation(from, typeof(VampiricEmbraceSpell)))
|
||||
{
|
||||
from.SendLocalizedMessage(1061652); // The garlic in the potion would surely kill you.
|
||||
}
|
||||
else if (from.Poisoned)
|
||||
{
|
||||
DoCure(from);
|
||||
|
||||
PlayDrinkEffect( from );
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
from.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
|
||||
from.PlaySound( 0x1E0 );
|
||||
from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
|
||||
from.PlaySound(0x1E0);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042000 ); // You are not poisoned.
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042000); // You are not poisoned.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +1,47 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class CurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo = {
|
||||
new CureLevelInfo( Poison.Lesser, 1.00 ), // 100% chance to cure lesser poison
|
||||
new CureLevelInfo( Poison.Regular, 0.75 ), // 75% chance to cure regular poison
|
||||
new CureLevelInfo( Poison.Greater, 0.50 ), // 50% chance to cure greater poison
|
||||
new CureLevelInfo( Poison.Deadly, 0.15 ) // 15% chance to cure deadly poison
|
||||
};
|
||||
public class CurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
|
||||
new CureLevelInfo(Poison.Regular, 0.75), // 75% chance to cure regular poison
|
||||
new CureLevelInfo(Poison.Greater, 0.50), // 50% chance to cure greater poison
|
||||
new CureLevelInfo(Poison.Deadly, 0.15) // 15% chance to cure deadly poison
|
||||
};
|
||||
|
||||
private static CureLevelInfo[] m_AosLevelInfo = {
|
||||
new CureLevelInfo( Poison.Lesser, 1.00 ),
|
||||
new CureLevelInfo( Poison.Regular, 0.95 ),
|
||||
new CureLevelInfo( Poison.Greater, 0.75 ),
|
||||
new CureLevelInfo( Poison.Deadly, 0.50 ),
|
||||
new CureLevelInfo( Poison.Lethal, 0.25 )
|
||||
};
|
||||
private static CureLevelInfo[] m_AosLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00),
|
||||
new CureLevelInfo(Poison.Regular, 0.95),
|
||||
new CureLevelInfo(Poison.Greater, 0.75),
|
||||
new CureLevelInfo(Poison.Deadly, 0.50),
|
||||
new CureLevelInfo(Poison.Lethal, 0.25)
|
||||
};
|
||||
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
[Constructible]
|
||||
public CurePotion() : base(PotionEffect.Cure)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public CurePotion() : base( PotionEffect.Cure )
|
||||
{
|
||||
}
|
||||
public CurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public CurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +1,48 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo = {
|
||||
new CureLevelInfo( Poison.Lesser, 1.00 ), // 100% chance to cure lesser poison
|
||||
new CureLevelInfo( Poison.Regular, 1.00 ), // 100% chance to cure regular poison
|
||||
new CureLevelInfo( Poison.Greater, 1.00 ), // 100% chance to cure greater poison
|
||||
new CureLevelInfo( Poison.Deadly, 0.75 ), // 75% chance to cure deadly poison
|
||||
new CureLevelInfo( Poison.Lethal, 0.25 ) // 25% chance to cure lethal poison
|
||||
};
|
||||
public class GreaterCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
|
||||
new CureLevelInfo(Poison.Regular, 1.00), // 100% chance to cure regular poison
|
||||
new CureLevelInfo(Poison.Greater, 1.00), // 100% chance to cure greater poison
|
||||
new CureLevelInfo(Poison.Deadly, 0.75), // 75% chance to cure deadly poison
|
||||
new CureLevelInfo(Poison.Lethal, 0.25) // 25% chance to cure lethal poison
|
||||
};
|
||||
|
||||
private static CureLevelInfo[] m_AosLevelInfo = {
|
||||
new CureLevelInfo( Poison.Lesser, 1.00 ),
|
||||
new CureLevelInfo( Poison.Regular, 1.00 ),
|
||||
new CureLevelInfo( Poison.Greater, 1.00 ),
|
||||
new CureLevelInfo( Poison.Deadly, 0.95 ),
|
||||
new CureLevelInfo( Poison.Lethal, 0.75 )
|
||||
};
|
||||
private static CureLevelInfo[] m_AosLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00),
|
||||
new CureLevelInfo(Poison.Regular, 1.00),
|
||||
new CureLevelInfo(Poison.Greater, 1.00),
|
||||
new CureLevelInfo(Poison.Deadly, 0.95),
|
||||
new CureLevelInfo(Poison.Lethal, 0.75)
|
||||
};
|
||||
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
[Constructible]
|
||||
public GreaterCurePotion() : base(PotionEffect.CureGreater)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterCurePotion() : base( PotionEffect.CureGreater )
|
||||
{
|
||||
}
|
||||
public GreaterCurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterCurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +1,44 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo = {
|
||||
new CureLevelInfo( Poison.Lesser, 0.75 ), // 75% chance to cure lesser poison
|
||||
new CureLevelInfo( Poison.Regular, 0.50 ), // 50% chance to cure regular poison
|
||||
new CureLevelInfo( Poison.Greater, 0.15 ) // 15% chance to cure greater poison
|
||||
};
|
||||
public class LesserCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 0.75), // 75% chance to cure lesser poison
|
||||
new CureLevelInfo(Poison.Regular, 0.50), // 50% chance to cure regular poison
|
||||
new CureLevelInfo(Poison.Greater, 0.15) // 15% chance to cure greater poison
|
||||
};
|
||||
|
||||
private static CureLevelInfo[] m_AosLevelInfo = {
|
||||
new CureLevelInfo( Poison.Lesser, 0.75 ),
|
||||
new CureLevelInfo( Poison.Regular, 0.50 ),
|
||||
new CureLevelInfo( Poison.Greater, 0.25 )
|
||||
};
|
||||
private static CureLevelInfo[] m_AosLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 0.75),
|
||||
new CureLevelInfo(Poison.Regular, 0.50),
|
||||
new CureLevelInfo(Poison.Greater, 0.25)
|
||||
};
|
||||
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
[Constructible]
|
||||
public LesserCurePotion() : base(PotionEffect.CureLesser)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public LesserCurePotion() : base( PotionEffect.CureLesser )
|
||||
{
|
||||
}
|
||||
public LesserCurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserCurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +1,36 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class DarkglowPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison => Poison.Greater; /* MUST be restored when prerequisites are done */
|
||||
public class DarkglowPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public DarkglowPotion() : base(PotionEffect.Darkglow)
|
||||
{
|
||||
Hue = 0x96;
|
||||
}
|
||||
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
public DarkglowPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072849; // Darkglow Poison
|
||||
public override Poison Poison => Poison.Greater; /* MUST be restored when prerequisites are done */
|
||||
|
||||
[Constructible]
|
||||
public DarkglowPotion() : base( PotionEffect.Darkglow )
|
||||
{
|
||||
Hue = 0x96;
|
||||
}
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public DarkglowPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1072849; // Darkglow Poison
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,286 +1,287 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseExplosionPotion : BasePotion
|
||||
{
|
||||
public abstract int MinDamage { get; }
|
||||
public abstract int MaxDamage { get; }
|
||||
public abstract class BaseExplosionPotion : BasePotion
|
||||
{
|
||||
private const int ExplosionRange = 2; // How long is the blast radius?
|
||||
|
||||
public override bool RequireFreeHand => false;
|
||||
private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
|
||||
private static bool InstantExplosion = false; // Should explosion potions explode on impact?
|
||||
private static bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
|
||||
|
||||
private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
|
||||
private static bool InstantExplosion = false; // Should explosion potions explode on impact?
|
||||
private static bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
|
||||
private const int ExplosionRange = 2; // How long is the blast radius?
|
||||
private Timer m_Timer;
|
||||
|
||||
public BaseExplosionPotion( PotionEffect effect ) : base( 0xF0D, effect )
|
||||
{
|
||||
}
|
||||
public BaseExplosionPotion(PotionEffect effect) : base(0xF0D, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public BaseExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public abstract int MinDamage{ get; }
|
||||
public abstract int MaxDamage{ get; }
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
public override bool RequireFreeHand => false;
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual object FindParent( Mobile from )
|
||||
{
|
||||
Mobile m = HeldBy;
|
||||
|
||||
if ( m != null && m.Holding == this )
|
||||
return m;
|
||||
|
||||
object obj = RootParent;
|
||||
|
||||
if ( obj != null )
|
||||
return obj;
|
||||
|
||||
if ( Map == Map.Internal )
|
||||
return from;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
public List<Mobile> Users { get; private set; }
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062725 ); // You can not use a purple potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
|
||||
|
||||
if ( targ != null && targ.Potion == this )
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if ( Users == null )
|
||||
Users = new List<Mobile>();
|
||||
|
||||
if ( !Users.Contains( from ) )
|
||||
Users.Add( from );
|
||||
public List<Mobile> Users{ get; private set; }
|
||||
|
||||
from.Target = new ThrowTarget( this );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
if ( m_Timer == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 500236 ); // You should throw it now!
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
if ( Core.ML )
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 5, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 3.6 seconds explosion delay
|
||||
else
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 2.6 seconds explosion delay
|
||||
}
|
||||
}
|
||||
public virtual object FindParent(Mobile from)
|
||||
{
|
||||
Mobile m = HeldBy;
|
||||
|
||||
if (m != null && m.Holding == this)
|
||||
return m;
|
||||
|
||||
object obj = RootParent;
|
||||
|
||||
if (obj != null)
|
||||
return obj;
|
||||
|
||||
private void Detonate_OnTick( object state )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
int timer = (int)states[1];
|
||||
|
||||
object parent = FindParent( from );
|
||||
if (Map == Map.Internal)
|
||||
return from;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
|
||||
{
|
||||
from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
|
||||
|
||||
if (targ != null && targ.Potion == this)
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if (Users == null)
|
||||
Users = new List<Mobile>();
|
||||
|
||||
if (!Users.Contains(from))
|
||||
Users.Add(from);
|
||||
|
||||
if ( timer == 0 )
|
||||
{
|
||||
Point3D loc;
|
||||
Map map;
|
||||
from.Target = new ThrowTarget(this);
|
||||
|
||||
if ( parent is Item item )
|
||||
{
|
||||
loc = item.GetWorldLocation();
|
||||
map = item.Map;
|
||||
}
|
||||
else if ( parent is Mobile m )
|
||||
{
|
||||
loc = m.Location;
|
||||
map = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_Timer == null)
|
||||
{
|
||||
from.SendLocalizedMessage(500236); // You should throw it now!
|
||||
|
||||
Explode( from, true, loc, map );
|
||||
m_Timer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( parent is Item item )
|
||||
item.PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
else if ( parent is Mobile mobile )
|
||||
mobile.PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
if (Core.ML)
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5,
|
||||
new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4,
|
||||
new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay
|
||||
}
|
||||
}
|
||||
|
||||
states[1] = timer - 1;
|
||||
}
|
||||
}
|
||||
private void Detonate_OnTick(object state)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
int timer = (int)states[1];
|
||||
|
||||
private void Reposition_OnTick( object state )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
object parent = FindParent(from);
|
||||
|
||||
if (timer == 0)
|
||||
{
|
||||
Point3D loc;
|
||||
Map map;
|
||||
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
IPoint3D p = (IPoint3D)states[1];
|
||||
Map map = (Map)states[2];
|
||||
|
||||
Point3D loc = new Point3D( p );
|
||||
|
||||
if ( InstantExplosion )
|
||||
Explode( from, true, loc, map );
|
||||
else
|
||||
MoveToWorld( loc, map );
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public BaseExplosionPotion Potion { get; }
|
||||
|
||||
public ThrowTarget( BaseExplosionPotion potion ) : base( 12, true, TargetFlags.None )
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
if (parent is Item item)
|
||||
{
|
||||
loc = item.GetWorldLocation();
|
||||
map = item.Map;
|
||||
}
|
||||
else if (parent is Mobile m)
|
||||
{
|
||||
loc = m.Location;
|
||||
map = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Explode(from, true, loc, map);
|
||||
m_Timer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parent is Item item)
|
||||
item.PublicOverheadMessage(MessageType.Regular, 0x22, false, timer.ToString());
|
||||
else if (parent is Mobile mobile)
|
||||
mobile.PublicOverheadMessage(MessageType.Regular, 0x22, false, timer.ToString());
|
||||
|
||||
states[1] = timer - 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void Reposition_OnTick(object state)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
IPoint3D p = (IPoint3D)states[1];
|
||||
Map map = (Map)states[2];
|
||||
|
||||
Point3D loc = new Point3D(p);
|
||||
|
||||
if (InstantExplosion)
|
||||
Explode(from, true, loc, map);
|
||||
else
|
||||
MoveToWorld(loc, map);
|
||||
}
|
||||
|
||||
public void Explode(Mobile from, bool direct, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
Consume();
|
||||
|
||||
for (int i = 0; Users != null && i < Users.Count; ++i)
|
||||
{
|
||||
Mobile m = Users[i];
|
||||
|
||||
if (m.Target is ThrowTarget targ && targ.Potion == this)
|
||||
Target.Cancel(m);
|
||||
}
|
||||
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
Effects.PlaySound(loc, map, 0x307);
|
||||
|
||||
Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
|
||||
int alchemyBonus = 0;
|
||||
|
||||
if (direct)
|
||||
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
|
||||
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInRange(loc, ExplosionRange, LeveledExplosion, true);
|
||||
List<IEntity> toExplode = new List<IEntity>();
|
||||
|
||||
int toDamage = 0;
|
||||
|
||||
foreach (IEntity o in eable)
|
||||
if (o is Mobile mobile && (from == null ||
|
||||
SpellHelper.ValidIndirectTarget(from, mobile) &&
|
||||
from.CanBeHarmful(mobile, false)))
|
||||
{
|
||||
toExplode.Add(mobile);
|
||||
++toDamage;
|
||||
}
|
||||
else if (o is BaseExplosionPotion && o != this)
|
||||
{
|
||||
toExplode.Add(o);
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
int min = Scale(from, MinDamage);
|
||||
int max = Scale(from, MaxDamage);
|
||||
|
||||
for (int i = 0; i < toExplode.Count; ++i)
|
||||
{
|
||||
object o = toExplode[i];
|
||||
|
||||
if (o is Mobile m)
|
||||
{
|
||||
from?.DoHarmful(m);
|
||||
|
||||
int damage = Utility.RandomMinMax(min, max);
|
||||
|
||||
damage += alchemyBonus;
|
||||
|
||||
if (!Core.AOS && damage > 40)
|
||||
damage = 40;
|
||||
else if (Core.AOS && toDamage > 2)
|
||||
damage /= toDamage - 1;
|
||||
|
||||
AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
|
||||
}
|
||||
else if (o is BaseExplosionPotion pot)
|
||||
{
|
||||
pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( Potion.Deleted || Potion.Map == Map.Internal )
|
||||
return;
|
||||
|
||||
if ( !(targeted is IPoint3D p) )
|
||||
return;
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to = new Entity( Serial.Zero, new Point3D( p ), map );
|
||||
|
||||
if ( p is Mobile m )
|
||||
{
|
||||
if ( !RelativeLocation ) // explosion location = current mob location.
|
||||
p = m.Location;
|
||||
else
|
||||
to = m;
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect( from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue, 0 );
|
||||
|
||||
if ( Potion.Amount > 1 )
|
||||
{
|
||||
Mobile.LiftItemDupe( Potion, 1 );
|
||||
}
|
||||
|
||||
Potion.Internalize();
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Reposition_OnTick ), new object[]{ from, p, map } );
|
||||
}
|
||||
}
|
||||
|
||||
public void Explode( Mobile from, bool direct, Point3D loc, Map map )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
Consume();
|
||||
|
||||
for ( int i = 0; Users != null && i < Users.Count; ++i )
|
||||
{
|
||||
Mobile m = Users[i];
|
||||
|
||||
if ( m.Target is ThrowTarget targ && targ.Potion == this )
|
||||
Target.Cancel( m );
|
||||
}
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
|
||||
Effects.PlaySound(loc, map, 0x307);
|
||||
|
||||
Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
|
||||
int alchemyBonus = 0;
|
||||
|
||||
if ( direct )
|
||||
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public ThrowTarget(BaseExplosionPotion potion) : base(12, true, TargetFlags.None)
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInRange(loc, ExplosionRange, LeveledExplosion, true);
|
||||
List<IEntity> toExplode = new List<IEntity>();
|
||||
public BaseExplosionPotion Potion{ get; }
|
||||
|
||||
int toDamage = 0;
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Potion.Deleted || Potion.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
foreach ( IEntity o in eable )
|
||||
{
|
||||
if ( o is Mobile mobile && (from == null || (SpellHelper.ValidIndirectTarget( from, mobile ) && from.CanBeHarmful( mobile, false ))))
|
||||
{
|
||||
toExplode.Add( mobile );
|
||||
++toDamage;
|
||||
}
|
||||
else if ( o is BaseExplosionPotion && o != this )
|
||||
{
|
||||
toExplode.Add( o );
|
||||
}
|
||||
}
|
||||
if (!(targeted is IPoint3D p))
|
||||
return;
|
||||
|
||||
eable.Free();
|
||||
Map map = from.Map;
|
||||
|
||||
int min = Scale( from, MinDamage );
|
||||
int max = Scale( from, MaxDamage );
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < toExplode.Count; ++i )
|
||||
{
|
||||
object o = toExplode[i];
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
if ( o is Mobile m )
|
||||
{
|
||||
from?.DoHarmful( m );
|
||||
from.RevealingAction();
|
||||
|
||||
int damage = Utility.RandomMinMax( min, max );
|
||||
IEntity to = new Entity(Serial.Zero, new Point3D(p), map);
|
||||
|
||||
damage += alchemyBonus;
|
||||
if (p is Mobile m)
|
||||
{
|
||||
if (!RelativeLocation) // explosion location = current mob location.
|
||||
p = m.Location;
|
||||
else
|
||||
to = m;
|
||||
}
|
||||
|
||||
if ( !Core.AOS && damage > 40 )
|
||||
damage = 40;
|
||||
else if ( Core.AOS && toDamage > 2 )
|
||||
damage /= toDamage - 1;
|
||||
Effects.SendMovingEffect(from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue, 0);
|
||||
|
||||
AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
else if ( o is BaseExplosionPotion pot )
|
||||
{
|
||||
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Potion.Amount > 1) Mobile.LiftItemDupe(Potion, 1);
|
||||
|
||||
Potion.Internalize();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(Potion.Reposition_OnTick),
|
||||
new object[] { from, p, map });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
public override int MinDamage => 10;
|
||||
public override int MaxDamage => 20;
|
||||
public class ExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ExplosionPotion() : base(PotionEffect.Explosion)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ExplosionPotion() : base( PotionEffect.Explosion )
|
||||
{
|
||||
}
|
||||
public ExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public ExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int MinDamage => 10;
|
||||
public override int MaxDamage => 20;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
public override int MinDamage => Core.AOS ? 20 : 15;
|
||||
public override int MaxDamage => Core.AOS ? 40 : 30;
|
||||
public class GreaterExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterExplosionPotion() : base(PotionEffect.ExplosionGreater)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterExplosionPotion() : base( PotionEffect.ExplosionGreater )
|
||||
{
|
||||
}
|
||||
public GreaterExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int MinDamage => Core.AOS ? 20 : 15;
|
||||
public override int MaxDamage => Core.AOS ? 40 : 30;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
public override int MinDamage => 5;
|
||||
public override int MaxDamage => 10;
|
||||
public class LesserExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
[Constructible]
|
||||
public LesserExplosionPotion() : base(PotionEffect.ExplosionLesser)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public LesserExplosionPotion() : base( PotionEffect.ExplosionLesser )
|
||||
{
|
||||
}
|
||||
public LesserExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int MinDamage => 5;
|
||||
public override int MaxDamage => 10;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +1,84 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseHealPotion : BasePotion
|
||||
{
|
||||
public abstract int MinHeal { get; }
|
||||
public abstract int MaxHeal { get; }
|
||||
public abstract double Delay { get; }
|
||||
public abstract class BaseHealPotion : BasePotion
|
||||
{
|
||||
public BaseHealPotion(PotionEffect effect) : base(0xF0C, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseHealPotion( PotionEffect effect ) : base( 0xF0C, effect )
|
||||
{
|
||||
}
|
||||
public BaseHealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseHealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract int MinHeal{ get; }
|
||||
public abstract int MaxHeal{ get; }
|
||||
public abstract double Delay{ get; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoHeal( Mobile from )
|
||||
{
|
||||
int min = Scale( from, MinHeal );
|
||||
int max = Scale( from, MaxHeal );
|
||||
public void DoHeal(Mobile from)
|
||||
{
|
||||
int min = Scale(from, MinHeal);
|
||||
int max = Scale(from, MaxHeal);
|
||||
|
||||
from.Heal( Utility.RandomMinMax( min, max ) );
|
||||
}
|
||||
from.Heal(Utility.RandomMinMax(min, max));
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.Hits < from.HitsMax )
|
||||
{
|
||||
if ( from.Poisoned || MortalStrike.IsWounded( from ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 1005000 ); // You can not heal yourself in your current state.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( from.BeginAction( typeof( BaseHealPotion ) ) )
|
||||
{
|
||||
DoHeal( from );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.Hits < from.HitsMax)
|
||||
{
|
||||
if (from.Poisoned || MortalStrike.IsWounded(from))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22,
|
||||
1005000); // You can not heal yourself in your current state.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from.BeginAction(typeof(BaseHealPotion)))
|
||||
{
|
||||
DoHeal(from);
|
||||
|
||||
PlayDrinkEffect( from );
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( Delay ), new TimerStateCallback( ReleaseHealLock ), from );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500235 ); // You must wait 10 seconds before using another healing potion.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049547 ); // You decide against drinking this potion, as you are already at full health.
|
||||
}
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseHealLock), from);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22,
|
||||
500235); // You must wait 10 seconds before using another healing potion.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1049547); // You decide against drinking this potion, as you are already at full health.
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReleaseHealLock( object state )
|
||||
{
|
||||
((Mobile)state).EndAction( typeof( BaseHealPotion ) );
|
||||
}
|
||||
}
|
||||
private static void ReleaseHealLock(object state)
|
||||
{
|
||||
((Mobile)state).EndAction(typeof(BaseHealPotion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterHealPotion : BaseHealPotion
|
||||
{
|
||||
public override int MinHeal => (Core.AOS ? 20 : 9);
|
||||
public override int MaxHeal => (Core.AOS ? 25 : 30);
|
||||
public override double Delay => 10.0;
|
||||
public class GreaterHealPotion : BaseHealPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterHealPotion() : base(PotionEffect.HealGreater)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterHealPotion() : base( PotionEffect.HealGreater )
|
||||
{
|
||||
}
|
||||
public GreaterHealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterHealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int MinHeal => Core.AOS ? 20 : 9;
|
||||
public override int MaxHeal => Core.AOS ? 25 : 30;
|
||||
public override double Delay => 10.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class HealPotion : BaseHealPotion
|
||||
{
|
||||
public override int MinHeal => (Core.AOS ? 13 : 6);
|
||||
public override int MaxHeal => (Core.AOS ? 16 : 20);
|
||||
public override double Delay => (Core.AOS ? 8.0 : 10.0);
|
||||
public class HealPotion : BaseHealPotion
|
||||
{
|
||||
[Constructible]
|
||||
public HealPotion() : base(PotionEffect.Heal)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public HealPotion() : base( PotionEffect.Heal )
|
||||
{
|
||||
}
|
||||
public HealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public HealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int MinHeal => Core.AOS ? 13 : 6;
|
||||
public override int MaxHeal => Core.AOS ? 16 : 20;
|
||||
public override double Delay => Core.AOS ? 8.0 : 10.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserHealPotion : BaseHealPotion
|
||||
{
|
||||
public override int MinHeal => (Core.AOS ? 6 : 3);
|
||||
public override int MaxHeal => (Core.AOS ? 8 : 10);
|
||||
public override double Delay => (Core.AOS ? 3.0 : 10.0);
|
||||
public class LesserHealPotion : BaseHealPotion
|
||||
{
|
||||
[Constructible]
|
||||
public LesserHealPotion() : base(PotionEffect.HealLesser)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public LesserHealPotion() : base( PotionEffect.HealLesser )
|
||||
{
|
||||
}
|
||||
public LesserHealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserHealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int MinHeal => Core.AOS ? 6 : 3;
|
||||
public override int MaxHeal => Core.AOS ? 8 : 10;
|
||||
public override double Delay => Core.AOS ? 3.0 : 10.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,108 +3,109 @@ using System.Collections;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class InvisibilityPotion : BasePotion
|
||||
{
|
||||
public override int LabelNumber => 1072941; // Potion of Invisibility
|
||||
public class InvisibilityPotion : BasePotion
|
||||
{
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
[Constructible]
|
||||
public InvisibilityPotion() : base( 0xF0A, PotionEffect.Invisibility )
|
||||
{
|
||||
Hue = 0x48D;
|
||||
}
|
||||
[Constructible]
|
||||
public InvisibilityPotion() : base(0xF0A, PotionEffect.Invisibility)
|
||||
{
|
||||
Hue = 0x48D;
|
||||
}
|
||||
|
||||
public InvisibilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public InvisibilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.Hidden )
|
||||
{
|
||||
from.SendLocalizedMessage( 1073185 ); // You are already unseen.
|
||||
return;
|
||||
}
|
||||
public override int LabelNumber => 1072941; // Potion of Invisibility
|
||||
|
||||
if ( HasTimer( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1073186 ); // An invisibility potion is already taking effect on your person.
|
||||
return;
|
||||
}
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.Hidden)
|
||||
{
|
||||
from.SendLocalizedMessage(1073185); // You are already unseen.
|
||||
return;
|
||||
}
|
||||
|
||||
Consume();
|
||||
m_Table[ from ] = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerStateCallback( Hide_Callback ), from );
|
||||
PlayDrinkEffect( from );
|
||||
}
|
||||
if (HasTimer(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1073186); // An invisibility potion is already taking effect on your person.
|
||||
return;
|
||||
}
|
||||
|
||||
private static void Hide_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile mobile )
|
||||
Hide( mobile );
|
||||
}
|
||||
Consume();
|
||||
m_Table[from] = Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerStateCallback(Hide_Callback), from);
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
|
||||
public static void Hide( Mobile m )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), m.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 );
|
||||
m.PlaySound( 0x3C4 );
|
||||
private static void Hide_Callback(object obj)
|
||||
{
|
||||
if (obj is Mobile mobile)
|
||||
Hide(mobile);
|
||||
}
|
||||
|
||||
m.Hidden = true;
|
||||
public static void Hide(Mobile m)
|
||||
{
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(new Point3D(m.X, m.Y, m.Z + 16), m.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045);
|
||||
m.PlaySound(0x3C4);
|
||||
|
||||
BuffInfo.RemoveBuff( m, BuffIcon.HidingAndOrStealth );
|
||||
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Invisibility, 1075825 ) ); //Invisibility/Invisible
|
||||
m.Hidden = true;
|
||||
|
||||
RemoveTimer( m );
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825)); //Invisibility/Invisible
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 30 ), new TimerStateCallback( EndHide_Callback ), m );
|
||||
}
|
||||
RemoveTimer(m);
|
||||
|
||||
private static void EndHide_Callback( object obj )
|
||||
{
|
||||
if ( obj is Mobile mobile )
|
||||
EndHide( mobile );
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), new TimerStateCallback(EndHide_Callback), m);
|
||||
}
|
||||
|
||||
public static void EndHide( Mobile m )
|
||||
{
|
||||
m.RevealingAction();
|
||||
RemoveTimer( m );
|
||||
}
|
||||
private static void EndHide_Callback(object obj)
|
||||
{
|
||||
if (obj is Mobile mobile)
|
||||
EndHide(mobile);
|
||||
}
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
public static void EndHide(Mobile m)
|
||||
{
|
||||
m.RevealingAction();
|
||||
RemoveTimer(m);
|
||||
}
|
||||
|
||||
public static bool HasTimer( Mobile m )
|
||||
{
|
||||
return m_Table[ m ] != null;
|
||||
}
|
||||
public static bool HasTimer(Mobile m)
|
||||
{
|
||||
return m_Table[m] != null;
|
||||
}
|
||||
|
||||
public static void RemoveTimer( Mobile m )
|
||||
{
|
||||
Timer t = (Timer) m_Table[ m ];
|
||||
public static void RemoveTimer(Mobile m)
|
||||
{
|
||||
Timer t = (Timer)m_Table[m];
|
||||
|
||||
if ( t != null )
|
||||
{
|
||||
t.Stop();
|
||||
m_Table.Remove( m );
|
||||
}
|
||||
}
|
||||
if (t != null)
|
||||
{
|
||||
t.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Iterrupt( Mobile m )
|
||||
{
|
||||
m.SendLocalizedMessage( 1073187 ); // The invisibility effect is interrupted.
|
||||
RemoveTimer( m );
|
||||
}
|
||||
public static void Iterrupt(Mobile m)
|
||||
{
|
||||
m.SendLocalizedMessage(1073187); // The invisibility effect is interrupted.
|
||||
RemoveTimer(m);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +1,51 @@
|
|||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class NightSightPotion : BasePotion
|
||||
{
|
||||
[Constructible]
|
||||
public NightSightPotion() : base( 0xF06, PotionEffect.Nightsight )
|
||||
{
|
||||
}
|
||||
public class NightSightPotion : BasePotion
|
||||
{
|
||||
[Constructible]
|
||||
public NightSightPotion() : base(0xF06, PotionEffect.Nightsight)
|
||||
{
|
||||
}
|
||||
|
||||
public NightSightPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public NightSightPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.BeginAction( typeof( LightCycle ) ) )
|
||||
{
|
||||
new LightCycle.NightSightTimer( from ).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.BeginAction(typeof(LightCycle)))
|
||||
{
|
||||
new LightCycle.NightSightTimer(from).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
|
||||
from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist );
|
||||
from.PlaySound( 0x1E3 );
|
||||
from.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
|
||||
from.PlaySound(0x1E3);
|
||||
|
||||
PlayDrinkEffect( from );
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You already have nightsight." );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You already have nightsight.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,37 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ParasiticPotion : BasePoisonPotion
|
||||
{
|
||||
/* public override Poison Poison => Poison.Darkglow; MUST be restored when prerequisites are done */
|
||||
public override Poison Poison => Poison.Greater;
|
||||
public class ParasiticPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ParasiticPotion() : base(PotionEffect.Parasitic)
|
||||
{
|
||||
Hue = 0x17C;
|
||||
}
|
||||
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
public ParasiticPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072848; // Parasitic Poison
|
||||
/* public override Poison Poison => Poison.Darkglow; MUST be restored when prerequisites are done */
|
||||
public override Poison Poison => Poison.Greater;
|
||||
|
||||
[Constructible]
|
||||
public ParasiticPotion() : base( PotionEffect.Parasitic )
|
||||
{
|
||||
Hue = 0x17C;
|
||||
}
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public ParasiticPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int LabelNumber => 1072848; // Parasitic Poison
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +1,49 @@
|
|||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BasePoisonPotion : BasePotion
|
||||
{
|
||||
public abstract Poison Poison{ get; }
|
||||
public abstract class BasePoisonPotion : BasePotion
|
||||
{
|
||||
public BasePoisonPotion(PotionEffect effect) : base(0xF0A, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract double MinPoisoningSkill{ get; }
|
||||
public abstract double MaxPoisoningSkill{ get; }
|
||||
public BasePoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BasePoisonPotion( PotionEffect effect ) : base( 0xF0A, effect )
|
||||
{
|
||||
}
|
||||
public abstract Poison Poison{ get; }
|
||||
|
||||
public BasePoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract double MinPoisoningSkill{ get; }
|
||||
public abstract double MaxPoisoningSkill{ get; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoPoison( Mobile from )
|
||||
{
|
||||
from.ApplyPoison( from, Poison );
|
||||
}
|
||||
public void DoPoison(Mobile from)
|
||||
{
|
||||
from.ApplyPoison(from, Poison);
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
DoPoison( from );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
DoPoison(from);
|
||||
|
||||
PlayDrinkEffect( from );
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class DeadlyPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison => Poison.Deadly;
|
||||
public class DeadlyPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public DeadlyPoisonPotion() : base(PotionEffect.PoisonDeadly)
|
||||
{
|
||||
}
|
||||
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
public DeadlyPoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DeadlyPoisonPotion() : base( PotionEffect.PoisonDeadly )
|
||||
{
|
||||
}
|
||||
public override Poison Poison => Poison.Deadly;
|
||||
|
||||
public DeadlyPoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison => Poison.Greater;
|
||||
public class GreaterPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterPoisonPotion() : base(PotionEffect.PoisonGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public override double MinPoisoningSkill => 60.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
public GreaterPoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterPoisonPotion() : base( PotionEffect.PoisonGreater )
|
||||
{
|
||||
}
|
||||
public override Poison Poison => Poison.Greater;
|
||||
|
||||
public GreaterPoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double MinPoisoningSkill => 60.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison => Poison.Lesser;
|
||||
public class LesserPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public LesserPoisonPotion() : base(PotionEffect.PoisonLesser)
|
||||
{
|
||||
}
|
||||
|
||||
public override double MinPoisoningSkill => 0.0;
|
||||
public override double MaxPoisoningSkill => 60.0;
|
||||
public LesserPoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public LesserPoisonPotion() : base( PotionEffect.PoisonLesser )
|
||||
{
|
||||
}
|
||||
public override Poison Poison => Poison.Lesser;
|
||||
|
||||
public LesserPoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double MinPoisoningSkill => 0.0;
|
||||
public override double MaxPoisoningSkill => 60.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class PoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison => Poison.Regular;
|
||||
public class PoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public PoisonPotion() : base(PotionEffect.Poison)
|
||||
{
|
||||
}
|
||||
|
||||
public override double MinPoisoningSkill => 30.0;
|
||||
public override double MaxPoisoningSkill => 70.0;
|
||||
public PoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public PoisonPotion() : base( PotionEffect.Poison )
|
||||
{
|
||||
}
|
||||
public override Poison Poison => Poison.Regular;
|
||||
|
||||
public PoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double MinPoisoningSkill => 30.0;
|
||||
public override double MaxPoisoningSkill => 70.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +1,48 @@
|
|||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseRefreshPotion : BasePotion
|
||||
{
|
||||
public abstract double Refresh{ get; }
|
||||
public abstract class BaseRefreshPotion : BasePotion
|
||||
{
|
||||
public BaseRefreshPotion(PotionEffect effect) : base(0xF0B, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseRefreshPotion( PotionEffect effect ) : base( 0xF0B, effect )
|
||||
{
|
||||
}
|
||||
public BaseRefreshPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseRefreshPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract double Refresh{ get; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.Stam < from.StamMax )
|
||||
{
|
||||
from.Stam += Scale( from, (int)(Refresh * from.StamMax) );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.Stam < from.StamMax)
|
||||
{
|
||||
from.Stam += Scale(from, (int)(Refresh * from.StamMax));
|
||||
|
||||
PlayDrinkEffect( from );
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You decide against drinking this potion, as you are already at full stamina." );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You decide against drinking this potion, as you are already at full stamina.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +1,30 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class RefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
public override double Refresh => 0.25;
|
||||
public class RefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
[Constructible]
|
||||
public RefreshPotion() : base(PotionEffect.Refresh)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RefreshPotion() : base( PotionEffect.Refresh )
|
||||
{
|
||||
}
|
||||
public RefreshPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public RefreshPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double Refresh => 0.25;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +1,30 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class TotalRefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
public override double Refresh => 1.0;
|
||||
public class TotalRefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
[Constructible]
|
||||
public TotalRefreshPotion() : base(PotionEffect.RefreshTotal)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TotalRefreshPotion() : base( PotionEffect.RefreshTotal )
|
||||
{
|
||||
}
|
||||
public TotalRefreshPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public TotalRefreshPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override double Refresh => 1.0;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +1,59 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseStrengthPotion : BasePotion
|
||||
{
|
||||
public abstract int StrOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
public abstract class BaseStrengthPotion : BasePotion
|
||||
{
|
||||
public BaseStrengthPotion(PotionEffect effect) : base(0xF09, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseStrengthPotion( PotionEffect effect ) : base( 0xF09, effect )
|
||||
{
|
||||
}
|
||||
public BaseStrengthPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseStrengthPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public abstract int StrOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public bool DoStrength( Mobile from )
|
||||
{
|
||||
// TODO: Verify scaled; is it offset, duration, or both?
|
||||
if ( Spells.SpellHelper.AddStatOffset( from, StatType.Str, Scale( from, StrOffset ), Duration ) )
|
||||
{
|
||||
from.FixedEffect( 0x375A, 10, 15 );
|
||||
from.PlaySound( 0x1E7 );
|
||||
return true;
|
||||
}
|
||||
public bool DoStrength(Mobile from)
|
||||
{
|
||||
// TODO: Verify scaled; is it offset, duration, or both?
|
||||
if (SpellHelper.AddStatOffset(from, StatType.Str, Scale(from, StrOffset), Duration))
|
||||
{
|
||||
from.FixedEffect(0x375A, 10, 15);
|
||||
from.PlaySound(0x1E7);
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
|
||||
return false;
|
||||
}
|
||||
from.SendLocalizedMessage(502173); // You are already under a similar effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( DoStrength( from ) )
|
||||
{
|
||||
PlayDrinkEffect( from );
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (DoStrength(from))
|
||||
{
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if ( !Engines.ConPVP.DuelContext.IsFreeConsume( from ) )
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,32 +2,32 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterStrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
public override int StrOffset => 20;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes( 2.0 );
|
||||
public class GreaterStrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterStrengthPotion() : base(PotionEffect.StrengthGreater)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GreaterStrengthPotion() : base( PotionEffect.StrengthGreater )
|
||||
{
|
||||
}
|
||||
public GreaterStrengthPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterStrengthPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int StrOffset => 20;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,32 +2,32 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
public override int StrOffset => 10;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes( 2.0 );
|
||||
public class StrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
[Constructible]
|
||||
public StrengthPotion() : base(PotionEffect.Strength)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StrengthPotion() : base( PotionEffect.Strength )
|
||||
{
|
||||
}
|
||||
public StrengthPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public StrengthPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int StrOffset => 10;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue