本文整理汇总了C#中Server.Mobiles.BaseCreature.CanBeHarmful方法的典型用法代码示例。如果您正苦于以下问题:C# BaseCreature.CanBeHarmful方法的具体用法?C# BaseCreature.CanBeHarmful怎么用?C# BaseCreature.CanBeHarmful使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobiles.BaseCreature
的用法示例。
在下文中一共展示了BaseCreature.CanBeHarmful方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RoarAttack
public static void RoarAttack(BaseCreature from, Mobile target)
{
if (from.RoarAttack < 10 || from == null || target == null)
return;
int power = from.RoarAttack / 10;
int mindam = from.RoarAttack / 3;
int maxdam = from.RoarAttack / 2;
from.Say("*Roars*");
ArrayList targets = new ArrayList();
foreach (Mobile m in from.GetMobilesInRange(power))
{
if (m != from && from.CanBeHarmful(m))
targets.Add(m);
}
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = (Mobile)targets[i];
if (m is BaseCreature)
{
BaseCreature bc = (BaseCreature)m;
// if (bc.Controlled == true && bc.ControlMaster != null)
// return;//////////////////////////////////////////////////////////////////////////////
// else
bc.BeginFlee(TimeSpan.FromSeconds(10.0));
AOS.Damage(target, from, Utility.RandomMinMax(mindam, maxdam), 100, 0, 0, 0, 0);
}
}
}
示例2: AttemptFireBreath
private static void AttemptFireBreath(BaseCreature creature, Mobile target)
{
if (!creature.InLOS(target))
{
creature.SendMessage("Target cannot be seen.");
return;
}
if (!target.InRange(creature, creature.BreathRange))
{
creature.SendMessage("That is too far away.");
return;
}
if (target != null && target.Alive && !target.IsDeadBondedPet && creature.CanBeHarmful(target) &&
target.Map == creature.Map && !creature.IsDeadBondedPet &&
!creature.BardPacified)
{
creature.BreathStart(target);
creature.SetNextBreathTime();
}
else
{
creature.SendMessage("You can't breathe fire on that!");
}
}
示例3: GetSecondTarget
/// <summary>
/// Used for second Provocation target.
/// </summary>
/// <param name="first"></param>
/// <returns></returns>
public virtual Mobile GetSecondTarget(BaseCreature first)
{
if (first == null)
return null;
int range = BaseInstrument.GetBardRange(this, SkillName.Provocation);
IPooledEnumerable eable = this.Map.GetMobilesInRange(Location, range);
List<Mobile> possibles = new List<Mobile>();
foreach (Mobile m in eable)
{
if (m != first && m != this && first.InRange(m.Location, range))
{
if (this.CanBeHarmful(m, false) && first.CanBeHarmful(m, false))
possibles.Add(m);
}
}
eable.Free();
Mobile t = null;
if (possibles.Count > 0)
t = possibles[Utility.Random(possibles.Count)];
possibles.Clear();
possibles.TrimExcess();
return t;
}
示例4: ValidTarget
public static bool ValidTarget(BaseCreature caster, Mobile m)
{
bool validTarget = false;
if (m.AccessLevel > AccessLevel.Player) // can not hurt staff
validTarget = false;
else if (caster == null) // nobody cast the AOE, it hurts everybody
validTarget = true;
// player can not use this AOE
/*
else if (m_Caster.Player && m_Caster == m) // player can use AOE to hurt themselves under any condition
validTarget = true;
*/
else if (Core.AOS && caster == m) // NPC never hurt themselves with AOE in AOS context
validTarget = false;
else if (!caster.Controlled && !caster.Summoned)
{ // potion thrown by a wild creature (the most typical case for now)
if (m is BaseCreature)
{
BaseCreature target = (BaseCreature)m;
if (target.Blessed)
validTarget = false; // obvious
else if (!target.Controlled && !target.Summoned)
{ // wild NPC can not hurt another wild NPC of same alliance (good can not hurt good, bad can not hurt bad, but can hurt across)
if (target.InitialInnocent == caster.InitialInnocent)
validTarget = false;
else
validTarget = true;
}
else if (!caster.InitialInnocent && ((target.Controlled && target.ControlMaster != null && target.ControlMaster.Player && !target.IsDeadPet) || (target.Summoned && target.SummonMaster != null && target.SummonMaster.Player)))
validTarget = true; // wild non-good NPC can always hurt player controlled/summoned NPC
}
else if (m.Player && !caster.InitialInnocent && !(m.AccessLevel > AccessLevel.Player && m.Hidden))
validTarget = true; // wild NPC of non-good alliance can always hurt a player, given it is not a hidden GM
}
else
validTarget = (SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false));
return validTarget;
}
示例5: DoBomber
public static void DoBomber(BaseCreature mobile, Mobile player)
{
Mobile combatant = player;
if ( combatant == null || combatant.Deleted || combatant.Map != mobile.Map || !mobile.InRange( combatant, 12 ) || !mobile.CanBeHarmful( combatant ) || !mobile.InLOS( combatant ) )
return;
if ( DateTime.Now >= m_NextBomb )
{
ThrowBomb( combatant, player );
m_Thrown++;
if ( 0.75 >= Utility.RandomDouble() && (m_Thrown % 2) == 1 )
m_NextBomb = DateTime.Now + TimeSpan.FromSeconds( 3.0 );
else
m_NextBomb = DateTime.Now + TimeSpan.FromSeconds( 5.0 + (10.0 * Utility.RandomDouble()) );
}
}
示例6: IcyWindAttack
public static void IcyWindAttack(BaseCreature from, Mobile target)
{
if (from.IcyWindAttack < 10 || from == null || target == null)
return;
Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);
int mindam = from.IcyWindAttack / 3;
int maxdam = from.IcyWindAttack / 2;
ArrayList targets = new ArrayList();
foreach (Mobile m in from.GetMobilesInRange(from.IcyWindAttack / 10))
{
if (m != from && from.CanBeHarmful(m))
targets.Add(m);
}
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = (Mobile)targets[i];
from.Say("Icy Wind Attack");
AOS.Damage(target, from, Utility.RandomMinMax(mindam, maxdam), 0, 0, 100, 0, 0);
Slow.SlowWalk(m, 10);
}
}