本文整理汇总了C#中Mobile.CanBeHarmful方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.CanBeHarmful方法的具体用法?C# Mobile.CanBeHarmful怎么用?C# Mobile.CanBeHarmful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile
的用法示例。
在下文中一共展示了Mobile.CanBeHarmful方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) )
{
BaseCreature creature = (BaseCreature)targeted;
if ( creature.Controled )
{
from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked.
}
else if ( creature.IsParagon )
{
from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
}
else
{
from.RevealingAction();
m_Instrument.PlayInstrumentWell( from );
from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered. Whom do you wish them to attack?
from.Target = new InternalSecondTarget( from, m_Instrument, creature );
}
}
}
示例2: Shoot
public static void Shoot(Mobile from, Mobile target, INinjaWeapon weapon)
{
if (from != target && (!(from is PlayerMobile) || CanUseWeapon((PlayerMobile)from, weapon)) && from.CanBeHarmful(target))
{
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
if(from is PlayerMobile)
((PlayerMobile)from).NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback<object[]>(OnHit), new object[] { from, target, weapon });
}
if(from is PlayerMobile)
Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), (PlayerMobile)from);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
}
}
示例3: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
if( targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true) )
{
BaseCreature creature = (BaseCreature)targeted;
if( !m_Instrument.IsChildOf(from.Backpack) )
{
from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
}
else if( creature.Controlled && from.Skills.Provocation.Value < 120.0)
{
from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked.
}
else
{
from.RevealingAction();
m_Instrument.PlayInstrumentWell(from);
from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered. Whom do you wish them to attack?
from.Target = new InternalSecondTarget(from, m_Instrument, creature);
}
}
else
{
from.SendLocalizedMessage(501589); // You can't incite that!
}
EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.Provocation]));
}
示例4: OnTarget
protected override void OnTarget(Mobile from, object targeted)
{
from.RevealingAction();
if (targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true))
{
BaseCreature creature = (BaseCreature)targeted;
if (!this.m_Instrument.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
}
else if (creature.Controlled)
{
from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked.
}
else if (creature.IsParagon && BaseInstrument.GetBaseDifficulty(creature) >= 160.0)
{
from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
}
else
{
from.RevealingAction();
this.m_Instrument.PlayInstrumentWell(from);
from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered. Whom do you wish them to attack?
from.Target = new InternalSecondTarget(from, this.m_Instrument, creature);
}
}
else
{
from.SendLocalizedMessage(501589); // You can't incite that!
}
}
示例5: DoDoubleShot
public virtual void DoDoubleShot( Mobile attacker, Mobile defender )
{
if ( !attacker.CanBeHarmful( defender, false ) )
return;
bowSpeed = 350;
attacker.SendMessage( "The bow strikes again with lightning speed!" );
}
示例6: OnPickedInstrument
public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
{
from.RevealingAction();
if ( !BaseInstrument.CheckMusicianship( from ) )
{
from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
instrument.PlayInstrumentBadly( from );
instrument.ConsumeUse( from );
}
else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, 100.0 ) )
{
from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
instrument.PlayInstrumentBadly( from );
instrument.ConsumeUse( from );
}
else
{
instrument.PlayInstrumentWell( from );
instrument.ConsumeUse( from );
Map map = from.Map;
if ( map != null )
{
int range = BaseInstrument.GetBardRange( from, SkillName.Peacemaking );
bool calmed = false;
foreach ( Mobile m in from.GetMobilesInRange( range ) )
{
if ( (m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful( m, false ) )
continue;
calmed = true;
m.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
m.Combatant = null;
m.Warmode = false;
if ( m is BaseCreature && !((BaseCreature)m).BardPacified )
((BaseCreature)m).Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 1.0 ) );
}
if ( !calmed )
from.SendLocalizedMessage( 1049648 ); // You play hypnotic music, but there is nothing in range...
else
from.SendLocalizedMessage( 500615 ); // You play your hypnotic music, stopping the battle.
}
}
}
示例7: DoFlamestrike
public void DoFlamestrike( Mobile attacker, Mobile defender )
{
if ( !attacker.CanBeHarmful( defender, false ) )
return;
attacker.DoHarmful( defender );
double damage = GetAosDamage( attacker, 48, 1, 5 );
defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
defender.PlaySound( 0x208 );
SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 );
}
示例8: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1042001 );
else if ( from.Region is TownRegion ) { from.SendMessage( "You are not allowed to do that in town" ); }
else if ( from.Region.Name == "Tele Center Tram" || from.Region.Name == "Tele Center Fel" ) { from.SendMessage( "You are not allowed to do that in the Tele Center" ); }
else
{
from.SendMessage("You throw the pumpkin at your feet lett off a clound of smoke through out the area");
foreach ( Mobile mobile in from.GetMobilesInRange( 12 ) )
{
if ( mobile != null && mobile.AccessLevel < AccessLevel.GameMaster && from.CanBeHarmful(mobile) )
{
mobile.Say("*cough cough*");
mobile.Poison = Poison.Greater;
}
}
this.Delete();
}
}
示例9: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) )
{
BaseCreature creature = (BaseCreature)targeted;
if ( creature.Controled )
{
from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked.
}
else
{
from.RevealingAction();
from.Target = new InternalSecondTarget( from, m_Instrument, creature );
}
}
}
示例10: OnTarget
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Provocation, from.Skills[SkillName.Provocation].Value))
{
return;
}
if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) )
{
BaseCreature creature = (BaseCreature)targeted;
if ( !m_Instrument.IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
}
else if ( creature.Controlled )
{
from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked.
}
else if ( creature.IsParagon && BaseInstrument.GetBaseDifficulty( creature ) >= 160.0 )
{
from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
}
else if ( creature.Unprovokable )
{
from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
}
else
{
from.RevealingAction();
m_Instrument.PlayInstrumentWell( from );
from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered. Whom do you wish them to attack?
from.Target = new InternalSecondTarget( from, m_Instrument, creature );
}
}
else
{
from.SendLocalizedMessage( 501589 ); // You can't incite that!
}
}
示例11: CheckSnoopAllowed
public static bool CheckSnoopAllowed(Mobile from, Mobile to)
{
Map map = from.Map;
if (to.Player)
return from.CanBeHarmful(to, false, true); // normal restrictions
if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
return true; // felucca you can snoop anybody
GuardedRegion reg = (GuardedRegion)to.Region.GetRegion(typeof(GuardedRegion));
if (reg == null || reg.IsDisabled())
return true; // not in town? we can snoop any npc
BaseCreature cret = to as BaseCreature;
if (to.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)))
return false; // in town we cannot snoop blue human npcs
return true;
}
示例12: DoFireball
public virtual void DoFireball(Mobile attacker, Mobile defender)
{
if (!attacker.CanBeHarmful(defender, false))
{
return;
}
attacker.DoHarmful(defender);
double damage = GetAosDamage(attacker, 19, 1, 5);
attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
attacker.PlaySound(0x15E);
SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
}
示例13: DoLightning
public virtual void DoLightning(Mobile attacker, Mobile defender)
{
if (!attacker.CanBeHarmful(defender, false))
{
return;
}
attacker.DoHarmful(defender);
double damage = GetAosDamage(attacker, 23, 1, 4);
defender.BoltEffect(0);
SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100);
}
示例14: DoMagicArrow
public virtual void DoMagicArrow(Mobile attacker, Mobile defender)
{
if (!attacker.CanBeHarmful(defender, false))
{
return;
}
attacker.DoHarmful(defender);
double damage = GetAosDamage(attacker, 10, 1, 4);
attacker.MovingParticles(defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0);
attacker.PlaySound(0x1E5);
SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
}
示例15: DoHarm
public virtual void DoHarm(Mobile attacker, Mobile defender)
{
if (!attacker.CanBeHarmful(defender, false))
{
return;
}
attacker.DoHarmful(defender);
double damage = GetAosDamage(attacker, 17, 1, 5);
if (!defender.InRange(attacker, 2))
{
damage *= 0.25; // 1/4 damage at > 2 tile range
}
else if (!defender.InRange(attacker, 1))
{
damage *= 0.50; // 1/2 damage at 2 tile range
}
defender.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
defender.PlaySound(0x0FC);
SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 100, 0, 0);
}