#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
8eae46895e
7512 changed files with 416187 additions and 0 deletions
68
Scripts/Items/Traps/MushroomTrap.cs
Normal file
68
Scripts/Items/Traps/MushroomTrap.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MushroomTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public MushroomTrap() : base( 0x19C2 )
|
||||
{
|
||||
Name = "mushroom";
|
||||
Hue = Utility.RandomList( 0x49B, 0x4A4 );
|
||||
Light = LightType.Circle150;
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return true; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 2; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.Zero; } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
ItemID = 0x1126;
|
||||
Effects.PlaySound( Location, Map, 0x306 );
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, from, Utility.Dice( 2, 4, 0 ) );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerCallback( OnMushroomReset ) );
|
||||
}
|
||||
|
||||
public virtual void OnMushroomReset()
|
||||
{
|
||||
if ( Region.Find( Location, Map ).IsPartOf( typeof( DungeonRegion ) ) )
|
||||
{
|
||||
ItemID = 0x19C2; // reset
|
||||
Hue = Utility.RandomList( 0x49B, 0x4A4 );
|
||||
}
|
||||
else
|
||||
Delete();
|
||||
}
|
||||
|
||||
public MushroomTrap( 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();
|
||||
|
||||
if ( ItemID == 0x1126 )
|
||||
OnMushroomReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue