protected override void ProcessAction_Injured(GameStruct.Action act) { BaseObject attack_obj = act.GetObject(0) as BaseObject; NetMsg.MsgAttackInfo info = act.GetObject(2) as NetMsg.MsgAttackInfo; if (attack_obj == null) { return; } uint injured = (uint)act.GetObject(1); //受伤害的值 mTarget = attack_obj; this.GetAi().Injured(attack_obj); //死亡-- 锁定后不允许死亡 if (IsDie() && !this.IsLock() && info.tag == 2 /*单体攻击*/) { GameStruct.Action action; //死亡 action = new GameStruct.Action(GameStruct.Action.DIE, null); action.AddObject(attack_obj); action.AddObject(injured); this.PushAction(action); } //魔法攻击要延迟一秒下发死亡消息 if (info.tag == 21 && IsDie() && !this.IsLock()) { mnDieMagicTick = System.Environment.TickCount; mDieMagicInfo = act; } }
protected override void ProcessAction_Die(GameStruct.Action act) { PlayerObject play = act.GetObject(0) as PlayerObject; BaseObject baseobj = act.GetObject(0) as BaseObject; if (play == null && baseobj.type == OBJECTTYPE.EUDEMON) { play = (baseobj as EudemonObject).GetOwnerPlay(); } //根据打出的伤害获得经验值 uint injured = (uint)act.GetObject(1); NetMsg.MsgMonsterDieInfo info = new NetMsg.MsgMonsterDieInfo(); info.roleid = baseobj.GetTypeId(); info.role_x = baseobj.GetCurrentX(); info.role_y = baseobj.GetCurrentY(); info.injuredvalue = 0; info.monsterid = this.GetTypeId(); byte[] msg = info.GetBuffer(); //掉落道具 this.DropItem(baseobj); //RefreshVisibleObject(); //if (mRefreshList.Count > 0) //{ // this.GetGameMap().BroadcastBuffer(this,msg); // //掉落道具 // this.DropItem(play); //} this.BrocatBuffer(msg); LastDieTime = System.Environment.TickCount; if (play == null && baseobj.type != OBJECTTYPE.EUDEMON) { return; } //计算经验 play.AddExp((int)injured, play.GetLevel(), this.GetLevel()); //死亡的幻兽加灵气值复活 play.GetEudemonSystem().Eudemon_Alive(this); this.GetAi().Die(); this.GetAi().SetAttackTarget(null); mAliveTime.Update(); //执行死亡脚本- 最后一击的击杀者执行该脚本 if (mInfo.die_scripte_id > 0 && play != null) { ScripteManager.Instance().ExecuteAction(mInfo.die_scripte_id, play); } }
public override bool Run() { if (this.GetAi() == null) { return(true); } base.Run(); //单体魔法攻击延迟死亡 if (mDieMagicInfo != null && System.Environment.TickCount - mnDieMagicTick >= 500) { GameStruct.Action action = new GameStruct.Action(GameStruct.Action.DIE, null); action.AddObject(mDieMagicInfo.GetObject(0)); action.AddObject(mDieMagicInfo.GetObject(1)); this.PushAction(action); mDieMagicInfo = null; return(true); } else if (mDieMagicInfo != null) { return(true); } this.GetAi().Run(); if (this.IsLock()) { if (!this.CheckLockTime()) { this.UnLock(false); if (IsDie()) { GameStruct.Action action; //死亡 action = new GameStruct.Action(GameStruct.Action.DIE, null); action.AddObject(mTarget); action.AddObject((uint)mTarget.GetMinAck()); //取最小攻击为经验值 this.PushAction(action); LastDieTime = System.Environment.TickCount; } } } //死亡后三秒后发送清除怪物消息 if (IsDie() && !this.IsLock()) { if (!IsClear() && System.Environment.TickCount - LastDieTime > 3000) { this.ClearThis(); } } ////复活 //if (IsClear() && IsDie() && mRebirthTime > 0) //{ // if (System.Environment.TickCount - LastDieTime > mRebirthTime) // { // Alive(false); // } //} if (IsClear() && IsDie() && mAliveTime.ToNextTime()) { Alive(false); } return(true); }