[Fix] Name & add meta
This commit is contained in:
@@ -17,7 +17,7 @@ namespace YachtDice.DI
|
||||
{
|
||||
public class GameLifetimeScope : LifetimeScope
|
||||
{
|
||||
[SerializeField] private ModifierCatalogSO modifierCatalog;
|
||||
[SerializeField] private ModifierCatalog modifierCatalog;
|
||||
[SerializeField] private CategoryCatalog categoryCatalog;
|
||||
|
||||
[Header("Scene References")]
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace YachtDice.Inventory
|
||||
|
||||
public void SetMaxActiveSlots(int slots) => registry.SetMaxActiveSlots(slots);
|
||||
|
||||
public void AddModifier(ModifierDefinitionSO definition) => registry.Add(definition);
|
||||
public void AddModifier(ModifierDefinition definition) => registry.Add(definition);
|
||||
|
||||
public void RemoveModifier(ModifierInstance instance) => registry.Remove(instance);
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace YachtDice.Inventory
|
||||
|
||||
public void ConsumeUseOnActive() => registry.ConsumeChargesOnActive();
|
||||
|
||||
public List<ModifierDefinitionSO> GetActiveModifierDefinitions()
|
||||
public List<ModifierDefinition> GetActiveModifierDefinitions()
|
||||
{
|
||||
var result = new List<ModifierDefinitionSO>();
|
||||
var result = new List<ModifierDefinition>();
|
||||
var active = registry.Active;
|
||||
for (int i = 0; i < active.Count; i++)
|
||||
result.Add(active[i].Definition);
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Conditions
|
||||
{
|
||||
[CreateAssetMenu(fileName = "CategoryCondition", menuName = "YachtDice/Modifiers/Conditions/Category")]
|
||||
public class CategoryCondition : ConditionSO
|
||||
public class CategoryCondition : Condition
|
||||
{
|
||||
[SerializeField] private CategoryDefinition requiredCategory;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Conditions
|
||||
{
|
||||
[CreateAssetMenu(fileName = "DiceCountCondition", menuName = "YachtDice/Modifiers/Conditions/Dice Count")]
|
||||
public class DiceCountCondition : ConditionSO
|
||||
public class DiceCountCondition : Condition
|
||||
{
|
||||
[Tooltip("Die face value to count (1-6). 0 = any value.")]
|
||||
[SerializeField, Range(0, 6)] private int targetValue;
|
||||
|
||||
@@ -6,7 +6,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Conditions
|
||||
{
|
||||
[CreateAssetMenu(fileName = "DieValueCondition", menuName = "YachtDice/Modifiers/Conditions/Die Value")]
|
||||
public class DieValueCondition : ConditionSO
|
||||
public class DieValueCondition : Condition
|
||||
{
|
||||
[SerializeField, Range(1, 6)] private int targetValue = 1;
|
||||
[SerializeField] private int minCount = 1;
|
||||
|
||||
@@ -6,7 +6,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Conditions
|
||||
{
|
||||
[CreateAssetMenu(fileName = "MinScoreCondition", menuName = "YachtDice/Modifiers/Conditions/Min Score")]
|
||||
public class MinScoreCondition : ConditionSO
|
||||
public class MinScoreCondition : Condition
|
||||
{
|
||||
[SerializeField] private int minimumBaseScore;
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
|
||||
namespace YachtDice.Modifiers.Definition
|
||||
{
|
||||
public abstract class ConditionSO : ScriptableObject, ICondition
|
||||
public abstract class Condition : ScriptableObject, ICondition
|
||||
{
|
||||
public abstract bool Evaluate(ModifierContext context, ModifierInstance instance);
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
|
||||
namespace YachtDice.Modifiers.Definition
|
||||
{
|
||||
public abstract class EffectSO : ScriptableObject, IEffect
|
||||
public abstract class Effect : ScriptableObject, IEffect
|
||||
{
|
||||
[SerializeField] private ModifierPhase phase = ModifierPhase.Additive;
|
||||
[SerializeField] private int priority;
|
||||
+11
-11
@@ -6,15 +6,15 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Definition
|
||||
{
|
||||
[CreateAssetMenu(fileName = "NewBehavior", menuName = "YachtDice/Modifiers/Behavior")]
|
||||
public class ModifierBehaviorSO : ScriptableObject
|
||||
public class ModifierBehavior : ScriptableObject
|
||||
{
|
||||
[SerializeField] private TriggerType trigger;
|
||||
[SerializeField] private List<ConditionSO> conditions = new();
|
||||
[SerializeField] private List<EffectSO> effects = new();
|
||||
[SerializeField] private List<Condition> conditions = new();
|
||||
[SerializeField] private List<Effect> effects = new();
|
||||
|
||||
public TriggerType Trigger => trigger;
|
||||
public IReadOnlyList<ConditionSO> Conditions => conditions;
|
||||
public IReadOnlyList<EffectSO> Effects => effects;
|
||||
public IReadOnlyList<Condition> Conditions => conditions;
|
||||
public IReadOnlyList<Effect> Effects => effects;
|
||||
|
||||
public bool EvaluateConditions(ModifierContext context, ModifierInstance instance)
|
||||
{
|
||||
@@ -27,15 +27,15 @@ namespace YachtDice.Modifiers.Definition
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static ModifierBehaviorSO CreateForTest(
|
||||
public static ModifierBehavior CreateForTest(
|
||||
TriggerType trigger,
|
||||
List<ConditionSO> conditions,
|
||||
List<EffectSO> effects)
|
||||
List<Condition> conditions,
|
||||
List<Effect> effects)
|
||||
{
|
||||
var so = CreateInstance<ModifierBehaviorSO>();
|
||||
var so = CreateInstance<ModifierBehavior>();
|
||||
so.trigger = trigger;
|
||||
so.conditions = conditions ?? new List<ConditionSO>();
|
||||
so.effects = effects ?? new List<EffectSO>();
|
||||
so.conditions = conditions ?? new List<Condition>();
|
||||
so.effects = effects ?? new List<Effect>();
|
||||
return so;
|
||||
}
|
||||
#endif
|
||||
+4
-4
@@ -4,13 +4,13 @@ using UnityEngine;
|
||||
namespace YachtDice.Modifiers.Definition
|
||||
{
|
||||
[CreateAssetMenu(fileName = "ModifierCatalog", menuName = "YachtDice/Modifiers/Catalog")]
|
||||
public class ModifierCatalogSO : ScriptableObject
|
||||
public class ModifierCatalog : ScriptableObject
|
||||
{
|
||||
[SerializeField] private List<ModifierDefinitionSO> modifiers = new();
|
||||
[SerializeField] private List<ModifierDefinition> modifiers = new();
|
||||
|
||||
public IReadOnlyList<ModifierDefinitionSO> All => modifiers;
|
||||
public IReadOnlyList<ModifierDefinition> All => modifiers;
|
||||
|
||||
public ModifierDefinitionSO FindById(string id)
|
||||
public ModifierDefinition FindById(string id)
|
||||
{
|
||||
for (int i = 0; i < modifiers.Count; i++)
|
||||
{
|
||||
+7
-7
@@ -5,7 +5,7 @@ using YachtDice.Modifiers.Core;
|
||||
namespace YachtDice.Modifiers.Definition
|
||||
{
|
||||
[CreateAssetMenu(fileName = "NewModifier", menuName = "YachtDice/Modifiers/Definition")]
|
||||
public class ModifierDefinitionSO : ScriptableObject
|
||||
public class ModifierDefinition : ScriptableObject
|
||||
{
|
||||
[Header("Identity")]
|
||||
[SerializeField] private string id;
|
||||
@@ -24,7 +24,7 @@ namespace YachtDice.Modifiers.Definition
|
||||
[SerializeField] private int maxStacks = 1;
|
||||
|
||||
[Header("Behaviors")]
|
||||
[SerializeField] private List<ModifierBehaviorSO> behaviors = new();
|
||||
[SerializeField] private List<ModifierBehavior> behaviors = new();
|
||||
|
||||
public string Id => id;
|
||||
public string DisplayName => displayName;
|
||||
@@ -36,19 +36,19 @@ namespace YachtDice.Modifiers.Definition
|
||||
public bool HasLimitedUses => hasLimitedUses;
|
||||
public int MaxUses => maxUses;
|
||||
public int MaxStacks => maxStacks;
|
||||
public IReadOnlyList<ModifierBehaviorSO> Behaviors => behaviors;
|
||||
public IReadOnlyList<ModifierBehavior> Behaviors => behaviors;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static ModifierDefinitionSO CreateForTest(
|
||||
public static ModifierDefinition CreateForTest(
|
||||
string id,
|
||||
List<ModifierBehaviorSO> behaviors,
|
||||
List<ModifierBehavior> behaviors,
|
||||
bool hasLimitedUses = false,
|
||||
int maxUses = 0,
|
||||
int shopPrice = 100,
|
||||
int sellPrice = 50,
|
||||
ModifierRarity rarity = ModifierRarity.Common)
|
||||
{
|
||||
var so = CreateInstance<ModifierDefinitionSO>();
|
||||
var so = CreateInstance<ModifierDefinition>();
|
||||
so.id = id;
|
||||
so.displayName = id;
|
||||
so.description = id;
|
||||
@@ -57,7 +57,7 @@ namespace YachtDice.Modifiers.Definition
|
||||
so.sellPrice = sellPrice;
|
||||
so.hasLimitedUses = hasLimitedUses;
|
||||
so.maxUses = maxUses;
|
||||
so.behaviors = behaviors ?? new List<ModifierBehaviorSO>();
|
||||
so.behaviors = behaviors ?? new List<ModifierBehavior>();
|
||||
return so;
|
||||
}
|
||||
#endif
|
||||
@@ -26,7 +26,7 @@ namespace YachtDice.Modifiers.Editor
|
||||
for (int i = 0; i < guids.Length; i++)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
var def = AssetDatabase.LoadAssetAtPath<ModifierDefinitionSO>(path);
|
||||
var def = AssetDatabase.LoadAssetAtPath<ModifierDefinition>(path);
|
||||
|
||||
if (def == null)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ namespace YachtDice.Modifiers.Editor
|
||||
for (int i = 0; i < guids.Length; i++)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
||||
var catalog = AssetDatabase.LoadAssetAtPath<ModifierCatalogSO>(path);
|
||||
var catalog = AssetDatabase.LoadAssetAtPath<ModifierCatalog>(path);
|
||||
|
||||
if (catalog == null)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "AddCurrencyEffect", menuName = "YachtDice/Modifiers/Effects/Add Currency")]
|
||||
public class AddCurrencyEffect : EffectSO
|
||||
public class AddCurrencyEffect : Effect
|
||||
{
|
||||
[SerializeField] private int amount;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "AddFlatScoreEffect", menuName = "YachtDice/Modifiers/Effects/Add Flat Score")]
|
||||
public class AddFlatScoreEffect : EffectSO
|
||||
public class AddFlatScoreEffect : Effect
|
||||
{
|
||||
[SerializeField] private int value;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "AddPerDieEffect", menuName = "YachtDice/Modifiers/Effects/Add Per Die")]
|
||||
public class AddPerDieEffect : EffectSO
|
||||
public class AddPerDieEffect : Effect
|
||||
{
|
||||
[Tooltip("Points to add per matching die.")]
|
||||
[SerializeField] private int valuePerDie;
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "ConsumeChargeEffect", menuName = "YachtDice/Modifiers/Effects/Consume Charge")]
|
||||
public class ConsumeChargeEffect : EffectSO
|
||||
public class ConsumeChargeEffect : Effect
|
||||
{
|
||||
[SerializeField] private int charges = 1;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "MultiplyPerDieEffect", menuName = "YachtDice/Modifiers/Effects/Multiply Per Die")]
|
||||
public class MultiplyPerDieEffect : EffectSO
|
||||
public class MultiplyPerDieEffect : Effect
|
||||
{
|
||||
[Tooltip("Multiplier to apply per matching die.")]
|
||||
[SerializeField] private float multiplierPerDie = 1f;
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "MultiplyScoreEffect", menuName = "YachtDice/Modifiers/Effects/Multiply Score")]
|
||||
public class MultiplyScoreEffect : EffectSO
|
||||
public class MultiplyScoreEffect : Effect
|
||||
{
|
||||
[SerializeField] private float multiplier = 1f;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using YachtDice.Modifiers.Runtime;
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "PostMultiplyEffect", menuName = "YachtDice/Modifiers/Effects/Post Multiply")]
|
||||
public class PostMultiplyEffect : EffectSO
|
||||
public class PostMultiplyEffect : Effect
|
||||
{
|
||||
[SerializeField] private float postMultiplier = 1f;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace YachtDice.Modifiers.Pipeline
|
||||
{
|
||||
public struct EffectEntry
|
||||
{
|
||||
public EffectSO Effect;
|
||||
public Effect Effect;
|
||||
public ModifierInstance Instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace YachtDice.Modifiers.Runtime
|
||||
{
|
||||
public class ModifierInstance
|
||||
{
|
||||
public ModifierDefinitionSO Definition { get; }
|
||||
public ModifierDefinition Definition { get; }
|
||||
public bool IsActive { get; set; }
|
||||
public int RemainingUses { get; set; }
|
||||
public int Stacks { get; set; } = 1;
|
||||
@@ -13,7 +13,7 @@ namespace YachtDice.Modifiers.Runtime
|
||||
|
||||
public bool IsExpired => Definition.HasLimitedUses && RemainingUses <= 0;
|
||||
|
||||
public ModifierInstance(ModifierDefinitionSO definition)
|
||||
public ModifierInstance(ModifierDefinition definition)
|
||||
{
|
||||
Definition = definition;
|
||||
RemainingUses = definition.HasLimitedUses ? definition.MaxUses : -1;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace YachtDice.Modifiers.Runtime
|
||||
maxActiveSlots = slots;
|
||||
}
|
||||
|
||||
public ModifierInstance Add(ModifierDefinitionSO definition)
|
||||
public ModifierInstance Add(ModifierDefinition definition)
|
||||
{
|
||||
var instance = new ModifierInstance(definition);
|
||||
instances.Add(instance);
|
||||
@@ -151,7 +151,7 @@ namespace YachtDice.Modifiers.Runtime
|
||||
return entries;
|
||||
}
|
||||
|
||||
public void LoadSaveData(List<ModifierSaveEntry> entries, ModifierCatalogSO catalog)
|
||||
public void LoadSaveData(List<ModifierSaveEntry> entries, ModifierCatalog catalog)
|
||||
{
|
||||
instances.Clear();
|
||||
activeCacheDirty = true;
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace YachtDice.Shop
|
||||
{
|
||||
[SerializeField] private ShopView shopView;
|
||||
|
||||
private ModifierCatalogSO catalog;
|
||||
private ModifierCatalog catalog;
|
||||
private CurrencyBank currencyBank;
|
||||
private ShopModel model;
|
||||
|
||||
public ModifierCatalogSO Catalog => catalog;
|
||||
public ModifierCatalog Catalog => catalog;
|
||||
|
||||
[Inject]
|
||||
public void Construct(ModifierCatalogSO catalog, CurrencyBank currencyBank, ShopModel model)
|
||||
public void Construct(ModifierCatalog catalog, CurrencyBank currencyBank, ShopModel model)
|
||||
{
|
||||
this.catalog = catalog;
|
||||
this.currencyBank = currencyBank;
|
||||
@@ -55,7 +55,7 @@ namespace YachtDice.Shop
|
||||
shopView.Show();
|
||||
}
|
||||
|
||||
private void HandleBuyClicked(ModifierDefinitionSO def)
|
||||
private void HandleBuyClicked(ModifierDefinition def)
|
||||
{
|
||||
model.TryPurchase(def);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace YachtDice.Shop
|
||||
shopView.RefreshStates(catalog.All, model);
|
||||
}
|
||||
|
||||
private void HandleItemPurchased(ModifierDefinitionSO def)
|
||||
private void HandleItemPurchased(ModifierDefinition def)
|
||||
{
|
||||
shopView.RefreshStates(catalog.All, model);
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace YachtDice.Shop
|
||||
[SerializeField] private Color rareColor = new(0.4f, 0.6f, 1f);
|
||||
[SerializeField] private Color epicColor = new(0.8f, 0.4f, 1f);
|
||||
|
||||
private ModifierDefinitionSO data;
|
||||
private ModifierDefinition data;
|
||||
|
||||
public event Action<ModifierDefinitionSO> OnBuyClicked;
|
||||
public event Action<ModifierDefinition> OnBuyClicked;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace YachtDice.Shop
|
||||
buyButton.onClick.AddListener(() => OnBuyClicked?.Invoke(data));
|
||||
}
|
||||
|
||||
public void Setup(ModifierDefinitionSO modifierDef, ShopItemState state)
|
||||
public void Setup(ModifierDefinition modifierDef, ShopItemState state)
|
||||
{
|
||||
data = modifierDef;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace YachtDice.Shop
|
||||
private readonly InventoryModel inventoryModel;
|
||||
private readonly HashSet<string> purchasedPermanentIds = new();
|
||||
|
||||
public event Action<ModifierDefinitionSO> OnItemPurchased;
|
||||
public event Action<ModifierDefinition> OnItemPurchased;
|
||||
|
||||
public ShopModel(CurrencyBank currencyBank, InventoryModel inventoryModel)
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace YachtDice.Shop
|
||||
this.inventoryModel = inventoryModel;
|
||||
}
|
||||
|
||||
public bool CanPurchase(ModifierDefinitionSO modifier)
|
||||
public bool CanPurchase(ModifierDefinition modifier)
|
||||
{
|
||||
if (modifier == null) return false;
|
||||
if (!currencyBank.CanAfford(modifier.ShopPrice)) return false;
|
||||
@@ -31,7 +31,7 @@ namespace YachtDice.Shop
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryPurchase(ModifierDefinitionSO modifier)
|
||||
public bool TryPurchase(ModifierDefinition modifier)
|
||||
{
|
||||
if (!CanPurchase(modifier)) return false;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace YachtDice.Shop
|
||||
|
||||
public bool IsPermanentOwned(string modifierId) => purchasedPermanentIds.Contains(modifierId);
|
||||
|
||||
public ShopItemState GetItemState(ModifierDefinitionSO modifier)
|
||||
public ShopItemState GetItemState(ModifierDefinition modifier)
|
||||
{
|
||||
if (modifier == null) return ShopItemState.TooExpensive;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace YachtDice.Shop
|
||||
|
||||
private readonly List<ShopItemView> spawnedItems = new();
|
||||
|
||||
public event Action<ModifierDefinitionSO> OnBuyClicked;
|
||||
public event Action<ModifierDefinition> OnBuyClicked;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace YachtDice.Shop
|
||||
public void Hide() => gameObject.SetActive(false);
|
||||
public bool IsVisible => gameObject.activeSelf;
|
||||
|
||||
public void Populate(IReadOnlyList<ModifierDefinitionSO> catalog, ShopModel model)
|
||||
public void Populate(IReadOnlyList<ModifierDefinition> catalog, ShopModel model)
|
||||
{
|
||||
ClearItems();
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace YachtDice.Shop
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshStates(IReadOnlyList<ModifierDefinitionSO> catalog, ShopModel model)
|
||||
public void RefreshStates(IReadOnlyList<ModifierDefinition> catalog, ShopModel model)
|
||||
{
|
||||
for (int i = 0; i < spawnedItems.Count && i < catalog.Count; i++)
|
||||
{
|
||||
@@ -76,6 +76,6 @@ namespace YachtDice.Shop
|
||||
spawnedItems.Clear();
|
||||
}
|
||||
|
||||
private void HandleBuy(ModifierDefinitionSO def) => OnBuyClicked?.Invoke(def);
|
||||
private void HandleBuy(ModifierDefinition def) => OnBuyClicked?.Invoke(def);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace YachtDice.Tests
|
||||
inventory = new InventoryModel(registry);
|
||||
}
|
||||
|
||||
private ModifierDefinitionSO CreateTestDef(string id = "test",
|
||||
private ModifierDefinition CreateTestDef(string id = "test",
|
||||
bool hasLimitedUses = false, int maxUses = 0)
|
||||
{
|
||||
return ModifierDefinitionSO.CreateForTest(id, null,
|
||||
return ModifierDefinition.CreateForTest(id, null,
|
||||
hasLimitedUses: hasLimitedUses, maxUses: maxUses);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace YachtDice.Tests
|
||||
|
||||
private ModifierInstance CreateInstance(string id = "test")
|
||||
{
|
||||
var def = ModifierDefinitionSO.CreateForTest(id, null);
|
||||
var def = ModifierDefinition.CreateForTest(id, null);
|
||||
return new ModifierInstance(def);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace YachtDice.Tests
|
||||
{
|
||||
var effect = ConsumeChargeEffect.CreateForTest(1);
|
||||
var ctx = CreateContext(10, new[] { 1, 2, 3, 4, 5 });
|
||||
var def = ModifierDefinitionSO.CreateForTest("limited", null,
|
||||
var def = ModifierDefinition.CreateForTest("limited", null,
|
||||
hasLimitedUses: true, maxUses: 3);
|
||||
var inst = new ModifierInstance(def);
|
||||
|
||||
|
||||
@@ -51,17 +51,17 @@ namespace YachtDice.Tests
|
||||
Object.DestroyImmediate(sixesCategory);
|
||||
}
|
||||
|
||||
private ModifierDefinitionSO CreateDef(string id,
|
||||
private ModifierDefinition CreateDef(string id,
|
||||
TriggerType trigger,
|
||||
List<ConditionSO> conditions,
|
||||
List<EffectSO> effects)
|
||||
List<Condition> conditions,
|
||||
List<Effect> effects)
|
||||
{
|
||||
var behavior = ModifierBehaviorSO.CreateForTest(trigger, conditions, effects);
|
||||
return ModifierDefinitionSO.CreateForTest(id,
|
||||
new List<ModifierBehaviorSO> { behavior });
|
||||
var behavior = ModifierBehavior.CreateForTest(trigger, conditions, effects);
|
||||
return ModifierDefinition.CreateForTest(id,
|
||||
new List<ModifierBehavior> { behavior });
|
||||
}
|
||||
|
||||
private void RegisterAndActivate(ModifierDefinitionSO def)
|
||||
private void RegisterAndActivate(ModifierDefinition def)
|
||||
{
|
||||
var inst = registry.Add(def);
|
||||
registry.TryActivate(inst);
|
||||
@@ -87,9 +87,9 @@ namespace YachtDice.Tests
|
||||
var mulEffect = MultiplyScoreEffect.CreateForTest(2f, ModifierPhase.Multiplicative);
|
||||
|
||||
var addDef = CreateDef("add", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { addEffect });
|
||||
new List<Effect> { addEffect });
|
||||
var mulDef = CreateDef("mul", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { mulEffect });
|
||||
new List<Effect> { mulEffect });
|
||||
|
||||
RegisterAndActivate(mulDef);
|
||||
RegisterAndActivate(addDef);
|
||||
@@ -108,9 +108,9 @@ namespace YachtDice.Tests
|
||||
var postMulEffect = PostMultiplyEffect.CreateForTest(3f, ModifierPhase.PostMultiplicative);
|
||||
|
||||
var mulDef = CreateDef("mul", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { mulEffect });
|
||||
new List<Effect> { mulEffect });
|
||||
var postDef = CreateDef("post", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { postMulEffect });
|
||||
new List<Effect> { postMulEffect });
|
||||
|
||||
RegisterAndActivate(postDef);
|
||||
RegisterAndActivate(mulDef);
|
||||
@@ -131,8 +131,8 @@ namespace YachtDice.Tests
|
||||
var effect = AddFlatScoreEffect.CreateForTest(100);
|
||||
|
||||
var def = CreateDef("fh-bonus", TriggerType.OnCategoryScored,
|
||||
new List<ConditionSO> { condition },
|
||||
new List<EffectSO> { effect });
|
||||
new List<Condition> { condition },
|
||||
new List<Effect> { effect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
@@ -151,8 +151,8 @@ namespace YachtDice.Tests
|
||||
var effect = AddFlatScoreEffect.CreateForTest(15);
|
||||
|
||||
var def = CreateDef("fh-bonus", TriggerType.OnCategoryScored,
|
||||
new List<ConditionSO> { condition },
|
||||
new List<EffectSO> { effect });
|
||||
new List<Condition> { condition },
|
||||
new List<Effect> { effect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace YachtDice.Tests
|
||||
{
|
||||
var effect = AddFlatScoreEffect.CreateForTest(999);
|
||||
var def = CreateDef("turn-bonus", TriggerType.OnTurnStart, null,
|
||||
new List<EffectSO> { effect });
|
||||
new List<Effect> { effect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
@@ -192,13 +192,13 @@ namespace YachtDice.Tests
|
||||
var finalMul = MultiplyScoreEffect.CreateForTest(2f, ModifierPhase.Multiplicative, priority: 10);
|
||||
|
||||
var def1 = CreateDef("pda", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { perDieAdd });
|
||||
new List<Effect> { perDieAdd });
|
||||
var def2 = CreateDef("pdm", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { perDieMul });
|
||||
new List<Effect> { perDieMul });
|
||||
var def3 = CreateDef("fa", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { flatAdd });
|
||||
new List<Effect> { flatAdd });
|
||||
var def4 = CreateDef("fm", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { finalMul });
|
||||
new List<Effect> { finalMul });
|
||||
|
||||
RegisterAndActivate(def4);
|
||||
RegisterAndActivate(def3);
|
||||
@@ -231,7 +231,7 @@ namespace YachtDice.Tests
|
||||
{
|
||||
var effect = AddFlatScoreEffect.CreateForTest(50);
|
||||
var def = CreateDef("inactive", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { effect });
|
||||
new List<Effect> { effect });
|
||||
|
||||
registry.Add(def);
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace YachtDice.Tests
|
||||
var currencyEffect = AddCurrencyEffect.CreateForTest(25, ModifierPhase.SideEffect);
|
||||
|
||||
var def = CreateDef("rewards", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { scoreEffect, currencyEffect });
|
||||
new List<Effect> { scoreEffect, currencyEffect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace YachtDice.Tests
|
||||
|
||||
var effect = AddFlatScoreEffect.CreateForTest(10);
|
||||
var def = CreateDef("traced", TriggerType.OnCategoryScored, null,
|
||||
new List<EffectSO> { effect });
|
||||
new List<Effect> { effect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
@@ -292,8 +292,8 @@ namespace YachtDice.Tests
|
||||
var effect = AddFlatScoreEffect.CreateForTest(100);
|
||||
|
||||
var def = CreateDef("sixes-bonus", TriggerType.OnCategoryScored,
|
||||
new List<ConditionSO> { condition },
|
||||
new List<EffectSO> { effect });
|
||||
new List<Condition> { condition },
|
||||
new List<Effect> { effect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
@@ -319,8 +319,8 @@ namespace YachtDice.Tests
|
||||
var effect = MultiplyScoreEffect.CreateForTest(2f);
|
||||
|
||||
var def = CreateDef("high-score-bonus", TriggerType.OnCategoryScored,
|
||||
new List<ConditionSO> { condition },
|
||||
new List<EffectSO> { effect });
|
||||
new List<Condition> { condition },
|
||||
new List<Effect> { effect });
|
||||
|
||||
RegisterAndActivate(def);
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ namespace YachtDice.Tests
|
||||
Object.DestroyImmediate(go.gameObject);
|
||||
}
|
||||
|
||||
private ModifierDefinitionSO CreateDef(string id = "test",
|
||||
private ModifierDefinition CreateDef(string id = "test",
|
||||
bool hasLimitedUses = false, int maxUses = 0,
|
||||
int shopPrice = 100, int sellPrice = 50)
|
||||
{
|
||||
return ModifierDefinitionSO.CreateForTest(id, null,
|
||||
return ModifierDefinition.CreateForTest(id, null,
|
||||
hasLimitedUses: hasLimitedUses, maxUses: maxUses,
|
||||
shopPrice: shopPrice, sellPrice: sellPrice);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void TryPurchase_FiresPurchaseEvent()
|
||||
{
|
||||
ModifierDefinitionSO purchased = null;
|
||||
ModifierDefinition purchased = null;
|
||||
shop.OnItemPurchased += def => purchased = def;
|
||||
|
||||
var mod = CreateDef("test", shopPrice: 100);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace YachtDice.UI
|
||||
private InventoryController inventoryController;
|
||||
private ModifierRegistry modifierRegistry;
|
||||
private CategoryCatalog categoryCatalog;
|
||||
private ModifierCatalogSO modifierCatalog;
|
||||
private ModifierCatalog modifierCatalog;
|
||||
private ShopModel shopModel;
|
||||
|
||||
[Inject]
|
||||
@@ -48,7 +48,7 @@ namespace YachtDice.UI
|
||||
InventoryController inventoryController,
|
||||
ModifierRegistry modifierRegistry,
|
||||
CategoryCatalog categoryCatalog,
|
||||
ModifierCatalogSO modifierCatalog,
|
||||
ModifierCatalog modifierCatalog,
|
||||
ShopModel shopModel)
|
||||
{
|
||||
this.gameManager = gameManager;
|
||||
|
||||
Reference in New Issue
Block a user