本文整理汇总了C#中Server.MirObjects.DelayedAction类的典型用法代码示例。如果您正苦于以下问题:C# DelayedAction类的具体用法?C# DelayedAction怎么用?C# DelayedAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DelayedAction类属于Server.MirObjects命名空间,在下文中一共展示了DelayedAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:30,代码来源:PlayerObject.cs
示例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))
//.........这里部分代码省略.........
开发者ID:ElijahLOMCN,项目名称:mir2,代码行数:101,代码来源:Map.cs
示例3: Process
public override void Process(DelayedAction action)
{
switch (action.Type)
{
case DelayedType.Damage:
CompleteAttack(action.Params);
break;
case DelayedType.Recall:
PetRecall();
break;
}
}
开发者ID:GenysisGaming,项目名称:mir2,代码行数:13,代码来源:MonsterObject.cs
示例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);
}
开发者ID:Pete107,项目名称:Mir2,代码行数:26,代码来源:MonsterAI.cs
示例5: Process
public abstract void Process(DelayedAction action);
开发者ID:ufaith,项目名称:cmir2,代码行数:1,代码来源:MapObject.cs
示例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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:7,代码来源:PlayerObject.cs
示例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
}
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:101,代码来源:PlayerObject.cs
示例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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:7,代码来源:PlayerObject.cs
示例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;
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:17,代码来源:PlayerObject.cs
示例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 });
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:46,代码来源:PlayerObject.cs
示例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;
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:20,代码来源:PlayerObject.cs
示例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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:10,代码来源:PlayerObject.cs
示例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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:14,代码来源:PlayerObject.cs
示例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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:17,代码来源:PlayerObject.cs
示例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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:14,代码来源:PlayerObject.cs
示例16: CrescentSlash
private void CrescentSlash(UserMagic magic)
{
int criticalDamage = Envir.Random.Next(0, 100) <= Accuracy ? MaxDC * 2 : MinDC * 2;
//int damage = (MinDC / 5 + 4 * (magic.Level + Level / 20)) * criticalDamage / 20 + MaxDC;
int damage = (MinDC / 5 + 4 * (magic.Level + Level / 20)) + criticalDamage / 20 + MaxDC;
MirDirection backDir = Functions.ReverseDirection(Direction);
MirDirection preBackDir = Functions.PreviousDir(backDir);
MirDirection nextBackDir = Functions.NextDir(backDir);
for (int i = 0; i < 8; i++)
{
MirDirection dir = (MirDirection)i;
Point hitPoint = Functions.PointMove(CurrentLocation, dir, 1);
if (dir != backDir && dir != preBackDir && dir != nextBackDir)
{
if (!CurrentMap.ValidPoint(hitPoint)) continue;
Cell cell = CurrentMap.GetCell(hitPoint);
if (cell.Objects == null) continue;
for (int j = 0; j < cell.Objects.Count; j++)
{
MapObject target = cell.Objects[j];
switch (target.Race)
{
case ObjectType.Monster:
case ObjectType.Player:
//Only targets
if (target.IsAttackTarget(this))
{
DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + AttackSpeed, target, damage, DefenceType.AC, true);
ActionList.Add(action);
}
break;
}
}
LevelMagic(magic);
}
}
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:45,代码来源:PlayerObject.cs
示例17: 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);
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:13,代码来源:PlayerObject.cs
示例18: FlashDash
private void FlashDash(UserMagic magic)
{
bool success = false;
ActionTime = Envir.Time;
int travel = 0;
bool blocked = false;
int jumpDistance = (magic.Level <= 1) ? 0 : 1;//3 max
Point location = CurrentLocation;
for (int i = 0; i < jumpDistance; i++)
{
location = Functions.PointMove(location, Direction, 1);
if (!CurrentMap.ValidPoint(location)) break;
Cell cInfo = CurrentMap.GetCell(location);
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;
}
}
if (blocked) break;
travel++;
}
jumpDistance = travel;
if (jumpDistance > 0)
{
location = Functions.PointMove(CurrentLocation, Direction, jumpDistance);
CurrentMap.GetCell(CurrentLocation).Remove(this);
RemoveObjects(Direction, 1);
CurrentLocation = location;
CurrentMap.GetCell(CurrentLocation).Add(this);
AddObjects(Direction, 1);
Enqueue(new S.UserDashAttack { Direction = Direction, Location = location });
Broadcast(new S.ObjectDashAttack { ObjectID = ObjectID, Direction = Direction, Location = location, Distance = jumpDistance });
}
else
{
Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
}
if (travel == 0) location = CurrentLocation;
int attackDelay = (AttackSpeed - 120) <= 300 ? 300 : (AttackSpeed - 120);
AttackTime = Envir.Time + attackDelay;
SpellTime = Envir.Time + 300;
location = Functions.PointMove(location, Direction, 1);
if (CurrentMap.ValidPoint(location))
{
Cell cInfo = CurrentMap.GetCell(location);
if (cInfo.Objects != null)
{
for (int c = 0; c < cInfo.Objects.Count; c++)
{
MapObject ob = cInfo.Objects[c];
switch (ob.Race)
{
case ObjectType.Monster:
case ObjectType.Player:
//Only targets
if (ob.IsAttackTarget(this))
{
DelayedAction action = new DelayedAction(DelayedType.Damage, AttackTime, ob, GetAttackPower(MinDC, MaxDC), DefenceType.AC, true);
ActionList.Add(action);
success = true;
if ((((ob.Race != ObjectType.Player) || Settings.PvpCanResistPoison) && (Envir.Random.Next(Settings.PoisonAttackWeight) >= ob.PoisonResist)) && (Envir.Random.Next(15) <= magic.Level + 1))
{
DelayedAction pa = new DelayedAction(DelayedType.Poison, AttackTime, ob, PoisonType.Stun, SpellEffect.TwinDrakeBlade, magic.Level + 1, 1000);
ActionList.Add(pa);
}
}
break;
}
}
}
}
if (success) //technicaly this makes flashdash lvl when it casts rather then when it hits (it wont lvl if it's not hitting!)
LevelMagic(magic);
magic.CastTime = Envir.Time;
Enqueue(new S.MagicCast { Spell = magic.Spell });
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:89,代码来源:PlayerObject.cs
示例19: Portal
private void Portal(UserMagic magic, Point location, out bool cast)
{
cast = false;
if (!CurrentMap.ValidPoint(location)) return;
if (PortalObjectsArray[1] != null && PortalObjectsArray[1].Node != null)
{
PortalObjectsArray[0].ExpireTime = 0;
PortalObjectsArray[0].Process();
}
if (!CanFly(location)) return;
int duration = 30 + (magic.Level * 30);
int value = duration;
DelayedAction action = new DelayedAction(DelayedType.Magic, Envir.Time + 500, this, magic, value, location);
CurrentMap.ActionList.Add(action);
cast = true;
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:21,代码来源:PlayerObject.cs
示例20: 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;
}
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:20,代码来源:PlayerObject.cs
注:本文中的Server.MirObjects.DelayedAction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论