public bool ProcAttack_Hand2Hand() { try { if (m_pOwner == null || m_dwTargetId == 0 || !IsBattleMaintain()) { ResetBattle(); return(false); } } catch (Exception ex) { ServerKernel.Log.SaveLog("ProcAttack_Hand2Hand.IsBattleMaint", false, LogType.WARNING); ServerKernel.Log.SaveLog(ex.ToString(), false, LogType.EXCEPTION); return(false); } var pTarget = FindRole(m_dwTargetId); if (pTarget == null) { ResetBattle(); return(false); } if (m_pOwner.IsImmunity(pTarget)) { ResetBattle(); return(false); } Character pOwner = null; if (m_pOwner is Character) { pOwner = m_pOwner as Character; } if (IsTargetDodged(m_pOwner, pTarget)) { m_pOwner.SendDamageMsg(pTarget.Identity, 0, InteractionEffect.NONE); return(true); } // if archer //if (m_pOwner.IsBowman()) //{ // if (pOwner != null) // { // if (!pOwner.Equipment.Items.ContainsKey(5) || !pOwner.Equipment.Items[5].IsArrowSort() // || pOwner.Equipment.Items[5].Durability <= 0) // { // if (!pOwner.ReloadArrows()) // { // ResetBattle(); // return false; // no arrows // } // } // else // { // pOwner.Equipment.Items[5].Durability -= 1; // } // pOwner.Send(pOwner.Equipment.Items[5].InformationPacket(true)); // } //} if (QueryMagic() != null) { QueryMagic().AbortMagic(true); } if (pTarget is Character) { Character pTargetUser = pTarget as Character; if (pTargetUser.CheckScapegoat(m_pOwner)) { return(true); } } if (m_pOwner is Character && m_pOwner.AutoSkillAttack(pTarget)) { return(true); } InteractionEffect special = InteractionEffect.NONE; int nDamage = m_pOwner.Attack(pTarget, ref special); int nTargetLifeLost = Math.Max(1, nDamage); int nExp = (int)Math.Min(pTarget.MaxLife, nTargetLifeLost); if (m_pOwner.QueryStatus(FlagInt.FATAL_STRIKE) != null && pTarget is Monster) { Monster pMob = pTarget as Monster; if (!pMob.IsGuard() && !pMob.IsPlayer() && !pMob.IsDynaNpc() && !pMob.IsDynaMonster()) { m_pOwner.MapX = pTarget.MapX; m_pOwner.MapY = pTarget.MapY; var msg = new MsgAction(m_pOwner.Identity, pTarget.Identity, m_pOwner.MapX, m_pOwner.MapY, GeneralActionType.NINJA_STEP); m_pOwner.Send(msg); m_pOwner.Screen.SendMovement(msg); } } m_pOwner.SendDamageMsg(pTarget.Identity, (uint)nTargetLifeLost, special); if (nDamage == 0) { return(false); } // pTarget.AddAttribute(ClientUpdateType.HITPOINTS, -1*nTargetLifeLost, true); pTarget.BeAttack(0, m_pOwner, nDamage, true); // Syn rank DynamicNpc pNpc = null; Character pOwnerUser = null; if (pTarget is DynamicNpc) { pNpc = pTarget as DynamicNpc; } if (m_pOwner is Character) { pOwnerUser = m_pOwner as Character; } if (pNpc != null && pOwnerUser != null && pNpc.IsAwardScore()) { if (pNpc.IsCtfFlag()) { pOwnerUser.AwardCtfScore(pNpc, nTargetLifeLost); } else { pOwnerUser.AwardSynWarScore(pNpc, nTargetLifeLost); } } if (m_pOwner is Character && pNpc != null && pNpc.IsGoal() || pTarget.IsMonster()) // check is monster { nExp = m_pOwner.AdjustExperience(pTarget, nExp, false); int nAdditionExp = 0; if (!pTarget.IsAlive) { nAdditionExp = (int)(pTarget.MaxLife * 5 / 100); nExp += nAdditionExp; if (pOwnerUser != null) { if (pOwnerUser.Team != null) { pOwnerUser.Team.AwardMemberExp(pOwnerUser.Identity, pTarget, nAdditionExp); } } } m_pOwner.AwardBattleExp(nExp, true); if (!pTarget.IsAlive && nAdditionExp > 0) { if (!pTarget.IsAlive && !m_pOwner.Map.IsTrainingMap() && pOwnerUser != null) { pOwnerUser.Send(string.Format(ServerString.STR_KILLING_EXPERIENCE, nAdditionExp), ChatTone.TOP_LEFT); } } if (pOwnerUser != null) { Item item; if (pOwnerUser.Equipment.Items.TryGetValue(ItemPosition.RIGHT_HAND, out item)) { pOwnerUser.WeaponSkill.AwardExperience((ushort)item.GetItemSubtype(), nExp); } if (pOwnerUser.Equipment.Items.TryGetValue(ItemPosition.LEFT_HAND, out item)) { pOwnerUser.WeaponSkill.AwardExperience((ushort)item.GetItemSubtype(), nExp); } } } m_pOwner.AdditionMagic(nTargetLifeLost, nDamage); if (Calculations.ChanceCalc(5f) && m_pOwner is Character) { (m_pOwner as Character).SendWeaponMagic2(pTarget); } if (!pTarget.IsAlive) { int dwDieWay = m_pOwner.IsSimpleMagicAtk() ? 3 : 1; if (nDamage > pTarget.MaxLife / 3) { dwDieWay = 2; } m_pOwner.Kill(pTarget, m_pOwner.IsBowman() ? 5 : (uint)dwDieWay); } if (pOwnerUser != null && pOwnerUser.QueryStatus(FlagInt.FATAL_STRIKE) != null) { DestroyAutoAttack(); } return(true); }