本文整理汇总了C#中Mobile.DisruptiveAction方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.DisruptiveAction方法的具体用法?C# Mobile.DisruptiveAction怎么用?C# Mobile.DisruptiveAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile
的用法示例。
在下文中一共展示了Mobile.DisruptiveAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) {
// Make sure we've been standing still for one second
if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.AOS ? 0.5 : 1.0 )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) ) {
bool canSwing = true;
if( Core.AOS ) {
canSwing = (!attacker.Paralyzed && !attacker.Frozen);
if( canSwing ) {
Spell sp = attacker.Spell as Spell;
canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement);
}
}
if( canSwing && attacker.HarmfulCheck( defender ) ) {
attacker.DisruptiveAction();
attacker.Send( new Swing( 0, attacker, defender ) );
if( OnFired( attacker, defender ) ) {
if( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
}
return GetDelay( attacker );
} else {
return TimeSpan.FromSeconds( 0.25 );
}
}
示例2: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
// Make sure we've been standing still for .25/.5/1 second depending on Era
if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( 1.0 )) )
{
if ( attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
attacker.Send( new Swing( 0, attacker, defender ) );
if ( OnFired( attacker, defender ) )
{
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
}
attacker.RevealingAction();
return GetDelay( attacker );
}
else
{
attacker.RevealingAction();
return TimeSpan.FromSeconds( 0.25 );
}
}
示例3: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
// Make sure we've been standing still for .25/.5/1 second depending on Era
if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) )
{
bool canSwing = true;
if ( Core.AOS )
{
canSwing = ( !attacker.Paralyzed && !attacker.Frozen );
if ( canSwing )
{
Spell sp = attacker.Spell as Spell;
canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
}
}
#region Dueling
if (attacker is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)attacker;
if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this))
canSwing = false;
}
#endregion
if ( canSwing && attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
attacker.Send( new Swing( 0, attacker, defender ) );
if ( OnFired( attacker, defender ) )
{
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
}
attacker.RevealingAction();
return GetDelay( attacker );
}
else
{
attacker.RevealingAction();
return TimeSpan.FromSeconds( 0.25 );
}
}
示例4: ZombieSwingDirection
//.........这里部分代码省略.........
currentLoc.X += directionVector.X;
currentLoc.Y += directionVector.Y;
Sector newSector = mob.Map.GetSector(currentLoc);
possibleTargets.AddRange(
newSector.Mobiles.Where(
m =>
(m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m)) ||
m.X == mob.X && m.Y == mob.Y && m != mob));
}
else
{
for (int i = 0; i < range; i++)
{
currentLoc.X += directionVector.X;
currentLoc.Y += directionVector.Y;
Sector newSector = mob.Map.GetSector(currentLoc);
possibleTargets.AddRange(
newSector.Mobiles.Where(
m =>
m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m) &&
mob.InLOS(m)));
if (possibleTargets.Count > 0)
{
break; // we found our mark
}
}
}
if (possibleTargets.Count > 0)
{
// TODO: maybe I should add a check for friends? (less likely to hit a friend?)
Mobile target = possibleTargets[Utility.Random(possibleTargets.Count)];
if (weapon is BaseRanged)
{
var ranged = weapon as BaseRanged;
bool canSwing = ranged.CanSwing(mob, target);
if (mob is PlayerMobile)
{
var pm = (PlayerMobile) mob;
if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(mob, ranged))
{
canSwing = false;
}
}
if (canSwing && mob.HarmfulCheck(target))
{
mob.DisruptiveAction();
mob.Send(new Swing(0, mob, target));
if (ranged.OnFired(mob, target))
{
if (ranged.CheckHit(mob, target))
{
ranged.OnHit(mob, target);
}
else
{
ranged.OnMiss(mob, target);
}
}
}
mob.RevealingAction();
//GetDelay(mob);
}
else
{
weapon.OnSwing(mob, target);
}
}
else
{
if (weapon is BaseRanged)
{
if (((BaseRanged) weapon).OnFired(mob, null))
{
ZombieEffect(mob, ((BaseRanged) weapon).EffectID, 18, mob.X, mob.Y, mob.Z, currentLoc.X,
currentLoc.Y, currentLoc.Z, false, false);
Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a));
ZombieSwingAnimation(mob);
}
}
else
{
Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a));
ZombieSwingAnimation(mob);
}
}
}
示例5: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
//Remove weapon ability -- jabs
/*WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );*/
// Make sure we've been standing still for .25/.5/1 second depending on Era
if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) /*|| (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot)*/ )
{
bool canSwing = true;
//if ( Core.AOS )
{
canSwing = ( !attacker.Paralyzed && !attacker.Frozen );
if ( canSwing )
{
Spell sp = attacker.Spell as Spell;
canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
}
}
if ( canSwing && attacker.HarmfulCheck( defender ) && Map.LineOfSight(attacker, defender) )
{
attacker.DisruptiveAction();
// Swing packet causes the client to begin automatically changing direction
// every few seconds to face the attacker, a feature that has never been in zulu -- jabs
//attacker.Send( new Swing( 0, attacker, defender ) );
if ( OnFired( attacker, defender ) )
{
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
}
attacker.RevealingAction();
return GetDelay( attacker );
}
else
{
attacker.RevealingAction();
return TimeSpan.FromSeconds( 0.25 );
}
}
示例6: OnSwing
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
{
if ( attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
if ( attacker.NetState != null )
attacker.Send( new Swing( 0, attacker, defender ) );
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender, damageBonus );
else
OnMiss( attacker, defender );
}
return GetDelay( attacker );
}
示例7: OnSwing
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
{
bool canSwing = true;
int OldSwingState = attacker.SwingState;
int NewSwingState = this.AdvanceSwingState(attacker);
if (OldSwingState == NewSwingState)
return TimeSpan.Zero;
if (NewSwingState < 2)
return TimeSpan.Zero;
if (NewSwingState == 2)
PlaySwingAnimation(attacker);
if (NewSwingState == 3 && attacker.HarmfulCheck(defender))
{
attacker.DisruptiveAction();
if (attacker.NetState != null)
attacker.Send(new Swing(0, attacker, defender));
if (attacker is BaseCreature)
{
BaseCreature bc = (BaseCreature)attacker;
WeaponAbility ab = bc.GetWeaponAbility();
if (ab != null)
{
if (bc.WeaponAbilityChance > Utility.RandomDouble())
WeaponAbility.SetCurrentAbility(bc, ab);
else
WeaponAbility.ClearCurrentAbility(bc);
}
}
if (CheckHit(attacker, defender))
OnHit(attacker, defender, damageBonus);
else
OnMiss(attacker, defender);
}
return GetDelay( attacker );
}
示例8: OnSwing
public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus)
{
bool canSwing = CanSwing(attacker, defender);
if (attacker is PlayerMobile)
{
var pm = (PlayerMobile) attacker;
if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this))
{
canSwing = false;
}
}
if (canSwing && attacker.HarmfulCheck(defender))
{
// true if return override is encountered
if (XmlScript.HasTrigger(this, TriggerName.onSwing) &&
UberScriptTriggers.Trigger(this, defender, TriggerName.onSwing))
{
return GetDelay(attacker);
}
attacker.DisruptiveAction();
if (attacker.NetState != null)
{
attacker.Send(new Swing(0, attacker, defender));
}
if (attacker is BaseCreature)
{
var bc = (BaseCreature) attacker;
WeaponAbility ab = bc.GetWeaponAbility();
if (ab != null)
{
if (bc.WeaponAbilityChance > Utility.RandomDouble())
{
WeaponAbility.SetCurrentAbility(bc, ab);
}
else
{
WeaponAbility.ClearCurrentAbility(bc);
}
}
}
if (CheckHit(attacker, defender))
{
OnHit(attacker, defender, damageBonus);
}
else
{
OnMiss(attacker, defender);
}
}
return GetDelay(attacker);
}
示例9: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
// Make sure we've been standing still for one second
if ( attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
attacker.Send( new Swing( 0, attacker, defender ) );
if ( OnFired( attacker, defender ) )
{
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
}
return GetDelay( attacker );
}
示例10: OnSwing
public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus)
{
bool canSwing = true;
if (Core.AOS)
{
canSwing = (!attacker.Paralyzed && !attacker.Frozen);
if (canSwing)
{
Spell sp = attacker.Spell as Spell;
canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement);
}
if (canSwing)
{
PlayerMobile p = attacker as PlayerMobile;
canSwing = (p == null || p.PeacedUntil <= DateTime.UtcNow);
}
}
#region Dueling
if (attacker is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)attacker;
if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this))
{
canSwing = false;
}
}
#endregion
if (canSwing && attacker.HarmfulCheck(defender))
{
attacker.DisruptiveAction();
if (attacker.NetState != null)
{
attacker.Send(new Swing(0, attacker, defender));
}
if (attacker is BaseCreature)
{
BaseCreature bc = (BaseCreature)attacker;
WeaponAbility ab = bc.GetWeaponAbility();
if (ab != null)
{
if (bc.WeaponAbilityChance > Utility.RandomDouble())
{
WeaponAbility.SetCurrentAbility(bc, ab);
}
else
{
WeaponAbility.ClearCurrentAbility(bc);
}
}
}
if (CheckHit(attacker, defender))
{
OnHit(attacker, defender, damageBonus);
}
else
{
OnMiss(attacker, defender);
}
}
return GetDelay(attacker);
}
示例11: OnSwing
public override TimeSpan OnSwing(Mobile attacker, Mobile defender)
{
WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker);
//attacker.SendMessage(this.SwingState.ToString());
/*if (DateTime.Now <= (attacker.LastMoveTime + TimeSpan.FromSeconds(0.25)))
{
return TimeSpan.Zero;
}*/
// Make sure we've been standing still for .25/.5/1 second depending on Era
/*if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot))
{*/
bool canSwing = true;
int OldSwingState = attacker.SwingState;
int NewSwingState = this.AdvanceSwingState(attacker);
if (OldSwingState == NewSwingState)
return TimeSpan.Zero;
if (NewSwingState < 2)
return TimeSpan.Zero;
if (NewSwingState == 2)
{
if (!OnFired(attacker, defender))
{
this.ResetSwingState(1);
return TimeSpan.Zero;
}
PlaySwingAnimation(attacker);
//attacker.PlaySound(GetMissAttackSound(attacker, defender));
attacker.DisruptiveAction();
attacker.Send(new Swing(0, attacker, defender));
if (CheckHit(attacker, defender))
OnHit(attacker, defender);
else
OnMiss(attacker, defender);
}
if (NewSwingState == 3 && attacker.HarmfulCheck(defender))
{
/*if (OnFired(attacker, defender))
{*/
//}
}
attacker.RevealingAction();
return GetDelay(attacker);
/*}
else
{
attacker.RevealingAction();
return TimeSpan.FromSeconds(0.25);
}*/
}
示例12: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker);
if (this.Parent is Player)
{
Marksman mm = Perk.GetByType<Marksman>((Player)this.Parent);
if (mm != null && mm.RunAndGun())
{
bool canSwing = true;
if (Core.AOS)
{
canSwing = (!attacker.Paralyzed && !attacker.Frozen);
if (canSwing)
{
Spell sp = attacker.Spell as Spell;
canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement);
}
}
if (canSwing && attacker.HarmfulCheck(defender))
{
attacker.DisruptiveAction();
attacker.Send(new Swing(0, attacker, defender));
Item weapon = this as BaseRanged;
if (weapon != null)
{
if (((Player)this.Parent).Stam < (int)(((weapon.Weight + 2) / 2) + 3))
{
canSwing = false;
((Player)this.Parent).SendMessage("You do not have the stamina to draw your bow.");
}
else
{
((Player)this.Parent).Stam -= (int)(((weapon.Weight + 2) / 2) + 3);
}
}
if (OnFired(attacker, defender))
{
if (CheckHit(attacker, defender))
OnHit(attacker, defender);
else
OnMiss(attacker, defender);
}
}
attacker.RevealingAction();
return GetDelay(attacker);
}
}
// Make sure we've been standing still for .25/.5/1 second depending on Era
if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot) )
{
bool canSwing = true;
if( Core.AOS )
{
canSwing = (!attacker.Paralyzed && !attacker.Frozen);
if( canSwing )
{
Spell sp = attacker.Spell as Spell;
canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement);
}
}
if( canSwing && attacker.HarmfulCheck(defender) )
{
attacker.DisruptiveAction();
attacker.Send(new Swing(0, attacker, defender));
Item weapon = this as BaseRanged;
if (Parent is Player)
{
if (weapon != null)
{
if (((Player)this.Parent).Stam < (int)(((weapon.Weight + 2) / 2) + 3))
{
canSwing = false;
((Player)this.Parent).SendMessage("You do not have the stamina to draw your bow.");
}
else
{
((Player)this.Parent).Stam -= (int)(((weapon.Weight + 2) / 2) + 3);
}
}
}
if( OnFired(attacker, defender) )
//.........这里部分代码省略.........
示例13: OnSwing
public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
// Make sure we've been standing still for 0.5 seconds
if ( DateTime.Now > ( attacker.LastMoveTime + TimeSpan.FromSeconds( 0.5 ) ) || ( WeaponAbility.GetCurrentAbility( attacker ) is MovingShot ) )
{
if ( CanSwing( attacker ) && attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
attacker.Send( new Swing( 0, attacker, defender ) );
Effects.SendPacket( attacker, attacker.Map, new GraphicalEffect( EffectType.Moving, attacker.Serial, defender.Serial, ItemID, attacker.Location, defender.Location, 18, 0, false, 2 ) );
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
return GetDelay( attacker );
}
else
{
return TimeSpan.FromSeconds( 0.5 + ( 0.25 * Utility.RandomDouble() ) );
}
}
示例14: OnSwing
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus )
{
bool canSwing = true;
if ( Core.AOS )
{
canSwing = ( !attacker.Paralyzed && !attacker.Frozen );
if ( canSwing )
{
Spell sp = attacker.Spell as Spell;
canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
}
}
if ( canSwing && attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
// Swing packet causes the client to begin automatically changing direction
// every few seconds to face the attacker, a feature that has never been in zulu -- jabs
/*
if ( attacker.NetState != null )
attacker.Send( new Swing( 0, attacker, defender ) );
*/
//Removed weapon ability -- jabs
/*
if ( attacker is BaseCreature )
{
BaseCreature bc = (BaseCreature)attacker;
WeaponAbility ab = bc.GetWeaponAbility();
if ( ab != null )
{
if ( bc.WeaponAbilityChance > Utility.RandomDouble() )
WeaponAbility.SetCurrentAbility( bc, ab );
else
WeaponAbility.ClearCurrentAbility( bc );
}
}*/
if (CheckHit(attacker, defender))
{
OnHit( attacker, defender, damageBonus );
}
else
OnMiss(attacker, defender);
}
return GetDelay( attacker );
}
示例15: OnSwing
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender )
{
bool canSwing = true;
if ( Core.AOS )
{
canSwing = ( !attacker.Paralyzed && !attacker.Frozen );
if ( canSwing )
{
Spell sp = attacker.Spell as Spell;
canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
}
}
if ( canSwing && attacker.HarmfulCheck( defender ) )
{
attacker.DisruptiveAction();
if ( attacker.NetState != null )
attacker.Send( new Swing( 0, attacker, defender ) );
if ( attacker is BaseCreature )
{
BaseCreature bc = (BaseCreature)attacker;
WeaponAbility ab = bc.GetWeaponAbility();
if ( ab != null )
{
if ( bc.WeaponAbilityChance > Utility.RandomDouble() )
WeaponAbility.SetCurrentAbility( bc, ab );
else
WeaponAbility.ClearCurrentAbility( bc );
}
}
if ( CheckHit( attacker, defender ) )
OnHit( attacker, defender );
else
OnMiss( attacker, defender );
}
return GetDelay( attacker );
}