Fix sign issue
This commit is contained in:
parent
50cb258353
commit
d96921b2d3
@ -78,7 +78,7 @@ Material:
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Rotation: 9.499645
|
||||
- _Rotation: 4.9805784
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
|
||||
@ -17,9 +17,10 @@ MonoBehaviour:
|
||||
influencingStats:
|
||||
- statTag: {fileID: 11400000, guid: 918ee6f8846e6a9449166ac16b6330ae, type: 2}
|
||||
percentInfluence: 0.275
|
||||
baseValue: 3
|
||||
baseValue: 1
|
||||
damageType: 1
|
||||
AlliedTargetMultiplier: 1
|
||||
EnemyTargetMultiplier: 1
|
||||
FriendlyNPCTargetMultiplier: 1
|
||||
applyToClassResourceInstead: 0
|
||||
applyToSelfResourceInsteadOfHit: 0
|
||||
|
||||
@ -135,68 +135,4 @@ public class InstantValueEffect : BaseEffect
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private float GetCorrectValueSign(Taggable user, Taggable target)
|
||||
{
|
||||
if (user == null) return 0;
|
||||
if (target == null) return 0;
|
||||
|
||||
stats = user.GetComponent<CharacterStats>();
|
||||
damageOutputModifier = user.GetComponent<DamageOutputModifierEffectInstance>();
|
||||
GetFinalValue(stats, damageOutputModifier);
|
||||
|
||||
//return user.targetTag.AlliedTags.Contains(target.targetTag) ? (finalValue * AlliedTargetMultiplier) : (-finalValue * EnemyTargetMultiplier);
|
||||
|
||||
|
||||
|
||||
if (user.AlliedTagsContains(target.targetTag))
|
||||
{
|
||||
if (target.IsFriendlyNPC())
|
||||
return (finalValue * FriendlyNPCTargetMultiplier);
|
||||
else
|
||||
return (finalValue * AlliedTargetMultiplier);
|
||||
}
|
||||
else
|
||||
return (-finalValue * EnemyTargetMultiplier);
|
||||
}
|
||||
|
||||
|
||||
private void GetFinalValue(CharacterStats stats, DamageOutputModifierEffectInstance damageOutputModifier)
|
||||
{
|
||||
finalValue = baseValue;
|
||||
if (stats != null)
|
||||
{
|
||||
foreach (var statInfluence in influencingStats)
|
||||
{
|
||||
if (stats.primaryStatsDictionary.TryGetValue(statInfluence.statTag.name.ToLower(), out CharacterStat stat))
|
||||
{
|
||||
finalValue += stat.Value * statInfluence.percentInfluence;
|
||||
}
|
||||
else if (stats.secondaryStatsDictionary.TryGetValue(statInfluence.statTag.name.ToLower(), out CharacterStat secondaryStat))
|
||||
{
|
||||
finalValue += secondaryStat.Value * statInfluence.percentInfluence;
|
||||
}
|
||||
if (statInfluence.statTag.name.ToLower().Contains("Attack")) damageType = DamageType.Attack;
|
||||
else if (statInfluence.statTag.name.ToLower().Contains("Spell")) damageType = DamageType.Spell;
|
||||
}
|
||||
|
||||
}
|
||||
//Debug.Log("FinalValue = " + finalValue + " dmgType = " + damageType);
|
||||
if (IsCrit(stats) && !applyToClassResourceInstead)
|
||||
{
|
||||
finalValue *= (1 + stats.GetStat("critdamage").Value / 100f);
|
||||
isCrit = true;
|
||||
//Debug.Log("FinalValue IsCrit = " + finalValue + " dmgType = " + damageType);
|
||||
}
|
||||
else
|
||||
isCrit = false;
|
||||
|
||||
finalValue = damageOutputModifier.ModifyDamageOutput(finalValue);
|
||||
}
|
||||
|
||||
private bool IsCrit(CharacterStats stats)
|
||||
{
|
||||
return MathHelpers.RollChancePercent(stats.GetStat("critchance").Value);
|
||||
//return Random.Range(0, 100) < stats.CritChance.Value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class DamageIncomeModifierRuntimeEffectInstance : RuntimeEffectInstance
|
||||
{
|
||||
public float damageIncomeModifierPercentage;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class DamageOutputModifierRuntimeEffectInstance : RuntimeEffectInstance
|
||||
{
|
||||
public float damageOutputModifierPercentage;
|
||||
|
||||
@ -27,7 +27,7 @@ public class DamageTickingRuntimeEffectInstance : TickingRuntimeEffectInstance
|
||||
args.sourceEffect = sourceEffect;
|
||||
args.user = user;
|
||||
args.target = target;
|
||||
args.currentValue = -baseDamagePerTick * numberOfStacks;
|
||||
args.currentValue = baseDamagePerTick * numberOfStacks;
|
||||
args.isCrit = false;
|
||||
args.targetDead = false;
|
||||
args.applicationMethod = EffectApplicationMethod.Tick;
|
||||
|
||||
@ -2,6 +2,7 @@ using Kryz.CharacterStats;
|
||||
using Kryz.CharacterStats.Examples;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class MovementSpeedModifierRuntimeEffectInstance : RuntimeEffectInstance
|
||||
{
|
||||
public float speedModifierPercentage;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class RuntimeEffectInstance : IResettable
|
||||
{
|
||||
public Taggable user;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class TickingRuntimeEffectInstance : RuntimeEffectInstance
|
||||
{
|
||||
public float timeSinceLastTick = 0f;
|
||||
|
||||
@ -17,7 +17,7 @@ public class BasicStatModifierCalculator : BrokerInterceptor
|
||||
|
||||
private void CalculateDamageModsBasedOnStats(DamageArgs args)
|
||||
{
|
||||
float finalValue = args.currentValue;
|
||||
float finalValue = Mathf.Abs(args.currentValue);
|
||||
|
||||
if (stats == null)
|
||||
{
|
||||
@ -45,7 +45,7 @@ public class BasicStatModifierCalculator : BrokerInterceptor
|
||||
else
|
||||
args.isCrit = false;
|
||||
|
||||
args.currentValue = finalValue;
|
||||
args.currentValue = -finalValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,7 +9,21 @@ public class DamageArgs : IResettable
|
||||
public BaseEffect sourceEffect;
|
||||
public Taggable user;
|
||||
public Taggable target;
|
||||
public float currentValue;
|
||||
private float _currentValue;
|
||||
|
||||
public float currentValue
|
||||
{
|
||||
get => _currentValue;
|
||||
set
|
||||
{
|
||||
if (_currentValue != value)
|
||||
{
|
||||
if (user != null && sourceAbility != null)
|
||||
Debug.Log($"{user.name}'s {sourceAbility.name} DamageArgs.currentValue changed: {_currentValue} -> {value}\n{System.Environment.StackTrace}");
|
||||
_currentValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public float outgoingAccumulator;
|
||||
public float incomingAccumulator;
|
||||
public DamageType damageType;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user