Compare commits

..

No commits in common. "d9bbef4b055d5c5cfbff4dac459a4df3b17ec78a" and "124cb74bd59ce085a3ce15b29e4e5b0ec0166732" have entirely different histories.

9 changed files with 7 additions and 70 deletions

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1d13d7aac40657841955febd4faabbfa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,19 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c5304ff6dfe84844887d751cee48606a, type: 3}
m_Name: EnemyAttributes
m_EditorClassIdentifier:
STR: {fileID: 0}
CON: {fileID: 0}
SPD: {fileID: 0}
RNG: {fileID: 0}
MND: {fileID: 0}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d5bf638cf02c5b94cb9874d4414c1b8a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 494a21c06960ec442a7a6806f8aefedb, type: 3}
m_Name: StatEffect
m_EditorClassIdentifier:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4c96040df8ebed746832db7857b25bed
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +1,10 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
[Serializable] public class Attribute : ScriptableObject
public struct Attribute
{ {
public long Base; public long Base { get; set; }
public Attribute(long stat) { Base = stat; }
/// <summary> /// <summary>
/// Calculates the stat value with accumulated buff and debuff modifiers. /// Calculates the stat value with accumulated buff and debuff modifiers.

View File

@ -6,16 +6,16 @@ public class EffectSO : ScriptableObject
/// <summary> /// <summary>
/// Additive change applied before multiplicative scaling. /// Additive change applied before multiplicative scaling.
/// </summary> /// </summary>
public long Base; public long Base { get; private set; }
/// <summary> /// <summary>
/// Multiplicative scaling in units of hundredth of a percent. /// Multiplicative scaling in units of hundredth of a percent.
/// E.g., 625 permyriad is 6.25%. /// E.g., 625 permyriad is 6.25%.
/// </summary> /// </summary>
public long Permyriad; public long Permyriad { get; private set; }
/// <summary> /// <summary>
/// Additive change applied after multiplicative scaling. /// Additive change applied after multiplicative scaling.
/// </summary> /// </summary>
public long Flat; public long Flat { get; private set; }
/// <summary> /// <summary>
/// Create a new attribute effect instance. /// Create a new attribute effect instance.

View File

@ -1,6 +1,5 @@
using UnityEngine; using UnityEngine;
[CreateAssetMenu(fileName = "EnemyAttributes", menuName = "Enemy Attributes")]
public class EnemyAttributesSO : ScriptableObject public class EnemyAttributesSO : ScriptableObject
{ {
[SerializeField] private Attribute STR; [SerializeField] private Attribute STR;
@ -8,8 +7,6 @@ public class EnemyAttributesSO : ScriptableObject
[SerializeField] private Attribute SPD; [SerializeField] private Attribute SPD;
[SerializeField] private Attribute RNG; [SerializeField] private Attribute RNG;
[SerializeField] private Attribute MND; [SerializeField] private Attribute MND;
public long XP { get; private set; }
public long Threat { get; private set; }
public static EnemyAttributesSO New() public static EnemyAttributesSO New()
{ {

View File

@ -17,7 +17,8 @@ public class AttributeTest
[TestCase(1000000, 0, -20000, 0, ExpectedResult = 0)] [TestCase(1000000, 0, -20000, 0, ExpectedResult = 0)]
public long Value(long startStat, long baseBonus, long permyriadBonus, long flatBonus) public long Value(long startStat, long baseBonus, long permyriadBonus, long flatBonus)
{ {
var attr = new Attribute(startStat); var attr = ScriptableObject.CreateInstance<Attribute>();
attr.Base = startStat;
var effect = EffectSO.New(baseBonus, permyriadBonus, flatBonus); var effect = EffectSO.New(baseBonus, permyriadBonus, flatBonus);
return attr.Calc(effect); return attr.Calc(effect);
} }