/// <summary> /// 攻击客户端怪物 /// </summary> /// <param name="hitActionId"></param> /// <param name="beasts"></param> private void AttackBeast(int hitActionId, List <uint> beasts) { //受伤者列表 Dictionary <uint, List <int> > wounded = new Dictionary <uint, List <int> >(); for (int i = 0; i < beasts.Count; i++) { List <int> harm = new List <int>(); if (!GameWorld.Entities.ContainsKey(beasts[i])) { continue; } EntityParent e = GameWorld.Entities[beasts[i]]; //如果怪物不能被击中或者已经死亡 if (UnityTools.BitFlag(e.StateFlag, StateCfg.NO_HIT_STATE) == 1 || UnityTools.BitFlag(e.StateFlag, StateCfg.DEATH_STATE) == 1) { continue; } harm = CalculateDamage.CacuDamage(hitActionId, theOwner.ID, beasts[i]); wounded.Add(beasts[i], harm); uint demage = 0; demage = e.CurHp < harm[1] ? e.CurHp : (uint)harm[1]; e.CurHp -= demage; } }