مشاهدة النسخة كاملة : مشكلة في السورس اللي نزلوا MR Online
stevenayman1
2020-03-17, 09:20 PM
يا شباب في مشكلة في السورس وهي اني لما باجي اضرب اي وحش ضربة عادية مفيش مشاكل لكن لما اجي اضرب باي اسلكة الاسكلة مش بتضرب وبيجي ايرور زي الصورةعفواً لايمكن عرض الروابط في الإرشيف
stevenayman1
2020-03-18, 12:38 AM
صور سطور
اهم التلاته دول
عفواً لايمكن عرض الروابط في الإرشيف
عفواً لايمكن عرض الروابط في الإرشيف
عفواً لايمكن عرض الروابط في الإرشيف
فوق
عفواً لايمكن عرض الروابط في الإرشيف
جرب تضيف
if(attacked.entityflag=entityflag.player)
MRonlineGvrix
2020-03-19, 05:10 PM
اسف يكبير نسيت احلها قبل مرفع وكلمت حاذم يبدل الرابط
الحل بدل الكلاس دا با الى عندك
Calculate
using System;
using AbdoRedaGxV4.Network.GamePackets;
using System.Runtime.InteropServices;
//using AbdoRedaGxV4.ServerBase;
using AbdoRedaGxV4.Interfaces;
using System.Collections.Generic;
using AbdoRedaGxV4;
namespace AbdoRedaGxV4.Game.Attacking
{
public class Calculate
{
public static uint Percent(Entity attacked, float percent)
{
return (uint)(attacked.Hitpoints * percent);
}
public static uint Percent(SobNpcSpawn attacked, float percent)
{
return (uint)(attacked.Hitpoints * percent);
}
public static uint Percent(int target, float percent)
{
return (uint)(target * percent);
}
public static bool RateStatus(byte value)
{
return (Kernel.Random.Next() % 100) < value;
}
public static bool GetRefinery()
{
return RateStatus(30);
//byte val = (byte)MyRandom.Next(1, 200);
//return (byte)MyRandom.Next(1, val) > 90;
}
public static ulong CalculateExpBonus(ushort Level, ushort MonsterLevel, ulong Experience)
{
int leveldiff = (2 + Level - MonsterLevel);
if (leveldiff < -5)
Experience = (ulong)(Experience * 1.3);
else if (leveldiff < -1)
Experience = (ulong)(Experience * 1.2);
else if (leveldiff == 4)
Experience = (ulong)(Experience * 0.8);
else if (leveldiff == 5)
Experience = (ulong)(Experience * 0.3);
else if (leveldiff > 5)
Experience = (ulong)(Experience * 0.1);
return Experience;
}
internal static uint CalculateBossDamage(Entity attacker, Entity attacked, ushort SpellID)
{
int Damage = 0;
Damage = MyMath.GetDamageMonster2Entity(attacker, attacked, SpellID, 0);
Attack a = new Attack(true);
CheckDamage(attacker, attacked, ref Damage, ref a, true);
return (uint)Damage;
}
internal static uint Magic(Entity attacker, Entity attacked, Database.SpellInformation spell, ref Attack attack, byte p = 0)
{
int Damage = 0;
if (attacked.EntityFlag == EntityFlag.Monster)
Damage = MyMath.GetDamageEntity2Monster(attacker, attacked, spell.ID, spell.Level, ref attack);
else
Damage = MyMath.GetDamageEntity2Entity(attacker, attacked, spell.ID, spell.Level, ref attack);
CheckDamage(attacker, attacked, ref Damage, ref attack, true);
return (uint)Damage;
}
internal static uint Melee(Entity attacker, SobNpcSpawn attackedSobNpc, ref Attack attack)
{
return (uint)MyMath.GetDamageEntity2Environment(attacker, attackedSobNpc, (byte)Attack.Melee, ref attack);
}
internal static uint Melee(Entity attacker, Entity attacked, Database.SpellInformation spell, ref Attack attack, byte p = 0)
{
int Damage = 0;
if (attacked.EntityFlag == EntityFlag.Monster)
Damage = MyMath.GetDamageEntity2Monster(attacker, attacked, spell.ID, spell.Level, ref attack);
else
Damage = MyMath.GetDamageEntity2Entity(attacker, attacked, spell.ID, spell.Level, ref attack);
CheckDamage(attacker, attacked, ref Damage, ref attack, false);
return (uint)Damage;
}
internal static uint MonsterDamage(Entity attacker, Entity attacked, ref Attack attack, bool p)
{
int Damage = 0;
Damage = MyMath.GetDamageMonster2Entity(attacker, attacked, !p ? Attack.Melee : Attack.Magic);
Attack a = new Attack(true);
CheckDamage(attacker, attacked, ref Damage, ref a, p);
return (uint)Damage;
}
internal static uint MonsterDamage(Entity attacker, Entity attacked, ushort spellid)
{
int Damage = 0;
Damage = MyMath.GetDamageMonster2Entity(attacker, attacked, spellid, 0);
Attack a = new Attack(true);
CheckDamage(attacker, attacked, ref Damage, ref a, false);
return (uint)Damage;
}
internal static uint Ranged(Entity attacker, Entity attacked, ref Attack attack, byte p = 0)
{
int Damage = 0;
if (attacked.EntityFlag == EntityFlag.Monster)
Damage = MyMath.GetDamageEntity2Monster(attacker, attacked, Attack.Ranged, ref attack);
else
Damage = MyMath.GetDamageEntity2Entity(attacker, attacked, Attack.Ranged, ref attack);
CheckDamage(attacker, attacked, ref Damage, ref attack, false);
return (uint)Damage;
}
internal static uint Melee(Entity attacker, Entity attacked, ref Attack attack, byte p = 0)
{
int Damage = 0;
if (attacked.EntityFlag == EntityFlag.Monster)
Damage = MyMath.GetDamageEntity2Monster(attacker, attacked, Attack.Melee, ref attack);
else
Damage = MyMath.GetDamageEntity2Entity(attacker, attacked, Attack.Melee, ref attack);
CheckDamage(attacker, attacked, ref Damage, ref attack, false);
return (uint)Damage;
}
internal static uint Magic(Entity attacker, Entity attacked, ref Attack attack, byte p = 0)
{
int Damage = 0;
if (attacked.EntityFlag == EntityFlag.Monster)
Damage = MyMath.GetDamageEntity2Monster(attacker, attacked, Attack.Magic, ref attack);
else
Damage = MyMath.GetDamageEntity2Entity(attacker, attacked, Attack.Magic, ref attack);
CheckDamage(attacker, attacked, ref Damage, ref attack, false);
return (uint)Damage;
}
internal static uint Ranged(Entity attacker, SobNpcSpawn attackedsob, ref Attack attack)
{
return (uint)MyMath.GetDamageEntity2Environment(attacker, attackedsob, Attack.Ranged, ref attack) / 24;
}
internal static uint Magic(Entity attacker, SobNpcSpawn attackedsob, Database.SpellInformation spell, ref Attack attack)
{
return (uint)MyMath.GetDamageEntity2Environment(attacker, attackedsob, spell.ID, spell.Level, ref attack);
}
internal static uint Ranged(Entity attacker, Entity attacked, Database.SpellInformation spell, ref Attack attack, byte p = 0)
{
int Damage = 0;
if (attacked.EntityFlag == EntityFlag.Monster)
Damage = MyMath.GetDamageEntity2Monster(attacker, attacked, spell.ID, spell.Level, ref attack);
else
Damage = MyMath.GetDamageEntity2Entity(attacker, attacked, spell.ID, spell.Level, ref attack);
CheckDamage(attacker, attacked, ref Damage, ref attack, false);
return (uint)Damage;
}
public static int CalculateSkillCStrike(Entity AttackerClient, Entity AttackedClient, int damage)
{
if (AttackerClient.SkillCStrike == AttackedClient.Immunity)
return damage;
if (AttackerClient.SkillCStrike > AttackedClient.Immunity)
{
int Power = (int)(AttackerClient.SkillCStrike - AttackedClient.Immunity);
damage = (int)((double)damage * 1.500);
}
return damage;
}
public static int CalculateCriticalStrike(Entity AttackerClient, Entity AttackedClient, int damage)
{
if (AttackerClient.CriticalStrike == AttackedClient.Immunity)
return damage;
if (AttackerClient.CriticalStrike > AttackedClient.Immunity)
{
damage = (int)((double)damage * 1.500);
}
return damage;
}
public static int CalculateBreaktrough(Entity AttackerClient, Entity AttackedClient, int damage)
{
if ((AttackerClient.Breaktrough == AttackedClient.Counteraction) || AttackerClient.Class >= 130 && AttackerClient.Class <= 135)
return damage;
if (AttackerClient.Breaktrough > AttackedClient.Counteraction)
{
int Power = (int)(AttackerClient.Breaktrough - AttackedClient.Counteraction);
damage = (int)((double)damage * 1.600);
}
return damage;
}
private static void AutoRespone(Entity attacker, Entity attacked, ref int Damage)
{
try
{
if (attacker.EntityFlag == EntityFlag.Entity)
{
if (attacker.Owner.Spells.ContainsKey(11120))
{
var s = attacker.Owner.Spells[11120];
var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
if (spell != null)
{
if (Kernel.Rate(spell.Percent))
{
var ent = attacked as Entity;
if (!ent.IsBlackSpotted)
{
ent.IsBlackSpotted = true;
ent.BlackSpotStamp = Time32.Now;
ent.BlackSpotStepSecs = spell.Duration;
Kernel.BlackSpoted.TryAdd(ent.UID, ent);
BlackSpotPacket bsp = new BlackSpotPacket();
foreach (var h in Program.GamePool)
{
h.Send(bsp.ToArray(true, ent.UID));
}
}
}
}
}
}
if (attacked.EntityFlag == EntityFlag.Entity)
{
if (attacked.Owner.Spells.ContainsKey(11130) && attacked.Owner.Entity.IsEagleEyeShooted)
{
var s = attacked.Owner.Spells[11130];
var spell = Database.SpellTable.SpellInformations[s.ID][s.Level];
if (spell != null)
{
if (Kernel.Rate(spell.Percent))
{
attacked.Owner.Entity.IsEagleEyeShooted = false;
SpellUse ssuse = new SpellUse(true);
ssuse.Attacker = attacked.UID;
ssuse.SpellID = spell.ID;
ssuse.SpellLevel = spell.Level;
ssuse.AddTarget(attacked.Owner.Entity, new SpellUse.DamageClass().Damage = 11030, null);
if (attacked.EntityFlag == EntityFlag.Entity)
{
attacked.Owner.SendScreen(ssuse, true);
}
}
}
}
if (attacked.CounterKillSwitch && Kernel.Rate(30) && !attacker.ContainsFlag((ulong)Update.Flags.Fly) && Time32.Now > attacked.CounterKillStamp.AddSeconds(15))
{
attacked.CounterKillStamp = Time32.Now;
Network.GamePackets.Attack attack = new AbdoRedaGxV4.Network.GamePackets.Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Melee(attacked, attacker, ref attack);
damage = damage / 3;
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.Entity)
{
attacked.Owner.UpdateQualifier(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.Entity)
{
attacked.Owner.UpdateQualifier(attacker.Hitpoints) ;
attacker.Owner.SendScreen(attack, true);
}
else
{
attacker.MonsterInfo.SendScreen(attack);
}
}
Damage = 0;
}
else if (attacked.Owner.Spells.ContainsKey(3060) && Kernel.Rate(15))
{
uint damage = (uint)(Damage / 10);
if (damage <= 0)
damage = 1;
if (damage > 10000) damage = 10000;
Network.GamePackets.Attack attack = new AbdoRedaGxV4.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.Entity)
{
attacked.Owner.UpdateQualifier(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.Entity)
{
attacked.Owner.UpdateQualifier(attacker.Hitpoints) ;
attacker.Owner.SendScreen(attack, true);
}
else
{
attacker.MonsterInfo.SendScreen(attack);
}
}
Damage = 0;
}
}
}
catch (Exception e) { Program.SaveException(e); }
}
public static void CheckDamage(Entity attacker, Entity attacked, ref int Damage, ref Attack Packet, bool magic = false)
{
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (!attacker.Assassin() && !attacker.IsChaser1())
{
if (attacked.MonsterInfo.Boss || attacked.Boss == 1)
{
if (magic)
Damage = (int)Damage * 10;
else
Damage = (int)Damage * 4;
return;
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
{
BlessEffect.Effect(attacker);
GemEffect.Effect(attacker);
}
Calculate.AutoRespone(attacker, attacked, ref Damage);
if (attacked.ContainsFlag2(Network.GamePackets.Update .Flags2.AzureShield))
{
if (Damage > attacked.AzureShieldDefence)
{
Damage -= attacked.AzureShieldDefence;
CreateAzureDMG(attacked.AzureShieldDefence, attacker, attacked);
attacked.RemoveFlag2(Network.GamePackets.Update.Fl ags2.AzureShield);
}
else
{
CreateAzureDMG((uint)Damage, attacker, attacked);
attacked.AzureShieldDefence -= (ushort)Damage;
attacked.AzureShieldPacket();
Damage = 1;
}
}
#region Nobility Damage
if (attacked.EntityFlag == EntityFlag.Entity && (attacker.BattlePower < attacked.BattlePower))
{
if (attacked.Owner.Challenge == null)
{
if (attacker.EntityFlag == EntityFlag.Monster) return;
int sub = attacked.BattlePower - attacker.BattlePower;
//sub *= 2000;//##Samak BattlePower
if (sub > 41)
{
if (attacker.EntityFlag == EntityFlag.Monster) return;
Damage = 1;
}
else
{//Samak
if (attacker.EntityFlag == EntityFlag.Monster) return;
Damage = (Int32)Math.Floor((float)Damage * (.75 - (sub * 0.01)));
}
}
}
if (attacked.EntityFlag == EntityFlag.Entity && (attacker.BattlePower > attacked.BattlePower))
{
if (attacked.Owner.Challenge == null)
{
if (attacker.EntityFlag == EntityFlag.Monster) return;
int dmg = attacked.BattlePower - attacker.BattlePower;
if (dmg > 50)
{
if (attacker.EntityFlag == EntityFlag.Monster) return;
Damage = Damage * 2;
}
else
if (attacker.EntityFlag == EntityFlag.Monster) return;
Damage = (Int32)Math.Floor((float)Damage * (1.10 - (dmg * 0.01)));
}
}
#endregion
/* #region Nobility Damage
#region King
if (attacker.NobilityRank == ConquerStructures.NobilityRank.King)
{
if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
{
Damage = (int)((double)Damage * 1.08);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
{
Damage = (int)((double)Damage * 1.18);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
{
Damage = (int)((double)Damage * 1.19);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
{
Damage = (int)((double)Damage * 1.20);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Baron)
{
Damage = (int)((double)Damage * 1.21);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Knight)
{
Damage = (int)((double)Damage * 1.22);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Serf)
{
Damage = (int)((double)Damage * 1.23);
}
}
#endregion King
#region Prince
if (attacker.NobilityRank == ConquerStructures.NobilityRank.Prince)
{
if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
{
Damage = (int)((double)Damage * 1.03);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
{
Damage = (int)((double)Damage * 1.07);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
{
Damage = (int)((double)Damage * 1.19);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
{
Damage = (int)((double)Damage * 1.20);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Baron)
{
Damage = (int)((double)Damage * 1.21);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Knight)
{
Damage = (int)((double)Damage * 1.22);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Serf)
{
Damage = (int)((double)Damage * 1.23);
}
}
#endregion Prince
#region Duke
if (attacker.NobilityRank == ConquerStructures.NobilityRank.Duke)
{
if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
{
Damage = (int)((double)Damage * 1.02);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
{
Damage = (int)((double)Damage * 0.99);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
{
Damage = (int)((double)Damage * 1.08);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
{
Damage = (int)((double)Damage * 1.19);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Baron)
{
Damage = (int)((double)Damage * 1.20);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Knight)
{
Damage = (int)((double)Damage * 1.21);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Serf)
{
Damage = (int)((double)Damage * 1.22);
}
}
#endregion Duke
#region Earl
if (attacker.NobilityRank == ConquerStructures.NobilityRank.Earl)
{
if (attacked.NobilityRank == ConquerStructures.NobilityRank.King)
{
Damage = (int)((double)Damage * 0.91);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Prince)
{
Damage = (int)((double)Damage * 0.95);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Duke)
{
Damage = (int)((double)Damage * 1);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Earl)
{
Damage = (int)((double)Damage * 1.05);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Baron)
{
Damage = (int)((double)Damage * 1.19);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Knight)
{
Damage = (int)((double)Damage * 1.20);
}
if (attacked.NobilityRank == ConquerStructures.NobilityRank.Serf)
{
Damage = (int)((double)Damage * 1.21);
}
}
#endregion Earl
#endregion*/
#region DragonSwing
if (Kernel.Rate(20))//bas kada
{
if (attacked.ContainsFlag3(Update.Flags3.DragonSwing) )
{
_String str = new _String(true);
str.UID = attacked.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("poisonmiss");
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(str, true);
Damage = 0;
}
}
#endregion
if (attacked.ContainsFlag(Network.GamePackets.Update. Flags.ShurikenVortex))
Damage = 1;
if (Constants.Damage1Map.Contains(attacked.MapID))
Damage = 1;
}
public static void CreateAzureDMG(uint dmg, Entity attacker, Entity attacked)
{
Network.GamePackets.Attack attac = new Attack(true);
attac.Attacker = attacker.UID;
attac.Attacked = attacked.UID;
attac.X = attacked.X;
attac.Y = attacked.Y;
attac.AttackType = 55;
attac.Damage = dmg;
attacked.Owner.SendScreen(attac, true);
}
public static Int64 GetAgilityWeapons(Entity Attacker)
{
double result = 0;
if (Attacker.Transformed)
{
result = Attacker.TransformationHitRate * 100.0f;
}
else
{
int Values = 0;
int Junk = 0;
for (uint i = 0; i < 10; i++)
{
if (i != 5)
{
ConquerItem item = Attacker.Owner.Equipment.TryGetItem(i);
Database.ConquerItemInformation CII = new Database.ConquerItemInformation(item.ID, item.Plus);
if (item.Durability != 0)
if (item != null && item.ID != 0)
{
int now = (CII.BaseInformation.Agility + Attacker.Gems[2]) + Attacker.Gems[2] + Values;
Values = now + CII.PlusInformation.Agility;
Junk += Attacker.Gems[2]; //UnUse grin emoticon .
}
}
else
continue;
}
result = ((Attacker.Agility) * ((double)Values + 100.0f) * 0.0099999998f * 100.0f);
}
return (Int64)result;
}
public static bool isDodged(Entity Attacker, Entity Attacked)
{
int result = 0;
double percent = 0;
if (Attacker != null && Attacked != null)
{
if (!Attacker.Transformed)
{
result = (Attacker.Agility >> 1 /* /2 */) - Attacked.Dodge + 100;
if (Attacker.Agility != 0)
{
percent = (double)((GetAgilityWeapons(Attacker) / Attacker.Agility) - 100.0f) * 0.01f + 1.0f;
}
else
{
percent = 1.0f;
}
//Todo Status Hitrate Status skill :D
result = (int)(percent * result);
if (Attacker.Owner.Entity.IsBow() && Attacker.Owner.Entity.IsShield())
{
result = result * 12 / 100;
}
result = Math.Max(10, Math.Min(90, result));
if (Attacker.EntityFlag == EntityFlag.Entity)
{
if (Attacked.EntityFlag == EntityFlag.Monster)
{
int AntiMonsterPercent = Attacker.Level - Attacked.Level;
if (AntiMonsterPercent > 0)
{
result += 10 * (AntiMonsterPercent / 5);
}
if (Attacker.ContainsFlag(Update.Flags.Cyclone))
result = 100;
}
}
}
}
else
{
return true;
}
return Kernel.RandGet(100) >= result;
}
public static void Immu(Entity Attacked)
{
if (Attacked.EntityFlag == EntityFlag.Entity)
{
_String str = new _String(true);
str.UID = Attacked.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("bossimmunity");
Attacked.Owner.SendScreen(str, true);
}
}
public static void Refinary(Entity attacker, Entity attacked, ref double Damage, ref Attack Packet, bool magic = false)
{
if (attacker.Name == "Thundercloud") return;
if (attacker.EntityFlag == EntityFlag.Entity)
{
if (!attacker.IsTaoist(attacker.Class))
{
if (attacked.BattlePower > attacker.BattlePower)
{
if (attacker.Breaktrough > 0)
{
if (attacker.Breaktrough > attacked.Counteraction)
{
double Power = (double)(attacker.Breaktrough - attacked.Counteraction);
if (attacker.NobilityRank < ConquerStructures.NobilityRank.King)
{
Power = (double)(Power / 0);
if (MyMath.Success2(Power))
{
Damage += Damage * 0 / 1;
Damage += 15000;
Packet.Effect1 |= Attack.AttackEffects1.Break;
}
else Immu(attacked);
}
else
{
Power = (double)(Power / 0);
if (MyMath.Success(Power))
{
Damage += Damage * 0 / 1;
Packet.Effect1 |= Attack.AttackEffects1.Break;
}
else Immu(attacked);
}
}
else
Immu(attacked);
}
}
if (RateStatus(80))
{
if (!magic)
{
if (attacker.CriticalStrike > 0)
{
if (attacker.CriticalStrike > attacked.Immunity)
{
double Power = (double)(attacker.CriticalStrike - attacked.Immunity);
if (Kernel.ChanceSuccess2(((float)attacker.CriticalSt rike / 300f) - ((float)attacked.Immunity / 300f)))
{
Damage += 15000;
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
}
else
Immu(attacked);
}
else
Immu(attacked);
}
}
else
{
if (attacker.Penetration > 0)
{
double Power = (double)(attacker.Penetration / 1);
if (MyMath.Success(Power))
{
Damage += Damage * 0 / 4;
Packet.Effect1 |= Attack.AttackEffects1.Penetration;
}
else if (attacker.SkillCStrike > 0)
{
if (attacker.SkillCStrike >= attacked.Immunity)
{
Power = (double)(attacker.SkillCStrike - attacked.Immunity);
Power = (double)(Power / 100);
if (MyMath.Success(Power))
{
Damage += Damage * 50 / 100;
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
}
else
Immu(attacked);
}
}
else
Immu(attacked);
}
else if (attacker.SkillCStrike > 0)
{
if (attacker.SkillCStrike >= attacked.Immunity)
{
double Power = (double)(attacker.SkillCStrike - attacked.Immunity);
Power = (double)(Power / 100);
if (MyMath.Success(Power))
{
Damage += Damage * 50 / 100;
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
}
else
Immu(attacked);
}
}
else
Immu(attacked);
}
}
}
}
if (attacked.EntityFlag == EntityFlag.Entity)
{
if (RateStatus(5))
{
if (attacked.Block > 0)
{
double Power = (double)(attacked.Block / 2);
if (MyMath.Success(Power))
{
Damage = Damage / 2;
Packet.Effect1 |= Attack.AttackEffects1.Block;
}
}
if (attacked.IsShieldBlock)
{
if (MyMath.Success(attacked.ShieldBlockPercent))
{
Damage = Damage / 2;
Packet.Effect1 |= Attack.AttackEffects1.Block;
}
}
}
}
}
public static void Refinary(Entity attacker, SobNpcSpawn attacked, ref double Damage, ref Attack Packet, bool magic = false)
{
if (attacker.EntityFlag == EntityFlag.Entity)
{
if (RateStatus(10))
{
if (!magic)
{
if (attacker.CriticalStrike > 0)
{
double Power = (double)(attacker.CriticalStrike);
Power = (double)(Power / 100);
if (MyMath.Success(Power))
{
Damage += Damage * 80 / 100;
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
}
}
}
else
{
if (attacker.Penetration > 0)
{
double Power = (double)(attacker.Penetration / 100);
if (MyMath.Success(Power))
{
Damage = Damage * 50 / 100;
Packet.Effect1 |= Attack.AttackEffects1.Penetration;
}
}
if (attacker.SkillCStrike > 0)
{
double Power = (double)(attacker.SkillCStrike);
Power = (double)(Power / 100);
if (MyMath.Success(Power))
{
Damage += Damage * 50 / 100;
Packet.Effect1 |= Attack.AttackEffects1.CriticalStrike;
}
}
}
}
}
}
}
}
namespace AbdoRedaGxV4
{
public class StatusConstants
{
public const int AdjustSet = -30000,
AdjustFull = -32768,
AdjustPercent = 30000;
}
public class MathHelper
{
public static int BitFold32(int lower16, int higher16)
{
return (lower16) | (higher16 << 16);
}
public static void BitUnfold32(int bits32, out int lower16, out int upper16)
{
lower16 = (int)(bits32 & UInt16.MaxValue);
upper16 = (int)(bits32 >> 16);
}
public static void BitUnfold64(ulong bits64, out int lower32, out int upper32)
{
lower32 = (int)(bits64 & UInt32.MaxValue);
upper32 = (int)(bits64 >> 32);
}
public static int RoughDistance(int x1, int y1, int x2, int y2)
{
return Math.Max(Math.Abs(x1 - x2), Math.Abs(y1 - y2));
}
public static int ConquerDirection(int x1, int y1, int x2, int y2)
{
double angle = Math.Atan2(y2 - y1, x2 - x1);
angle -= Math.PI / 2;
if (angle < 0) angle += 2 * Math.PI;
angle *= 8 / (2 * Math.PI);
return (int)angle;
}
public static int MulDiv(int number, int numerator, int denominator)
{
return (number * numerator + denominator / 2) / denominator;
}
public static bool OverflowAdd(ref int acc, int add)
{
if (int.MaxValue - acc < add)
return true;
acc = Math.Max(acc + add, 0);
return false;
}
public static int AdjustDataEx(int data, int adjust, int maxData = 0)
{
if (adjust >= StatusConstants.AdjustPercent)
return MulDiv(data, adjust - StatusConstants.AdjustPercent, 100);
if (adjust <= StatusConstants.AdjustSet)
return -1 * adjust + StatusConstants.AdjustSet;
if (adjust == StatusConstants.AdjustFull)
return maxData;
return data + adjust;
}
}
public class GemTypes
{
public const int
Phoenix = 0,
Dragon = 1,
Fury = 2,
Rainbow = 3,
Kylin = 4,
Violet = 5,
Moon = 6,
Tortoise = 7,
Thunder = 10,
Glory = 12,
First = Phoenix,
Last = Glory + 1;
public static readonly string[] Animation = new string[]
{
"phoenix",
"goldendragon",
"fastflash",
"rainbow",
"goldenkylin",
"purpleray",
"moon",
"recovery"
};
public static readonly int[][] Effects = new[]
{
new[] { 0, 5, 10, 15 },
new[] { 0, 5, 10, 15 },
new[] { 0, 5, 10, 15 },
new[] { 0, 10, 15, 25 },
new[] { 0, 50, 100, 200 },
new[] { 0, 30, 50, 100 },
new[] { 0, 15, 30, 50 },
new[] { 0, 2, 4, 6 },
new[] { 0, 0, 0, 0 },
new[] { 0, 0, 0, 0 },
new[] { 0, 100, 300, 500 },
new[] { 0, 0, 0, 0 },
new[] { 0, 100, 300, 500 }
};
}
}
stevenayman1
2020-03-19, 07:05 PM
فوق
جرب تضيف
if(attacked.entityflag=entityflag.player)
جاب يرور هنا entityflag
stevenayman1
2020-03-19, 07:11 PM
اسف يكبير نسيت احلها قبل مرفع وكلمت حاذم يبدل الرابط
الحل بدل الكلاس دا با الى عندك
calculate
using system;
using abdoredagxv4.network.gamepackets;
using system.runtime.interopservices;
//using abdoredagxv4.serverbase;
using abdoredagxv4.interfaces;
using system.collections.generic;
using abdoredagxv4;
namespace abdoredagxv4.game.attacking
{
public class calculate
{
public static uint percent(entity attacked, float percent)
{
return (uint)(attacked.hitpoints * percent);
}
public static uint percent(sobnpcspawn attacked, float percent)
{
return (uint)(attacked.hitpoints * percent);
}
public static uint percent(int target, float percent)
{
return (uint)(target * percent);
}
public static bool ratestatus(byte value)
{
return (kernel.random.next() % 100) < value;
}
public static bool getrefinery()
{
return ratestatus(30);
//byte val = (byte)myrandom.next(1, 200);
//return (byte)myrandom.next(1, val) > 90;
}
public static ulong calculateexpbonus(ushort level, ushort monsterlevel, ulong experience)
{
int leveldiff = (2 + level - monsterlevel);
if (leveldiff < -5)
experience = (ulong)(experience * 1.3);
else if (leveldiff < -1)
experience = (ulong)(experience * 1.2);
else if (leveldiff == 4)
experience = (ulong)(experience * 0.8);
else if (leveldiff == 5)
experience = (ulong)(experience * 0.3);
else if (leveldiff > 5)
experience = (ulong)(experience * 0.1);
return experience;
}
internal static uint calculatebossdamage(entity attacker, entity attacked, ushort spellid)
{
int damage = 0;
damage = mymath.getdamagemonster2entity(attacker, attacked, spellid, 0);
attack a = new attack(true);
checkdamage(attacker, attacked, ref damage, ref a, true);
return (uint)damage;
}
internal static uint magic(entity attacker, entity attacked, database.spellinformation spell, ref attack attack, byte p = 0)
{
int damage = 0;
if (attacked.entityflag == entityflag.monster)
damage = mymath.getdamageentity2monster(attacker, attacked, spell.id, spell.level, ref attack);
else
damage = mymath.getdamageentity2entity(attacker, attacked, spell.id, spell.level, ref attack);
checkdamage(attacker, attacked, ref damage, ref attack, true);
return (uint)damage;
}
internal static uint melee(entity attacker, sobnpcspawn attackedsobnpc, ref attack attack)
{
return (uint)mymath.getdamageentity2environment(attacker, attackedsobnpc, (byte)attack.melee, ref attack);
}
internal static uint melee(entity attacker, entity attacked, database.spellinformation spell, ref attack attack, byte p = 0)
{
int damage = 0;
if (attacked.entityflag == entityflag.monster)
damage = mymath.getdamageentity2monster(attacker, attacked, spell.id, spell.level, ref attack);
else
damage = mymath.getdamageentity2entity(attacker, attacked, spell.id, spell.level, ref attack);
checkdamage(attacker, attacked, ref damage, ref attack, false);
return (uint)damage;
}
internal static uint monsterdamage(entity attacker, entity attacked, ref attack attack, bool p)
{
int damage = 0;
damage = mymath.getdamagemonster2entity(attacker, attacked, !p ? Attack.melee : Attack.magic);
attack a = new attack(true);
checkdamage(attacker, attacked, ref damage, ref a, p);
return (uint)damage;
}
internal static uint monsterdamage(entity attacker, entity attacked, ushort spellid)
{
int damage = 0;
damage = mymath.getdamagemonster2entity(attacker, attacked, spellid, 0);
attack a = new attack(true);
checkdamage(attacker, attacked, ref damage, ref a, false);
return (uint)damage;
}
internal static uint ranged(entity attacker, entity attacked, ref attack attack, byte p = 0)
{
int damage = 0;
if (attacked.entityflag == entityflag.monster)
damage = mymath.getdamageentity2monster(attacker, attacked, attack.ranged, ref attack);
else
damage = mymath.getdamageentity2entity(attacker, attacked, attack.ranged, ref attack);
checkdamage(attacker, attacked, ref damage, ref attack, false);
return (uint)damage;
}
internal static uint melee(entity attacker, entity attacked, ref attack attack, byte p = 0)
{
int damage = 0;
if (attacked.entityflag == entityflag.monster)
damage = mymath.getdamageentity2monster(attacker, attacked, attack.melee, ref attack);
else
damage = mymath.getdamageentity2entity(attacker, attacked, attack.melee, ref attack);
checkdamage(attacker, attacked, ref damage, ref attack, false);
return (uint)damage;
}
internal static uint magic(entity attacker, entity attacked, ref attack attack, byte p = 0)
{
int damage = 0;
if (attacked.entityflag == entityflag.monster)
damage = mymath.getdamageentity2monster(attacker, attacked, attack.magic, ref attack);
else
damage = mymath.getdamageentity2entity(attacker, attacked, attack.magic, ref attack);
checkdamage(attacker, attacked, ref damage, ref attack, false);
return (uint)damage;
}
internal static uint ranged(entity attacker, sobnpcspawn attackedsob, ref attack attack)
{
return (uint)mymath.getdamageentity2environment(attacker, attackedsob, attack.ranged, ref attack) / 24;
}
internal static uint magic(entity attacker, sobnpcspawn attackedsob, database.spellinformation spell, ref attack attack)
{
return (uint)mymath.getdamageentity2environment(attacker, attackedsob, spell.id, spell.level, ref attack);
}
internal static uint ranged(entity attacker, entity attacked, database.spellinformation spell, ref attack attack, byte p = 0)
{
int damage = 0;
if (attacked.entityflag == entityflag.monster)
damage = mymath.getdamageentity2monster(attacker, attacked, spell.id, spell.level, ref attack);
else
damage = mymath.getdamageentity2entity(attacker, attacked, spell.id, spell.level, ref attack);
checkdamage(attacker, attacked, ref damage, ref attack, false);
return (uint)damage;
}
public static int calculateskillcstrike(entity attackerclient, entity attackedclient, int damage)
{
if (attackerclient.skillcstrike == attackedclient.immunity)
return damage;
if (attackerclient.skillcstrike > attackedclient.immunity)
{
int power = (int)(attackerclient.skillcstrike - attackedclient.immunity);
damage = (int)((double)damage * 1.500);
}
return damage;
}
public static int calculatecriticalstrike(entity attackerclient, entity attackedclient, int damage)
{
if (attackerclient.criticalstrike == attackedclient.immunity)
return damage;
if (attackerclient.criticalstrike > attackedclient.immunity)
{
damage = (int)((double)damage * 1.500);
}
return damage;
}
public static int calculatebreaktrough(entity attackerclient, entity attackedclient, int damage)
{
if ((attackerclient.breaktrough == attackedclient.counteraction) || attackerclient.class >= 130 && attackerclient.class <= 135)
return damage;
if (attackerclient.breaktrough > attackedclient.counteraction)
{
int power = (int)(attackerclient.breaktrough - attackedclient.counteraction);
damage = (int)((double)damage * 1.600);
}
return damage;
}
private static void autorespone(entity attacker, entity attacked, ref int damage)
{
try
{
if (attacker.entityflag == entityflag.entity)
{
if (attacker.owner.spells.containskey(11120))
{
var s = attacker.owner.spells[11120];
var spell = database.spelltable.spellinformations[s.id][s.level];
if (spell != null)
{
if (kernel.rate(spell.percent))
{
var ent = attacked as entity;
if (!ent.isblackspotted)
{
ent.isblackspotted = true;
ent.blackspotstamp = time32.now;
ent.blackspotstepsecs = spell.duration;
kernel.blackspoted.tryadd(ent.uid, ent);
blackspotpacket bsp = new blackspotpacket();
foreach (var h in program.gamepool)
{
h.send(bsp.toarray(true, ent.uid));
}
}
}
}
}
}
if (attacked.entityflag == entityflag.entity)
{
if (attacked.owner.spells.containskey(11130) && attacked.owner.entity.iseagleeyeshooted)
{
var s = attacked.owner.spells[11130];
var spell = database.spelltable.spellinformations[s.id][s.level];
if (spell != null)
{
if (kernel.rate(spell.percent))
{
attacked.owner.entity.iseagleeyeshooted = false;
spelluse ssuse = new spelluse(true);
ssuse.attacker = attacked.uid;
ssuse.spellid = spell.id;
ssuse.spelllevel = spell.level;
ssuse.addtarget(attacked.owner.entity, new spelluse.damageclass().damage = 11030, null);
if (attacked.entityflag == entityflag.entity)
{
attacked.owner.sendscreen(ssuse, true);
}
}
}
}
if (attacked.counterkillswitch && kernel.rate(30) && !attacker.containsflag((ulong)update.flags.fly) && time32.now > attacked.counterkillstamp.addseconds(15))
{
attacked.counterkillstamp = time32.now;
network.gamepackets.attack attack = new abdoredagxv4.network.gamepackets.attack(true);
attack.effect1 = attack.attackeffects1.none;
uint damage = melee(attacked, attacker, ref attack);
damage = damage / 3;
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.entity)
{
attacked.owner.updatequalifier(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.entity)
{
attacked.owner.updatequalifier(attacker.hitpoints) ;
attacker.owner.sendscreen(attack, true);
}
else
{
attacker.monsterinfo.sendscreen(attack);
}
}
damage = 0;
}
else if (attacked.owner.spells.containskey(3060) && kernel.rate(15))
{
uint damage = (uint)(damage / 10);
if (damage <= 0)
damage = 1;
if (damage > 10000) damage = 10000;
network.gamepackets.attack attack = new abdoredagxv4.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.entity)
{
attacked.owner.updatequalifier(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.entity)
{
attacked.owner.updatequalifier(attacker.hitpoints) ;
attacker.owner.sendscreen(attack, true);
}
else
{
attacker.monsterinfo.sendscreen(attack);
}
}
damage = 0;
}
}
}
catch (exception e) { program.saveexception(e); }
}
public static void checkdamage(entity attacker, entity attacked, ref int damage, ref attack packet, bool magic = false)
{
if (attacked.entityflag == entityflag.monster)
{
if (!attacker.assassin() && !attacker.ischaser1())
{
if (attacked.monsterinfo.boss || attacked.boss == 1)
{
if (magic)
damage = (int)damage * 10;
else
damage = (int)damage * 4;
return;
}
}
}
if (attacker.entityflag == entityflag.entity)
{
blesseffect.effect(attacker);
gemeffect.effect(attacker);
}
calculate.autorespone(attacker, attacked, ref damage);
if (attacked.containsflag2(network.gamepackets.update .flags2.azureshield))
{
if (damage > attacked.azureshielddefence)
{
damage -= attacked.azureshielddefence;
createazuredmg(attacked.azureshielddefence, attacker, attacked);
attacked.removeflag2(network.gamepackets.update.fl ags2.azureshield);
}
else
{
createazuredmg((uint)damage, attacker, attacked);
attacked.azureshielddefence -= (ushort)damage;
attacked.azureshieldpacket();
damage = 1;
}
}
#region nobility damage
if (attacked.entityflag == entityflag.entity && (attacker.battlepower < attacked.battlepower))
{
if (attacked.owner.challenge == null)
{
if (attacker.entityflag == entityflag.monster) return;
int sub = attacked.battlepower - attacker.battlepower;
//sub *= 2000;//##samak battlepower
if (sub > 41)
{
if (attacker.entityflag == entityflag.monster) return;
damage = 1;
}
else
{//samak
if (attacker.entityflag == entityflag.monster) return;
damage = (int32)math.floor((float)damage * (.75 - (sub * 0.01)));
}
}
}
if (attacked.entityflag == entityflag.entity && (attacker.battlepower > attacked.battlepower))
{
if (attacked.owner.challenge == null)
{
if (attacker.entityflag == entityflag.monster) return;
int dmg = attacked.battlepower - attacker.battlepower;
if (dmg > 50)
{
if (attacker.entityflag == entityflag.monster) return;
damage = damage * 2;
}
else
if (attacker.entityflag == entityflag.monster) return;
damage = (int32)math.floor((float)damage * (1.10 - (dmg * 0.01)));
}
}
#endregion
/* #region nobility damage
#region king
if (attacker.nobilityrank == conquerstructures.nobilityrank.king)
{
if (attacked.nobilityrank == conquerstructures.nobilityrank.king)
{
damage = (int)((double)damage * 1.08);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.prince)
{
damage = (int)((double)damage * 1.18);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.duke)
{
damage = (int)((double)damage * 1.19);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.earl)
{
damage = (int)((double)damage * 1.20);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.baron)
{
damage = (int)((double)damage * 1.21);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.knight)
{
damage = (int)((double)damage * 1.22);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.serf)
{
damage = (int)((double)damage * 1.23);
}
}
#endregion king
#region prince
if (attacker.nobilityrank == conquerstructures.nobilityrank.prince)
{
if (attacked.nobilityrank == conquerstructures.nobilityrank.king)
{
damage = (int)((double)damage * 1.03);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.prince)
{
damage = (int)((double)damage * 1.07);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.duke)
{
damage = (int)((double)damage * 1.19);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.earl)
{
damage = (int)((double)damage * 1.20);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.baron)
{
damage = (int)((double)damage * 1.21);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.knight)
{
damage = (int)((double)damage * 1.22);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.serf)
{
damage = (int)((double)damage * 1.23);
}
}
#endregion prince
#region duke
if (attacker.nobilityrank == conquerstructures.nobilityrank.duke)
{
if (attacked.nobilityrank == conquerstructures.nobilityrank.king)
{
damage = (int)((double)damage * 1.02);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.prince)
{
damage = (int)((double)damage * 0.99);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.duke)
{
damage = (int)((double)damage * 1.08);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.earl)
{
damage = (int)((double)damage * 1.19);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.baron)
{
damage = (int)((double)damage * 1.20);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.knight)
{
damage = (int)((double)damage * 1.21);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.serf)
{
damage = (int)((double)damage * 1.22);
}
}
#endregion duke
#region earl
if (attacker.nobilityrank == conquerstructures.nobilityrank.earl)
{
if (attacked.nobilityrank == conquerstructures.nobilityrank.king)
{
damage = (int)((double)damage * 0.91);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.prince)
{
damage = (int)((double)damage * 0.95);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.duke)
{
damage = (int)((double)damage * 1);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.earl)
{
damage = (int)((double)damage * 1.05);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.baron)
{
damage = (int)((double)damage * 1.19);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.knight)
{
damage = (int)((double)damage * 1.20);
}
if (attacked.nobilityrank == conquerstructures.nobilityrank.serf)
{
damage = (int)((double)damage * 1.21);
}
}
#endregion earl
#endregion*/
#region dragonswing
if (kernel.rate(20))//bas kada
{
if (attacked.containsflag3(update.flags3.dragonswing) )
{
_string str = new _string(true);
str.uid = attacked.uid;
str.textscount = 1;
str.type = _string.effect;
str.texts.add("poisonmiss");
if (attacked.entityflag == entityflag.entity)
attacked.owner.sendscreen(str, true);
damage = 0;
}
}
#endregion
if (attacked.containsflag(network.gamepackets.update. flags.shurikenvortex))
damage = 1;
if (constants.damage1map.contains(attacked.mapid))
damage = 1;
}
public static void createazuredmg(uint dmg, entity attacker, entity attacked)
{
network.gamepackets.attack attac = new attack(true);
attac.attacker = attacker.uid;
attac.attacked = attacked.uid;
attac.x = attacked.x;
attac.y = attacked.y;
attac.attacktype = 55;
attac.damage = dmg;
attacked.owner.sendscreen(attac, true);
}
public static int64 getagilityweapons(entity attacker)
{
double result = 0;
if (attacker.transformed)
{
result = attacker.transformationhitrate * 100.0f;
}
else
{
int values = 0;
int junk = 0;
for (uint i = 0; i < 10; i++)
{
if (i != 5)
{
conqueritem item = attacker.owner.equipment.trygetitem(i);
database.conqueriteminformation cii = new database.conqueriteminformation(item.id, item.plus);
if (item.durability != 0)
if (item != null && item.id != 0)
{
int now = (cii.baseinformation.agility + attacker.gems[2]) + attacker.gems[2] + values;
values = now + cii.plusinformation.agility;
junk += attacker.gems[2]; //unuse grin emoticon .
}
}
else
continue;
}
result = ((attacker.agility) * ((double)values + 100.0f) * 0.0099999998f * 100.0f);
}
return (int64)result;
}
public static bool isdodged(entity attacker, entity attacked)
{
int result = 0;
double percent = 0;
if (attacker != null && attacked != null)
{
if (!attacker.transformed)
{
result = (attacker.agility >> 1 /* /2 */) - attacked.dodge + 100;
if (attacker.agility != 0)
{
percent = (double)((getagilityweapons(attacker) / attacker.agility) - 100.0f) * 0.01f + 1.0f;
}
else
{
percent = 1.0f;
}
//todo status hitrate status skill :d
result = (int)(percent * result);
if (attacker.owner.entity.isbow() && attacker.owner.entity.isshield())
{
result = result * 12 / 100;
}
result = math.max(10, math.min(90, result));
if (attacker.entityflag == entityflag.entity)
{
if (attacked.entityflag == entityflag.monster)
{
int antimonsterpercent = attacker.level - attacked.level;
if (antimonsterpercent > 0)
{
result += 10 * (antimonsterpercent / 5);
}
if (attacker.containsflag(update.flags.cyclone))
result = 100;
}
}
}
}
else
{
return true;
}
return kernel.randget(100) >= result;
}
public static void immu(entity attacked)
{
if (attacked.entityflag == entityflag.entity)
{
_string str = new _string(true);
str.uid = attacked.uid;
str.textscount = 1;
str.type = _string.effect;
str.texts.add("bossimmunity");
attacked.owner.sendscreen(str, true);
}
}
public static void refinary(entity attacker, entity attacked, ref double damage, ref attack packet, bool magic = false)
{
if (attacker.name == "thundercloud") return;
if (attacker.entityflag == entityflag.entity)
{
if (!attacker.istaoist(attacker.class))
{
if (attacked.battlepower > attacker.battlepower)
{
if (attacker.breaktrough > 0)
{
if (attacker.breaktrough > attacked.counteraction)
{
double power = (double)(attacker.breaktrough - attacked.counteraction);
if (attacker.nobilityrank < conquerstructures.nobilityrank.king)
{
power = (double)(power / 0);
if (mymath.success2(power))
{
damage += damage * 0 / 1;
damage += 15000;
packet.effect1 |= attack.attackeffects1.break;
}
else immu(attacked);
}
else
{
power = (double)(power / 0);
if (mymath.success(power))
{
damage += damage * 0 / 1;
packet.effect1 |= attack.attackeffects1.break;
}
else immu(attacked);
}
}
else
immu(attacked);
}
}
if (ratestatus(80))
{
if (!magic)
{
if (attacker.criticalstrike > 0)
{
if (attacker.criticalstrike > attacked.immunity)
{
double power = (double)(attacker.criticalstrike - attacked.immunity);
if (kernel.chancesuccess2(((float)attacker.criticalst rike / 300f) - ((float)attacked.immunity / 300f)))
{
damage += 15000;
packet.effect1 |= attack.attackeffects1.criticalstrike;
}
else
immu(attacked);
}
else
immu(attacked);
}
}
else
{
if (attacker.penetration > 0)
{
double power = (double)(attacker.penetration / 1);
if (mymath.success(power))
{
damage += damage * 0 / 4;
packet.effect1 |= attack.attackeffects1.penetration;
}
else if (attacker.skillcstrike > 0)
{
if (attacker.skillcstrike >= attacked.immunity)
{
power = (double)(attacker.skillcstrike - attacked.immunity);
power = (double)(power / 100);
if (mymath.success(power))
{
damage += damage * 50 / 100;
packet.effect1 |= attack.attackeffects1.criticalstrike;
}
else
immu(attacked);
}
}
else
immu(attacked);
}
else if (attacker.skillcstrike > 0)
{
if (attacker.skillcstrike >= attacked.immunity)
{
double power = (double)(attacker.skillcstrike - attacked.immunity);
power = (double)(power / 100);
if (mymath.success(power))
{
damage += damage * 50 / 100;
packet.effect1 |= attack.attackeffects1.criticalstrike;
}
else
immu(attacked);
}
}
else
immu(attacked);
}
}
}
}
if (attacked.entityflag == entityflag.entity)
{
if (ratestatus(5))
{
if (attacked.block > 0)
{
double power = (double)(attacked.block / 2);
if (mymath.success(power))
{
damage = damage / 2;
packet.effect1 |= attack.attackeffects1.block;
}
}
if (attacked.isshieldblock)
{
if (mymath.success(attacked.shieldblockpercent))
{
damage = damage / 2;
packet.effect1 |= attack.attackeffects1.block;
}
}
}
}
}
public static void refinary(entity attacker, sobnpcspawn attacked, ref double damage, ref attack packet, bool magic = false)
{
if (attacker.entityflag == entityflag.entity)
{
if (ratestatus(10))
{
if (!magic)
{
if (attacker.criticalstrike > 0)
{
double power = (double)(attacker.criticalstrike);
power = (double)(power / 100);
if (mymath.success(power))
{
damage += damage * 80 / 100;
packet.effect1 |= attack.attackeffects1.criticalstrike;
}
}
}
else
{
if (attacker.penetration > 0)
{
double power = (double)(attacker.penetration / 100);
if (mymath.success(power))
{
damage = damage * 50 / 100;
packet.effect1 |= attack.attackeffects1.penetration;
}
}
if (attacker.skillcstrike > 0)
{
double power = (double)(attacker.skillcstrike);
power = (double)(power / 100);
if (mymath.success(power))
{
damage += damage * 50 / 100;
packet.effect1 |= attack.attackeffects1.criticalstrike;
}
}
}
}
}
}
}
}
namespace abdoredagxv4
{
public class statusconstants
{
public const int adjustset = -30000,
adjustfull = -32768,
adjustpercent = 30000;
}
public class mathhelper
{
public static int bitfold32(int lower16, int higher16)
{
return (lower16) | (higher16 << 16);
}
public static void bitunfold32(int bits32, out int lower16, out int upper16)
{
lower16 = (int)(bits32 & uint16.maxvalue);
upper16 = (int)(bits32 >> 16);
}
public static void bitunfold64(ulong bits64, out int lower32, out int upper32)
{
lower32 = (int)(bits64 & uint32.maxvalue);
upper32 = (int)(bits64 >> 32);
}
public static int roughdistance(int x1, int y1, int x2, int y2)
{
return math.max(math.abs(x1 - x2), math.abs(y1 - y2));
}
public static int conquerdirection(int x1, int y1, int x2, int y2)
{
double angle = math.atan2(y2 - y1, x2 - x1);
angle -= math.pi / 2;
if (angle < 0) angle += 2 * math.pi;
angle *= 8 / (2 * math.pi);
return (int)angle;
}
public static int muldiv(int number, int numerator, int denominator)
{
return (number * numerator + denominator / 2) / denominator;
}
public static bool overflowadd(ref int acc, int add)
{
if (int.maxvalue - acc < add)
return true;
acc = math.max(acc + add, 0);
return false;
}
public static int adjustdataex(int data, int adjust, int maxdata = 0)
{
if (adjust >= statusconstants.adjustpercent)
return muldiv(data, adjust - statusconstants.adjustpercent, 100);
if (adjust <= statusconstants.adjustset)
return -1 * adjust + statusconstants.adjustset;
if (adjust == statusconstants.adjustfull)
return maxdata;
return data + adjust;
}
}
public class gemtypes
{
public const int
phoenix = 0,
dragon = 1,
fury = 2,
rainbow = 3,
kylin = 4,
violet = 5,
moon = 6,
tortoise = 7,
thunder = 10,
glory = 12,
first = phoenix,
last = glory + 1;
public static readonly string[] animation = new string[]
{
"phoenix",
"goldendragon",
"fastflash",
"rainbow",
"goldenkylin",
"purpleray",
"moon",
"recovery"
};
public static readonly int[][] effects = new[]
{
new[] { 0, 5, 10, 15 },
new[] { 0, 5, 10, 15 },
new[] { 0, 5, 10, 15 },
new[] { 0, 10, 15, 25 },
new[] { 0, 50, 100, 200 },
new[] { 0, 30, 50, 100 },
new[] { 0, 15, 30, 50 },
new[] { 0, 2, 4, 6 },
new[] { 0, 0, 0, 0 },
new[] { 0, 0, 0, 0 },
new[] { 0, 100, 300, 500 },
new[] { 0, 0, 0, 0 },
new[] { 0, 100, 300, 500 }
};
}
}
ولا يهمك يا غالي بس بعد ما بدلت مفيش جديد نفس الايرورات
stevenayman1
2020-03-20, 04:00 AM
يغلق تم تغير السورس
vBulletin® v3.8.8 Beta 1, Copyright ©2000-2024, TranZ by code