percent stats fixed

This commit is contained in:
Pedro Gomes 2025-09-27 22:33:47 +01:00
parent a723c5d3cd
commit de3703c0ab
31 changed files with 126 additions and 112 deletions

View File

@ -32,11 +32,13 @@ Material:
m_LightmapFlags: 0
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: -1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Opaque
RenderType: Transparent
disabledShaderPasses:
- GRABPASS
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
@ -99,8 +101,8 @@ Material:
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0
- _DstBlend: 0
- _DstBlendAlpha: 0
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EmissionEnabled: 0
- _FlipbookBlending: 0
- _FlipbookMode: 0
@ -118,16 +120,16 @@ Material:
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _UVSec: 0
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 2.3773584, g: 2.3773584, b: 2.3773584, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 2.3773584, g: 2.3773584, b: 2.3773584, a: 1}
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}

View File

@ -78,7 +78,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Rotation: 1476.1123
- _Rotation: 2685.8706
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View File

@ -78,7 +78,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Rotation: 51.40349
- _Rotation: 44.39648
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View File

@ -139,10 +139,6 @@ PrefabInstance:
propertyPath: onStartFishing.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 5523225171841185422, guid: 9c432d220280f704684a6d5b9354c782, type: 3}
propertyPath: m_Speed
value: 5
objectReference: {fileID: 0}
- target: {fileID: 5830540571469033375, guid: 9c432d220280f704684a6d5b9354c782, type: 3}
propertyPath: visualWeaponSlots.Array.size
value: 3

View File

@ -127,8 +127,8 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0.01
maxStatRoll: 0.02
minStatRoll: 1
maxStatRoll: 2
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0

View File

@ -127,8 +127,8 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0.01
maxStatRoll: 0.02
minStatRoll: 1
maxStatRoll: 2
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
@ -199,11 +199,11 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 1
weightMultiplier: 2
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.06
minStatRoll: 1
maxStatRoll: 6
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
- stat: {fileID: 11400000, guid: 599541ff1aaa6c848a732f9a97e5f1c4, type: 2}
isAllowed: 0
isMandatory: 0

View File

@ -100,8 +100,8 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 1
weightMultiplier: 2
minStatRoll: 0.01
maxStatRoll: 0.03
minStatRoll: 1
maxStatRoll: 3
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
@ -109,8 +109,8 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1.2
minStatRoll: 0.01
maxStatRoll: 0.05
minStatRoll: 1
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0

View File

@ -55,9 +55,9 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 1
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 1
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.05
- stat: {fileID: 11400000, guid: 332d0dbee9590e24e9ad5166dd75ef69, type: 2}
@ -100,18 +100,18 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.03
minStatRoll: 1
maxStatRoll: 3
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
- stat: {fileID: 11400000, guid: a19f2ac40579e5d4aa0713f43fcfa276, type: 2}
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 1
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.05
- stat: {fileID: 11400000, guid: d52b20e3f02ba8946bf37a7470beafd0, type: 2}
@ -127,11 +127,11 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.02
minStatRoll: 1
maxStatRoll: 2
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
- stat: {fileID: 11400000, guid: 63eee8f1286035f4a80356bcfad289b6, type: 2}
isAllowed: 0
isMandatory: 0

View File

@ -91,11 +91,11 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 0.25
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minPercentStatRoll: 0.02
maxPercentStatRoll: 0.05
minStatRoll: 2
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
- stat: {fileID: 11400000, guid: d318a3662a3ccf04f9f193a818cc3361, type: 2}
isAllowed: 0
isMandatory: 0

View File

@ -127,11 +127,11 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.03
minStatRoll: 1
maxStatRoll: 3
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
- stat: {fileID: 11400000, guid: 63eee8f1286035f4a80356bcfad289b6, type: 2}
isAllowed: 0
isMandatory: 0

View File

@ -73,8 +73,8 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 1
weightMultiplier: 2
minStatRoll: 0.05
maxStatRoll: 0.09
minStatRoll: 5
maxStatRoll: 9
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0
@ -82,8 +82,8 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 1
weightMultiplier: 2
minStatRoll: 0.05
maxStatRoll: 0.09
minStatRoll: 5
maxStatRoll: 9
forceUsePercent: 0
minPercentStatRoll: 0
maxPercentStatRoll: 0

View File

@ -109,9 +109,9 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 0.25
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 3
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0.03
maxPercentStatRoll: 0.05
- stat: {fileID: 11400000, guid: d52b20e3f02ba8946bf37a7470beafd0, type: 2}

