/// <summary> /// Processing damage. /// </summary> /// <param name="attacker">The attacker.</param> /// <param name="attacked">The attacked.</param> /// <param name="damage">The damage.</param> public static void ProcessDamage(Entities.IEntity attacker, Entities.IEntity attacked, ref uint damage, bool kill_damage = true) { // Removed dura, bugged atm. the dura works, although client doesn't update proper etc. CBA to fix it as I never intended to use it // Although you can go ahead and fix it yourself if you want, I may do it if I ever feel like it // The dura lose is commented out below. #region ATTACKER : GAMECLIENT if (attacker is Entities.GameClient) { Entities.GameClient attackerclient = attacker as Entities.GameClient; attackerclient.LoseAttackDura(damage); #region ATTACKED : GAMECLIENT if (attacked is Entities.GameClient) { Entities.GameClient attackedclient = attacked as Entities.GameClient; // tournament check, damage = 1 + return if (attackerclient.Battle != null) { if (!attackerclient.Battle.HandleAttack(attackerclient, attackedclient, ref damage)) { damage = 0; return; } } else { if (attacked.Map.GotKillCons() && !attackedclient.ContainsFlag1(Enums.Effect1.BlueName) && !attackedclient.ContainsFlag1(Enums.Effect1.RedName) && !attackedclient.ContainsFlag1(Enums.Effect1.BlackName)) { attackerclient.AddStatusEffect1(Enums.Effect1.BlueName, 20000); } attackedclient.LoseDefenseDura(damage); } } #endregion #region ATTACKED : MONSTER if (attacked is Entities.Monster) { Entities.Monster attackedmob = attacked as Entities.Monster; if (((byte)attackedmob.Behaviour) >= 3) { attackerclient.AddStatusEffect1(Enums.Effect1.BlueName, 20000); } if (damage > 0) { ulong exp = (ulong)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next((int)(damage / 2), (int)damage); if (attacked.Level > (attacker.Level + 10)) { exp *= 2; } else if (attacker.Level > (attacked.Level + 10)) { exp = (ulong)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(1, (int)attackedmob.Level); } attackerclient.AddExp(exp); } } #endregion //if (Calculations.Battle.LoseDuraAttak()) //attackerclient.LoseAttackDura(damage); } #endregion #region ATTACKER : MONSTER #region ATTACKED : GAMECLIENT if (attacked is Entities.GameClient) { Entities.GameClient attackedclient = attacked as Entities.GameClient; attackedclient.LoseDefenseDura(damage); } #endregion #endregion if (kill_damage) { HitDamage(attacker, attacked, damage); } }