Compare commits
5 Commits
124cb74bd5
...
d9bbef4b05
Author | SHA1 | Date | |
---|---|---|---|
|
d9bbef4b05 | ||
|
61b7bbefc0 | ||
|
3b1b4a90b7 | ||
|
d8d3a69c36 | ||
|
ee2d696cec |
8
Assets/Scriptables.meta
generated
Normal file
8
Assets/Scriptables.meta
generated
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d13d7aac40657841955febd4faabbfa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/Scriptables/EnemyAttributes.asset
generated
Normal file
19
Assets/Scriptables/EnemyAttributes.asset
generated
Normal file
@ -0,0 +1,19 @@
|
||||
%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}
|
8
Assets/Scriptables/EnemyAttributes.asset.meta
generated
Normal file
8
Assets/Scriptables/EnemyAttributes.asset.meta
generated
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5bf638cf02c5b94cb9874d4414c1b8a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
14
Assets/Scriptables/StatEffect.asset
generated
Normal file
14
Assets/Scriptables/StatEffect.asset
generated
Normal file
@ -0,0 +1,14 @@
|
||||
%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:
|
8
Assets/Scriptables/StatEffect.asset.meta
generated
Normal file
8
Assets/Scriptables/StatEffect.asset.meta
generated
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c96040df8ebed746832db7857b25bed
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Attribute : ScriptableObject
|
||||
[Serializable]
|
||||
public struct Attribute
|
||||
{
|
||||
public long Base { get; set; }
|
||||
public long Base;
|
||||
|
||||
public Attribute(long stat) { Base = stat; }
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the stat value with accumulated buff and debuff modifiers.
|
||||
|
@ -6,16 +6,16 @@ public class EffectSO : ScriptableObject
|
||||
/// <summary>
|
||||
/// Additive change applied before multiplicative scaling.
|
||||
/// </summary>
|
||||
public long Base { get; private set; }
|
||||
public long Base;
|
||||
/// <summary>
|
||||
/// Multiplicative scaling in units of hundredth of a percent.
|
||||
/// E.g., 625 permyriad is 6.25%.
|
||||
/// </summary>
|
||||
public long Permyriad { get; private set; }
|
||||
public long Permyriad;
|
||||
/// <summary>
|
||||
/// Additive change applied after multiplicative scaling.
|
||||
/// </summary>
|
||||
public long Flat { get; private set; }
|
||||
public long Flat;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new attribute effect instance.
|
||||
|
@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "EnemyAttributes", menuName = "Enemy Attributes")]
|
||||
public class EnemyAttributesSO : ScriptableObject
|
||||
{
|
||||
[SerializeField] private Attribute STR;
|
||||
@ -7,6 +8,8 @@ public class EnemyAttributesSO : ScriptableObject
|
||||
[SerializeField] private Attribute SPD;
|
||||
[SerializeField] private Attribute RNG;
|
||||
[SerializeField] private Attribute MND;
|
||||
public long XP { get; private set; }
|
||||
public long Threat { get; private set; }
|
||||
|
||||
public static EnemyAttributesSO New()
|
||||
{
|
||||
|
@ -17,8 +17,7 @@ public class AttributeTest
|
||||
[TestCase(1000000, 0, -20000, 0, ExpectedResult = 0)]
|
||||
public long Value(long startStat, long baseBonus, long permyriadBonus, long flatBonus)
|
||||
{
|
||||
var attr = ScriptableObject.CreateInstance<Attribute>();
|
||||
attr.Base = startStat;
|
||||
var attr = new Attribute(startStat);
|
||||
var effect = EffectSO.New(baseBonus, permyriadBonus, flatBonus);
|
||||
return attr.Calc(effect);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user