View File

@ -55,9 +55,9 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1.5
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 4
maxStatRoll: 6
forceUsePercent: 0
minPercentStatRoll: 0.04
maxPercentStatRoll: 0.06
- stat: {fileID: 11400000, guid: 332d0dbee9590e24e9ad5166dd75ef69, type: 2}
@ -91,27 +91,27 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 1
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.05
- stat: {fileID: 11400000, guid: d318a3662a3ccf04f9f193a818cc3361, type: 2}
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 2
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0.02
maxPercentStatRoll: 0.05
- stat: {fileID: 11400000, guid: a19f2ac40579e5d4aa0713f43fcfa276, type: 2}
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 3
maxStatRoll: 5
forceUsePercent: 0
minPercentStatRoll: 0.03
maxPercentStatRoll: 0.05
- stat: {fileID: 11400000, guid: d52b20e3f02ba8946bf37a7470beafd0, type: 2}

View File

@ -55,9 +55,9 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 2
maxStatRoll: 4
forceUsePercent: 0
minPercentStatRoll: 0.02
maxPercentStatRoll: 0.04
- stat: {fileID: 11400000, guid: 332d0dbee9590e24e9ad5166dd75ef69, type: 2}
@ -100,18 +100,18 @@ MonoBehaviour:
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 1
maxStatRoll: 3
forceUsePercent: 0
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.03
- stat: {fileID: 11400000, guid: a19f2ac40579e5d4aa0713f43fcfa276, type: 2}
isAllowed: 1
isMandatory: 0
weightMultiplier: 1
minStatRoll: 0
maxStatRoll: 0
forceUsePercent: 1
minStatRoll: 1
maxStatRoll: 3
forceUsePercent: 0
minPercentStatRoll: 0.01
maxPercentStatRoll: 0.03
- stat: {fileID: 11400000, guid: d52b20e3f02ba8946bf37a7470beafd0, type: 2}

View File

@ -23,7 +23,7 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0

View File

@ -23,7 +23,7 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0

View File

@ -23,9 +23,9 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0
maxValue: 1
maxValue: 100
roundToInteger: 0

View File

@ -23,9 +23,9 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0
maxValue: 0.75
maxValue: 75
roundToInteger: 0

View File

@ -23,9 +23,9 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0
maxValue: 0.9
maxValue: 90
roundToInteger: 0

View File

@ -25,7 +25,7 @@ MonoBehaviour:
defaultWeight: 1
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
defaultBaseValue: 2
minValue: 0
maxValue: 9999999
roundToInteger: 0

View File

@ -25,7 +25,7 @@ MonoBehaviour:
defaultWeight: 1
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
defaultBaseValue: 50
minValue: 0
maxValue: 9999999
roundToInteger: 0

View File

@ -23,9 +23,9 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0.02
defaultBaseValue: 2
minValue: 0
maxValue: 1
maxValue: 100
roundToInteger: 0

View File

@ -23,7 +23,7 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 0
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0

View File

@ -23,9 +23,9 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 1
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0
maxValue: 1
maxValue: 100
roundToInteger: 0

View File

@ -23,7 +23,7 @@ MonoBehaviour:
showInTooltips: 1
canRollOnItems: 0
defaultWeight: 1
canBeFlat: 0
canBeFlat: 1
canBePercent: 1
defaultBaseValue: 0
minValue: 0

View File

@ -136,7 +136,7 @@ public class InstantValueEffect : BaseEffect
private bool IsCrit(CharacterStats stats)
{
return MathHelpers.RollChance(MathHelpers.NormalizePercentageDecimal(stats.GetStat("critchance").Value));
return MathHelpers.RollChancePercent(stats.GetStat("critchance").Value);
//return Random.Range(0, 100) < stats.CritChance.Value;
}
}

View File

