Selaa lähdekoodia

宝物表预设宝物加成

WGL 1 kuukausi sitten
vanhempi
commit
7a8c5dc865

+ 16 - 2
ActionTowerDefense/Assets/Gen/SingleTreasureConfig.cs

@@ -25,10 +25,12 @@ public sealed partial class SingleTreasureConfig :  Bright.Config.BeanBase
         { var __json0 = _json["Tag"]; if(!__json0.IsArray) { throw new SerializationException(); } Tag = new System.Collections.Generic.List<int>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0;  { if(!__e0.IsNumber) { throw new SerializationException(); }  __v0 = __e0; }  Tag.Add(__v0); }   }
         { if(!_json["Attribute"].IsString) { throw new SerializationException(); }  Attribute = _json["Attribute"]; }
         { if(!_json["Price"].IsNumber) { throw new SerializationException(); }  Price = _json["Price"]; }
+        { var __json0 = _json["Type"]; if(!__json0.IsArray) { throw new SerializationException(); } Type = new System.Collections.Generic.List<string>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { string __v0;  { if(!__e0.IsString) { throw new SerializationException(); }  __v0 = __e0; }  Type.Add(__v0); }   }
+        { var __json0 = _json["Data"]; if(!__json0.IsArray) { throw new SerializationException(); } Data = new System.Collections.Generic.List<float>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { float __v0;  { if(!__e0.IsNumber) { throw new SerializationException(); }  __v0 = __e0; }  Data.Add(__v0); }   }
         PostInit();
     }
 
-    public SingleTreasureConfig(int ID, string Name, string SpriteName, int Quality, System.Collections.Generic.List<int> Tag, string Attribute, int Price ) 
+    public SingleTreasureConfig(int ID, string Name, string SpriteName, int Quality, System.Collections.Generic.List<int> Tag, string Attribute, int Price, System.Collections.Generic.List<string> Type, System.Collections.Generic.List<float> Data ) 
     {
         this.ID = ID;
         this.Name = Name;
@@ -37,6 +39,8 @@ public sealed partial class SingleTreasureConfig :  Bright.Config.BeanBase
         this.Tag = Tag;
         this.Attribute = Attribute;
         this.Price = Price;
+        this.Type = Type;
+        this.Data = Data;
         PostInit();
     }
 
@@ -66,13 +70,21 @@ public sealed partial class SingleTreasureConfig :  Bright.Config.BeanBase
     /// </summary>
     public System.Collections.Generic.List<int> Tag { get; private set; }
     /// <summary>
-    /// 宝物属性
+    /// 宝物加成描述
     /// </summary>
     public string Attribute { get; private set; }
     /// <summary>
     /// 价格
     /// </summary>
     public int Price { get; private set; }
+    /// <summary>
+    /// 属性类型
+    /// </summary>
+    public System.Collections.Generic.List<string> Type { get; private set; }
+    /// <summary>
+    /// 属性
+    /// </summary>
+    public System.Collections.Generic.List<float> Data { get; private set; }
 
     public const int __ID__ = -581043879;
     public override int GetTypeId() => __ID__;
@@ -96,6 +108,8 @@ public sealed partial class SingleTreasureConfig :  Bright.Config.BeanBase
         + "Tag:" + Bright.Common.StringUtil.CollectionToString(Tag) + ","
         + "Attribute:" + Attribute + ","
         + "Price:" + Price + ","
+        + "Type:" + Bright.Common.StringUtil.CollectionToString(Type) + ","
+        + "Data:" + Bright.Common.StringUtil.CollectionToString(Data) + ","
         + "}";
     }
     

+ 2 - 0
ActionTowerDefense/Assets/Scripts/Characters/AttackController.cs

@@ -31,6 +31,8 @@ public class AttackInfo
     [LabelText("击打值")] public int attackValue;
     public int damage;
     public Vector3 attackDir;
+    [LabelText("暴击率")] public int criticalChance;
+    [LabelText("吸血")] public int lifesteal;
     [LabelText("击中特效")] public GameObject effect;
     public AttackEffect[] attackEffect;
     [HideInInspector] public AttackMethod_Type attackMethod_Type;

+ 1 - 0
ActionTowerDefense/Assets/Scripts/Characters/AttributeStatus.cs

@@ -90,6 +90,7 @@ public class AttributeStatus : MonoBehaviour
         [Space]
         //非控制效果抗性
         [LabelText("护甲值")] public int armor;
