|
@@ -0,0 +1,133 @@
|
|
|
+/*
|
|
|
+ * ioGame
|
|
|
+ * Copyright (C) 2021 - 2023 渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
|
|
|
+ * # iohao.com . 渔民小镇
|
|
|
+ *
|
|
|
+ * This program is free software: you can redistribute it and/or modify
|
|
|
+ * it under the terms of the GNU Affero General Public License as
|
|
|
+ * published by the Free Software Foundation, either version 3 of the
|
|
|
+ * License, or (at your option) any later version.
|
|
|
+ *
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ * GNU Affero General Public License for more details.
|
|
|
+ *
|
|
|
+ * You should have received a copy of the GNU Affero General Public License
|
|
|
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
+ */
|
|
|
+package com.iohao.mmo.equip.entity;
|
|
|
+
|
|
|
+import com.iohao.mmo.common.kit.RandomKit;
|
|
|
+import lombok.AccessLevel;
|
|
|
+import lombok.Builder;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.experimental.FieldDefaults;
|
|
|
+import org.springframework.data.mongodb.core.mapping.Document;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 装备基础属性
|
|
|
+ * <pre>
|
|
|
+ * 装备的基本属性
|
|
|
+ * </pre>
|
|
|
+ *
|
|
|
+ * @author 唐斌
|
|
|
+ * @date 2023-07-24
|
|
|
+ */
|
|
|
+@Data
|
|
|
+@Builder(toBuilder = true)
|
|
|
+@Document
|
|
|
+@FieldDefaults(level = AccessLevel.PRIVATE)
|
|
|
+public class EquipPropertyBasic {
|
|
|
+
|
|
|
+ /** 物理攻击最小值 */
|
|
|
+ Integer physicsAttackMin;
|
|
|
+ /** 物理攻击最大值 */
|
|
|
+ Integer physicsAttackMax;
|
|
|
+ /** 法术攻击最小值 */
|
|
|
+ Integer magicAttackMin;
|
|
|
+ /** 法术攻击最大值 */
|
|
|
+ Integer magicAttackMax;
|
|
|
+ /** 物理攻击速度 */
|
|
|
+ Integer physicsAttackSpeed;
|
|
|
+ /** 法术攻击速度 */
|
|
|
+ Integer magicAttackSpeed;
|
|
|
+
|
|
|
+ /** 物理防御 */
|
|
|
+ Integer physicsDefense;
|
|
|
+ /** 法术防御 */
|
|
|
+ Integer magicDefense;
|
|
|
+
|
|
|
+ /** 物理命中 */
|
|
|
+ Integer physicsHit;
|
|
|
+ /** 法术命中 */
|
|
|
+ Integer magicHit;
|
|
|
+
|
|
|
+ /** 物理闪避 */
|
|
|
+ Integer physicsDodge;
|
|
|
+ /** 法术闪避 */
|
|
|
+ Integer magicDodge;
|
|
|
+
|
|
|
+ /** 生命值 */
|
|
|
+ Integer hp;
|
|
|
+ /** 能量值 */
|
|
|
+ Integer mp;
|
|
|
+
|
|
|
+ /** 耐久度 */
|
|
|
+ Integer durability;
|
|
|
+
|
|
|
+ public static EquipPropertyBasic randomFixed(EquipPropertyBasic fixedEquipPropertyMin,
|
|
|
+ EquipPropertyBasic fixedEquipPropertyMax){
|
|
|
+
|
|
|
+ EquipPropertyBasic equipPropertyBasic = new EquipPropertyBasic();
|
|
|
+ if(fixedEquipPropertyMin==null || fixedEquipPropertyMax == null)
|
|
|
+ {
|
|
|
+ return equipPropertyBasic;
|
|
|
+ }
|
|
|
+ if(fixedEquipPropertyMin.getPhysicsAttackMin()!=null&&fixedEquipPropertyMax.getPhysicsAttackMin()!=null){
|
|
|
+ equipPropertyBasic.toBuilder().physicsAttackMin(RandomKit.randomFromInt(fixedEquipPropertyMin.physicsAttackMin.intValue(),
|
|
|
+ fixedEquipPropertyMax.physicsAttackMin.intValue()));
|
|
|
+ }
|
|
|
+ return EquipPropertyBasic.builder()
|
|
|
+ .physicsAttackMin(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getPhysicsAttackMin(),
|
|
|
+ fixedEquipPropertyMax.getPhysicsAttackMin()))
|
|
|
+ .physicsAttackMax(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getPhysicsAttackMax(),
|
|
|
+ fixedEquipPropertyMax.getPhysicsAttackMax()))
|
|
|
+ .magicAttackMin(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getMagicAttackMin(),
|
|
|
+ fixedEquipPropertyMax.getMagicAttackMin()))
|
|
|
+ .magicAttackMax(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getMagicAttackMax(),
|
|
|
+ fixedEquipPropertyMax.getMagicAttackMax()))
|
|
|
+ .physicsDefense(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getPhysicsDefense(),
|
|
|
+ fixedEquipPropertyMax.getPhysicsDefense()))
|
|
|
+ .magicDefense(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getMagicDefense(),
|
|
|
+ fixedEquipPropertyMax.getMagicDefense()))
|
|
|
+ .magicDefense(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getMagicDefense(),
|
|
|
+ fixedEquipPropertyMax.getMagicDefense()))
|
|
|
+ .physicsHit(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getPhysicsHit(),
|
|
|
+ fixedEquipPropertyMax.getPhysicsHit()))
|
|
|
+ .physicsDodge(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getPhysicsDodge(),
|
|
|
+ fixedEquipPropertyMax.getPhysicsDodge()))
|
|
|
+ .magicHit(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getMagicHit(),
|
|
|
+ fixedEquipPropertyMax.getMagicHit()))
|
|
|
+ .magicDodge(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getMagicDodge(),
|
|
|
+ fixedEquipPropertyMax.getMagicDodge()))
|
|
|
+ .hpPct(
|
|
|
+ RandomKit.randomFromBigDecimal(fixedEquipPropertyMin.getHpPct(),
|
|
|
+ fixedEquipPropertyMax.getHpPct()))
|
|
|
+ .durability(
|
|
|
+ RandomKit.randomFromInt(fixedEquipPropertyMin.getDurability(),
|
|
|
+ fixedEquipPropertyMax.getDurability()))
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+}
|