@ -1,3 +1,4 @@
using Kryz.CharacterStats.Examples;
using UnityEngine;
using UnityEngine.AI;
@ -13,10 +14,13 @@ public class MovementSpeedModifierEffectInstance : StatusEffectInstance
private bool castingPenalty = false;
CharacterStats stats;
protected override void Awake()
{
base.Awake();
navMeshAgent = GetComponent<NavMeshAgent>();
stats = GetComponent<CharacterStats>();
baseSpeed = navMeshAgent.speed;
@ -27,11 +31,11 @@ public class MovementSpeedModifierEffectInstance : StatusEffectInstance
public float ModifyMovementSpeed()
{
return baseSpeed * (1 + currentSpeedModifierPercent);
return baseSpeed * (1 + stats.GetStat("movementspeed").Value/100f) * (1 + currentSpeedModifierPercent);
}
public float ModifyMovementSpeedWithCastingPenalty()
{
return (baseSpeed * (1 + currentSpeedModifierPercent)) * (1 + GameConstants.CharacterBalancing.MovementSpeedCastingPenalty);
return (baseSpeed * (1 + stats.GetStat("movementspeed").Value / 100f) * (1 + currentSpeedModifierPercent)) * (1 + GameConstants.CharacterBalancing.MovementSpeedCastingPenalty);
}
public float ModifyTurnSpeed()
{

View File

@ -101,7 +101,7 @@ public class SummonAbility : BaseAbility
{
ownerStats = user.GetComponent<CharacterStats>();
minionStats = instantiatedMinion.GetComponent<CharacterStats>();
//TODO: FIX MINION STAT SCALE
//minionStats.AttackDamage.AddModifier(new StatModifier(ownerStats.AttackDamage.Value * AttackDamagePercentFromMaster, StatModType.Flat, ownerStats));
//minionStats.SpellDamage.AddModifier(new StatModifier(ownerStats.SpellDamage.Value * SpellDamagePercentFromMaster, StatModType.Flat, ownerStats));
//

View File

@ -117,24 +117,24 @@ public static class GameConstants
public static class CharacterStatsBalancing
{
#region Cunning Influence
public static float CritChanceIncreasePerCunning = 0.33f;
public static float CritDamageIncreasePerCunning = 0.8f;
public static float MovementSpeedIncreasePerCunning = 0.33f;
public const float CritChanceIncreasePerCunning = 0.33f;
public const float CritDamageIncreasePerCunning = 0.8f;
public const float MovementSpeedIncreasePerCunning = 0.33f;
#endregion
#region Flow Influence
public const float MaxManaIncreasePerFlow = 4f;
public const float ManaRegenIncreasePerFlow = 1.5f;
public const float CooldownReductionIncreasePerFlow = 0.3f;
public const float AttackSpeedIncreasePerFlow = 0.01f;
public const float AttackSpeedIncreasePerFlow = 0.5f;
#endregion
#region Presence Influence
public static float AreaEffectivenessIncreasePerPresence = 0.33f;
public const float AreaEffectivenessIncreasePerPresence = 0.33f;
public static float ReputationGainIncreasePerPresence = 0.01f;
public static float GoldCostReductionPerPresence = 0.005f;
public static float AuraPowerPerPresence = 0.33f;
public const float ReputationGainIncreasePerPresence = 0.01f;
public const float GoldCostReductionPerPresence = 0.005f;
public const float AuraPowerPerPresence = 0.33f;
#endregion
public const float AttackDamageIncreaseFromStrength = 0.35f; // 35% str => AttkDmg

View File

@ -92,11 +92,11 @@ public class Health : Resource
protected bool HasDodged()
{
return MathHelpers.RollChance(MathHelpers.NormalizePercentageDecimal(character.GetStat("dodgechance").Value));
return MathHelpers.RollChancePercent(character.GetStat("dodgechance").Value);
}
protected bool HasBlocked()
{
return MathHelpers.RollChance(MathHelpers.NormalizePercentageDecimal(character.GetStat("blockchance").Value));
return MathHelpers.RollChancePercent(character.GetStat("blockchance").Value);
}
protected void HandleBlockMitigation()

View File

@ -2,13 +2,20 @@ using UnityEngine;
public static class MathHelpers
{
public static bool RollChance(float chance)
public static bool RollChanceNormalized(float chance)
{
if (chance >= 1f) return true; // 100% always succeeds
if (chance <= 0f) return false; // 0% always fails
return UnityEngine.Random.value < chance;
}
public static bool RollChancePercent(float chancePercent)
{
if (chancePercent >= 100f) return true; // 100% always succeeds
if (chancePercent <= 0f) return false; // 0% always fails
return UnityEngine.Random.value < (chancePercent / 100f);
}
/// <summary>
/// 0.05 or 5 will always return from 0 to 100 ==> 5%
/// </summary>
@ -30,4 +37,9 @@ public static class MathHelpers
{
return value <= 1f ? value : value / 100f;
}
public static float PercentAsDecimal(float value)
{
return value / 100f;
}
}