+        [LabelText("闪避")] public int dodge;
     }
     [LabelText("抗性")] public Resistances resistances;
 

+ 11 - 1
ActionTowerDefense/Assets/Scripts/Characters/Character.cs

@@ -84,11 +84,14 @@ public class Character : MonoBehaviour
     [HideInInspector]
     public Character attackTarget;
 
+    //
     [DisplayOnly]
     [FoldoutGroup("角色信息", order: -1)] public CharacterState state;
     [FoldoutGroup("角色信息")] public int totalHp = 100;
     [FoldoutGroup("角色信息")] public int hp;
-
+    [FoldoutGroup("角色信息")] [LabelText("生命回复")] public int regeneration;
+    [HideInInspector] public float regenerationTime;
+    //
     [Header("角色状态")]
     public bool canFly = false;
     [LabelText("飞行单位高度可进行修改")]
@@ -209,6 +212,13 @@ public class Character : MonoBehaviour
 
     public virtual void OnState()
     {
+        regenerationTime += Time.deltaTime;
+        if(regenerationTime > 1)
+        {
+            regenerationTime = 0;
+            hp = Mathf.Clamp(hp + regeneration, 0, totalHp);
+        }
+
         if (pastWordTime > 0)
         {
             pastWordTime -= Time.deltaTime;

+ 11 - 0
ActionTowerDefense/Assets/Scripts/Characters/MoveCharacter.cs

@@ -241,6 +241,10 @@ public class MoveCharacter : Character
             //attributeStatus.AddSpecialState(attackInfo, attackFrom);
             return;
         }
+        if (Random.Range(0, 100) < attributeStatus.resistances.dodge)
+        {
+            return;
+        }
         AttackInfo attackInfo = attackMethod.attackInfo;
         ScreenReflectPresets.instance.ScreenReflect(hitFeedbackSystem, attackInfo.attackValue - hitResistance);
         int damageData;
@@ -295,7 +299,14 @@ public class MoveCharacter : Character
         //    damage = (int)((1 - reductionDegree) * damage);
         //}
 
+        if (Random.Range(0, 100) < attackInfo.criticalChance)
+        {
+            damageData *= 2;
+        }
+
         hp -= damageData;
+        attackFrom.hp += Mathf.RoundToInt(damageData * attackInfo.lifesteal / 100f);
+        attackFrom.hp = Mathf.Clamp(attackFrom.hp, 0, attackFrom.totalHp);
 
         //敌方士兵受起手式伤害/我方士兵受伤 闪白
         if(attackFrom.CompareTag("Demonic") && attackInfo.attackMethod_Type == AttackMethod_Type.Attack_Summon)

+ 20 - 1
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -1574,7 +1574,26 @@ public class PlayerController : MoveCharacter
         GameObject demonicObj = PoolManager.Instantiate(prefab);
         Demonic demonic = demonicObj.GetComponent<Demonic>();
         slr.SoldierAddLevelBuff(demonic);
-
+        GameManager gameManager = GameManager.instance;
+        AttackController attackController = demonic.attackController;
+        for (int i = 0; i < attackController.attackMethod_summon.Length; i++)
+        {
+            AttackInfo attackInfo = attackController.attackMethod_summon[i].attackInfo;
+            attackInfo.damage += gameManager.damage;
+            attackInfo.criticalChance = gameManager.criticalChance;
+            attackInfo.lifesteal = gameManager.lifesteal;
+        }
+        for (int i = 0; i < attackController.attackMethod_march.Length; i++)
+        {
+            AttackInfo attackInfo = attackController.attackMethod_summon[i].attackInfo;
+            attackInfo.damage += gameManager.damage;
+            attackInfo.criticalChance = gameManager.criticalChance;
+            attackInfo.lifesteal = gameManager.lifesteal;
+        }
+        demonic.attributeStatus.resistances.armor = gameManager.armor;
+        demonic.attributeStatus.resistances.dodge = gameManager.dodge;
+        demonic.regeneration = GameManager.instance.regeneration;
+        demonic.totalHp += gameManager.totalHp;
         demonic.id = id;
         demonic.playerID = playerId;
         if (!demonicDic.ContainsKey(id))

+ 49 - 1
ActionTowerDefense/Assets/Scripts/GameManager.cs

@@ -41,6 +41,16 @@ public class GameManager : MonoBehaviour
     [FoldoutGroup("金币结算")][LabelText("惩罚时间间隔")] public int deductMoneyTime;
     [FoldoutGroup("金币结算")][LabelText("每次惩罚扣除金币数量")] public int deductMoney;
 
+    [FoldoutGroup("Rogue数值")] [LabelText("伤害")] public int damage;
+    [FoldoutGroup("Rogue数值")] [LabelText("暴击率")] public int criticalChance;
+    [FoldoutGroup("Rogue数值")] [LabelText("回血")] public int regeneration;
+    [FoldoutGroup("Rogue数值")] [LabelText("吸血")] public int lifesteal;
+    [FoldoutGroup("Rogue数值")] [LabelText("护甲")] public int armor;
+    [FoldoutGroup("Rogue数值")] [LabelText("闪避")] public int dodge;
+    [FoldoutGroup("Rogue数值")] [LabelText("血量上限")] public int totalHp;
+    [FoldoutGroup("Rogue数值")] [LabelText("金币获得增加")] public int increasedGoldGain;
+    [FoldoutGroup("Rogue数值")] [LabelText("经验获得增加")] public int increasedEXPGain;
+
     public LeveType leveType;
     [LabelText("下一关倍率增幅")] public List<float> ratioIncrease = new List<float> { 0.4f, 1.6f, -0.8f };
     public int nowLevel;
@@ -152,7 +162,7 @@ public class GameManager : MonoBehaviour
             int extraTime = (int)gameTime - rewardTime;
             addMoney = Mathf.Clamp(totalMoney - (extraTime / deductMoneyTime) * deductMoney, 0, totalMoney);
         }
