public void UpdateCount(SufferStateProperty.SufferType key, SkillStatus skillStatus = null) { List <SufferStatePropertyCounter.CountData> list = null; this.countDictionary.TryGetValue(key, out list); if (list == null || list.Count == 0) { return; } using (List <SufferStatePropertyCounter.CountData> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { SufferStatePropertyCounter.CountData countData = enumerator.Current; HaveSufferState currentSufferState = countData.characterStateControl.currentSufferState; if (currentSufferState.FindSufferState(key)) { SufferStateProperty sufferStateProperty = currentSufferState.GetSufferStateProperty(key); SufferStateProperty.Data[] array = sufferStateProperty.GetNotIsMultiHitThroughDatas(); if (!string.IsNullOrEmpty(countData.id)) { array = array.Where((SufferStateProperty.Data item) => countData.id == item.id).ToArray <SufferStateProperty.Data>(); } if (array.Length > 0) { sufferStateProperty.AddCurrentKeepCount(array, -1, skillStatus, countData.characterStateControl); } } } } }
public void AddCountDictionary(SufferStateProperty.SufferType key, CharacterStateControl value, string[] ids = null) { if (!this.countDictionary.ContainsKey(key)) { this.countDictionary.Add(key, new List <SufferStatePropertyCounter.CountData>()); } HaveSufferState currentSufferState = value.currentSufferState; if (currentSufferState.FindSufferState(key)) { SufferStateProperty sufferStateProperty = currentSufferState.GetSufferStateProperty(key); SufferStateProperty.Data[] array = sufferStateProperty.GetIsMultiHitThroughDatas(); if (ids != null) { array = array.Where((SufferStateProperty.Data item) => ids.Contains(item.id)).ToArray <SufferStateProperty.Data>(); } if (array.Length > 0) { sufferStateProperty.AddCurrentKeepCount(array, -1, null, null); } SufferStateProperty.Data[] array2 = sufferStateProperty.GetNotIsMultiHitThroughDatas(); if (ids != null) { array2 = array2.Where((SufferStateProperty.Data item) => ids.Contains(item.id)).ToArray <SufferStateProperty.Data>(); } if (array2.Length > 0) { SufferStateProperty.Data[] array3 = array2; for (int i = 0; i < array3.Length; i++) { SufferStateProperty.Data notIsMultiHitThroughData = array3[i]; if (!this.countDictionary[key].Where((SufferStatePropertyCounter.CountData item) => item.characterStateControl == value && item.id == notIsMultiHitThroughData.id).Any <SufferStatePropertyCounter.CountData>()) { SufferStatePropertyCounter.CountData countData = new SufferStatePropertyCounter.CountData(); countData.characterStateControl = value; countData.id = notIsMultiHitThroughData.id; this.countDictionary[key].Add(countData); } } } } }
private static SufferStateProperty.DamageRateResult GetReduceDamageRate(AffectEffectProperty affectEffectProperty, CharacterStateControl attackerCharacter, CharacterStateControl targetCharacter) { HaveSufferState currentSufferState = targetCharacter.currentSufferState; SufferStateProperty.DamageRateResult damageRateResult = new SufferStateProperty.DamageRateResult(); damageRateResult.damageRate = 1f; if (affectEffectProperty.powerType == PowerType.Percentage && currentSufferState.FindSufferState(SufferStateProperty.SufferType.CountGuard)) { SufferStateProperty sufferStateProperty = currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.CountGuard); SufferStateProperty.DamageRateResult caseDamageRate = sufferStateProperty.GetCaseDamageRate(affectEffectProperty, attackerCharacter); if (BattleStateManager.current.battleStateData.IsChipSkill()) { CharacterStateControl autoCounterCharacter = BattleStateManager.current.battleStateData.GetAutoCounterCharacter(); if (autoCounterCharacter.chipSkillId == SkillStatus.COUNTER_ATTACK_SKILL_ID) { caseDamageRate.damageRate = 0f; } } float damageRate = Mathf.Max(1f - caseDamageRate.damageRate, 0f); damageRateResult.damageRate = damageRate; damageRateResult.dataList.AddRange(caseDamageRate.dataList); } return(damageRateResult); }
private static void CalculationBasePower(ref float attackCalced, ref float defenceCalced, bool isPhysics, bool isExtra, CharacterStateControl attackerCharacter, CharacterStateControl targetCharacter) { HaveSufferState currentSufferState = attackerCharacter.currentSufferState; HaveSufferState currentSufferState2 = targetCharacter.currentSufferState; float num = 0f; float num2 = 0f; float num3 = 0f; float num4 = 0f; int num5; int num6; if (isExtra) { num5 = ((!isPhysics) ? attackerCharacter.specialAttackPower : attackerCharacter.attackPower); num6 = ((!isPhysics) ? targetCharacter.specialDefencePower : targetCharacter.defencePower); } else { num5 = ((!isPhysics) ? attackerCharacter.extraSpecialAttackPower : attackerCharacter.extraAttackPower); num6 = ((!isPhysics) ? targetCharacter.extraSpecialDefencePower : targetCharacter.extraDefencePower); } float num7 = (!isPhysics) ? attackerCharacter.leaderSkillResult.specialAttackUpPercent : attackerCharacter.leaderSkillResult.attackUpPercent; float num8 = (!isPhysics) ? targetCharacter.leaderSkillResult.specialDefenceUpPercent : targetCharacter.leaderSkillResult.defenceUpPercent; float num9 = num7 * (float)num5; float num10 = num8 * (float)num6; global::Debug.Log(string.Format("onLeaderAttackUp {0} | onLeaderDefenceUp {1}", num9, num10)); SufferStateProperty.SufferType sufferType = SufferStateProperty.SufferType.AttackUp; SufferStateProperty.SufferType sufferType2 = SufferStateProperty.SufferType.AttackDown; SufferStateProperty.SufferType sufferType3 = SufferStateProperty.SufferType.DefenceUp; SufferStateProperty.SufferType sufferType4 = SufferStateProperty.SufferType.DefenceDown; if (!isPhysics) { sufferType = SufferStateProperty.SufferType.SpAttackUp; sufferType2 = SufferStateProperty.SufferType.SpAttackDown; sufferType3 = SufferStateProperty.SufferType.SpDefenceUp; sufferType4 = SufferStateProperty.SufferType.SpDefenceDown; } SufferStateProperty sufferStateProperty = currentSufferState.GetSufferStateProperty(sufferType); if (sufferStateProperty.isActive) { num = sufferStateProperty.upPercent * (float)num5; } SufferStateProperty sufferStateProperty2 = currentSufferState.GetSufferStateProperty(sufferType2); if (sufferStateProperty2.isActive) { num2 = sufferStateProperty2.downPercent * (float)num5; } SufferStateProperty sufferStateProperty3 = currentSufferState2.GetSufferStateProperty(sufferType3); if (sufferStateProperty3.isActive) { num3 = sufferStateProperty3.upPercent * (float)num6; } SufferStateProperty sufferStateProperty4 = currentSufferState2.GetSufferStateProperty(sufferType4); if (sufferStateProperty4.isActive) { num4 = sufferStateProperty4.downPercent * (float)num6; } attackCalced = (float)num5 + num - num2 + num9; defenceCalced = (float)num6 + num3 - num4 + num10; attackCalced = Mathf.Min(attackCalced, (float)num5 * 3f); attackCalced = Mathf.Max(attackCalced, 0f); defenceCalced = Mathf.Min(defenceCalced, (float)num6 * 3f); defenceCalced = Mathf.Max(defenceCalced, 0f); global::Debug.Log("========================================="); global::Debug.Log("onAttackUp : " + num); global::Debug.Log("onAttackDown : " + num2); global::Debug.Log("onDefenceUp : " + num3); global::Debug.Log("onDefenceDown : " + num4); global::Debug.Log(string.Format("攻撃 {0}/(上限{1}/下限{2}/基礎{3})", new object[] { attackCalced, (float)num5 * 3f, 0f, num5 })); global::Debug.Log(string.Format("防御 {0}/(上限{1}/下限{2}/基礎{3})", new object[] { defenceCalced, (float)num6 * 3f, 0f, num6 })); }
public static SkillResults GetSkillResults(AffectEffectProperty affectEffectProperty, CharacterStateControl attackerCharacter, CharacterStateControl targetCharacter, bool onRandomAttack = true, int attackNum = 0) { SkillResults skillResults = new SkillResults(); LeaderSkillResult leaderSkillResult = attackerCharacter.leaderSkillResult; HaveSufferState currentSufferState = attackerCharacter.currentSufferState; HaveSufferState currentSufferState2 = targetCharacter.currentSufferState; float[] array = new float[2]; skillResults.useAffectEffectProperty = affectEffectProperty; skillResults.hitIconAffectEffect = AffectEffect.Damage; skillResults.attackCharacter = attackerCharacter; skillResults.targetCharacter = targetCharacter; if (targetCharacter.isDied) { return(skillResults); } skillResults.onWeakHit = ((!affectEffectProperty.canUseAttribute) ? Strength.None : targetCharacter.tolerance.GetAttributeStrength(affectEffectProperty.attribute)); if (attackerCharacter.hittingTheTargetType == BattleInvariant.Type.Non) { skillResults.onMissHit = !affectEffectProperty.OnHit(attackerCharacter, targetCharacter); } else if (attackerCharacter.hittingTheTargetType == BattleInvariant.Type.Up) { skillResults.onMissHit = false; } else if (attackerCharacter.hittingTheTargetType == BattleInvariant.Type.Down) { skillResults.onMissHit = true; } if (skillResults.onWeakHit == Strength.None || skillResults.onWeakHit == Strength.Weak) { if (attackerCharacter.criticalTheTargetType == BattleInvariant.Type.Non) { float num = affectEffectProperty.satisfactionRate; SufferStateProperty sufferStateProperty = currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.SatisfactionRateUp); if (sufferStateProperty.isActive) { num += sufferStateProperty.upPercent; } SufferStateProperty sufferStateProperty2 = currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.SatisfactionRateDown); if (sufferStateProperty2.isActive) { num -= sufferStateProperty2.downPercent; } if (attackerCharacter.isSelectSkill > 0) { num += leaderSkillResult.satisfactionRateUpPercent; } num += attackerCharacter.chipAddCritical; skillResults.onCriticalHit = RandomExtension.Switch(num); } else if (attackerCharacter.criticalTheTargetType == BattleInvariant.Type.Up) { skillResults.onCriticalHit = true; } else if (attackerCharacter.criticalTheTargetType == BattleInvariant.Type.Down) { skillResults.onCriticalHit = false; } } if (!skillResults.onMissHit) { if (affectEffectProperty.powerType == PowerType.Percentage && skillResults.onWeakHit == Strength.Invalid) { skillResults.hitIconAffectEffect = AffectEffect.Invalid; skillResults.onMissHit = false; skillResults.onWeakHit = Strength.Invalid; skillResults.onCriticalHit = false; } else if (skillResults.targetCharacter.currentSufferState.FindSufferState(SufferStateProperty.SufferType.TurnBarrier)) { skillResults.hitIconAffectEffect = AffectEffect.TurnBarrier; skillResults.onMissHit = false; skillResults.onWeakHit = Strength.None; skillResults.onCriticalHit = false; } else if (skillResults.targetCharacter.currentSufferState.FindSufferState(SufferStateProperty.SufferType.CountBarrier)) { skillResults.hitIconAffectEffect = AffectEffect.CountBarrier; skillResults.onMissHit = false; skillResults.onWeakHit = Strength.None; skillResults.onCriticalHit = false; } else if (skillResults.targetCharacter.currentSufferState.FindSufferState(SufferStateProperty.SufferType.TurnEvasion)) { skillResults.hitIconAffectEffect = AffectEffect.TurnEvasion; skillResults.onMissHit = false; skillResults.onWeakHit = Strength.None; skillResults.onCriticalHit = false; } else if (skillResults.targetCharacter.currentSufferState.FindSufferState(SufferStateProperty.SufferType.CountEvasion)) { skillResults.hitIconAffectEffect = AffectEffect.CountEvasion; skillResults.onMissHit = false; skillResults.onWeakHit = Strength.None; skillResults.onCriticalHit = false; } else if (affectEffectProperty.type == AffectEffect.ReferenceTargetHpRate) { SufferStateProperty.DamageRateResult reduceDamageRate = SkillStatus.GetReduceDamageRate(affectEffectProperty, attackerCharacter, targetCharacter); skillResults.damageRateResult = reduceDamageRate; float attributeDamegeResult = SkillStatus.GetAttributeDamegeResult(skillResults.onWeakHit); float num2 = 1f; if (skillResults.onCriticalHit) { num2 = 1.2f; } int num3 = (int)(affectEffectProperty.damagePercent * (float)targetCharacter.hp); for (int i = 0; i < array.Length; i++) { array[i] = (float)num3 * attributeDamegeResult * num2 * reduceDamageRate.damageRate; } } else if (affectEffectProperty.type == AffectEffect.RefHpRateNonAttribute) { SufferStateProperty.DamageRateResult reduceDamageRate2 = SkillStatus.GetReduceDamageRate(affectEffectProperty, attackerCharacter, targetCharacter); skillResults.damageRateResult = reduceDamageRate2; float num4 = 1f; if (skillResults.onCriticalHit) { num4 = 1.2f; } int num5 = (int)(affectEffectProperty.damagePercent * (float)targetCharacter.hp); for (int j = 0; j < array.Length; j++) { array[j] = (float)num5 * num4 * reduceDamageRate2.damageRate; } } else if (affectEffectProperty.powerType == PowerType.Percentage) { bool flag = affectEffectProperty.techniqueType == TechniqueType.Physics; float attributeDamegeResult2 = SkillStatus.GetAttributeDamegeResult(skillResults.onWeakHit); float num6 = 1f; if (skillResults.onCriticalHit) { num6 = 1.2f; } float num7 = 1f; if (onRandomAttack) { num7 = UnityEngine.Random.Range(0.85f, 1f); } SufferStateProperty.DamageRateResult reduceDamageRate3 = SkillStatus.GetReduceDamageRate(affectEffectProperty, attackerCharacter, targetCharacter); skillResults.damageRateResult = reduceDamageRate3; float num8 = 1f; if (flag) { SufferStateProperty sufferStateProperty3 = targetCharacter.currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.Counter); if (sufferStateProperty3.isActive) { num8 *= sufferStateProperty3.recieveDamageRate; } } else { SufferStateProperty sufferStateProperty4 = targetCharacter.currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.Reflection); if (sufferStateProperty4.isActive) { num8 *= sufferStateProperty4.recieveDamageRate; } } float num9 = 1f; SufferStateProperty sufferStateProperty5 = currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.PowerCharge); if (sufferStateProperty5.isActive) { if (flag) { num9 *= sufferStateProperty5.physicUpPercent; } else { num9 *= sufferStateProperty5.specialUpPercent; } } float num10 = 1f; float num11 = 0f; float num12 = 0f; SufferStateProperty sufferStateProperty6 = currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.DamageRateUp); if (sufferStateProperty6.isActive) { SufferStateProperty.DamageRateResult caseDamageRate = sufferStateProperty6.GetCaseDamageRate(affectEffectProperty, targetCharacter); num11 += caseDamageRate.damageRate; } SufferStateProperty sufferStateProperty7 = currentSufferState.GetSufferStateProperty(SufferStateProperty.SufferType.DamageRateDown); if (sufferStateProperty7.isActive) { SufferStateProperty.DamageRateResult caseDamageRate2 = sufferStateProperty7.GetCaseDamageRate(affectEffectProperty, targetCharacter); num12 += caseDamageRate2.damageRate; } num10 = Mathf.Max(0f, num10 + num11 - num12); for (int k = 0; k < array.Length; k++) { int num13 = 0; float num14 = 1f; foreach (int num15 in attackerCharacter.potencyChipIdList.Keys) { GameWebAPI.RespDataMA_ChipEffectM.ChipEffect chipEffectDataToId = ChipDataMng.GetChipEffectDataToId(num15.ToString()); if (k != 0 || chipEffectDataToId.effectTrigger.ToInt32() != 11) { GameWebAPI.RespDataMA_ChipEffectM.ChipEffect[] chipEffects = new GameWebAPI.RespDataMA_ChipEffectM.ChipEffect[] { chipEffectDataToId }; num13 += ChipEffectStatus.GetSkillPowerCorrectionValue(chipEffects, affectEffectProperty, attackerCharacter, attackNum); num14 += ChipEffectStatus.GetSkillDamageCorrectionValue(chipEffects, affectEffectProperty, attackerCharacter); } } float num16 = 1f; foreach (int num17 in targetCharacter.potencyChipIdList.Keys) { GameWebAPI.RespDataMA_ChipEffectM.ChipEffect chipEffectDataToId2 = ChipDataMng.GetChipEffectDataToId(num17.ToString()); if (k != 0 || chipEffectDataToId2.effectTrigger.ToInt32() != 11) { GameWebAPI.RespDataMA_ChipEffectM.ChipEffect[] chipEffects2 = new GameWebAPI.RespDataMA_ChipEffectM.ChipEffect[] { chipEffectDataToId2 }; num16 += ChipEffectStatus.GetSkillDamageCorrectionValue(chipEffects2, affectEffectProperty, targetCharacter); } } float num18 = 0f; float num19 = 0f; SkillStatus.CalculationBasePower(ref num18, ref num19, flag, k == 0, attackerCharacter, targetCharacter); int num20; if (k == 0) { num20 = affectEffectProperty.GetPower(attackerCharacter); } else { List <ExtraEffectStatus> extraEffectStatus = BattleStateManager.current.battleStateData.extraEffectStatus; List <ExtraEffectStatus> invocationList = ExtraEffectStatus.GetInvocationList(extraEffectStatus, EffectStatusBase.EffectTriggerType.Usually); num20 = ExtraEffectStatus.GetSkillPowerCorrectionValue(invocationList, affectEffectProperty, attackerCharacter); } if (affectEffectProperty.type == AffectEffect.DefenseThroughDamage || affectEffectProperty.type == AffectEffect.SpDefenseThroughDamage) { num19 = (float)affectEffectProperty.DefenseThrough; } if (num18 <= 0f) { array[k] = 0f; } else { num18 = Mathf.Max(num18, 0f); num19 = Mathf.Max(num19, 1f); float num21 = (float)attackerCharacter.level * 0.01f + 1f; float num22 = (float)(num20 + num13) * (1f + leaderSkillResult.damageUpPercent); float num23 = num21 * num22 * num18 * num9 / num19 + 2f; float num24 = num14 * num16 * reduceDamageRate3.damageRate * num8 * num7 * num6 * attributeDamegeResult2 * num10; array[k] = num23 * num24; } } } else if (affectEffectProperty.powerType == PowerType.Fixable) { for (int l = 0; l < array.Length; l++) { array[l] = (float)affectEffectProperty.damagePower; } skillResults.onWeakHit = Strength.None; } } skillResults.originalAttackPower = Mathf.FloorToInt(array[0]); skillResults.attackPower = Mathf.FloorToInt(array[1]); if (skillResults.hitIconAffectEffect == AffectEffect.Damage && skillResults.attackPower <= 0) { skillResults.onMissHit = true; skillResults.onCriticalHit = false; } if (skillResults.onWeakHit != Strength.Drain) { targetCharacter.hp -= skillResults.attackPower; } else { targetCharacter.hp += skillResults.attackPower; } if (skillResults.attackPower < skillResults.originalAttackPower) { skillResults.extraEffectType = ExtraEffectType.Down; } else if (skillResults.attackPower > skillResults.originalAttackPower) { skillResults.extraEffectType = ExtraEffectType.Up; } else { skillResults.extraEffectType = ExtraEffectType.Non; } return(skillResults); }