本文整理汇总了C#中wServer.realm.Entity.HasConditionEffect方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.HasConditionEffect方法的具体用法?C# Entity.HasConditionEffect怎么用?C# Entity.HasConditionEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wServer.realm.Entity
的用法示例。
在下文中一共展示了Entity.HasConditionEffect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSpeed
public static float GetSpeed(Entity entity, float stat)
{
float ret = 4 + 5.6f*(stat/75f);
if (entity.HasConditionEffect(ConditionEffectIndex.Speedy))
ret *= 1.5f;
if (entity.HasConditionEffect(ConditionEffectIndex.Slowed))
ret = 4;
if (entity.HasConditionEffect(ConditionEffectIndex.Paralyzed))
ret = 0;
return ret;
}
示例2: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
BuzzStorage storage = (BuzzStorage)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
if (storage.RemainingTime > 0)
{
storage.RemainingTime -= time.thisTickTimes;
Status = CycleStatus.NotStarted;
}
else
{
Status = CycleStatus.InProgress;
if (storage.RemainingDistance <= 0)
{
do
{
storage.Direction = new Vector2(Random.Next(-1, 2), Random.Next(-1, 2));
} while (storage.Direction.X == 0 && storage.Direction.Y == 0);
storage.Direction.Normalize();
storage.RemainingDistance = this.dist;
Status = CycleStatus.Completed;
}
float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
host.ValidateAndMove(host.X + storage.Direction.X * dist, host.Y + storage.Direction.Y * dist);
host.UpdateCount++;
storage.RemainingDistance -= dist;
}
state = storage;
}
示例3: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int) state;
if (cool <= 0)
{
if (host.HasConditionEffect(ConditionEffectIndex.Stunned)) return;
Position target = new Position
{
X = host.X + (float) (range*Math.Cos(angle.Value)),
Y = host.Y + (float) (range*Math.Sin(angle.Value)),
};
host.Owner.Timers.Add(new WorldTimer(0, (world, t) =>
{
Entity entity = Entity.Resolve(world.Manager, child);
entity.Move(target.X, target.Y);
(entity as Enemy).Terrain = (host as Enemy).Terrain;
world.EnterWorld(entity);
}));
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例4: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int)state;
if (cool <= 0)
{
if (host.HasConditionEffect(ConditionEffects.Stunned)) return;
Position target = new Position()
{
X = host.X + (float)(range * Math.Cos(angle.Value)),
Y = host.Y + (float)(range * Math.Sin(angle.Value)),
};
host.Owner.BroadcastPacket(new ShowEffectPacket()
{
EffectType = EffectType.Throw,
Color = new ARGB(0xffffbf00),
TargetId = host.Id,
PosA = target
}, null);
host.Owner.Timers.Add(new WorldTimer(1500, (world, t) =>
{
Entity entity = Entity.Resolve(child);
entity.Move(target.X, target.Y);
(entity as Enemy).Terrain = (host as Enemy).Terrain;
world.EnterWorld(entity);
}));
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例5: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
WanderStorage storage;
if (state == null) storage = new WanderStorage();
else storage = (WanderStorage)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
Status = CycleStatus.InProgress;
if (storage.RemainingDistance <= 0)
{
storage.Direction = new Vector2(Random.Next(-1, 2), Random.Next(-1, 2));
storage.Direction.Normalize();
storage.RemainingDistance = period.Next(Random) / 1000f;
Status = CycleStatus.Completed;
}
float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
host.ValidateAndMove(host.X + storage.Direction.X * dist, host.Y + storage.Direction.Y * dist);
host.UpdateCount++;
storage.RemainingDistance -= dist;
state = storage;
}
示例6: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
if (!returned)
{
if (host.HasConditionEffect(ConditionEffectIndex.Paralyzed)) return;
var spd = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
Position pos = (host as Enemy).SpawnPoint;
var tx = pos.X;
var ty = pos.Y;
if (Math.Abs(tx - host.X) > 1 || Math.Abs(ty - host.Y) > 1)
{
var x = host.X;
var y = host.Y;
Vector2 vect = new Vector2(tx, ty) - new Vector2(host.X, host.Y);
vect.Normalize();
vect *= spd;
host.Move(host.X + vect.X, host.Y + vect.Y);
host.UpdateCount++;
}
if (host.X == pos.X && host.Y == pos.Y && once)
{
once = true;
returned = true;
}
}
}
示例7: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
var s = (OrbitState) state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
Entity entity = host.GetNearestEntity(acquireRange, target);
if (entity != null)
{
double angle;
if (host.Y == entity.Y && host.X == entity.X) //small offset
angle = Math.Atan2(host.Y - entity.Y + (Random.NextDouble()*2 - 1),
host.X - entity.X + (Random.NextDouble()*2 - 1));
else
angle = Math.Atan2(host.Y - entity.Y, host.X - entity.X);
float angularSpd = host.GetSpeed(s.Speed)/s.Radius;
angle += angularSpd*(time.thisTickTimes/1000f);
double x = entity.X + Math.Cos(angle)*radius;
double y = entity.Y + Math.Sin(angle)*radius;
Vector2 vect = new Vector2((float) x, (float) y) - new Vector2(host.X, host.Y);
vect.Normalize();
vect *= host.GetSpeed(s.Speed)*(time.thisTickTimes/1000f);
host.ValidateAndMove(host.X + vect.X, host.Y + vect.Y);
host.UpdateCount++;
Status = CycleStatus.InProgress;
}
state = s;
}
示例8: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
ProtectState s;
if (state == null) s = ProtectState.DontKnowWhere;
else s = (ProtectState) state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffectIndex.Paralyzed)) return;
Entity entity = host.GetNearestEntity(acquireRange, protectee);
Vector2 vect;
switch (s)
{
case ProtectState.DontKnowWhere:
if (entity != null)
{
s = ProtectState.Protecting;
goto case ProtectState.Protecting;
}
break;
case ProtectState.Protecting:
if (entity == null)
{
s = ProtectState.DontKnowWhere;
break;
}
vect = new Vector2(entity.X - host.X, entity.Y - host.Y);
if (vect.Length > reprotectRange)
{
Status = CycleStatus.InProgress;
vect.Normalize();
float dist = host.GetSpeed(speed)*(time.thisTickTimes/1000f);
host.ValidateAndMove(host.X + vect.X*dist, host.Y + vect.Y*dist);
host.UpdateCount++;
}
else
{
Status = CycleStatus.Completed;
s = ProtectState.Protected;
}
break;
case ProtectState.Protected:
if (entity == null)
{
s = ProtectState.DontKnowWhere;
break;
}
Status = CycleStatus.Completed;
vect = new Vector2(entity.X - host.X, entity.Y - host.Y);
if (vect.Length > protectionRange)
{
s = ProtectState.Protecting;
goto case ProtectState.Protecting;
}
break;
}
state = s;
}
示例9: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cooldown;
if (state == null) cooldown = 1000;
else cooldown = (int)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
var player = (Player)host.GetNearestEntity(distance, null);
if (player != null)
{
Vector2 vect;
vect = new Vector2(player.X - host.X, player.Y - host.Y);
vect.Normalize();
float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
host.ValidateAndMove(host.X + (-vect.X) * dist, host.Y + (-vect.Y) * dist);
host.UpdateCount++;
if (cooldown <= 0)
{
Status = CycleStatus.Completed;
cooldown = 1000;
}
else
{
Status = CycleStatus.InProgress;
cooldown -= time.thisTickTimes;
}
}
state = cooldown;
}
示例10: GetDefenseDamage
public static float GetDefenseDamage(Entity host, int dmg, int def)
{
if (host.HasConditionEffect(ConditionEffectIndex.Armored))
def *= 2;
if (host.HasConditionEffect(ConditionEffectIndex.ArmorBroken))
def = 0;
float limit = dmg*0.15f;
float ret;
if (dmg - def < limit) ret = limit;
else ret = dmg - def;
if (host.HasConditionEffect(ConditionEffectIndex.Invulnerable) ||
host.HasConditionEffect(ConditionEffectIndex.Invincible))
ret = 0;
return ret;
}
示例11: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int)state;
if (cool <= 0)
{
if (host.HasConditionEffect(ConditionEffects.Stunned)) return;
Entity player = host.GetNearestEntity(range, null);
if (player != null || fixedAngle != null)
{
Position target;
if (fixedAngle != null)
target = new Position()
{
X = (float)(range * Math.Cos(fixedAngle.Value)),
Y = (float)(range * Math.Sin(fixedAngle.Value)),
};
else
target = new Position()
{
X = player.X,
Y = player.Y,
};
host.Owner.BroadcastPacket(new ShowEffectPacket()
{
EffectType = EffectType.Throw,
Color = new ARGB(0xffff0000),
TargetId = host.Id,
PosA = target
}, null);
host.Owner.Timers.Add(new WorldTimer(1500, (world, t) =>
{
world.BroadcastPacket(new AOEPacket()
{
Position = target,
Radius = radius,
Damage = (ushort)damage,
EffectDuration = 0,
Effects = 0,
OriginType = host.ObjectType
}, null);
EntityUtils.AOE(world, target, radius, true, p =>
{
(p as IPlayer).Damage(damage, host as Character);
});
}));
}
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例12: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int) state;
if (cool <= 0)
{
if (host.HasConditionEffect(ConditionEffectIndex.Stunned)) return;
double? tossAngle = randomToss ? Random.Next(0, 360)*Math.PI/180 : angle;
Entity en = null;
if(tossAngle == null)
en = host.GetNearestEntity(range, null);
if (tossAngle == null && en == null) return;
Position target = tossAngle == null ?
new Position
{
X = en.X,
Y = en.Y
} :
new Position
{
X = host.X + (float)(range * Math.Cos(tossAngle.Value)),
Y = host.Y + (float)(range * Math.Sin(tossAngle.Value)),
};
host.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Throw,
Color = new ARGB(0xffffbf00),
TargetId = host.Id,
PosA = target
}, null);
host.Owner.Timers.Add(new WorldTimer(1500, (world, t) =>
{
Entity entity = Entity.Resolve(world.Manager, child);
entity.Move(target.X, target.Y);
if(entity is Enemy && host is Enemy)
(entity as Enemy).Terrain = (host as Enemy).Terrain;
world.EnterWorld(entity);
}));
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例13: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int)state;
if (cool <= 0)
{
if (host.HasConditionEffect(ConditionEffectIndex.Sick)) return;
Player entity = host.GetNearestEntity(range, null) as Player;
if (entity != null)
{
int maxHp = entity.Stats[0] + entity.Boost[0];
int newHp = Math.Min(maxHp, entity.HP + amount);
if (newHp != entity.HP)
{
int n = newHp - entity.HP;
entity.HP = newHp;
entity.UpdateCount++;
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Potion,
TargetId = entity.Id,
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Trail,
TargetId = host.Id,
PosA = new Position { X = entity.X, Y = entity.Y },
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new NotificationPacket
{
ObjectId = entity.Id,
Text = "{\"key\":\"blank\",\"tokens\":{\"data\":\"+" + n + "\"}}",
Color = new ARGB(0xff00ff00)
}, null);
}
}
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例14: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
//var en = host.GetNearestEntity(20, null);
//var player = en as Player;
//if (en == null)
//{
// return;
//}
float dist;
if (state == null) dist = distance;
else dist = (float)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffectIndex.Paralyzed)) return;
float moveDist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
if (dist > 0)
{
Status = CycleStatus.InProgress;
host.ValidateAndMove(host.X + moveDist, host.Y);
host.UpdateCount++;
dist -= moveDist;
if (dist <= 0)
{
dist = -distance;
Status = CycleStatus.Completed;
}
}
else
{
Status = CycleStatus.InProgress;
host.ValidateAndMove(host.X - moveDist, host.Y);
host.UpdateCount++;
dist += moveDist;
if (dist >= 0)
{
dist = distance;
Status = CycleStatus.Completed;
}
}
state = dist;
}
示例15: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
ChargeState s;
if (state == null) s = new ChargeState();
else s = (ChargeState)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
if (s.RemainingTime <= 0)
{
if (s.Direction == Vector2.Zero)
{
var player = (Player)host.GetNearestEntity(range, null);
if (player != null && player.X != host.X && player.Y != host.Y)
{
s.Direction = new Vector2(player.X - host.X, player.Y - host.Y);
var d = s.Direction.Length();
s.Direction.Normalize();
s.RemainingTime = coolDown.Next(Random);
if (d / host.GetSpeed(speed) < s.RemainingTime)
s.RemainingTime = (int)(d / host.GetSpeed(speed) * 1000);
Status = CycleStatus.InProgress;
}
}
else
{
s.Direction = Vector2.Zero;
s.RemainingTime = coolDown.Next(Random);
Status = CycleStatus.Completed;
}
}
if (s.Direction != Vector2.Zero)
{
float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
host.ValidateAndMove(host.X + s.Direction.X * dist, host.Y + s.Direction.Y * dist);
host.UpdateCount++;
Status = CycleStatus.InProgress;
}
s.RemainingTime -= time.thisTickTimes;
state = s;
}