#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
8eae46895e
7512 changed files with 416187 additions and 0 deletions
67
Scripts/Items/Rares/Elixirs/BaseManaElixir.cs
Normal file
67
Scripts/Items/Rares/Elixirs/BaseManaElixir.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseManaElixir : BasePotion
|
||||
{
|
||||
public override int Hue{ get { return 0x43C; } }
|
||||
|
||||
public abstract int MinMana { get; }
|
||||
public abstract int MaxMana { get; }
|
||||
public abstract double Delay { get; }
|
||||
|
||||
public BaseManaElixir( PotionEffect effect ) : base( 0x180F, effect )
|
||||
{
|
||||
}
|
||||
|
||||
public BaseManaElixir( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public void DoMana( Mobile from )
|
||||
{
|
||||
from.Mana = from.Mana + ( Utility.RandomMinMax( MinMana, MaxMana ) );
|
||||
}
|
||||
|
||||
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.Mana < from.ManaMax )
|
||||
{
|
||||
if ( from.BeginAction( typeof( BaseManaElixir ) ) )
|
||||
{
|
||||
DoMana( from );
|
||||
|
||||
BasePotion.PlayDrinkEffect( from );
|
||||
|
||||
this.Consume();
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( Delay ), new TimerStateCallback( ReleaseManaLock ), from );
|
||||
}
|
||||
else
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, true, "You must wait 10 seconds before using another mana potion." );
|
||||
|
||||
}
|
||||
else
|
||||
from.SendMessage( "You decide against drinking this potion, as you are already at full mana." );
|
||||
}
|
||||
|
||||
private static void ReleaseManaLock( object state )
|
||||
{
|
||||
((Mobile)state).EndAction( typeof( BaseManaElixir ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue