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; } }
public override void Injured(BaseObject obj, uint value, NetMsg.MsgAttackInfo info) { if (value > attr.life) { attr.life = 0; } else { attr.life -= (int)value; } GameStruct.Action action; action = new GameStruct.Action(GameStruct.Action.INJURED, null); action.AddObject(obj); action.AddObject(value); action.AddObject(info); this.PushAction(action); }
public virtual void Injured(BaseObject obj, uint value, NetMsg.MsgAttackInfo info) { }