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); }
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); }
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); }