本文整理汇总了C#中Server.MirObjects.MapObject.IsAttackTarget方法的典型用法代码示例。如果您正苦于以下问题:C# MapObject.IsAttackTarget方法的具体用法?C# MapObject.IsAttackTarget怎么用?C# MapObject.IsAttackTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.MirObjects.MapObject
的用法示例。
在下文中一共展示了MapObject.IsAttackTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoubleShot
private bool DoubleShot(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return false;
if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return false;
int distance = Functions.MaxDistance(CurrentLocation, target.CurrentLocation);
int damage = (GetAttackPower(MinMC, MaxMC) + magic.GetPower());
damage = (int)(damage * Math.Max(1, (distance * 0.25)));//range boost
damage = ApplyArcherState(damage);
int delay = distance * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target);
ActionList.Add(action);
action = new DelayedAction(DelayedType.Magic, Envir.Time + delay + 50, magic, damage, target);
ActionList.Add(action);
return true;
}
示例2: DelayedExplosion
private bool DelayedExplosion(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false;
int power = GetAttackPower(MinMC, MaxMC) + magic.GetPower();
int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, power, target);
ActionList.Add(action);
return true;
}
示例3: Entrapment
private void Entrapment(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return;
int damage = 0;
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, damage, target);
ActionList.Add(action);
}
示例4: Trap
private void Trap(UserMagic magic, MapObject target, out bool cast)
{
cast = false;
if (target == null || !target.IsAttackTarget(this) || !(target is MonsterObject)) return;
if (target.Level >= Level + 2) return;
Point location = target.CurrentLocation;
LevelMagic(magic);
uint duration = 60000;
int value = (int)duration;
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, value, location);
CurrentMap.ActionList.Add(action);
cast = true;
}
示例5: ArcherSummon
public void ArcherSummon(UserMagic magic, MapObject target, Point location)
{
if (target != null && target.IsAttackTarget(this))
location = target.CurrentLocation;
if (!CanFly(location)) return;
uint duration = (uint)((magic.Level * 5 + 10) * 1000);
int value = (int)duration;
int delay = Functions.MaxDistance(CurrentLocation, location) * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, value, location, target);
ActionList.Add(action);
}
示例6: ProcessSpell
public void ProcessSpell(MapObject ob)
{
if (Envir.Time < StartTime) return;
switch (Spell)
{
case Spell.FireWall:
if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) return;
if (ob.Dead) return;
if (!ob.IsAttackTarget(Caster)) return;
ob.Attacked(Caster, Value, DefenceType.MAC, false);
break;
case Spell.Healing: //SafeZone
if (ob.Race != ObjectType.Player && (ob.Race != ObjectType.Monster || ob.Master == null || ob.Master.Race != ObjectType.Player)) return;
if (ob.Dead || ob.HealAmount != 0 || ob.PercentHealth == 100) return;
ob.HealAmount += 25;
Broadcast(new S.ObjectEffect {ObjectID = ob.ObjectID, Effect = SpellEffect.Healing});
break;
case Spell.PoisonField:
if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) return;
if (ob.Dead) return;
if (!ob.IsAttackTarget(Caster)) return;
ob.Attacked(Caster, Value, DefenceType.None, false);
if (!ob.Dead)
ob.ApplyPoison(new Poison
{
Duration = 15,
Owner = Caster,
PType = PoisonType.Green,
TickSpeed = 2000,
Value = Value/20
}, Caster);
break;
case Spell.Blizzard:
if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) return;
if (ob.Dead) return;
if (Caster.ActiveBlizzard == false) return;
if (!ob.IsAttackTarget(Caster)) return;
ob.Attacked(Caster, Value, DefenceType.MACAgility, false);
if (!ob.Dead && Envir.Random.Next(8) == 0)
ob.ApplyPoison(new Poison
{
Duration = 5 + Envir.Random.Next(Caster.Freezing),
Owner = Caster,
PType = PoisonType.Slow,
TickSpeed = 2000,
}, Caster);
break;
case Spell.MeteorStrike:
if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) return;
if (ob.Dead) return;
if (Caster.ActiveBlizzard == false) return;
if (!ob.IsAttackTarget(Caster)) return;
ob.Attacked(Caster, Value, DefenceType.MACAgility, false);
break;
}
}
示例7: Poisoning
private bool Poisoning(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return false;
UserItem item = GetPoison(1);
if (item == null) return false;
int power = GetAttackPower(MinSC, MaxSC);
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, power, target, item);
ActionList.Add(action);
ConsumeItem(item, 1);
return true;
}
示例8: SpecialArrowShot
public void SpecialArrowShot(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return;
if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return;
int distance = Functions.MaxDistance(CurrentLocation, target.CurrentLocation);
int damage = (GetAttackPower(MinMC, MaxMC) + magic.GetPower());
if (magic.Spell != Spell.CrippleShot)
damage = (int)(damage * Math.Max(1, (distance * 0.4)));//range boost
damage = ApplyArcherState(damage);
int delay = distance * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target);
ActionList.Add(action);
}
示例9: TurnUndead
private void TurnUndead(MapObject target, UserMagic magic)
{
if (target == null || target.Race != ObjectType.Monster || !target.Undead || !target.IsAttackTarget(this)) return;
if (Envir.Random.Next(2) + Level - 1 <= target.Level)
{
target.Target = this;
return;
}
int dif = Level - target.Level + 15;
if (Envir.Random.Next(100) >= (magic.Level + 1 << 3) + dif)
{
target.Target = this;
return;
}
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, target);
ActionList.Add(action);
}
示例10: FlameDisruptor
private void FlameDisruptor(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return;
int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower();
if (!target.Undead) damage = (int)(damage * 1.5F);
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, damage, target);
ActionList.Add(action);
}
示例11: Vampirism
private void Vampirism(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return;
int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower();
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, damage, target);
ActionList.Add(action);
}
示例12: Fireball
private bool Fireball(MapObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false;
int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower();
int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target);
//if(magic.Info.Spell == Spell.GreatFireBall && magic.Level >= 3 && target.Race == ObjectType.Monster)
//{
// List<MapObject> targets = ((MonsterObject)target).FindAllNearby(3, target.CurrentLocation);
// int secondaryTargetCount = targets.Count > 3 ? 3 : targets.Count;
// for (int i = 0; i < secondaryTargetCount; i++)
// {
// if (!target.IsAttackTarget(this)) continue;
// DelayedAction action2 = new DelayedAction(DelayedType.Magic, Envir.Time + delay + 200, magic, damage / 2, targets[i]);
// ActionList.Add(action2);
// Enqueue(new S.Magic { Spell = magic.Info.Spell, TargetID = targets[i].ObjectID, Target = targets[i].CurrentLocation, Cast = true, Level = magic.Level });
// Broadcast(new S.ObjectMagic { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Spell = magic.Info.Spell, TargetID = targets[i].ObjectID, Target = targets[i].CurrentLocation, Cast = true, Level = magic.Level });
// }
//}
ActionList.Add(action);
return true;
}
示例13: ElementalShot
private bool ElementalShot(MapObject target, UserMagic magic)
{
if (HasElemental)
{
if (target == null || !target.IsAttackTarget(this)) return false;
if ((Info.MentalState != 1) && !CanFly(target.CurrentLocation)) return false;
int orbPower = magic.GetPower() + GetElementalOrbPower(false);//base power + orbpower
int damage = GetAttackPower(MinMC, MaxMC) + orbPower;
int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target);
ActionList.Add(action);
}
else
{
ObtainElement(true);//gather orb through casting
LevelMagic(magic);
return false;
}
return true;
}
示例14: DoKnockback
public void DoKnockback(MapObject target, UserMagic magic)//ElementalShot - knockback
{
Cell cell = CurrentMap.GetCell(target.CurrentLocation);
if (!cell.Valid || cell.Objects == null) return;
if (target.CurrentLocation.Y < 0 || target.CurrentLocation.Y >= CurrentMap.Height || target.CurrentLocation.X < 0 || target.CurrentLocation.X >= CurrentMap.Height) return;
if (target.Race != ObjectType.Monster && target.Race != ObjectType.Player) return;
if (!target.IsAttackTarget(this) || target.Level >= Level) return;
if (Envir.Random.Next(20) >= 6 + magic.Level * 3 + ElementsLevel + Level - target.Level) return;
int distance = 1 + Math.Max(0, magic.Level - 1) + Envir.Random.Next(2);
MirDirection dir = Functions.DirectionFromPoint(CurrentLocation, target.CurrentLocation);
target.Pushed(this, dir, distance);
}
示例15: SoulFireball
private bool SoulFireball(MapObject target, UserMagic magic, out bool cast)
{
cast = false;
UserItem item = GetAmulet(1);
if (item == null) return false;
cast = true;
if (target == null || !target.IsAttackTarget(this) || !CanFly(target.CurrentLocation)) return false;
int damage = GetAttackPower(MinSC, MaxSC) + magic.GetPower();
int delay = Functions.MaxDistance(CurrentLocation, target.CurrentLocation) * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, magic, damage, target);
ActionList.Add(action);
ConsumeItem(item, 1);
return true;
}