Browse Source

银月:装备属性设计

tangbin 1 year ago
parent
commit
319a54aa18

+ 133 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/entity/EquipPropertyBasic.java

@@ -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();
+    }
+}

+ 3 - 45
logic/equip-logic/src/main/java/com/iohao/mmo/equip/entity/FixedEquipProperty.java

@@ -50,7 +50,6 @@ public class FixedEquipProperty {
     int magicAttackMin;
     /** 法术攻击最大值 */
     int magicAttackMax;
-
     /** 物理攻击速度 */
     int physicsAttackSpeed;
     /** 法术攻击速度 */
@@ -63,55 +62,14 @@ public class FixedEquipProperty {
 
     /** 物理命中 */
     int physicsHit;
-    /** 物理闪避 */
-    int physicsDodge;
     /** 法术命中 */
     int magicHit;
+
+    /** 物理闪避 */
+    int physicsDodge;
     /** 法术闪避 */
     int magicDodge;
 
-    /** 物理致命 */
-    int physicsDeathblow;
-    /** 物理致命效果 */
-    int physicsDeathblowEffect;
-    /** 法术致命 */
-    int magicDeathblow;
-    /** 法术致命效果 */
-    int magicDeathblowEffect;
-
-    /** 抗物理致命 */
-    int physicsDeathblowResist;
-    /** 抗物理致命效果 */
-    int physicsDeathblowEffectResist;
-    /** 抗法术致命 */
-    int magicDeathblowResist;
-    /** 抗法术致命效果 */
-    int magicDeathblowEffectResist;
-
-    /** 受到最终物理伤害 */
-    int finalPhysicsDamage;
-    /** 受到最终法术伤害 */
-    int finalMagicDamage;
-
-    /** 元素攻击 */
-    List<EquipPropertyItem> elementAttack;
-    /** 元素抗性 */
-    List<EquipPropertyItem> elementAttackResist;
-    /** 忽视元素抗性 */
-    List<EquipPropertyItem> elementAttackIgnore;
-
-    /** 破盾 */
-    int breakingShield;
-
-    /** 格挡 */
-    int brock;
-
-    /** 要求等级降低 */
-    int levelReduce;
-
-    /** 对职业伤害 */
-    List<EquipPropertyItem> careerEffect;
-
     /** 生命值 */
     int hp;
     /** 能量值 */