From 6426d91be8905091a27d75469045437327754a37 Mon Sep 17 00:00:00 2001 From: GL <2365963573@qq.com> Date: Sun, 29 Dec 2024 17:44:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A4=E7=94=B2=E4=BC=A4=E5=AE=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Role/Role.cs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Role/Role.cs b/Role/Role.cs index 87e4b34..22990ae 100644 --- a/Role/Role.cs +++ b/Role/Role.cs @@ -568,6 +568,7 @@ public class Role : Fun } hurt *= (1 + WuxingDamage(Target.gameObject.GetComponent()));//计算五行属性伤害 + hurt *= HujiaDamage(Target.gameObject.GetComponent());//计算破甲伤害 if (GetComponent()) { GetComponent().HarmNumber += Mathf.Round(hurt); @@ -601,8 +602,31 @@ public class Role : Fun // 如果是正数,表示加成,增加伤害 // 如果是负数,表示减成,减少伤害 - UnityEngine.Debug.Log("属性关系:"+"萌妖"+ GetComponent().elementType+"::"+"敌人"+ Target.elementType+"伤害加成"+relation); + // UnityEngine.Debug.Log("属性关系:"+"萌妖"+ GetComponent().elementType+"::"+"敌人"+ Target.elementType+"伤害加成"+relation); return relation; } + public float HujiaDamage(enemy Target)//护甲伤害计算 返回倍率减伤或增加伤害 + { + // 克制关系表(使用二维数组表示,行表示攻击类型,列表示防御类型) + float[,] attackDefenseRelations = new float[5, 4] + { + // 轻甲 重甲 魔盾 灵体 + { 1f, 0.5f, 1f, 0.35f }, // 普通攻击 + { 0.6f, 1.5f, 1f, 0.35f }, // 破甲攻击 + { 1.5f, 0.75f, 1f, 0.35f }, // 刺穿攻击 + { 1.25f, 1.5f, 0.5f, 2f }, // 魔法攻击 + { 1f, 1f, 1f, 1f } // 真实攻击 + }; + + + // 获取克制关系 + float relation = attackDefenseRelations[int.Parse(AttackType), (int)Target.defenseType]; + + + // 如果是正数,表示加成,增加伤害 + // 如果是负数,表示减成,减少伤害 + //UnityEngine.Debug.Log("破甲关系:" + "萌妖" + AttackType + "::" + "敌人" + Target.defenseType + "伤害加成" + relation); + return relation; + } }