本文整理汇总了C#中ExpireTimer类的典型用法代码示例。如果您正苦于以下问题:C# ExpireTimer类的具体用法?C# ExpireTimer怎么用?C# ExpireTimer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpireTimer类属于命名空间,在下文中一共展示了ExpireTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Target
public void Target( Mobile m )
{
if ( CheckHSequence( m ) )
{
SpellHelper.Turn( Caster, m );
/* Transmogrifies the flesh of the target creature or player to resemble rotted corpse flesh,
* making them more vulnerable to Fire and Poison damage,
* but increasing their resistance to Physical and Cold damage.
*
* The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 25 ) + 40 seconds.
*
* NOTE: Algorithm above is fixed point, should be:
* ((ss-mr)/2.5) + 40
*
* NOTE: Resistance is not checked if targeting yourself
*/
ExpireTimer timer = (ExpireTimer)m_Table[m];
if ( timer != null )
timer.DoExpire();
else
m.SendLocalizedMessage( 1061689 ); // Your skin turns dry and corpselike.
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.FixedParticles( 0x373A, 1, 15, 9913, 67, 7, EffectLayer.Head );
m.PlaySound( 0x1BB );
double ss = GetDamageSkill( Caster );
double mr = ( Caster == m ? 0.0 : GetResistSkill( m ) );
m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ); //Skill check for gain
TimeSpan duration = TimeSpan.FromSeconds( ((ss - mr) / 2.5) + 40.0 );
ResistanceMod[] mods = new ResistanceMod[4]
{
new ResistanceMod( ResistanceType.Fire, -15 ),
new ResistanceMod( ResistanceType.Poison, -15 ),
new ResistanceMod( ResistanceType.Cold, +10 ),
new ResistanceMod( ResistanceType.Physical, +10 )
};
timer = new ExpireTimer( m, mods, duration );
timer.Start();
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.CorpseSkin, 1075663, duration, m ) );
m_Table[m] = timer;
for ( int i = 0; i < mods.Length; ++i )
m.AddResistanceMod( mods[i] );
HarmfulSpell( m );
}
FinishSequence();
}
示例2: OnGaveMeleeAttack
public override void OnGaveMeleeAttack( Mobile defender )
{
base.OnGaveMeleeAttack( defender );
if ( 0.1 > Utility.RandomDouble() && !IsStunned( defender ) )
{
/* Lightning Fist
* Cliloc: 1070839
* Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(884 715, 10)" ToLocation: "(884 715, 10)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
* Damage: 35-65, 100% energy, resistable
* Freezes for 4 seconds
* Effect cannot stack
*/
defender.FixedEffect( 0x37B9, 10, 5 );
defender.SendLocalizedMessage( 1070839 ); // The creature attacks with stunning force!
// This should be done in place of the normal attack damage.
//AOS.Damage( defender, this, Utility.RandomMinMax( 35, 65 ), 0, 0, 0, 0, 100 );
defender.Frozen = true;
ExpireTimer timer = new ExpireTimer( defender, TimeSpan.FromSeconds( 4.0 ) );
timer.Start();
m_Table[defender] = timer;
}
}
示例3: Target
public void Target( Mobile m )
{
if ( !Caster.CanSee( m ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( CheckHSequence( m ) )
{
Mobile source = Caster;
SpellHelper.Turn( source, m );
SpellHelper.CheckReflect( (int)this.Circle, ref source, ref m );
m.FixedParticles( 0x374A, 10, 30, 5013, 0x238, 2, EffectLayer.Waist );
int amount = (int)( Caster.Skills[SkillName.Musicianship].Base * 0.17 );
TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Musicianship].Base * 0.15 );
m.SendMessage( "Your poison resistance has decreased." );
ResistanceMod mod1 = new ResistanceMod( ResistanceType.Cold, - amount );
m.AddResistanceMod( mod1 );
ExpireTimer timer1 = new ExpireTimer( m, mod1, duration );
timer1.Start();
}
FinishSequence();
}
示例4: OnGaveMeleeAttack
// TODO: Put this attack shared with Hiryu and Lesser Hiryu in one place
public override void OnGaveMeleeAttack( Mobile defender )
{
base.OnGaveMeleeAttack( defender );
if( 0.1 > Utility.RandomDouble() )
{
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if( timer != null )
{
timer.DoExpire();
defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state.
}
else
defender.SendLocalizedMessage( 1070836 ); // The blow from the creature's claws has made you more susceptible to physical attacks.
int effect = -(defender.PhysicalResistance * 15 / 100);
ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, effect );
defender.FixedEffect( 0x37B9, 10, 5 );
defender.AddResistanceMod( mod );
timer = new ExpireTimer( defender, mod, TimeSpan.FromSeconds( 5.0 ) );
timer.Start();
m_Table[defender] = timer;
}
}
示例5: OnCast
public override void OnCast()
{
if( CheckSequence() )
{
Caster.PlaySound( 0x5C3 );
Caster.FixedParticles( 0x3728, 1, 13, 0x26B8, 0x455, 7, EffectLayer.Waist );
Caster.FixedParticles( 0x3779, 1, 15, 0x251E, 0x3F, 7, EffectLayer.Waist );
double skill = Caster.Skills[SkillName.Spellweaving].Value;
int damageAbsorb = (int)(18 + ((skill-10)/10)*3 + (FocusLevel * 6));
Caster.MeleeDamageAbsorb = damageAbsorb;
TimeSpan duration = TimeSpan.FromSeconds( 60 + (FocusLevel * 12) );
ExpireTimer t = new ExpireTimer( Caster, duration );
t.Start();
m_Table[Caster] = t;
Caster.BeginAction( typeof( AttuneWeaponSpell ) );
BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.AttuneWeapon, 1075798, duration, Caster, damageAbsorb.ToString() ) );
}
FinishSequence();
}
示例6: Target
public void Target( Mobile m )
{
if ( Caster == m || !(m is PlayerMobile || m is BaseCreature) ) // only PlayerMobile and BaseCreature implement blood oath checking
{
Caster.SendLocalizedMessage( 1060508 ); // You can't curse that.
}
else if ( m_OathTable.Contains( Caster ) )
{
Caster.SendLocalizedMessage( 1061607 ); // You are already bonded in a Blood Oath.
}
else if ( m_OathTable.Contains( m ) )
{
if ( m.Player )
Caster.SendLocalizedMessage( 1061608 ); // That player is already bonded in a Blood Oath.
else
Caster.SendLocalizedMessage( 1061609 ); // That creature is already bonded in a Blood Oath.
}
else if ( CheckHSequence( m ) )
{
SpellHelper.Turn( Caster, m );
/* Temporarily creates a dark pact between the caster and the target.
* Any damage dealt by the target to the caster is increased, but the target receives the same amount of damage.
* The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 80 ) + 8 seconds.
*
* NOTE: The above algorithm must be fixed point, it should be:
* ((ss-rm)/8)+8
*/
ExpireTimer timer = (ExpireTimer)m_Table[m];
if ( timer != null )
timer.DoExpire();
m_OathTable[Caster] = Caster;
m_OathTable[m] = Caster;
Caster.PlaySound( 0x175 );
Caster.FixedParticles( 0x375A, 1, 17, 9919, 33, 7, EffectLayer.Waist );
Caster.FixedParticles( 0x3728, 1, 13, 9502, 33, 7, (EffectLayer)255 );
m.FixedParticles( 0x375A, 1, 17, 9919, 33, 7, EffectLayer.Waist );
m.FixedParticles( 0x3728, 1, 13, 9502, 33, 7, (EffectLayer)255 );
TimeSpan duration = TimeSpan.FromSeconds( ((GetDamageSkill( Caster ) - GetResistSkill( m )) / 8) + 8 );
m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ); //Skill check for gain
timer = new ExpireTimer ( Caster, m, duration );
timer.Start ();
BuffInfo.AddBuff ( Caster, new BuffInfo ( BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name.ToString () ) );
BuffInfo.AddBuff ( m, new BuffInfo ( BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name.ToString () ) );
m_Table[m] = timer;
}
FinishSequence();
}
示例7: EssenceOfWindInfo
public EssenceOfWindInfo( Mobile defender, int fcMalus, int ssiMalus, TimeSpan duration )
{
m_Defender = defender;
m_FCMalus = fcMalus;
m_SSIMalus = ssiMalus;
m_Timer = new ExpireTimer( m_Defender, duration );
m_Timer.Start();
}
示例8: OnCast
public override void OnCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
if ( weapon == null || weapon is Fists )
{
Caster.SendLocalizedMessage( 501078 ); // You must be holding a weapon.
}
else if ( CheckSequence() )
{
/* Temporarily enchants the weapon the caster is currently wielding.
* The type of damage the weapon inflicts when hitting a target will
* be converted to the target's worst Resistance type.
* Duration of the effect is affected by the caster's Karma and lasts for 3 to 11 seconds.
*/
int itemID, soundID;
switch ( weapon.Skill )
{
case SkillName.Macing: itemID = 0xFB4; soundID = 0x232; break;
case SkillName.Archery: itemID = 0x13B1; soundID = 0x145; break;
default: itemID = 0xF5F; soundID = 0x56; break;
}
Caster.PlaySound( 0x20C );
Caster.PlaySound( soundID );
Caster.FixedParticles( 0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist );
IEntity from = new Entity( Serial.Zero, new Point3D( Caster.X, Caster.Y, Caster.Z ), Caster.Map );
IEntity to = new Entity( Serial.Zero, new Point3D( Caster.X, Caster.Y, Caster.Z + 50 ), Caster.Map );
Effects.SendMovingParticles( from, to, itemID, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100 );
double seconds = ComputePowerValue( 20 );
// TODO: Should caps be applied?
if ( seconds < 3.0 )
seconds = 3.0;
else if ( seconds > 11.0 )
seconds = 11.0;
TimeSpan duration = TimeSpan.FromSeconds( seconds );
Timer t = (Timer)m_Table[weapon];
if ( t != null )
t.Stop();
weapon.Consecrated = true;
m_Table[weapon] = t = new ExpireTimer( weapon, duration );
t.Start();
}
FinishSequence();
}
示例9: Target
public void Target( Mobile m )
{
BaseCreature bc = m as BaseCreature;
if( !Caster.CanSee( m ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if( m.IsDeadBondedPet || !m.Alive )
{
// As per Osi: Nothing happens.
}
else if( m != Caster && (bc == null || !bc.IsBonded || bc.ControlMaster != Caster) )
{
Caster.SendLocalizedMessage( 1072077 ); // You may only cast this spell on yourself or a bonded pet.
}
else if( m_Table.ContainsKey( m ) )
{
Caster.SendLocalizedMessage( 501775 ); // This spell is already in effect.
}
else if( CheckBSequence( m ) )
{
if( Caster == m )
{
Caster.SendLocalizedMessage( 1074774 ); // You weave powerful magic, protecting yourself from death.
}
else
{
Caster.SendLocalizedMessage( 1074775 ); // You weave powerful magic, protecting your pet from death.
SpellHelper.Turn( Caster, m );
}
m.PlaySound( 0x244 );
m.FixedParticles( 0x3709, 1, 30, 0x26ED, 5, 2, EffectLayer.Waist );
m.FixedParticles( 0x376A, 1, 30, 0x251E, 5, 3, EffectLayer.Waist );
double skill = Caster.Skills[SkillName.Spellweaving].Value;
TimeSpan duration = TimeSpan.FromMinutes( ((int)(skill / 24))* 2 + FocusLevel );
ExpireTimer t = new ExpireTimer( m, duration, this );
t.Start();
m_Table[m] = t;
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.GiftOfLife, 1031615, 1075807, duration, m, null, true ) );
}
FinishSequence();
}
示例10: OnCast
public override void OnCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
if ( weapon == null || weapon is Fists )
{
Caster.SendLocalizedMessage( 501078 ); // You must be holding a weapon.
}
else if ( CheckSequence() )
{
/* Temporarily imbues a weapon with a life draining effect.
* Half the damage that the weapon inflicts is added to the necromancer's health.
* The effects lasts for (Spirit Speak skill level / 34) + 1 seconds.
*
* NOTE: Above algorithm is fixed point, should be :
* (Spirit Speak skill level / 3.4) + 1
*
* TODO: What happens if you curse a weapon then give it to someone else? Should they get the drain effect?
*/
Caster.PlaySound( 0x387 );
Caster.FixedParticles( 0x3779, 1, 15, 9905, 32, 2, EffectLayer.Head );
Caster.FixedParticles( 0x37B9, 1, 14, 9502, 32, 5, (EffectLayer)255 );
new SoundEffectTimer( Caster ).Start();
TimeSpan duration = TimeSpan.FromSeconds( (Caster.Skills[SkillName.SpiritSpeak].Value / 3.4) + 1.0 );
Timer t = (Timer)m_Table[weapon];
if ( t != null )
t.Stop();
weapon.Cursed = true;
m_Table[weapon] = t = new ExpireTimer( weapon, duration );
t.Start();
}
FinishSequence();
}
示例11: OnGaveMeleeAttack
public override void OnGaveMeleeAttack( Mobile defender )
{
base.OnGaveMeleeAttack( defender );
if ( Utility.RandomDouble() < 0.1 )
{
ExpireTimer timer;
if ( m_Table.TryGetValue( defender, out timer ) )
timer.DoExpire();
defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
defender.PlaySound( 0x208 );
defender.SendLocalizedMessage( 1070833 ); // The creature fans you with fire, reducing your resistance to fire attacks.
ResistanceMod mod = new ResistanceMod( ResistanceType.Fire, -10 );
defender.AddResistanceMod( mod );
m_Table[defender] = timer = new ExpireTimer( defender, mod );
timer.Start();
}
}
示例12: Target
public void Target(Mobile m)
{
if (CheckBSequence(m))
{
Timer t = m_Table[m] as Timer;
if (t != null && t.Running)
{
Caster.SendAsciiMessage("This target already has reactive armor.");
}
else
{
m.MeleeDamageAbsorb = (int)(10 + Caster.Skills[SkillName.Magery].Value / 4);
m.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
m.PlaySound(0x1F2);
t = new ExpireTimer(m, TimeSpan.FromSeconds(25 + (Caster.Skills[SkillName.Magery].Value / 2.0)));
t.Start();
m_Table[m] = t;
}
}
FinishSequence();
}
示例13: OnCast
public override void OnCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
if ( weapon == null || weapon is Fists )
{
Caster.SendLocalizedMessage( 501078 ); // You must be holding a weapon.
}
else if ( CheckSequence() )
{
/* Temporarily enchants the weapon the caster is currently wielding.
* The type of damage the weapon inflicts when hitting a target will
* be converted to the target's worst Resistance type.
* Duration of the effect is affected by the caster's Karma and lasts for 3 to 11 seconds.
*/
int itemID, soundID;
switch ( weapon.Skill )
{
case SkillName.Macing:
itemID = 0xFB4;
soundID = 0x232;
break;
case SkillName.Archery:
itemID = 0x13B1;
soundID = 0x145;
break;
default:
itemID = 0xF5F;
soundID = 0x56;
break;
}
Caster.PlaySound( 0x20C );
Caster.PlaySound( soundID );
Caster.FixedParticles( 0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist );
IEntity from = new DummyEntity( Serial.Zero, new Point3D( Caster.X, Caster.Y, Caster.Z ), Caster.Map );
IEntity to = new DummyEntity( Serial.Zero, new Point3D( Caster.X, Caster.Y, Caster.Z + 50 ), Caster.Map );
Effects.SendMovingParticles( from, to, itemID, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100 );
double seconds = ComputePowerValue( 20 );
// TODO: Should caps be applied?
Utility.FixMinMax( ref seconds, 3.0, 11.0 );
TimeSpan duration = TimeSpan.FromSeconds( seconds );
if ( m_Table.ContainsKey( Caster ) )
{
Timer t = m_Table[Caster].Timer;
if ( t != null )
t.Stop();
}
double chivalry = Caster.Skills.Chivalry.Value;
Timer expireTimer = new ExpireTimer( Caster, duration );
int procChance = (int) ( ( chivalry - 20.0 ) / 0.6 );
int bonusDamage = (int) ( ( chivalry - 90.0 ) / 2.0 );
Utility.FixMinMax( ref procChance, 0, 100 );
Utility.FixMinMax( ref bonusDamage, 0, 15 );
BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.ConsecrateWeapon, 1151385, 1151386, duration, Caster, String.Format( "{0}\t{1}", procChance, bonusDamage ) ) );
ConsecrateContext context = new ConsecrateContext( expireTimer, procChance, bonusDamage );
m_Table[Caster] = context;
expireTimer.Start();
}
FinishSequence();
}
示例14: OnGaveMeleeAttack
public override void OnGaveMeleeAttack(Mobile defender)
{
base.OnGaveMeleeAttack(defender);
if (0.05 > Utility.RandomDouble())
{
/* Rune Corruption
* Start cliloc: 1070846 "The creature magically corrupts your armor!"
* Effect: All resistances -70 (lowest 0) for 5 seconds
* End ASCII: "The corruption of your armor has worn off"
*/
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if (timer != null)
{
timer.DoExpire();
defender.SendLocalizedMessage(1070845); // The creature continues to corrupt your armor!
}
else
defender.SendLocalizedMessage(1070846); // The creature magically corrupts your armor!
List<ResistanceMod> mods = new List<ResistanceMod>();
if (Core.ML)
{
if (defender.PhysicalResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Physical, -(defender.PhysicalResistance / 2)));
if (defender.FireResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Fire, -(defender.FireResistance / 2)));
if (defender.ColdResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Cold, -(defender.ColdResistance / 2)));
if (defender.PoisonResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Poison, -(defender.PoisonResistance / 2)));
if (defender.EnergyResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Energy, -(defender.EnergyResistance / 2)));
}
else
{
if (defender.PhysicalResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Physical, (defender.PhysicalResistance > 70) ? -70 : -defender.PhysicalResistance));
if (defender.FireResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Fire, (defender.FireResistance > 70) ? -70 : -defender.FireResistance));
if (defender.ColdResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Cold, (defender.ColdResistance > 70) ? -70 : -defender.ColdResistance));
if (defender.PoisonResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Poison, (defender.PoisonResistance > 70) ? -70 : -defender.PoisonResistance));
if (defender.EnergyResistance > 0)
mods.Add(new ResistanceMod(ResistanceType.Energy, (defender.EnergyResistance > 70) ? -70 : -defender.EnergyResistance));
}
for (int i = 0; i < mods.Count; ++i)
defender.AddResistanceMod(mods[i]);
defender.FixedEffect(0x37B9, 10, 5);
timer = new ExpireTimer(defender, mods, TimeSpan.FromSeconds(5.0));
timer.Start();
m_Table[defender] = timer;
}
}
示例15: OnGaveMeleeAttack
public override void OnGaveMeleeAttack(Mobile defender)
{
base.OnGaveMeleeAttack(defender);
if (0.1 > Utility.RandomDouble())
{
/* Grasping Claw
* Start cliloc: 1070836
* Effect: Physical resistance -15% for 5 seconds
* End cliloc: 1070838
* Effect: Type: "3" - From: "0x57D4F5B" (player) - To: "0x0" - ItemId: "0x37B9" - ItemIdName: "glow" - FromLocation: "(1149 808, 32)" - ToLocation: "(1149 808, 32)" - Speed: "10" - Duration: "5" - FixedDirection: "True" - Explode: "False"
*/
ExpireTimer timer = (ExpireTimer)m_Table[defender];
if (timer != null)
{
timer.DoExpire();
defender.SendLocalizedMessage(1070837); // The creature lands another blow in your weakened state.
}
else
defender.SendLocalizedMessage(1070836); // The blow from the creature's claws has made you more susceptible to physical attacks.
int effect = -(defender.PhysicalResistance * 15 / 100);
ResistanceMod mod = new ResistanceMod(ResistanceType.Physical, effect);
defender.FixedEffect(0x37B9, 10, 5);
defender.AddResistanceMod(mod);
timer = new ExpireTimer(defender, mod, TimeSpan.FromSeconds(5.0));
timer.Start();
m_Table[defender] = timer;
}
}