-        money += addMoney;
+        money += Mathf.RoundToInt(addMoney * increasedGoldGain / 100f);
         moneyText.text = $"{money}";
     }
 
@@ -202,4 +212,42 @@ public class GameManager : MonoBehaviour
         gameType = GameType.Shop;
         shopUI.Init();
     }
+
+    public void GetTreasure(Treasure treasure)
+    {
+        for (int i = 0; i < treasure.type.Count; i++)
+        {
+            float data = treasure.data[i];
+            switch (treasure.type[i])
+            {
+                case "伤害":
+                    damage += (int)data;
+                    break;
+                case "暴击率":
+                    criticalChance += (int)data;
+                    break;
+                case "回血":
+                    regeneration += (int)data;
+                    break;
+                case "吸血":
+                    lifesteal += (int)data;
+                    break;
+                case "护甲":
+                    armor += (int)data;
+                    break;
+                case "闪避":
+                    dodge += (int)data;
+                    break;
+                case "血量上限":
+                    totalHp += (int)data;
+                    break;
+                case "金币获得增加":
+                    increasedGoldGain += (int)data;
+                    break;
+                case "经验获得增加":
+                    increasedEXPGain += (int)data;
+                    break;
+            }
+        }
+    }
 }

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Rougue/SoldierEXP.cs

@@ -65,7 +65,7 @@ public class SoldierEXP : MonoBehaviour
                 {
                     return;
                 }
-                ssexp[i].curEXP += exp;
+                ssexp[i].curEXP += Mathf.RoundToInt(exp * GameManager.instance.increasedEXPGain/100f);
                 JudgeEXP(st);
                 break;
             }

+ 3 - 1
ActionTowerDefense/Assets/Scripts/UI/ShopUI.cs

@@ -74,7 +74,9 @@ public class ShopUI : MonoBehaviour
                 singleTreasureConfig.Tag,
                 tags,
                 singleTreasureConfig.Attribute,
-                singleTreasureConfig.Price
+                singleTreasureConfig.Price,
+                singleTreasureConfig.Type,
+                singleTreasureConfig.Data
                 );
             treasuresSaleUI[i].treasure = treasure;
             treasuresSaleUI[i].Init();

+ 8 - 1
ActionTowerDefense/Assets/Scripts/UI/TreasuresSaleUI.cs

@@ -15,8 +15,10 @@ public struct Treasure
     public List<Sprite> tags;
     public string attribute;
     public int price;
+    public List<string> type;
+    public List<float> data;
 
