// 远距离使用冰咆哮 5*5范围 public override bool AttackTarget() { bool result = false; if (m_TargetCret == null) { return(result); } if (HUtil32.GetTickCount() - m_dwHitTick > m_nNextHitTime) { m_dwHitTick = HUtil32.GetTickCount(); if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 5)) { m_dwTargetFocusTick = HUtil32.GetTickCount(); m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY); M2Share.MagicManager.MagBigExplosion(this, GetAttackPower(HUtil32.LoWord(m_WAbil.DC), ((short)HUtil32.HiWord(m_WAbil.DC) - HUtil32.LoWord(m_WAbil.DC))), m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, M2Share.g_Config.nSnowWindRange, MagicConst.SKILL_SNOWWIND); SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(m_TargetCret), ""); result = true; return(result); } if (m_TargetCret.m_PEnvir == m_PEnvir) { if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 11)) { SetTargetXY(m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY); } } else { DelTargetCreat(); } } return(result); }
// 增加检查两动作的间隔 private bool AutoAvoid() { bool result = true; int nTargetX = 0; int nTargetY = 0; byte nDir; if ((m_TargetCret != null) && (!m_TargetCret.m_boDeath)) { if (AutoAvoid_GotoMasterXY(ref nTargetX, ref nTargetY)) { result = GotoTargetXY(nTargetX, nTargetY); } else { nTargetX = m_TargetCret.m_nCurrX; nTargetY = m_TargetCret.m_nCurrY; nDir = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, nTargetX, nTargetY); nDir = GetBackDir(nDir); m_PEnvir.GetNextPosition(nTargetX, nTargetY, nDir, 3, ref m_nTargetX, ref m_nTargetY); result = GotoTargetXY(m_nTargetX, m_nTargetY); } } return(result); }
/// <summary> /// 物理攻击 /// </summary> /// <param name="TargeTBaseObject">目标</param> /// <param name="nHitPower">物理伤害值</param> /// <param name="nMagPower">魔法伤害值</param> /// <param name="boFlag"></param> public void HitMagAttackTarget(TBaseObject TargeTBaseObject, int nHitPower, int nMagPower, bool boFlag) { int nDamage; this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, TargeTBaseObject.m_nCurrX, TargeTBaseObject.m_nCurrY); IList <TPlayObject> BaseObjectList = new List <TPlayObject>(); try { this.m_PEnvir.GeTBaseObjects(TargeTBaseObject.m_nCurrX, TargeTBaseObject.m_nCurrY, false, BaseObjectList); foreach (var BaseObject in BaseObjectList) { if (this.IsProperTarget(BaseObject)) { nDamage = 0; nDamage += BaseObject.GetHitStruckDamage(this, nHitPower); nDamage += BaseObject.GetMagStruckDamage(this, nMagPower); if (nDamage > 0) { BaseObject.StruckDamage(nDamage); BaseObject.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, BaseObject.m_WAbil.HP, BaseObject.m_WAbil.MaxHP, Parse(this), "", 200); } } } } finally { Dispose(BaseObjectList); BaseObjectList = null; } this.SendRefMsg(Grobal2.RM_HIT, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, ""); }
/// <summary> /// 大火圈攻击 /// </summary> /// <param name="nPower">伤害值</param> /// <param name="nX">坐标X</param> /// <param name="nY">坐标Y</param> /// <param name="nRage">攻击范围</param> /// <returns></returns> internal bool MagBigExplosion(int nPower, int nX, int nY, int nRage) { bool result = false; List <TBaseObject> BaseObjectList = new List <TBaseObject>(); this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY);// 调整火龙的方向 try { BaseObjectList = this.GetMapBaseObjects(this.m_PEnvir, nX, nY, nRage); foreach (var TargeTBaseObject in BaseObjectList) { if (TargeTBaseObject != null) { if (TargeTBaseObject.m_boDeath || (TargeTBaseObject.m_boGhost)) { continue; } if (this.IsProperTarget(TargeTBaseObject)) { this.SetTargetCreat(TargeTBaseObject); TargeTBaseObject.SendMsg(this, Grobal2.RM_MAGSTRUCK, 0, nPower, 0, 0, ""); result = true; } } } } finally { Dispose(BaseObjectList); } return(result); }
private void FlyAxeAttack(TBaseObject Target) { TAbility WAbil; int nDamage; // 重击几率,目标等级不高于自己,才使用重击 if (((HUtil32.Random(M2Share.g_Config.nFairyDuntRate) == 0) && (Target.m_Abil.Level <= m_Abil.Level)) || (nHitCount >= HUtil32._MIN((3 + M2Share.g_Config.nFairyDuntRateBelow), (m_btSlaveExpLevel + M2Share.g_Config.nFairyDuntRateBelow)))) { // 月灵重击次数,达到次数时按等级出重击 m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY); WAbil = m_WAbil;// 重击倍数 nDamage = (int)HUtil32._MAX(0, (int)HUtil32.Round((double)((HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1)) + HUtil32.LoWord(WAbil.DC)) * M2Share.g_Config.nFairyAttackRate / 100)); if (nDamage > 0) { nDamage = Target.GetHitStruckDamage(this, nDamage); } if (nDamage > 0) { Target.StruckDamage(nDamage); } Target.SetLastHiter(this); Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, Parse(this), "", (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600); SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, m_nCurrX, m_nCurrY, Parse(Target), ""); m_dwActionTick = HUtil32.GetTickCount(); nHitCount = 0;// 攻击计数 } else { m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY); WAbil = m_WAbil; nDamage = HUtil32._MAX(0, HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC)); if (nDamage > 0) { nDamage = Target.GetHitStruckDamage(this, nDamage); } if (nDamage > 0) { Target.StruckDamage(nDamage); } Target.SetLastHiter(this); Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, Parse(this), "", (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600); SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(Target), ""); m_dwActionTick = HUtil32.GetTickCount(); nHitCount++;// 攻击计数 } }
public override void Run() { int nAttackDir; int nX; int nY; try { if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0)) { // 血量低于一半时开始用魔法攻击 if (m_WAbil.HP < m_WAbil.MaxHP / 2) { m_boUseMagic = true; } else { m_boUseMagic = false; } if (((HUtil32.GetTickCount() - m_dwSearchEnemyTick) > 1000) && (m_TargetCret == null)) { m_dwSearchEnemyTick = HUtil32.GetTickCount(); SearchTarget(); } if (m_TargetCret == null) { return; } nX = Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX); nY = Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY); if ((nX <= 2) && (nY <= 2)) { if (m_boUseMagic || ((nX == 2) || (nY == 2))) { if (((HUtil32.GetTickCount() - m_dwHitTick) > m_nNextHitTime)) { m_dwHitTick = HUtil32.GetTickCount(); nAttackDir = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY); LightingAttack(nAttackDir); } } } } } catch { M2Share.MainOutMessage("{异常} TElectronicScolpionMon.Run"); } base.Run(); }
public override void Run() { int nAttackDir; try { if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0) && ((HUtil32.GetTickCount() - m_dwSearchEnemyTick) > 8000)) { if (((HUtil32.GetTickCount() - m_dwSearchEnemyTick) > 1000) && (m_TargetCret == null)) { m_dwSearchEnemyTick = HUtil32.GetTickCount(); SearchTarget(); } if (((HUtil32.GetTickCount() - m_dwWalkTick) > m_nWalkSpeed) && (m_TargetCret != null) && (Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 4) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 4)) { if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) <= 2) && (HUtil32.Random(3) != 0)) { base.Run(); return; } GetBackPosition(ref m_nTargetX, ref m_nTargetY); } if ((m_TargetCret != null)) { if ((Math.Abs(m_nCurrX - m_TargetCret.m_nCurrX) < 6) && (Math.Abs(m_nCurrY - m_TargetCret.m_nCurrY) < 6) && ((HUtil32.GetTickCount() - m_dwHitTick) > m_nNextHitTime)) { m_dwHitTick = HUtil32.GetTickCount(); nAttackDir = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY); LightingAttack(nAttackDir); } } } } catch { M2Share.MainOutMessage("{异常} TLightingZombi.Run"); } base.Run(); }
private void FlyAxeAttack(TBaseObject Target) { TAbility WAbil; int nDamage; if (this.m_PEnvir.CanFly(this.m_nCurrX, this.m_nCurrY, Target.m_nCurrX, Target.m_nCurrY)) { this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, Target.m_nCurrX, Target.m_nCurrY); WAbil = this.m_WAbil; nDamage = (HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC)); if (nDamage > 0) { nDamage = Target.GetHitStruckDamage(this, nDamage); } if (nDamage > 0) { Target.StruckDamage(nDamage); Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, 0, "", (uint)HUtil32._MAX(Math.Abs(this.m_nCurrX - Target.m_nCurrX), Math.Abs(this.m_nCurrY - Target.m_nCurrY)) * 50 + 600); } this.SendRefMsg(Grobal2.RM_FLYAXE, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, ""); } }
// 大火圈攻击 private bool MagBigExplosion(int nPower, int nX, int nY, int nRage) { bool result; List <TBaseObject> BaseObjectList; TBaseObject TargeTBaseObject; result = false; this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY);// 调整火龙的方向 BaseObjectList = new List <TBaseObject>(); try { this.GetMapBaseObjects(this.m_PEnvir, nX, nY, nRage, BaseObjectList); if (BaseObjectList.Count > 0) { for (int I = 0; I < BaseObjectList.Count; I++) { TargeTBaseObject = BaseObjectList[I]; if (TargeTBaseObject != null) { if (TargeTBaseObject.m_boDeath || (TargeTBaseObject.m_boGhost)) { continue; } if (this.IsProperTarget(TargeTBaseObject)) { this.SetTargetCreat(TargeTBaseObject); TargeTBaseObject.SendMsg(this, Grobal2.RM_MAGSTRUCK, 0, nPower, 0, 0, ""); result = true; } } } } } finally { Dispose(BaseObjectList); } return(result); }
public bool AttackTarget() { bool result; int nOldX; int nOldY; byte btOldDir; ushort wHitMode; result = false; if (this.m_TargetCret.m_PEnvir == this.m_PEnvir) { if (((int)HUtil32.GetTickCount() - this.m_dwHitTick) > this.m_nNextHitTime) { this.m_dwHitTick = (uint)HUtil32.GetTickCount(); this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount(); nOldX = this.m_nCurrX; nOldY = this.m_nCurrY; btOldDir = this.m_btDirection; this.m_TargetCret.GetBackPosition(ref this.m_nCurrX, ref this.m_nCurrY); this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY); this.SendRefMsg(Grobal2.RM_HIT, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, ""); wHitMode = 0; this._Attack(ref wHitMode, this.m_TargetCret); this.m_TargetCret.SetLastHiter(this); this.m_TargetCret.m_ExpHitter = null; this.m_nCurrX = nOldX; this.m_nCurrY = nOldY; this.m_btDirection = btOldDir; this.TurnTo(this.m_btDirection); this.BreakHolySeizeMode(); } result = true; } else { this.DelTargetCreat(); } return(result); }
/// <summary> /// 寒冰掌,治疗术 攻击 /// </summary> /// <returns></returns> public override bool AttackTarget() { bool result = false; int nPower; int nDir; int push; if (this.m_TargetCret == null) { return(result); } if (HUtil32.GetTickCount() - this.m_dwHitTick > this.m_nNextHitTime) { this.m_dwHitTick = (uint)HUtil32.GetTickCount(); if (!this.m_TargetCret.m_boDeath) { if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5)) { this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount(); if ((this.m_WAbil.HP < HUtil32.Round(this.m_WAbil.MaxHP * 0.6)) && (HUtil32.Random(2) == 0)) { // 使用治疗术 this.SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, this.m_nCurrX, this.m_nCurrY, 0, ""); // 治愈术 this.SendDelayMsg(this, Grobal2.RM_MAGHEALING, 0, 50, 0, 0, "", 800); // 发消息给客户端,显示治愈术效果 result = true; return(result); } else { // 寒冰掌 nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC))); this.SendDelayMsg(this, Grobal2.RM_DELAYMAGIC, nPower, HUtil32.MakeLong(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY), 2, 0, "", 600); if ((!this.m_TargetCret.m_boStickMode) && (HUtil32.Random(2) == 0)) { push = HUtil32.Random(3) - 1; if (push > 0) { nDir = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY); this.SendDelayMsg(this, Grobal2.RM_DELAYPUSHED, nDir, HUtil32.MakeLong(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY), push, 0, "", 600); } } // 发消息给客户端,显示寒冰掌效果 this.SendRefMsg(Grobal2.RM_LIGHTING, 1, this.m_nCurrX, this.m_nCurrY, 0, ""); result = true; return(result); } } if (this.m_TargetCret.m_PEnvir == this.m_PEnvir) { if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11)) { this.SetTargetXY(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY); } } else { this.DelTargetCreat(); } } } return(result); }
/// <summary> /// 使用冰咆哮攻击 /// </summary> /// <returns></returns> public override bool AttackTarget() { bool result; int nPower; result = false; if ((this.m_TargetCret == null)) { return(result); } if (HUtil32.GetTickCount() - this.m_dwHitTick > this.m_nNextHitTime) { this.m_dwHitTick = HUtil32.GetTickCount(); if (!this.m_TargetCret.m_boDeath) { if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 5)) { this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount(); if ((this.m_TargetCret.m_wStatusTimeArr[Grobal2.POISON_DECHEALTH] == 0))// 目标绿毒时间到,才重新使用施毒术 { if (this.IsProperTarget(this.m_TargetCret)) { if (HUtil32.Random(this.m_TargetCret.m_btAntiPoison + 7) <= 6) // 施毒 { nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC))); // 中毒类型:绿毒 this.m_TargetCret.SendDelayMsg(this, Grobal2.RM_POISON, Grobal2.POISON_DECHEALTH, nPower, 0, 4, "", 150); this.SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, this.m_nCurrX, this.m_nCurrY, 0, ""); // 发给客户端毒的消息 result = true; return(result); } } } else { // 冰咆哮 if ((HUtil32.Random(10) >= this.m_TargetCret.m_nAntiMagic)) { // 魔法躲避 this.m_dwTargetFocusTick = (uint)HUtil32.GetTickCount(); this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY); nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC))); M2Share.MagicManager.MagBigExplosion(this, nPower, this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY, M2Share.g_Config.nSnowWindRange, MagicConst.SKILL_SNOWWIND);// 发消息给客户端,显示冰咆哮效果 this.SendRefMsg(Grobal2.RM_LIGHTING, 1, this.m_nCurrX, this.m_nCurrY, 0, ""); result = true; return(result); } else { // 物理攻击 if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 2)) { nPower = this.GetAttackPower(HUtil32.LoWord(this.m_WAbil.DC), ((short)HUtil32.HiWord(this.m_WAbil.DC) - HUtil32.LoWord(this.m_WAbil.DC))); this.HitMagAttackTarget(this.m_TargetCret, nPower / 2, nPower / 2, true); result = true; return(result); } } } } if (this.m_TargetCret.m_PEnvir == this.m_PEnvir) { if ((Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11) && (Math.Abs(this.m_nCurrX - this.m_TargetCret.m_nCurrX) <= 11)) { this.SetTargetXY(this.m_TargetCret.m_nCurrX, this.m_TargetCret.m_nCurrY); } } else { this.DelTargetCreat(); } } } return(result); }
public override void Run() { int nC; int n10; int n14; TBaseObject BaseObject1C; TBaseObject BaseObject; try { n10 = 9999; BaseObject = null; BaseObject1C = null; if (!m_boDeath && !m_boGhost && (m_wStatusTimeArr[Grobal2.POISON_STONE] == 0)) { if ((HUtil32.GetTickCount() - m_dwWalkTick) >= m_nWalkSpeed) { if (m_VisibleActors.Count > 0) { foreach (var item in m_VisibleActors) { BaseObject = item.BaseObject; if (BaseObject == null) { continue; } if (BaseObject.m_boDeath) { continue; } if (IsProperTarget(BaseObject)) { if (!BaseObject.m_boHideMode || m_boCoolEye) { nC = Math.Abs(m_nCurrX - BaseObject.m_nCurrX) + Math.Abs(m_nCurrY - BaseObject.m_nCurrY); if (nC < n10) { n10 = nC; BaseObject1C = BaseObject; } } } } } if (BaseObject1C != null) { m_boRunAwayMode = true; m_TargetCret = BaseObject1C; } else { m_boRunAwayMode = false; m_TargetCret = null; } } if (m_boRunAwayMode && (m_TargetCret != null) && ((HUtil32.GetTickCount() - m_dwWalkTick) >= m_nWalkSpeed)) { if ((Math.Abs(m_nCurrX - BaseObject.m_nCurrX) <= 6) && (Math.Abs(m_nCurrX - BaseObject.m_nCurrX) <= 6)) { n14 = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY); m_PEnvir.GetNextPosition(m_TargetCret.m_nCurrX, m_TargetCret.m_nCurrY, n14, 5, ref m_nTargetX, ref m_nTargetY); } } } } catch { M2Share.MainOutMessage("{异常} TChickenDeer.Run"); } base.Run(); }