示例#1
0
        public bool AddSelectObjsAtk(PeEntity npc, List <ItemObject> objs)
        {
            if (objs == null)
            {
                return(false);
            }

            for (int i = 0; i < objs.Count; i++)
            {
                if (SelectItem.EquipCanAttack(npc, objs[i]))
                {
                    _hasSelectsAtkEq.Add(objs[i]);
                }
            }

            return(true);
        }
示例#2
0
        public static bool HasCanAttackEquip(PeEntity entity, AttackType type)
        {
            List <ItemObject> objs = entity.GetEquipObjs(EeqSelect.combat);

            if (objs == null)
            {
                return(false);              //is player
            }
            for (int i = 0; i < objs.Count; i++)
            {
                if (SelectItem.EquipCanAttack(entity, objs[i]))
                {
                    AttackMode mode = objs[i].protoData.weaponInfo.attackModes[0];
                    if (mode.type == type)
                    {
                        return(true);
                    }
                }
            }

            ItemObject curobj = entity.motionEquipment.PEHoldAbleEqObj;
            EeqSelect  curEq  = SelectItem.GetEquipSelect(curobj);

            bool IsNeedTakeOff = (curobj != null && curobj.protoData.weaponInfo != null && curobj.protoData.weaponInfo.attackModes[0].type == AttackType.Ranged) ? true : false;
            bool canAttack     = SelectItem.EquipCanAttack(entity, curobj);

            if (IsNeedTakeOff && !canAttack)
            {
                TakeOffEquip(entity);
            }

            if (curEq == EeqSelect.combat && canAttack)
            {
                AttackMode mode = curobj.protoData.weaponInfo.attackModes[0];
                if (mode.type == type)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#3
0
        public bool SetSelectObjsAtk(PeEntity npc, AttackType type)
        {
            AddSelectObjsAtk(npc, FilterAtkObjs(type, npc.GetEquipObjs(EeqSelect.combat)));

            ItemObject curobj = npc.motionEquipment.PEHoldAbleEqObj;
            EeqSelect  curEq  = SelectItem.GetEquipSelect(curobj);

            bool IsNeedTakeOff = (curobj != null && curobj.protoData.weaponInfo != null && curobj.protoData.weaponInfo.attackModes[0].type == AttackType.Ranged) ? true : false;
            bool canAttack     = SelectItem.EquipCanAttack(npc, curobj);

            if (IsNeedTakeOff && !canAttack)
            {
                SelectItem.TakeOffEquip(npc);
            }

            if (curEq == EeqSelect.combat && curobj.protoData.weaponInfo.attackModes[0].type == type && canAttack)
            {
                AddSeclectObjAtk(curobj);
            }

            return(_hasSelectsAtkEq.Count > 0);
        }
示例#4
0
        public bool Add(ItemObject obj)
        {
            if (obj == null)
            {
                return(false);
            }

            EquipInfo info = SelectItem.SwichEquipInfo(obj);

            if (info != null)
            {
                mItemsDic[(int)info._selectType].Add(obj);

                if (obj.protoData.weaponInfo != null && !mAtkItems[(int)obj.protoData.weaponInfo.attackModes[0].type].Contains(obj))
                {
                    mAtkItems[(int)obj.protoData.weaponInfo.attackModes[0].type].Add(obj);
                }

                return(true);
            }
            return(false);
        }
示例#5
0
        public ItemObject GetBetterAtkObj(PeEntity npc, Enemy enemy)
        {
            List <EvaluateInfo> infos = EvaluateMgr.Evaluates(npc, enemy, _hasSelectsAtkEq);

            if (infos == null || infos.Count <= 0)
            {
                //在水中需要收回当前装备的武器(如果远程 INFOS可能是0个,此时应用拳头)
                if (npc.biologyViewCmpt != null && !npc.biologyViewCmpt.monoPhyCtrl.Equals(null) && npc.biologyViewCmpt.monoPhyCtrl.feetInWater)
                {
                    SelectItem.TakeOffEquip(npc);
                }

                return(null);
            }
            ;
            if (infos.Count == 1)
            {
                _BetterAtkObj = infos[0].ItemObj;
                return(_BetterAtkObj);
            }

            EvaluateInfo tmpInfo = infos[0];

            for (int i = 1; i < infos.Count; i++)
            {
                if (tmpInfo.EvaluateValue < infos[i].EvaluateValue)
                {
                    tmpInfo = infos[i];
                }

                EvaluateMgr.Recyle(infos[i]);
            }

            _BetterAtkObj = tmpInfo.ItemObj;
            return(_BetterAtkObj);
        }