public static EvaluateInfo Evaluate(PeEntity npc, Enemy enemy, ItemObject obj) { float RANGE_DATA = 5.0f; ItemProto.WeaponInfo weaponInfo = obj.protoData.weaponInfo; AttackMode mode = obj.protoData.weaponInfo.attackModes[0]; EvaluateInfo info = new EvaluateInfo(); //当前装备 if (npc.motionEquipment.PEHoldAbleEqObj == obj) { info.setEquipment(1.2f); } else { info.setEquipment(1.0f); } if (mode.type == AttackType.Ranged) { info.SetRangeFir(2.0f); } else { info.SetRangeFir(1.0f); } //bool npcFeetInwater = npc.biologyViewCmpt != null && npc.biologyViewCmpt.monoPhyCtrl != null ? npc.biologyViewCmpt.monoPhyCtrl.feetInWater : false; float hpNpc = npc.GetAttribute(AttribType.Hp); //float atkNpc = npc.GetAttribute(AttribType.Atk); float defNpc = npc.GetAttribute(AttribType.Def); float enemyAtk = enemy.entityTarget.GetAttribute(AttribType.Atk); bool rangeFrist = ((enemyAtk - defNpc > hpNpc * 0.1f) && mode.type == AttackType.Ranged) ? true : false; // && !enemy.IsInWater && !npcFeetInwater //飞行怪物或者boss 只能远程攻击 if (enemy.entityTarget.Field == MovementField.Sky || enemy.entityTarget.IsBoss || rangeFrist) { if (mode.type == AttackType.Ranged) { info.SetLongRange(2.0f); } else { info.SetLongRange(0); } } //}//水中 只能用近战 //else if(npcFeetInwater) //{ // if(mode.type == AttackType.Melee) // info.SetLongRange(2.0f); // else // info.SetLongRange(0); //} else { info.SetLongRange(1.0f); } // float distance = PETools.PEUtil.MagnitudeH(npc.position, enemy.position); if (mode.IsInRange(distance)) { info.SetRangeValue(2.0f); } else { if (distance < mode.minRange && distance + RANGE_DATA > mode.minRange) { info.SetRangeValue(1.0f + Mathf.Clamp01(distance / mode.minRange)); } else if (distance > mode.maxRange && mode.maxRange + RANGE_DATA > distance) { info.SetRangeValue(1.0f + Mathf.Clamp01(RANGE_DATA - (distance - mode.maxRange) / RANGE_DATA)); } else { if (mode.type == AttackType.Ranged) { info.SetRangeValue(1.8f); } else { info.SetRangeValue(1.0f); } } } // info.SetDPS(mode.damage / (mode.frequency < PETools.PEMath.Epsilon ? 1.0f : mode.frequency)); if (weaponInfo.useEnergry) { GunAmmo gunAmmo = obj.GetCmpt <GunAmmo>(); if (gunAmmo != null) { int shootCount = gunAmmo.count / Mathf.Max(weaponInfo.costPerShoot, 1); //float energy = npc.GetAttribute(AttribType.Energy); if (shootCount > 3) { info.SetSurplusCnt(1.0f); } else if (shootCount >= 1 || npc.GetAttribute(AttribType.Energy) > PETools.PEMath.Epsilon) { info.SetSurplusCnt(0.5f); } else { info.SetSurplusCnt(0); } } else { info.SetSurplusCnt(0); } } else if (weaponInfo.costItem > 0) { GunAmmo gunAmmo = obj.GetCmpt <GunAmmo>(); if (gunAmmo == null) { if (npc.GetItemCount(weaponInfo.costItem) < 3) { info.SetSurplusCnt(0.5f); } else { info.SetSurplusCnt(1.0f); } } else { if (gunAmmo.count < 3) { if (npc.GetItemCount(weaponInfo.costItem) < 3) { info.SetSurplusCnt(0.5f); } else { info.SetSurplusCnt(1.0f); } } else { info.SetSurplusCnt(1.0f); } } } else { info.SetSurplusCnt(1.0f); } info.SetObj(obj); return(info); }