-    public Treasure(int id, string name, Sprite sprite, Color qualityIcon, Color qualityText, List<int> tagsId, List<Sprite> tags, string attribute, int price)
+    public Treasure(int id, string name, Sprite sprite, Color qualityIcon, Color qualityText, List<int> tagsId, List<Sprite> tags, string attribute, int price, List<string> type, List<float>data)
     {
         this.id = id;
         this.name = name;
@@ -27,6 +29,8 @@ public struct Treasure
         this.tags = new List<Sprite>(tags);
         this.attribute = attribute;
         this.price = price;
+        this.type = type;
+        this.data = data;
     }
 }
 
@@ -137,5 +141,8 @@ public class TreasuresSaleUI : MonoBehaviour
         gameObject.SetActive(false);
         isNull = true;
         islock = false;
+        GameManager.instance.GetTreasure(treasure);
     }
+
+
 }

+ 0 - 3
ActionTowerDefense/Assets/Scripts/UI/WeaponDetails.cs

@@ -17,7 +17,6 @@ public class WeaponDetails : MonoBehaviour
     {
         if(this.id == -1)
         {
-            Debug.Log("111");
             this.id = id;
             Init();
             gameObject.SetActive(true);
@@ -26,13 +25,11 @@ public class WeaponDetails : MonoBehaviour
         {
             if(this.id == id)
             {
-                Debug.Log("222");
                 this.id = -1;
                 gameObject.SetActive(false);
             }
             else
             {
-                Debug.Log("333");
                 this.id = id;
                 Init();
             }

+ 42 - 18
ActionTowerDefense/GenerateDatas/json/cfgtreasure.json

@@ -7,8 +7,16 @@
     "Tag": [
       1
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+5%</color>飞行兵攻速",
-    "Price": 523
+    "Attribute": "伤害+1\n暴击率+3%",
+    "Price": 52,
+    "Type": [
+      "伤害",
+      "暴击率"
+    ],
+    "Data": [
+      1,
+      3
+    ]
   },
   {
     "ID": 2,
@@ -19,8 +27,10 @@
       1,
       2
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+6%</color>飞行兵攻速",
-    "Price": 524
+    "Attribute": "+10%飞行兵伤害\n+6%飞行兵攻速",
+    "Price": 53,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 3,
@@ -28,8 +38,10 @@
     "SpriteName": "purpleFire",
     "Quality": 2,
     "Tag": [],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+7%</color>飞行兵攻速",
-    "Price": 525
+    "Attribute": "+10%飞行兵伤害\n+7%飞行兵攻速",
+    "Price": 54,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 4,
@@ -41,8 +53,10 @@
       4,
       5
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+8%</color>飞行兵攻速",
-    "Price": 526
+    "Attribute": "+10%飞行兵伤害\n+8%飞行兵攻速",
+    "Price": 55,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 5,
@@ -50,8 +64,10 @@
     "SpriteName": "shield_soul",
     "Quality": 0,
     "Tag": [],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+9%</color>飞行兵攻速",
-    "Price": 527
+    "Attribute": "+10%飞行兵伤害\n+9%飞行兵攻速",
+    "Price": 56,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 6,
@@ -62,8 +78,10 @@
       7,
       8
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+10%</color>飞行兵攻速",
-    "Price": 528
+    "Attribute": "+10%飞行兵伤害\n+10%飞行兵攻速",
+    "Price": 57,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 7,
@@ -73,8 +91,10 @@
     "Tag": [
       5
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+11%</color>飞行兵攻速",
-    "Price": 529
+    "Attribute": "+10%飞行兵伤害\n+11%飞行兵攻速",
+    "Price": 58,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 8,
@@ -84,8 +104,10 @@
     "Tag": [
       6
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+12%</color>飞行兵攻速",
-    "Price": 530
+    "Attribute": "+10%飞行兵伤害\n+12%飞行兵攻速",
+    "Price": 59,
+    "Type": [],
+    "Data": []
   },
   {
     "ID": 9,
@@ -95,7 +117,9 @@
     "Tag": [
       1
     ],
-    "Attribute": "<color=#fbe085>+10%</color>飞行兵伤害\n<color=#fbe085>+13%</color>飞行兵攻速",
-    "Price": 531
+    "Attribute": "+10%飞行兵伤害\n+13%飞行兵攻速",
+    "Price": 60,
+    "Type": [],
+    "Data": []
   }
 ]

BIN
ActionTowerDefense/Luban/Config/Datas/宝物表.xlsx