本文整理汇总了C#中Entities.ContainsFlag1方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.ContainsFlag1方法的具体用法?C# Entities.ContainsFlag1怎么用?C# Entities.ContainsFlag1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.ContainsFlag1方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public static bool Handle(Entities.GameClient client, UseSpellPacket usespell)
{
if (!client.Equipments.Contains(Enums.ItemLocation.Steed))
return false;
if (client.ContainsFlag1(Enums.Effect1.Riding))
client.RemoveFlag1(Enums.Effect1.Riding);
else if (client.Stamina < 100)
return false;
else
client.AddStatusEffect1(Enums.Effect1.Riding);
using (var vigor = new Packets.SteedVigorPacket())
{
vigor.Type = 2;
vigor.Amount = 9001;
client.Send(vigor);
}
usespell.AddTarget(client.EntityUID, 0);
return true;
}
示例2: Handle
/// <summary>
/// Handling the Jump action from GeneralDataPacket.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="General">The GeneralDataPacket.</param>
public static void Handle(Entities.GameClient client, GeneralDataPacket General)
{
if (!client.Alive)
return;
if (client.ContainsFlag1(Enums.Effect1.IceBlock))
return;
if (client.Booth != null)
{
client.Booth.CancelBooth();
client.Pullback();
}
client.Action = Enums.ActionType.None;
client.AttackPacket = null;
ushort JumpX = General.Data1Low;
ushort JumpY = General.Data1High;
if (Core.Screen.GetDistance(client.X, client.Y, JumpX, JumpY) > 28)
{
client.Pullback();
return;
}
if (!client.Map.ValidCoord(JumpX, JumpY))
{
client.Pullback();
return;
}
/*DateTime time = new ProjectX_V3_Lib.Time.SystemTime(General.Timestamp);
if (client.LastMovement > time)
{
client.Pullback(); // speedhack
return;
}*/
if (!(DateTime.Now >= client.LastMovement.AddMilliseconds(400)) && client.LastMoveJump)
{
client.Pullback(); // speedhack
return;
}
if (client.Battle != null)
{
if (!client.Battle.EnterArea(client))
{
client.Pullback();
return;
}
else if (!client.Battle.LeaveArea(client))
{
client.Pullback();
return;
}
}
if (Calculations.BasicCalculations.ChanceSuccess(50))
client.Stamina += 7;
client.LastMoveJump = true;
client.LastMovement = DateTime.Now;
client.LastX = client.X;
client.LastY = client.Y;
client.X = JumpX;
client.Y = JumpY;
client.SendToScreen(General, true);
Data.AdvancedSkill.SkillInArea(client, client.X, client.Y);
}
示例3: GetRangedDamage_PVP
/// <summary>
/// Gets the ranged damage. (PVP)
/// </summary>
/// <param name="attacker">The attacker.</param>
/// <param name="attacked">The attacked.</param>
/// <returns>Returns the damage.</returns>
private static double GetRangedDamage_PVP(Entities.GameClient attacker, Entities.GameClient attacked)
{
double damage = ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(attacker.MinAttack, attacker.MaxAttack);
damage *= 1 - (attacked.Dodge * 0.01);
damage *= 0.45;
if (attacker.ContainsFlag1(Enums.Effect1.Stig))
damage *= 1.75;
damage *= 1 + attacker.DragonGemPercentage;
double damage_perc = damage;
damage_perc = (damage / 100) * attacked.TortoiseGemPercentage;
damage -= damage_perc;
damage_perc = (damage / 100) * attacked.Bless;
damage -= damage_perc;
return damage;
}
示例4: GetPhysicalMagicDamage_PVP
/// <summary>
/// Gets the magic damage. (PVP)
/// </summary>
/// <param name="attacker">The attacker.</param>
/// <param name="attacked">The attacked.</param>
/// <param name="spell">The spell.</param>
/// <returns>Returns the damage.</returns>
private static double GetPhysicalMagicDamage_PVP(Entities.GameClient attacker, Entities.GameClient attacked, Data.Spell spell)
{
double damage = (double) ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(attacker.MinAttack, attacker.MaxAttack * 2);
damage -= attacked.Defense;
damage *= 0.65;
// penetration extra damage
if (spell.SpellID == 1290 && damage > 0)
{
double hunperc = (double)((damage / 100) * 26.6);
damage += (hunperc * spell.Level);
}
// damage += spell.Power;
damage *= 1 + attacker.DragonGemPercentage;
if (attacked.ContainsFlag1(Enums.Effect1.Shield))
damage *= 0.5;
// damage -= attacked.Defense;
double damage_perc = damage;
damage_perc = (damage / 100) * attacked.TortoiseGemPercentage;
damage -= damage_perc;
damage_perc = (damage / 100) * attacked.Bless;
damage -= damage_perc;
return damage;
}
示例5: GetPhysicalDamage_PVM
/// <summary>
/// Gets the physical damage (PVM).
/// </summary>
/// <param name="attacker">The attacker.</param>
/// <param name="attacked">The attacked.</param>
/// <returns>Returns the damage.</returns>
private static double GetPhysicalDamage_PVM(Entities.GameClient attacker, Entities.Monster attacked)
{
double damage = ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(attacker.MinAttack, attacker.MaxAttack);
damage *= 1 + attacker.DragonGemPercentage;
damage -= attacked.Defense;
if (attacker.ContainsFlag1(Enums.Effect1.Stig))
damage *= 1.75;
//double damage_perc = damage;
//damage_perc = (damage / 100) * attacked.TortoiseGemPercentage;
//damage -= damage_perc;
//damage_perc = (damage / 100) * attacked.Bless;
//damage -= damage_perc;
return damage;
}
示例6: Handle
/// <summary>
/// Handling the combat of the interact packet.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="interact">The interact packet.</param>
public static void Handle(Entities.GameClient client, InteractionPacket interact)
{
if (interact == null)
return;
if (!client.Alive)
return;
if (client.Paralyzed)
return;
if (!client.CanAttack)
return;
if (!(DateTime.Now >= client.LoginProtection.AddSeconds(10)))
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.REST))
client.Send(fmsg);
return;
}
if (!(DateTime.Now >= client.ReviveProtection.AddSeconds(5)))
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.REST))
client.Send(fmsg);
return;
}
if (!(DateTime.Now >= client.LastAttack.AddMilliseconds(Core.TimeIntervals.AttackInterval)) && client.AttackPacket == null)
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.REST))
client.Send(fmsg);
return;
}
if (client.Battle != null)
{
if (!client.Battle.HandleBeginAttack(client))
{
using (var fmsg = Packets.Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.REST))
client.Send(fmsg);
return;
}
}
client.LastAttack = DateTime.Now;
//client.AutoAttacking = false;
switch (interact.Action)
{
case Enums.InteractAction.MagicAttack:
{
#region TemporaryDecryption
if (!interact.UnPacked)
{
interact.UnPacked = true;
byte[] packet = interact.Copy();
ushort SkillId = Convert.ToUInt16(((long)packet[24] & 0xFF) | (((long)packet[25] & 0xFF) << 8));
SkillId ^= (ushort)0x915d;
SkillId ^= (ushort)client.EntityUID;
SkillId = (ushort)(SkillId << 0x3 | SkillId >> 0xd);
SkillId -= 0xeb42;
uint Target = ((uint)packet[12] & 0xFF) | (((uint)packet[13] & 0xFF) << 8) | (((uint)packet[14] & 0xFF) << 16) | (((uint)packet[15] & 0xFF) << 24);
Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ client.EntityUID) - 0x746F4AE6;
ushort TargetX = 0;
ushort TargetY = 0;
long xx = (packet[16] & 0xFF) | ((packet[17] & 0xFF) << 8);
long yy = (packet[18] & 0xFF) | ((packet[19] & 0xFF) << 8);
xx = xx ^ (client.EntityUID & 0xffff) ^ 0x2ed6;
xx = ((xx << 1) | ((xx & 0x8000) >> 15)) & 0xffff;
xx |= 0xffff0000;
xx -= 0xffff22ee;
yy = yy ^ (client.EntityUID & 0xffff) ^ 0xb99b;
yy = ((yy << 5) | ((yy & 0xF800) >> 11)) & 0xffff;
yy |= 0xffff0000;
yy -= 0xffff8922;
TargetX = Convert.ToUInt16(xx);
TargetY = Convert.ToUInt16(yy);
interact.TargetUID = Target;
interact.MagicType = SkillId;
interact.X = TargetX;
interact.Y = TargetY;
}
#endregion
if (client.ContainsFlag1(Enums.Effect1.Riding) && interact.MagicType != 7001)
{
if (client.Stamina >= 100)
{
client.Stamina = 0;
client.RemoveFlag1(Enums.Effect1.Riding);
}
return;
}
//.........这里部分代码省略.........
示例7: Regular
void Regular(Entities.Monster mob)
{
#region Poison
if (mob.ContainsFlag1(Enums.Effect1.Poisoned))
{
if (DateTime.Now >= mob.LastPoison.AddMilliseconds(3000))
{
mob.LastPoison = DateTime.Now;
if (mob.PoisonEffect > 0)
{
uint damage = (uint)((mob.HP / 100) * mob.PoisonEffect);
if (mob.HP > damage)
{
Packets.Interaction.Battle.Combat.HitDamage(null, mob, damage);
using (var interact = new Packets.InteractionPacket())
{
interact.Action = Enums.InteractAction.Attack;
interact.EntityUID = mob.EntityUID;
interact.TargetUID = mob.EntityUID;
interact.UnPacked = true;
interact.X = mob.X;
interact.Y = mob.Y;
interact.Data = damage;
mob.Screen.UpdateScreen(interact, false);
}
}
else
mob.RemoveFlag1(Enums.Effect1.Poisoned);
}
}
}
#endregion
if (mob.Target != null)
{
if (mob.Target.Alive)
{
if (mob.Screen.MapObjects.ContainsKey(mob.Target.EntityUID))
{
if (Core.Screen.GetDistance(mob.X, mob.Y, mob.Target.X, mob.Target.Y) <= mob.AttackRange &&
DateTime.Now >= mob.AttackTime)
{
mob.AttackTime = DateTime.Now.AddMilliseconds(
ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(
mob.AttackSpeed, mob.AttackSpeed * 3));
#region physical attack
using (var interact = new Packets.InteractionPacket())
{
interact.Action = Enums.InteractAction.Attack;
interact.EntityUID = mob.EntityUID;
interact.TargetUID = mob.Target.EntityUID;
interact.UnPacked = true;
interact.X = mob.Target.X;
interact.Y = mob.Target.Y;
Packets.Interaction.Battle.Physical.Handle(mob, interact);
}
#endregion
return;
}
}
}
}
mob.Target = null;
foreach (Maps.IMapObject obj in mob.Screen.MapObjects.Values)
{
if (obj is Entities.GameClient)
{
if ((obj as Entities.GameClient).ContainsFlag1(Enums.Effect1.PartiallyInvisible))
{
continue;
}
mob.Target = obj as Entities.IEntity;
if (!mob.Target.Alive)
{
mob.Target = null;
continue;
}
break;
}
}
}
示例8: Handle
/// <summary>
/// Handles the movement packet.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="packet">The packet.</param>
public static void Handle(Entities.GameClient client, DataPacket packet)
{
if (client.ContainsFlag1(Enums.Effect1.IceBlock))
return;
client.Action = Enums.ActionType.None;
client.AttackPacket = null;
client.LastMoveJump = false;
using (var move = new MovementPacket(packet))
{
if (move.EntityUID != client.EntityUID)
return;
int NewX = 0, NewY = 0;
int NewDir = 0;
switch (move.WalkMode)
{
case Enums.WalkMode.Run:
case Enums.WalkMode.Walk:
{
NewDir = (int)move.Direction % 8;
NewX = client.X + DeltaX[NewDir];
NewY = client.Y + DeltaY[NewDir];
break;
}
case Enums.WalkMode.Mount:
{
NewDir = (int)move.Direction % 24;
NewX = client.X + DeltaMountX[NewDir];
NewY = client.Y + DeltaMountY[NewDir];
break;
}
}
if (client.Map.ValidCoord(NewX, NewY))
{
client.LastX = client.X;
client.LastY = client.LastY;
client.LastMovement = DateTime.Now;
client.X = (ushort)NewX;
client.Y = (ushort)NewY;
client.Direction = (byte)NewDir;
client.SendToScreen(move, true);
if (client.Battle != null)
{
if (!client.Battle.EnterArea(client))
{
client.X = client.LastX;
client.Y = client.LastY;
client.Pullback();
return;
}
else if (!client.Battle.LeaveArea(client))
{
client.X = client.LastX;
client.Y = client.LastY;
client.Pullback();
return;
}
}
Data.AdvancedSkill.SkillInArea(client, client.X, client.Y);
}
}
}