本文整理汇总了C#中Server.MirObjects.DelayedAction类的典型用法代码示例。如果您正苦于以下问题:C# DelayedAction类的具体用法?C# DelayedAction怎么用?C# DelayedAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelayedAction类属于Server.MirObjects命名空间,在下文中一共展示了DelayedAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Plague
private void Plague(UserMagic magic, Point location, out bool cast)
{
cast = false;
UserItem item = GetAmulet(1);
if (item == null) return;
cast = true;
int delay = Functions.MaxDistance(CurrentLocation, location) * 50 + 500; //50 MS per Step
PoisonType pType = PoisonType.None;
UserItem itemp = GetPoison(1, 1);
if (itemp != null)
pType = PoisonType.Green;
else
{
itemp = GetPoison(1, 2);
if (itemp != null)
pType = PoisonType.Red;
}
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, GetAttackPower(MinSC, MaxSC), location, pType);
CurrentMap.ActionList.Add(action);
ConsumeItem(item, 1);
if (itemp != null) ConsumeItem(itemp, 1);
}
示例2: CompleteMagic
private void CompleteMagic(IList<object> data)
{
bool train = false;
PlayerObject player = (PlayerObject)data[0];
UserMagic magic = (UserMagic)data[1];
int value, value2;
Point location;
Cell cell;
MirDirection dir;
MonsterObject monster;
Point front;
switch (magic.Spell)
{
#region HellFire
case Spell.HellFire:
value = (int)data[2];
dir = (MirDirection)data[4];
location = Functions.PointMove((Point)data[3], dir, 1);
int count = (int)data[5] - 1;
if (!ValidPoint(location)) return;
if (count > 0)
{
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 100, player, magic, value, location, dir, count);
ActionList.Add(action);
}
cell = GetCell(location);
if (cell.Objects == null) return;
for (int i = 0; i < cell.Objects.Count; i++)
{
MapObject target = cell.Objects[i];
switch (target.Race)
{
case ObjectType.Monster:
case ObjectType.Player:
//Only targets
if (target.IsAttackTarget(player))
{
if (target.Attacked(player, value, DefenceType.MAC, false) > 0)
player.LevelMagic(magic);
return;
}
break;
}
}
break;
#endregion
#region SummonSkeleton
case Spell.SummonSkeleton:
monster = (MonsterObject)data[2];
front = (Point)data[3];
if (ValidPoint(front))
monster.Spawn(this, front);
else
monster.Spawn(player.CurrentMap, player.CurrentLocation);
break;
#endregion
#region FireBang, IceStorm
case Spell.IceStorm:
case Spell.FireBang:
value = (int)data[2];
location = (Point)data[3];
for (int y = location.Y - 1; y <= location.Y + 1; y++)
{
if (y < 0) continue;
if (y >= Height) break;
for (int x = location.X - 1; x <= location.X + 1; x++)
{
if (x < 0) continue;
if (x >= Width) break;
cell = GetCell(x, y);
if (!cell.Valid || cell.Objects == null) continue;
for (int i = 0; i < cell.Objects.Count; i++)
{
MapObject target = cell.Objects[i];
switch (target.Race)
{
case ObjectType.Monster:
case ObjectType.Player:
//Only targets
if (target.IsAttackTarget(player))
//.........这里部分代码省略.........
示例3: Process
public override void Process(DelayedAction action)
{
switch (action.Type)
{
case DelayedType.Damage:
CompleteAttack(action.Params);
break;
case DelayedType.Recall:
PetRecall();
break;
}
}
示例4: MagicAttack
public void MagicAttack(MonsterObject _target)
{
if (_target == null) return;
if (!uniqueAI.IgnorePets)
MagicAttackDamage += DamageToPets;
else
FindTarget();
AttackTime = Envir.Time + AttackSpeed + 500;
if (MagicAttackDamage == 0) return;
switch (uniqueAI.MagicAttackEffect)
{
case 1:
Broadcast(new S.ObjectEffect { ObjectID = _target.ObjectID, Effect = SpellEffect.Entrapment });
break;
case 2:
Broadcast(new S.ObjectEffect { ObjectID = _target.ObjectID, Effect = SpellEffect.GreatFoxSpirit });
break;
default:
break;
}
DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, _target, MagicAttackDamage, DefenceType.MAC);
ActionList.Add(action);
}
示例5: Process
public abstract void Process(DelayedAction action);
示例6: OneWithNature
public void OneWithNature(MapObject target, UserMagic magic)
{
int damage = GetAttackPower(MinMC, MaxMC) + magic.GetPower();
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation);
CurrentMap.ActionList.Add(action);
}
示例7: CompleteMagic
//.........这里部分代码省略.........
}
}
}
}
else
{
if (doVamp)//Vampire Effect
{
if (VampAmount == 0) VampTime = Envir.Time + 1000;
VampAmount += (ushort)(value * (magic.Level + 1) * 0.25F);
}
if (doPoison)//Poison Effect
{
target.ApplyPoison(new Poison
{
Duration = (value * 2) + (magic.Level + 1) * 7,
Owner = this,
PType = PoisonType.Green,
TickSpeed = 2000,
Value = value / 25 + magic.Level + 1 + Envir.Random.Next(PoisonAttack)
}, this);
target.OperateTime = 0;
}
}
LevelMagic(magic);
break;
#endregion
#region ArcherSummons
case Spell.SummonVampire:
case Spell.SummonToad:
case Spell.SummonSnakes:
value = (int)data[1];
location = (Point)data[2];
target = (MapObject)data[3];
int SummonType = 0;
switch (magic.Spell)
{
case Spell.SummonVampire:
SummonType = 1;
break;
case Spell.SummonToad:
SummonType = 2;
break;
case Spell.SummonSnakes:
SummonType = 3;
break;
}
if (SummonType == 0) return;
for (int i = 0; i < Pets.Count; i++)
{
monster = Pets[i];
if ((monster.Info.Name != (SummonType == 1 ? Settings.VampireName : (SummonType == 2 ? Settings.ToadName : Settings.SnakeTotemName))) || monster.Dead) continue;
if (monster.Node == null) continue;
monster.ActionList.Add(new DelayedAction(DelayedType.Recall, Envir.Time + 500, target));
monster.Target = target;
return;
}
if (Pets.Where(x => x.Race == ObjectType.Monster).Count() > 1) return;
//left it in for future summon amulets
//UserItem item = GetAmulet(5);
//if (item == null) return;
MonsterInfo info = Envir.GetMonsterInfo((SummonType == 1 ? Settings.VampireName : (SummonType == 2 ? Settings.ToadName : Settings.SnakeTotemName)));
if (info == null) return;
LevelMagic(magic);
//ConsumeItem(item, 5);
monster = MonsterObject.GetMonster(info);
monster.PetLevel = magic.Level;
monster.Master = this;
monster.MaxPetLevel = (byte)(1 + magic.Level * 2);
monster.Direction = Direction;
monster.ActionTime = Envir.Time + 1000;
monster.Target = target;
if (SummonType == 1)
((Monsters.VampireSpider)monster).AliveTime = Envir.Time + ((magic.Level * 1500) + 15000);
if (SummonType == 2)
((Monsters.SpittingToad)monster).AliveTime = Envir.Time + ((magic.Level * 2000) + 25000);
if (SummonType == 3)
((Monsters.SnakeTotem)monster).AliveTime = Envir.Time + ((magic.Level * 1500) + 20000);
//Pets.Add(monster);
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, monster, location);
CurrentMap.ActionList.Add(action);
break;
#endregion
}
}
示例8: HeavenlySword
private void HeavenlySword(UserMagic magic)
{
int damage = GetAttackPower(MinDC, MaxDC) + magic.GetPower();
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, Direction);
CurrentMap.ActionList.Add(action);
}
示例9: 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;
}
示例10: SlashingBurst
private void SlashingBurst(UserMagic magic, out bool cast)
{
cast = true;
// damage
int damage = GetAttackPower(MaxDC, MaxDC) * magic.GetPower();
// objects = this, magic, damage, currentlocation, direction, attackRange
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, damage, CurrentLocation, Direction, 1);
CurrentMap.ActionList.Add(action);
// telpo location
Point location = Functions.PointMove(CurrentLocation, Direction, 2);
if (!CurrentMap.ValidPoint(location)) return;
Cell cInfo = CurrentMap.GetCell(location);
bool blocked = false;
if (cInfo.Objects != null)
{
for (int c = 0; c < cInfo.Objects.Count; c++)
{
MapObject ob = cInfo.Objects[c];
if (!ob.Blocking) continue;
blocked = true;
if ((cInfo.Objects == null) || blocked) break;
}
}
// blocked telpo cancel
if (blocked) return;
Teleport(CurrentMap, location, false);
//// move character
//CurrentMap.GetCell(CurrentLocation).Remove(this);
//RemoveObjects(Direction, 1);
//CurrentLocation = location;
//CurrentMap.GetCell(CurrentLocation).Add(this);
//AddObjects(Direction, 1);
//Enqueue(new S.UserAttackMove { Direction = Direction, Location = location });
}
示例11: CounterAttackCast
private void CounterAttackCast(UserMagic magic, MapObject target)
{
if (target == null || magic == null) return;
if (CounterAttack == false) return;
int criticalDamage = Envir.Random.Next(0, 100) <= Accuracy ? MaxDC * 2 : MinDC * 2;
int damage = (MinDC / 5 + 4 * (magic.Level + Level / 20)) * criticalDamage / 20 + MaxDC;
MirDirection dir = Functions.ReverseDirection(target.Direction);
Direction = dir;
if (Functions.InRange(CurrentLocation, target.CurrentLocation, 1) == false) return;
if (Envir.Random.Next(10) > magic.Level + 6) return;
Enqueue(new S.ObjectMagic { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Spell = Spell.CounterAttack, TargetID = target.ObjectID, Target = target.CurrentLocation, Cast = true, Level = GetMagic(Spell.CounterAttack).Level, SelfBroadcast = true });
DelayedAction action = new DelayedAction(DelayedType.Damage, AttackTime, target, damage, DefenceType.AC, true);
ActionList.Add(action);
LevelMagic(magic);
CounterAttack = false;
}
示例12: 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);
}
示例13: PetEnhancer
private void PetEnhancer(MapObject target, UserMagic magic, out bool cast)
{
cast = false;
if (target == null || target.Race != ObjectType.Monster || !target.IsFriendlyTarget(this)) return;
int duration = GetAttackPower(MinSC, MaxSC) + magic.GetPower();
cast = true;
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, magic, duration, target);
ActionList.Add(action);
}
示例14: Curse
private void Curse(UserMagic magic, Point location, out bool cast)
{
cast = false;
UserItem item = GetAmulet(1);
if (item == null) return;
cast = true;
ConsumeItem(item, 1);
if (Envir.Random.Next(10 - ((magic.Level + 1) * 2)) > 2) return;
int delay = Functions.MaxDistance(CurrentLocation, location) * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, GetAttackPower(MinSC, MaxSC) + (magic.Level + 1) * 5, location, 1 + ((magic.Level + 1) * 2));
CurrentMap.ActionList.Add(action);
}
示例15: NapalmShot
public void NapalmShot(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());
damage = ApplyArcherState(damage);
int delay = distance * 50 + 500; //50 MS per Step
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + delay, this, magic, damage, target.CurrentLocation);
CurrentMap.ActionList.Add(action);
}