本文整理汇总了C#中System.Entity.ContainsFlag方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.ContainsFlag方法的具体用法?C# Entity.ContainsFlag怎么用?C# Entity.ContainsFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.ContainsFlag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoRespone
private static void AutoRespone(Entity attacker, Entity attacked, ref int Damage)
{
try
{
if (attacked.EntityFlag == EntityFlag.Player)
{
if (attacked.CounterKillSwitch && ServerBase.Kernel.Rate(10) && !attacked.ContainsFlag(Update.Flags.Fly) && Time32.Now > attacker.CounterKillStamp.AddSeconds(15))
{
attacker.CounterKillStamp = Time32.Now;
uint damage = Melee(attacked, attacker);
Database.SpellInformation information = Database.SpellTable.SpellInformations[6003][attacked.Owner.Spells[6003].Level];
damage = (uint)(Percent((int)damage, information.Percent) / 100);
Network.GamePackets.Attack attack = new Conquer_Online_Server.Network.GamePackets.Attack(true);
attack.Attacked = attacker.UID;
attack.Attacker = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Scapegoat;
attack.Damage = 0;
attack.ResponseDamage = damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
if (attacker.Hitpoints <= damage)
{
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.QualifierGroup != null)
attacked.Owner.QualifierGroup.UpdateDamage(attacked.Owner, attacker.Hitpoints);
attacker.Owner.SendScreen(attack, true);
attacked.AttackPacket = null;
}
else
{
attacker.MonsterInfo.SendScreen(attack);
}
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.QualifierGroup != null)
attacked.Owner.QualifierGroup.UpdateDamage(attacked.Owner, damage);
attacker.Owner.SendScreen(attack, true);
}
else
{
attacker.MonsterInfo.SendScreen(attack);
}
}
Damage = 0;
}
else if (attacked.Owner.Spells.ContainsKey(3060) && ServerBase.Kernel.Rate(10))
{
uint damage = (uint)(Damage / 10);
if (damage <= 0)
damage = 1;
Network.GamePackets.Attack attack = new Conquer_Online_Server.Network.GamePackets.Attack(true);
attack.Attacked = attacker.UID;
attack.Attacker = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Reflect;
attack.Damage = damage;
attack.ResponseDamage = damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
if (attacker.Hitpoints <= damage)
{
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.QualifierGroup != null)
attacked.Owner.QualifierGroup.UpdateDamage(attacked.Owner, attacker.Hitpoints);
attacker.Owner.SendScreen(attack, true);
attacked.AttackPacket = null;
}
else
{
attacker.MonsterInfo.SendScreen(attack);
}
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.QualifierGroup != null)
attacked.Owner.QualifierGroup.UpdateDamage(attacked.Owner, damage);
attacker.Owner.SendScreen(attack, true);
}
else
{
attacker.MonsterInfo.SendScreen(attack);
}
}
Damage = 0;
}
}
}
catch (Exception e) { Program.SaveException(e); }
//.........这里部分代码省略.........
示例2: Ranged
public static uint Ranged(Entity attacker, Entity attacked, Database.SpellInformation spell)
{
if (attacked.Name.Contains("Guard1"))
return 1;
int Damage = 0;
Durability(attacker, attacked, null);
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex))
return 1;
if (attacker.Transformed)
return 0;
if (attacker.Name.Contains("Guard1"))
return 700000;
Damage = ServerBase.Kernel.Random.Next(Math.Min((int)attacker.MinAttack, (int)attacker.MaxAttack), Math.Max((int)attacker.MinAttack, (int)attacker.MaxAttack) + 1);
if (attacker.OnSuperman())
if (attacked.EntityFlag == EntityFlag.Monster)
Damage *= 10;
else
Damage *= 2;
if (attacker.OnFatalStrike())
if (attacked.EntityFlag == EntityFlag.Monster)
Damage *= 5;
if (!attacked.Transformed)
Damage -= attacked.Defence;
else
Damage -= attacked.TransformationDefence;
Damage -= Damage * attacked.ItemBless / 100;
byte dodge = attacked.Dodge;
if (dodge > 100)
dodge = 99;
if (!attacked.Transformed)
Damage -= Damage * dodge / 100;
else
Damage -= Damage * attacked.TransformationDodge / 100;
if (attacker.OnIntensify && Time32.Now >= attacker.IntensifyStamp.AddSeconds(4))
{
Damage *= 2;
attacker.OnIntensify = false;
}
if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Stigma))
if (!attacker.Transformed)
Damage = (int)(Damage * attacker.StigmaIncrease);
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (int)(Damage * (1 + (GetLevelBonus(attacker.Level, attacked.Level) * 0.08)));
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (int)(Damage * AttackMultiplier(attacker, attacked));
}
Damage = BattlePowerCalculation(Damage, attacker.BattlePower - attacked.BattlePower);
if (ServerBase.Kernel.Rate(5))
{
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacker.Owner.BlessTime > 0)
{
Damage *= 2;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacker.Owner.SendScreen(str, true);
}
}
}
if (ServerBase.Kernel.Rate(5))
{
if (attacked.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.BlessTime > 0)
{
Damage = 1;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacked.Owner.SendScreen(str, true);
}
}
}
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (Damage >= 700 * attacked.MaxHitpoints)
Damage = (int)(700 * attacked.MaxHitpoints);
}
if (spell.PowerPercent != 0)
Damage = (int)(Damage * spell.PowerPercent);
//.........这里部分代码省略.........
示例3: Melee
public static uint Melee(Entity attacker, Entity attacked, Database.SpellInformation spell)
{
if (attacked.Name.Contains("Guard1"))
return 1;
int Damage = 0;
if (attacker.EntityFlag == EntityFlag.Monster)
if (attacked.EntityFlag == EntityFlag.Player)
if (ServerBase.Kernel.Rate(Math.Min(60, attacked.Dodge + 30)))
return 0;
Durability(attacker, attacked, null);
if (attacker.Name.Contains("Guard1"))
return 700000;
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex))
return 1;
if (!attacker.Transformed)
Damage = ServerBase.Kernel.Random.Next(Math.Min((int)attacker.MinAttack, (int)attacker.MaxAttack), Math.Max((int)attacker.MinAttack, (int)attacker.MaxAttack) + 1);
else
Damage = ServerBase.Kernel.Random.Next((int)attacker.TransformationMinAttack, (int)attacker.TransformationMaxAttack + 1);
if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Stigma))
if (!attacker.Transformed)
Damage = (int)(Damage * attacker.StigmaIncrease);
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (int)(Damage * (1 + (GetLevelBonus(attacker.Level, attacked.Level) * 0.08)));
}
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (attacked.MapID < 1351 || attacked.MapID > 1354)
if (!attacker.Owner.Equipment.Free(4) && !attacker.Owner.Equipment.Free(5))
Damage = (int)(Damage * 1.5);
}
if (attacked.EntityFlag == EntityFlag.Monster)
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (int)(Damage * AttackMultiplier(attacker, attacked));
// if (attacker.OnSuperman())
// if (attacked.EntityFlag == EntityFlag.Monster)
// Damage *= 10;
if (attacker.OnFatalStrike())
if (attacked.EntityFlag == EntityFlag.Monster)
Damage *= 5;
}
if (!attacked.Transformed)
{
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.MagicShield))
{
if (attacked.ShieldTime > 0)
Damage -= (ushort)(attacked.Defence * attacked.ShieldIncrease);
else
Damage -= (ushort)(attacked.Defence * attacked.MagicShieldIncrease);
}
else
{
Damage -= attacked.Defence;
}
}
else
Damage -= attacked.TransformationDefence;
Damage = BattlePowerCalculation(Damage, attacker.BattlePower - attacked.BattlePower);
if (ServerBase.Kernel.Rate(5))
{
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacker.Owner.BlessTime > 0)
{
Damage *= 2;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacker.Owner.SendScreen(str, true);
}
}
}
if (ServerBase.Kernel.Rate(5))
{
if (attacked.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.BlessTime > 0)
{
Damage = 1;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacked.Owner.SendScreen(str, true);
}
}
}
if (spell.ID == 6000 && attacked.EntityFlag == EntityFlag.Monster)
//.........这里部分代码省略.........
示例4: Magic
public static uint Magic(Entity attacker, Entity attacked, Database.SpellInformation spell)
{
if (!ServerBase.Kernel.Rate(spell.Percent))
return 0;
Durability(attacker, attacked, spell);
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex))
return 1;
if (attacker.Transformed)
return 0;
if (attacker.Name.Contains("Guard1"))
return 700000;
int Damage = 0;
Damage = (int)attacker.MagicAttack;
Damage += spell.Power;
if (!attacked.Transformed)
{
//(uint)((double)damage * (100 - Attacked.Entity.ItemBless) / 95);
// Damage -= (int)((uint)(attacked.MagicDefencePercent * Damage / 100));
if (attacked.ItemBless > 60)
attacked.ItemBless = 58;
Damage = (int)((uint)((double)Damage * (100 - attacked.ItemBless) / 340));
Damage -= attacked.MagicDefence;
}
else
Damage = (int)(((Damage * 0.75) * (1 - (0 * 0.01))) - attacked.TransformationMagicDefence);
if (attacked.EntityFlag == EntityFlag.Monster)
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (int)(Damage * AttackMultiplier(attacker, attacked) / 2);
if (attacked.EntityFlag == EntityFlag.Monster)
{
Damage = (int)(Damage * 6.6);
if (attacked.MapID < 1351 || attacked.MapID > 1354)
Damage = (int)(Damage * (1 + (GetLevelBonus(attacker.Level, attacked.Level) * 0.08)));
}
Damage = BattlePowerCalculation(Damage, attacker.BattlePower - attacked.BattlePower);
// Damage = RemoveExcessDamage(Damage, attacker, attacked);
// Console.WriteLine("[3]" + Damage);
if (ServerBase.Kernel.Rate(5))
{
if (attacker.EntityFlag == EntityFlag.Player)
{
Damage *= 2;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacker.Owner.SendScreen(str, true);
}
}
if (ServerBase.Kernel.Rate(5))
{
if (attacked.EntityFlag == EntityFlag.Player)
{
if (attacked.Owner.BlessTime > 0)
{
Damage = 1;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacked.Owner.SendScreen(str, true);
}
}
}
Damage += attacker.MagicDamageIncrease;
Damage -= attacked.MagicDamageDecrease;
if (Damage <= 0)
Damage = 1;
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (Damage >= 700 * attacked.MaxHitpoints)
Damage = (int)(700 * attacked.MaxHitpoints);
}
else
{
if (attacker.EntityFlag == EntityFlag.Monster)
{
if (attacker.Name.Contains("Guard1"))
Damage = (int)attacked.MaxHitpoints + 1;
}
}
AutoRespone(attacker, attacked, ref Damage);
if (attacked.ContainsFlag(Update.Flags.AzureShield))
{
if (Damage >= attacked.AzureDamage)
{
Damage -= attacked.AzureDamage;
//.........这里部分代码省略.........
示例5: Magic
public static uint Magic(Entity Attacker, Entity Attacked, Database.SpellInformation SInfo, ref Attack Packet)
{
if (Attacked.EntityFlag == EntityFlag.Player)
{
BlessEffect.Effect(Attacked);
}
if (Attacker.EntityFlag == EntityFlag.Player)
{
GemEffect.Effect(Attacker);
}
Boolean CritImmune = false;
switch (Attacked.EntityFlag)
{
case EntityFlag.Player:
{
if (Attacker.EntityFlag == EntityFlag.Monster)
{
if (!Attacked.ContainsFlag(Update.Flags.Stigma) && Attacker.Name == "StigGuard")
{
Attacked.AddFlag(Update.Flags.Stigma);
Attacked.StigmaStamp = Time32.Now;
Attacked.StigmaIncrease = 25;
Attacked.StigmaTime = (byte)20;
if (Attacked.EntityFlag == EntityFlag.Player)
Attacked.Owner.Send(ServerBase.Constants.Stigma(30, 20));
return 0;
}
if (Attacked.ContainsFlag(Update.Flags.Stigma) && Attacker.Name == "StigGuard")
{
return 0;
}
if (Attacked.Dead && Attacker.Name == "RevGuard")
{
Attacked.Owner.Entity.Action = PhoenixProject.Game.Enums.ConquerAction.None;
Attacked.Owner.ReviveStamp = Time32.Now;
Attacked.Owner.Attackable = false;
Attacked.Owner.Entity.TransformationID = 0;
Attacked.Owner.Entity.RemoveFlag(Update.Flags.Dead);
Attacked.Owner.Entity.RemoveFlag(Update.Flags.Ghost);
Attacked.Owner.Entity.Hitpoints = Attacked.Owner.Entity.MaxHitpoints;
Attacked.Ressurect();
Attacked.Owner.Send(new MapStatus() { BaseID = (ushort)Attacked.Owner.Map.BaseID, ID = (uint)Attacked.Owner.Map.ID, Status = Database.MapsTable.MapInformations[Attacked.Owner.Map.ID].Status, Weather = Database.MapsTable.MapInformations[Attacked.Owner.Map.ID].Weather });
//Attacked.Owner.Entity.Teleport(Attacked.Owner.Entity.MapID, Attacked.Owner.Entity.X, Attacked.Owner.Entity.Y);
return 0;
}
}
Int32 Damage = 0;
Int32 Defence = 0;
if (ChanceSuccess((float)Attacked.Immunity / 100f))
CritImmune = true;
Int32 Fan = 0, Tower = 0;
if (Attacker.EntityFlag == EntityFlag.Player)
Fan = Attacker.getFan(true);
if (Attacked.EntityFlag == EntityFlag.Player)
Tower = Attacked.getTower(true);
Damage = (int)Attacker.MagicAttack;
if (Attacked.EntityFlag == EntityFlag.Player)
if (Attacked.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex))
return 1;
if (Miss(SInfo.Percent))
return 0;
Defence = (Int32)Attacked.MagicDefence;
Defence = (Int32)Attacked.MagicDamageDecrease;
if (Attacked.EntityFlag == EntityFlag.Player)
{
if (Attacked.Reborn == 1)
Damage = (Int32)(Damage * 0.69);
if (Attacked.Reborn == 2)
Damage = (Int32)(Damage * 0.49);
}
Damage += Fan;
if (Attacker.EntityFlag == EntityFlag.Player)
Damage += Attacker.MagicDamageIncrease;
//UInt32 bpdmage = 0, bpdefence = 0;
//if (Attacked.EntityFlag == EntityFlag.Player)
//bpdefence = (UInt32)(Attacked.BattlePower * 3.5);
//Damage -= (int)bpdefence;
//Damage -= Attacked.MagicDamageDecrease;
Damage -= Defence;
Damage -= Tower;
//if (Damage <= 1) Damage = 1;
//return (UInt32)Damage;
//if (Damage <= 1) Damage = 1;
//return (UInt32)Damage;
//the new block offers us the behavior of the melee response.
if (!CritImmune)
{
//.........这里部分代码省略.........
示例6: Melee
public static uint Melee(Entity attacker, SobNpcSpawn attacked, ref Attack Packet)
{
int Damage = 0;
Boolean CritImmune = false;
Durability(attacker, null, null);
if (!attacker.Transformed)
Damage = ServerBase.Kernel.Random.Next((int)attacker.MinAttack, (int)attacker.MaxAttack + 1);
else
Damage = ServerBase.Kernel.Random.Next(Math.Min((int)attacker.MinAttack, (int)attacker.MaxAttack), Math.Max((int)attacker.MinAttack, (int)attacker.MaxAttack) + 1);
if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Stigma))
if (!attacker.Transformed)
Damage = (int)(Damage * 1.30);
Damage += attacker.PhysicalDamageIncrease;
if (attacker.EntityFlag == EntityFlag.Player)
{
GemEffect.Effect(attacker);
}
if (ServerBase.Kernel.Rate(5))
{
if (attacker.EntityFlag == EntityFlag.Player)
{
if (attacker.Owner.BlessTime > 0)
{
Damage *= 2;
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("LuckyGuy");
attacker.Owner.SendScreen(str, true);
}
}
}
if (attacker.EntityFlag == EntityFlag.Player)
{
if (!CritImmune)
{
if (ChanceSuccess((float)attacker.CriticalStrike / 100f))
{
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
Damage = (Int32)Math.Floor((float)Damage * 1.2);
}
}
}
Damage = (int)(Damage*1.8);//kimoz
if (Damage <= 0)
Damage = 1;
if (ServerBase.Constants.Damage1Map.Contains(attacker.MapID))
Damage = 1;
return (uint)Damage;
}
示例7: CheckForExtraWeaponPowers2
public static void CheckForExtraWeaponPowers2(Client.GameState client, Entity attacked)
{
#region Right Hand
if (client.Equipment.TryGetItem(ConquerItem.AltRightHand) != null)
{
if (client.Equipment.TryGetItem(ConquerItem.AltRightHand).ID != 0)
{
var Item = client.Equipment.TryGetItem(ConquerItem.AltRightHand);
if (Item.Effect != Enums.ItemEffect.None)
{
if (ServerBase.Kernel.Rate(30))
{
switch (Item.Effect)
{
case Enums.ItemEffect.HP:
{
SpellUse spellUse = new SpellUse(true);
spellUse.SpellID = 1175;
spellUse.SpellLevel = 4;
spellUse.X = client.Entity.X;
spellUse.Y = client.Entity.Y;
spellUse.Targets.Add(client.Entity.UID, 300);
uint damage = Math.Min(300, client.Entity.MaxHitpoints - client.Entity.Hitpoints);
client.Entity.Hitpoints += damage;
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.MP:
{
SpellUse spellUse = new SpellUse(true);
spellUse.SpellID = 1175;
spellUse.SpellLevel = 2;
spellUse.X = client.Entity.X;
spellUse.Y = client.Entity.Y;
spellUse.Targets.Add(client.Entity.UID, 300);
ushort damage = (ushort)Math.Min(300, client.Entity.MaxMana - client.Entity.Mana);
client.Entity.Mana += damage;
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.Shield:
{
if (client.Entity.ContainsFlag(Update.Flags.MagicShield))
return;
SpellUse spellUse = new SpellUse(true);
spellUse.SpellID = 1020;
spellUse.SpellLevel = 0;
spellUse.X = client.Entity.X;
spellUse.Y = client.Entity.Y;
spellUse.Targets.Add(client.Entity.UID, 120);
client.Entity.ShieldTime = 0;
client.Entity.ShieldStamp = Time32.Now;
client.Entity.MagicShieldStamp = Time32.Now;
client.Entity.MagicShieldTime = 0;
client.Entity.AddFlag(Update.Flags.MagicShield);
client.Entity.MagicShieldStamp = Time32.Now;
client.Entity.MagicShieldIncrease = 2;
client.Entity.MagicShieldTime = 120;
if (client.Entity.EntityFlag == EntityFlag.Player)
client.Send(ServerBase.Constants.Shield(2, 120));
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.Poison:
{
if (attacked != null)
{
if (attacked.EntityFlag == EntityFlag.Player)
{
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags2.IceBlock))
{
return;
}
if (attacked.Owner.Account.State == PhoenixProject.Database.AccountTable.AccountState.GameMaster)
{
return;
}
if (attacked.Owner.Account.State == PhoenixProject.Database.AccountTable.AccountState.ProjectManager)
{
return;
}
if (attacked.Owner.Account.State == PhoenixProject.Database.AccountTable.AccountState.GameHelper)
{
return;
}
if (ServerBase.Constants.PKForbiddenMaps.Contains(client.Entity.MapID))
return;
}
if (client.Map.BaseID == 700)
return;
if (attacked.UID == client.Entity.UID)
return;
if (attacked.ToxicFogLeft > 0)
return;
Attack attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damages = Calculate.Melee(client.Entity, attacked, ref attack);
damages = damages / 2;
//.........这里部分代码省略.........