// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-12-17 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using System.Collections.Generic; using CodeStage.AntiCheat.ObscuredTypes; namespace G { /// /// 战斗属性类型 /// public enum CombatAttributeId : byte { None = 0, /// /// 生命上限 /// HpPercent = 1, AttackPercent = 2, DefencePercent = 3, /// /// 生命上限 /// Hp = 4, //Mp = 2, /// /// 攻击 /// Attack = 5, /// /// 防御 /// Defence = 6, /// /// 每秒回复 /// HpRecoverPercent = 7, /// /// 每秒回复 /// HpRecover = 8, /// /// /// 伤害加深百分比 = 9, /// /// 命中率% /// HitRate = 10, /// /// 命中率% /// Hit = 11, /// /// 闪躲% /// EvasionRate = 12, /// /// 闪避 /// Evasion = 24, //HitResistRate = 102,//命中减免率 /// /// 击杀恢复生命值% /// KillHpRecoverPercent = 13, /// /// 击杀恢复生命值 /// KillHpRecover = 14, /// /// 免伤固定值 /// BlockF = 20, /// /// 格挡率免伤 % /// BlockRate = 21, /// /// /// 忽视防御百分比 = 22, /// /// /// 忽视防御固定值 = 23, /// /// 格挡减免率 /// BlockResistRate = 25, //BlockReduceRate = 109,//格挡减伤比例 //Crit = 4,//暴击 //CritResist = 2,//暴击减免 //CritHurt = 26,//暴伤 //CritHurtResist = 26,//暴伤减免 /// /// 暴击率 /// CritRate = 15, /// /// 暴击 /// Crit = 29, //CritResistRate = 106,//暴击减免率 /// /// 暴伤率 /// CritDamageRate = 16, /// /// 冷却减少 /// Cooldown = 17, /// /// 击杀减少冷却 /// KillCooldown = 18, //CritHurtResistRate = 25,//暴伤减免比例 /// /// 攻速 /// AttackSpeed = 19, /// /// 金钱掉落增加 /// CoinDropAdd = 26, //金币强化消耗减少 CoinUpgradeCostReduce = 27, /// /// /// 稀有装备掉落 = 28, ElementNone = 30, /// /// 火元素伤害 /// ElementFire = 31, /// /// 冰元素伤害 /// ElementIce = 32, /// /// 雷元素伤害 /// ElementLightning = 33, /// /// 毒元素伤害 /// ElementCurse = 34, //ElementMu = 35,//金元素伤害 VampiricPercent = 36,// 吸血% Vampiric = 37,//吸血固定值 StageHpRecoverPercent = 38,//过关血量恢复% StageHpRecover = 39,////过关血量恢复 产业加成百分比 = 40, kMin = 1, //最小属性 kMax = 64//最大属性 } /// /// 战斗属性 /// public struct CombatAttribute { /// /// /// public CombatAttributeId id; /// /// /// private ObscuredInt _value; /// /// 数值 /// public int value { get { return _value; } set { _value = value; } } /// /// 战斗值 /// public int combatValue { get { return value > 0 ? this.CalcCombatValue() : 0; } } /// /// /// public int maxValue => item.maxValue; /// /// /// /// public void AddValue(int v) { this.value += v; } /// /// /// /// public void SubValue(int v) { this.value -= v; } /// /// /// public void ResetValue() { this.value = 0; } /// /// /// public string name { get { return item.name; } } /// /// /// public ItemAttribute item { get { return ItemProxy.Instance.GetStaticItem((int)id); } } /// /// /// /// public int CalcCombatValue() { var item = this.item; if (item != null) { return value * item.combat[1]; } return 0; } public int CalcCombatValue(int factor) { var item = this.item; if (item != null) { if (factor > 0 && item.combat.Length == 3) { return value * (item.combat[1] + factor * item.combat[2]); } return value * item.combat[1]; } return 0; } static string _Format; public override string ToString() { var item = this.item; if (item != null) { if (_Format == null) _Format = KLocalization.GetLocalString(80); var vs = item.type == 1 ? value + "%" : value.ToString(); var result = string.Format(_Format, name, vs); #if UNITY_EDITOR if (string.IsNullOrEmpty(result)) result = $"description error id:{item.id}"; #endif return result; } return $"{this.id} not exist item."; } static string _Format2; public string ToString2() { var item = this.item; if (item != null) { if (_Format2 == null) _Format2 = KLocalization.GetLocalString(81); var vs = item.type == 1 ? value + "%" : value.ToString(); var result = string.Format(_Format2, name, vs); return result; } return $"{this.id} not exist item."; } static string _Format3; /// /// 境界 /// /// public string ToString3() { var item = this.item; if (item != null) { if (_Format3 == null) _Format3 = KLocalization.GetLocalString(82); var vs = item.type == 1 ? value + "%" : value.ToString(); var result = string.Format(_Format3, name, vs); return result; } return $"{this.id} not exist item."; } public static CombatAttribute Convert(int[] sources) { if (sources != null && sources.Length > 1) return new CombatAttribute { id = (CombatAttributeId)sources[0], value = sources[1], }; return default; } public static void Convert(int[][] sources, List results) { if (sources != null) for (int i = 0; i < sources.Length; i++) { results.Add(new CombatAttribute { id = (CombatAttributeId)sources[i][0], value = sources[i][1], }); } } public static void AddTo(int[] source, List results) { if (source != null && source.Length >= 2) results.Add(new CombatAttribute { id = (CombatAttributeId)source[0], value = source[1], }); } } }