#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
8eae46895e
7512 changed files with 416187 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
public override int DexOffset{ get{ return 10; } }
|
||||
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
|
||||
|
||||
[Constructable]
|
||||
public AgilityPotion() : base( PotionEffect.Agility )
|
||||
{
|
||||
}
|
||||
|
||||
public AgilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseAgilityPotion : BasePotion
|
||||
{
|
||||
public abstract int DexOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
|
||||
public BaseAgilityPotion( PotionEffect effect ) : base( 0xF08, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseAgilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( DoAgility( from ) )
|
||||
{
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterAgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
public override int DexOffset{ get{ return 20; } }
|
||||
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
|
||||
|
||||
[Constructable]
|
||||
public GreaterAgilityPotion() : base( PotionEffect.AgilityGreater )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterAgilityPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
235
Scripts/Items/Skill Items/Potions/BasePotion.cs
Normal file
235
Scripts/Items/Skill Items/Potions/BasePotion.cs
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Engines.Craft;
|
||||
using System.Collections.Generic;
|
||||
|
||||
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,
|
||||
InvisibilityWeak,
|
||||
Invisibility,
|
||||
InvisibilityStrong,
|
||||
VigorWeak,
|
||||
Vigor,
|
||||
VigorStrong,
|
||||
ManaWeak,
|
||||
Mana,
|
||||
ManaStrong
|
||||
}
|
||||
|
||||
public abstract class BasePotion : Item, ICraftable
|
||||
{
|
||||
private PotionEffect m_PotionEffect;
|
||||
|
||||
public PotionEffect PotionEffect
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_PotionEffect;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_PotionEffect = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041314 + (int)m_PotionEffect; } }
|
||||
|
||||
public BasePotion( int itemID, PotionEffect effect ) : base( itemID )
|
||||
{
|
||||
m_PotionEffect = effect;
|
||||
|
||||
Stackable = false;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public BasePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool RequireFreeHand{ get{ return Server.Misc.Settings.CannotDrinkPotionsWhileHoldingThings(); } }
|
||||
|
||||
public static bool HasFreeHand( Mobile m )
|
||||
{
|
||||
Item handOne = m.FindItemOnLayer( Layer.OneHanded );
|
||||
Item handTwo = m.FindItemOnLayer( Layer.TwoHanded );
|
||||
|
||||
if ( handTwo is BaseWeapon )
|
||||
handOne = handTwo;
|
||||
|
||||
return ( handOne == null || handTwo == null );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
|
||||
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
||||
{
|
||||
if (!RequireFreeHand || HasFreeHand(from))
|
||||
{
|
||||
if (this is BaseExplosionPotion && Amount > 1)
|
||||
{
|
||||
BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType());
|
||||
|
||||
if (pot != null)
|
||||
{
|
||||
Amount--;
|
||||
|
||||
if (from.Backpack != null && !from.Backpack.Deleted)
|
||||
{
|
||||
from.Backpack.DropItem(pot);
|
||||
}
|
||||
else
|
||||
{
|
||||
pot.MoveToWorld(from.Location, from.Map);
|
||||
}
|
||||
pot.Drink( from );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.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
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_PotionEffect );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_PotionEffect = (PotionEffect)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( version == 0 )
|
||||
Stackable = false;
|
||||
}
|
||||
|
||||
public abstract void Drink( Mobile from );
|
||||
|
||||
public static void PlayDrinkEffect( Mobile m )
|
||||
{
|
||||
m.RevealingAction();
|
||||
|
||||
m.PlaySound( 0x2D6 );
|
||||
|
||||
m.AddToBackpack( new Bottle() );
|
||||
|
||||
if ( m.Body.IsHuman && !m.Mounted )
|
||||
m.Animate( 34, 5, 1, true, false, 0 );
|
||||
}
|
||||
|
||||
public static TimeSpan Scale( Mobile m, TimeSpan v )
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
public static double Scale( Mobile m, double v )
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
public static int Scale( Mobile m, int v )
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
public override bool StackWith( Mobile from, Item dropped, bool playSound )
|
||||
{
|
||||
if( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect )
|
||||
return base.StackWith( from, dropped, playSound );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#region ICraftable Members
|
||||
|
||||
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 ( pack != null )
|
||||
{
|
||||
List<PotionKeg> kegs = pack.FindItemsByType<PotionKeg>();
|
||||
|
||||
for ( int i = 0; i < kegs.Count; ++i )
|
||||
{
|
||||
PotionKeg keg = kegs[i];
|
||||
|
||||
if ( keg == null )
|
||||
continue;
|
||||
|
||||
if ( keg.Held <= 0 || keg.Held >= 100 )
|
||||
continue;
|
||||
|
||||
if ( keg.Type != PotionEffect )
|
||||
continue;
|
||||
|
||||
++keg.Held;
|
||||
|
||||
Consume();
|
||||
from.AddToBackpack( new Bottle() );
|
||||
|
||||
return -1; // signal placed in keg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
104
Scripts/Items/Skill Items/Potions/Cure Potions/BaseCurePotion.cs
Normal file
104
Scripts/Items/Skill Items/Potions/Cure Potions/BaseCurePotion.cs
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CureLevelInfo
|
||||
{
|
||||
private Poison m_Poison;
|
||||
private double m_Chance;
|
||||
|
||||
public Poison Poison
|
||||
{
|
||||
get{ return m_Poison; }
|
||||
}
|
||||
|
||||
public double Chance
|
||||
{
|
||||
get{ return m_Chance; }
|
||||
}
|
||||
|
||||
public CureLevelInfo( Poison poison, double chance )
|
||||
{
|
||||
m_Poison = poison;
|
||||
m_Chance = chance;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseCurePotion : BasePotion
|
||||
{
|
||||
public abstract CureLevelInfo[] LevelInfo{ get; }
|
||||
|
||||
public BaseCurePotion( PotionEffect effect ) : base( 0xF07, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseCurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoCure( Mobile from )
|
||||
{
|
||||
bool cure = false;
|
||||
|
||||
CureLevelInfo[] info = LevelInfo;
|
||||
|
||||
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 ( 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!
|
||||
}
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.Poisoned )
|
||||
{
|
||||
DoCure( from );
|
||||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
from.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
|
||||
from.PlaySound( 0x1E0 );
|
||||
|
||||
this.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042000 ); // You are not poisoned.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Scripts/Items/Skill Items/Potions/Cure Potions/CurePotion.cs
Normal file
41
Scripts/Items/Skill Items/Potions/Cure Potions/CurePotion.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo = new CureLevelInfo[]
|
||||
{
|
||||
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 override CureLevelInfo[] LevelInfo{ get{ return m_OldLevelInfo; } }
|
||||
|
||||
[Constructable]
|
||||
public CurePotion() : base( PotionEffect.Cure )
|
||||
{
|
||||
}
|
||||
|
||||
public CurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo = new CureLevelInfo[]
|
||||
{
|
||||
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 override CureLevelInfo[] LevelInfo{ get{ return m_OldLevelInfo; } }
|
||||
|
||||
[Constructable]
|
||||
public GreaterCurePotion() : base( PotionEffect.CureGreater )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterCurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LesserCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo = new CureLevelInfo[]
|
||||
{
|
||||
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 override CureLevelInfo[] LevelInfo{ get{ return m_OldLevelInfo; } }
|
||||
|
||||
[Constructable]
|
||||
public LesserCurePotion() : base( PotionEffect.CureLesser )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserCurePotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Spells;
|
||||
using Server.Misc;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseExplosionPotion : BasePotion
|
||||
{
|
||||
public abstract int MinDamage { get; }
|
||||
public abstract int MaxDamage { get; }
|
||||
|
||||
public override bool RequireFreeHand{ get{ return 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 const int ExplosionRange = 2; // How long is the blast radius?
|
||||
|
||||
public BaseExplosionPotion( PotionEffect effect ) : base( 0xF0D, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual object FindParent( Mobile from )
|
||||
{
|
||||
Mobile m = this.HeldBy;
|
||||
|
||||
if ( m != null && m.Holding == this )
|
||||
return m;
|
||||
|
||||
object obj = this.RootParent;
|
||||
|
||||
if ( obj != null )
|
||||
return obj;
|
||||
|
||||
if ( Map == Map.Internal )
|
||||
return from;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
private ArrayList m_Users;
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
this.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 ( m_Users == null )
|
||||
m_Users = new ArrayList();
|
||||
|
||||
if ( !m_Users.Contains( from ) )
|
||||
m_Users.Add( from );
|
||||
|
||||
from.Target = new ThrowTarget( this );
|
||||
|
||||
if ( m_Timer == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 500236 ); // You should throw it now!
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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 ( timer == 0 )
|
||||
{
|
||||
Point3D loc;
|
||||
Map map;
|
||||
|
||||
if ( parent is Item )
|
||||
{
|
||||
Item item = (Item)parent;
|
||||
|
||||
loc = item.GetWorldLocation();
|
||||
map = item.Map;
|
||||
}
|
||||
else if ( parent is Mobile )
|
||||
{
|
||||
Mobile m = (Mobile)parent;
|
||||
|
||||
loc = m.Location;
|
||||
map = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Explode( from, true, loc, map );
|
||||
m_Timer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( parent is Item )
|
||||
((Item)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
|
||||
else if ( parent is Mobile )
|
||||
((Mobile)parent).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 );
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
private BaseExplosionPotion m_Potion;
|
||||
|
||||
public BaseExplosionPotion Potion
|
||||
{
|
||||
get{ return m_Potion; }
|
||||
}
|
||||
|
||||
public ThrowTarget( BaseExplosionPotion potion ) : base( 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Potion = potion;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
|
||||
return;
|
||||
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
||||
if ( p == null )
|
||||
return;
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to;
|
||||
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), map );
|
||||
|
||||
if( p is Mobile )
|
||||
{
|
||||
if( !RelativeLocation ) // explosion location = current mob location.
|
||||
p = ((Mobile)p).Location;
|
||||
else
|
||||
to = (Mobile)p;
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
|
||||
|
||||
if( m_Potion.Amount > 1 )
|
||||
{
|
||||
Mobile.LiftItemDupe( m_Potion, 1 );
|
||||
}
|
||||
|
||||
m_Potion.Internalize();
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_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; m_Users != null && i < m_Users.Count; ++i )
|
||||
{
|
||||
Mobile m = (Mobile)m_Users[i];
|
||||
ThrowTarget targ = m.Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && 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)(Server.Misc.SkillCheck.TradeSkill( from, Trades.Alchemy, false ) / 10);
|
||||
|
||||
IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
|
||||
ArrayList toExplode = new ArrayList();
|
||||
|
||||
int toDamage = 0;
|
||||
|
||||
foreach ( object o in eable )
|
||||
{
|
||||
if ( o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget( from, (Mobile)o ) && from.CanBeHarmful( (Mobile)o, false ))))
|
||||
{
|
||||
toExplode.Add( o );
|
||||
++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 )
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
|
||||
if ( from != null )
|
||||
from.DoHarmful( m );
|
||||
|
||||
int damage = Utility.RandomMinMax( min, max );
|
||||
|
||||
damage += alchemyBonus;
|
||||
|
||||
if ( damage > 40 )
|
||||
damage = 40;
|
||||
|
||||
Ultima.Damage( m, from, damage );
|
||||
}
|
||||
else if ( o is BaseExplosionPotion )
|
||||
{
|
||||
BaseExplosionPotion pot = (BaseExplosionPotion)o;
|
||||
|
||||
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
public override int MinDamage { get { return 10; } }
|
||||
public override int MaxDamage { get { return 20; } }
|
||||
|
||||
[Constructable]
|
||||
public ExplosionPotion() : base( PotionEffect.Explosion )
|
||||
{
|
||||
}
|
||||
|
||||
public ExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
public override int MinDamage { get { return 15; } }
|
||||
public override int MaxDamage { get { return 30; } }
|
||||
|
||||
[Constructable]
|
||||
public GreaterExplosionPotion() : base( PotionEffect.ExplosionGreater )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LesserExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
public override int MinDamage { get { return 5; } }
|
||||
public override int MaxDamage { get { return 10; } }
|
||||
|
||||
[Constructable]
|
||||
public LesserExplosionPotion() : base( PotionEffect.ExplosionLesser )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserExplosionPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseHealPotion : BasePotion
|
||||
{
|
||||
public abstract int MinHeal { get; }
|
||||
public abstract int MaxHeal { get; }
|
||||
public abstract double Delay { get; }
|
||||
|
||||
public BaseHealPotion( PotionEffect effect ) : base( 0xF0C, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseHealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoHeal( Mobile from )
|
||||
{
|
||||
int min = Scale( from, MinHeal );
|
||||
int max = Scale( from, MaxHeal );
|
||||
|
||||
int heal = Utility.RandomMinMax( min, max );
|
||||
if ( from is PlayerMobile ){ heal = (int)(heal * Server.Misc.Settings.HitPoints()); }
|
||||
|
||||
from.Heal( heal );
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.Hits < from.HitsMax )
|
||||
{
|
||||
if ( from.Poisoned )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 1005000 ); // You can not heal yourself in your current state.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( from.BeginAction( typeof( BaseHealPotion ) ) )
|
||||
{
|
||||
DoHeal( from );
|
||||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.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.
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReleaseHealLock( object state )
|
||||
{
|
||||
((Mobile)state).EndAction( typeof( BaseHealPotion ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterHealPotion : BaseHealPotion
|
||||
{
|
||||
public override int MinHeal { get { return 9; } }
|
||||
public override int MaxHeal { get { return 30; } }
|
||||
public override double Delay{ get{ return 10.0; } }
|
||||
|
||||
[Constructable]
|
||||
public GreaterHealPotion() : base( PotionEffect.HealGreater )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterHealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Scripts/Items/Skill Items/Potions/Heal Potions/HealPotion.cs
Normal file
35
Scripts/Items/Skill Items/Potions/Heal Potions/HealPotion.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HealPotion : BaseHealPotion
|
||||
{
|
||||
public override int MinHeal { get { return 6; } }
|
||||
public override int MaxHeal { get { return 20; } }
|
||||
public override double Delay{ get{ return 10.0; } }
|
||||
|
||||
[Constructable]
|
||||
public HealPotion() : base( PotionEffect.Heal )
|
||||
{
|
||||
}
|
||||
|
||||
public HealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LesserHealPotion : BaseHealPotion
|
||||
{
|
||||
public override int MinHeal { get { return 3; } }
|
||||
public override int MaxHeal { get { return 10; } }
|
||||
public override double Delay{ get{ return 10.0; } }
|
||||
|
||||
[Constructable]
|
||||
public LesserHealPotion() : base( PotionEffect.HealLesser )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserHealPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Scripts/Items/Skill Items/Potions/NightSight.cs
Normal file
51
Scripts/Items/Skill Items/Potions/NightSight.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class NightSightPotion : BasePotion
|
||||
{
|
||||
[Constructable]
|
||||
public NightSightPotion() : base( 0xF06, PotionEffect.Nightsight )
|
||||
{
|
||||
}
|
||||
|
||||
public NightSightPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
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;
|
||||
|
||||
from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist );
|
||||
from.PlaySound( 0x1E3 );
|
||||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You already have nightsight." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BasePoisonPotion : BasePotion
|
||||
{
|
||||
public abstract Poison Poison{ get; }
|
||||
|
||||
public abstract double MinPoisoningSkill{ get; }
|
||||
public abstract double MaxPoisoningSkill{ get; }
|
||||
|
||||
public BasePoisonPotion( PotionEffect effect ) : base( 0xF0A, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BasePoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoPoison( Mobile from )
|
||||
{
|
||||
from.ApplyPoison( from, Poison );
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
DoPoison( from );
|
||||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DeadlyPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison{ get{ return Poison.Deadly; } }
|
||||
|
||||
public override double MinPoisoningSkill{ get{ return 95.0; } }
|
||||
public override double MaxPoisoningSkill{ get{ return 100.0; } }
|
||||
|
||||
[Constructable]
|
||||
public DeadlyPoisonPotion() : base( PotionEffect.PoisonDeadly )
|
||||
{
|
||||
}
|
||||
|
||||
public DeadlyPoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison{ get{ return Poison.Greater; } }
|
||||
|
||||
public override double MinPoisoningSkill{ get{ return 60.0; } }
|
||||
public override double MaxPoisoningSkill{ get{ return 100.0; } }
|
||||
|
||||
[Constructable]
|
||||
public GreaterPoisonPotion() : base( PotionEffect.PoisonGreater )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterPoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LesserPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison{ get{ return Poison.Lesser; } }
|
||||
|
||||
public override double MinPoisoningSkill{ get{ return 0.0; } }
|
||||
public override double MaxPoisoningSkill{ get{ return 60.0; } }
|
||||
|
||||
[Constructable]
|
||||
public LesserPoisonPotion() : base( PotionEffect.PoisonLesser )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserPoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PoisonPotion : BasePoisonPotion
|
||||
{
|
||||
public override Poison Poison{ get{ return Poison.Regular; } }
|
||||
|
||||
public override double MinPoisoningSkill{ get{ return 30.0; } }
|
||||
public override double MaxPoisoningSkill{ get{ return 70.0; } }
|
||||
|
||||
[Constructable]
|
||||
public PoisonPotion() : base( PotionEffect.Poison )
|
||||
{
|
||||
}
|
||||
|
||||
public PoisonPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseRefreshPotion : BasePotion
|
||||
{
|
||||
public abstract double Refresh{ get; }
|
||||
|
||||
public BaseRefreshPotion( PotionEffect effect ) : base( 0xF0B, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseRefreshPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( from.Stam < from.StamMax )
|
||||
{
|
||||
from.Stam += Scale( from, (int)(Refresh * from.StamMax) );
|
||||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You decide against drinking this potion, as you are already at full stamina." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class RefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
public override double Refresh{ get{ return 0.25; } }
|
||||
|
||||
[Constructable]
|
||||
public RefreshPotion() : base( PotionEffect.Refresh )
|
||||
{
|
||||
}
|
||||
|
||||
public RefreshPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TotalRefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
public override double Refresh{ get{ return 1.0; } }
|
||||
|
||||
[Constructable]
|
||||
public TotalRefreshPotion() : base( PotionEffect.RefreshTotal )
|
||||
{
|
||||
}
|
||||
|
||||
public TotalRefreshPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseStrengthPotion : BasePotion
|
||||
{
|
||||
public abstract int StrOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
|
||||
public BaseStrengthPotion( PotionEffect effect ) : base( 0xF09, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseStrengthPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( DoStrength( from ) )
|
||||
{
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterStrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
public override int StrOffset{ get{ return 20; } }
|
||||
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
|
||||
|
||||
[Constructable]
|
||||
public GreaterStrengthPotion() : base( PotionEffect.StrengthGreater )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterStrengthPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
public override int StrOffset{ get{ return 10; } }
|
||||
public override TimeSpan Duration{ get{ return TimeSpan.FromMinutes( 2.0 ); } }
|
||||
|
||||
[Constructable]
|
||||
public StrengthPotion() : base( PotionEffect.Strength )
|
||||
{
|
||||
}
|
||||
|
||||
public StrengthPotion( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue