Merge branch 'claude/vibrant-tereshkova'
# Conflicts: # Assets/Scripts/Dice/DiceCatalog.cs # Assets/Scripts/Dice/DiceDefinitionSO.cs # Assets/Scripts/Dice/DiceDefinitionSO.cs.meta # Assets/Scripts/Dice/DiceInstance.cs # Assets/Scripts/Dice/DiceRoller.cs # Assets/Scripts/Dice/DieDefinitionSO.cs # Assets/Scripts/Dice/DieDefinitionSO.cs.meta # Assets/Scripts/Dice/DiсeDefinition.cs # Assets/Scripts/Dice/DiсeDefinition.cs.meta # Assets/Scripts/Dice/IDice.cs # Assets/Scripts/Dice/StandardDiceSO.cs # Assets/Scripts/Dice/StandardDiceSO.cs.meta # Assets/Scripts/Dice/StandardDieSO.cs # Assets/Scripts/Dice/StandardDieSO.cs.meta # Assets/Scripts/Dice/StandardDiсe.cs # Assets/Scripts/Dice/StandardDiсe.cs.meta # Assets/Scripts/Player/DiceCollection.cs # Assets/Scripts/Shop/ShopModel.cs # Assets/Scripts/Tests/Editor/DiceCollectionTests.cs # Assets/Scripts/Tests/Editor/ScoringSystemTests.cs # Assets/Scripts/Tests/Editor/ShopModelTests.cs
This commit is contained in:
@@ -6,11 +6,11 @@ namespace YachtDice.Dice
|
||||
[CreateAssetMenu(fileName = "DiceCatalog", menuName = "YachtDice/Dice/Catalog")]
|
||||
public class DiceCatalog : ScriptableObject
|
||||
{
|
||||
[SerializeField] private List<DiсeDefinition> dice = new();
|
||||
[SerializeField] private List<DiceDefinitionSO> dice = new();
|
||||
|
||||
public IReadOnlyList<DiсeDefinition> All => dice;
|
||||
public IReadOnlyList<DiceDefinitionSO> All => dice;
|
||||
|
||||
public DiсeDefinition FindById(string id)
|
||||
public DiceDefinitionSO FindById(string id)
|
||||
{
|
||||
for (int i = 0; i < dice.Count; i++)
|
||||
{
|
||||
@@ -21,10 +21,10 @@ namespace YachtDice.Dice
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static DiceCatalog CreateForTest(List<DiсeDefinition> defs)
|
||||
public static DiceCatalog CreateForTest(List<DiceDefinitionSO> defs)
|
||||
{
|
||||
var catalog = CreateInstance<DiceCatalog>();
|
||||
catalog.dice = defs ?? new List<DiсeDefinition>();
|
||||
catalog.dice = defs ?? new List<DiceDefinitionSO>();
|
||||
return catalog;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,11 @@ namespace YachtDice.Dice
|
||||
/// Абстрактное определение типа дайса.
|
||||
/// Наследники описывают конкретные виды (стандартный d6, специальные и т.д.).
|
||||
/// </summary>
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/DiсeDefinition.cs
|
||||
public abstract class DiсeDefinition : ScriptableObject, IShopItem
|
||||
========
|
||||
public abstract class DiceDefinitionSO : ScriptableObject, IShopItem
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/DiceDefinitionSO.cs
|
||||
{
|
||||
[field: Header("Identity")]
|
||||
[field: SerializeField] public string Id { get; private set; }
|
||||
@@ -28,7 +32,11 @@ namespace YachtDice.Dice
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static T CreateForTest<T>(string id, string displayName = null,
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/DiсeDefinition.cs
|
||||
int shopPrice = 0, string description = null) where T : DiсeDefinition
|
||||
========
|
||||
int shopPrice = 0, string description = null) where T : DiceDefinitionSO
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/DiceDefinitionSO.cs
|
||||
{
|
||||
var so = CreateInstance<T>();
|
||||
so.Id = id;
|
||||
@@ -6,18 +6,18 @@ namespace YachtDice.Dice
|
||||
/// </summary>
|
||||
public class DiceInstance : IDice
|
||||
{
|
||||
public DiсeDefinition Definition { get; }
|
||||
public DiceDefinitionSO Definition { get; }
|
||||
public int Value { get; set; }
|
||||
public bool IsLocked { get; set; }
|
||||
|
||||
public DiceInstance(DiсeDefinition definition)
|
||||
public DiceInstance(DiceDefinitionSO definition)
|
||||
{
|
||||
Definition = definition;
|
||||
Value = 0;
|
||||
IsLocked = false;
|
||||
}
|
||||
|
||||
public DiceInstance(DiсeDefinition definition, int initialValue)
|
||||
public DiceInstance(DiceDefinitionSO definition, int initialValue)
|
||||
{
|
||||
Definition = definition;
|
||||
Value = initialValue;
|
||||
|
||||
@@ -14,10 +14,9 @@ namespace YachtDice.Dice
|
||||
[Header("References")]
|
||||
[SerializeField] private Dice dice;
|
||||
[SerializeField] private Rigidbody rb;
|
||||
[SerializeField] private DiсeDefinition definition;
|
||||
|
||||
/// <summary>Определение типа дайса (назначается в инспекторе).</summary>
|
||||
public DiсeDefinition Definition => definition;
|
||||
[field: SerializeField] public DiceDefinitionSO Definition { get; private set; }
|
||||
|
||||
[Header("Throw Settings")]
|
||||
[Tooltip("Сила подброса вверх")]
|
||||
|
||||
@@ -10,6 +10,6 @@ namespace YachtDice.Dice
|
||||
int Value { get; }
|
||||
|
||||
/// <summary>Определение типа дайса (ScriptableObject).</summary>
|
||||
DiсeDefinition Definition { get; }
|
||||
DiceDefinitionSO Definition { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ namespace YachtDice.Dice
|
||||
/// По умолчанию — классический d6 (1-6).
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "StandardDice", menuName = "YachtDice/Dice/Standard Dice")]
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/StandardDiсe.cs
|
||||
public class StandardDiсe : DiсeDefinition
|
||||
========
|
||||
public class StandardDiceSO : DiceDefinitionSO
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/StandardDiceSO.cs
|
||||
{
|
||||
[Header("Configuration")]
|
||||
[SerializeField] private int[] faceValues = { 1, 2, 3, 4, 5, 6 };
|
||||
@@ -22,9 +26,15 @@ namespace YachtDice.Dice
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
<<<<<<<< HEAD:Assets/Scripts/Dice/StandardDiсe.cs
|
||||
public static StandardDiсe CreateStandardD6ForTest()
|
||||
{
|
||||
var so = CreateForTest<StandardDiсe>("standard_d6", "Стандартный d6");
|
||||
========
|
||||
public static StandardDiceSO CreateStandardD6ForTest()
|
||||
{
|
||||
var so = CreateForTest<StandardDiceSO>("standard_d6", "Стандартный d6");
|
||||
>>>>>>>> claude/vibrant-tereshkova:Assets/Scripts/Dice/StandardDiceSO.cs
|
||||
so.faceValues = new[] { 1, 2, 3, 4, 5, 6 };
|
||||
return so;
|
||||
}
|
||||
+4
-4
@@ -5,8 +5,8 @@ using YachtDice.Modifiers.Runtime;
|
||||
|
||||
namespace YachtDice.Modifiers.Conditions
|
||||
{
|
||||
[CreateAssetMenu(fileName = "DieValueCondition", menuName = "YachtDice/Modifiers/Conditions/Die Value")]
|
||||
public class DieValueCondition : Condition
|
||||
[CreateAssetMenu(fileName = "DiceValueCondition", menuName = "YachtDice/Modifiers/Conditions/Dice Value")]
|
||||
public class DiceValueCondition : Condition
|
||||
{
|
||||
[SerializeField, Range(1, 6)] private int targetValue = 1;
|
||||
[SerializeField] private int minCount = 1;
|
||||
@@ -25,9 +25,9 @@ namespace YachtDice.Modifiers.Conditions
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static DieValueCondition CreateForTest(int targetValue, int minCount = 1)
|
||||
public static DiceValueCondition CreateForTest(int targetValue, int minCount = 1)
|
||||
{
|
||||
var so = CreateInstance<DieValueCondition>();
|
||||
var so = CreateInstance<DiceValueCondition>();
|
||||
so.targetValue = targetValue;
|
||||
so.minCount = minCount;
|
||||
return so;
|
||||
+12
-12
@@ -6,14 +6,14 @@ using YachtDice.Modifiers.Runtime;
|
||||
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "AddPerDieEffect", menuName = "YachtDice/Modifiers/Effects/Add Per Die")]
|
||||
public class AddPerDieEffect : Effect
|
||||
[CreateAssetMenu(fileName = "AddPerDiceEffect", menuName = "YachtDice/Modifiers/Effects/Add Per Dice")]
|
||||
public class AddPerDiceEffect : Effect
|
||||
{
|
||||
[Tooltip("Points to add per matching die.")]
|
||||
[SerializeField] private int valuePerDie;
|
||||
[Tooltip("Points to add per matching dice.")]
|
||||
[SerializeField] private int valuePerDice;
|
||||
|
||||
[Tooltip("Die face value to match (1-6). 0 = any/all dice.")]
|
||||
[SerializeField, Range(0, 6)] private int targetDieValue;
|
||||
[Tooltip("Dice face value to match (1-6). 0 = any/all dice.")]
|
||||
[SerializeField, Range(0, 6)] private int targetDiceValue;
|
||||
|
||||
public override UniTask Apply(ModifierContext context, ModifierInstance instance)
|
||||
{
|
||||
@@ -22,21 +22,21 @@ namespace YachtDice.Modifiers.Effects
|
||||
int count = 0;
|
||||
for (int i = 0; i < context.DiceValues.Length; i++)
|
||||
{
|
||||
if (targetDieValue == 0 || context.DiceValues[i] == targetDieValue)
|
||||
if (targetDiceValue == 0 || context.DiceValues[i] == targetDiceValue)
|
||||
count++;
|
||||
}
|
||||
|
||||
context.FlatBonus += valuePerDie * count * instance.Stacks;
|
||||
context.FlatBonus += valuePerDice * count * instance.Stacks;
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static AddPerDieEffect CreateForTest(int valuePerDie, int targetDieValue = 0,
|
||||
public static AddPerDiceEffect CreateForTest(int valuePerDice, int targetDiceValue = 0,
|
||||
ModifierPhase phase = ModifierPhase.Additive, int priority = 0)
|
||||
{
|
||||
var so = CreateInstance<AddPerDieEffect>();
|
||||
so.valuePerDie = valuePerDie;
|
||||
so.targetDieValue = targetDieValue;
|
||||
var so = CreateInstance<AddPerDiceEffect>();
|
||||
so.valuePerDice = valuePerDice;
|
||||
so.targetDiceValue = targetDiceValue;
|
||||
so.SetPhaseForTest(phase);
|
||||
so.SetPriorityForTest(priority);
|
||||
return so;
|
||||
@@ -0,0 +1,44 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using YachtDice.Modifiers.Core;
|
||||
using YachtDice.Modifiers.Definition;
|
||||
using YachtDice.Modifiers.Runtime;
|
||||
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "MultiplyPerDiceEffect", menuName = "YachtDice/Modifiers/Effects/Multiply Per Dice")]
|
||||
public class MultiplyPerDiceEffect : Effect
|
||||
{
|
||||
[Tooltip("Multiplier to apply per matching dice.")]
|
||||
[SerializeField] private float multiplierPerDice = 1f;
|
||||
|
||||
[Tooltip("Dice face value to match (1-6). 0 = any/all dice.")]
|
||||
[SerializeField, Range(0, 6)] private int targetDiceValue;
|
||||
|
||||
public override UniTask Apply(ModifierContext context, ModifierInstance instance)
|
||||
{
|
||||
if (context.DiceValues == null) return UniTask.CompletedTask;
|
||||
|
||||
for (int i = 0; i < context.DiceValues.Length; i++)
|
||||
{
|
||||
if (targetDiceValue == 0 || context.DiceValues[i] == targetDiceValue)
|
||||
context.Multiplier *= multiplierPerDice;
|
||||
}
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static MultiplyPerDiceEffect CreateForTest(float multiplierPerDice, int targetDiceValue = 0,
|
||||
ModifierPhase phase = ModifierPhase.Multiplicative, int priority = 0)
|
||||
{
|
||||
var so = CreateInstance<MultiplyPerDiceEffect>();
|
||||
so.multiplierPerDice = multiplierPerDice;
|
||||
so.targetDiceValue = targetDiceValue;
|
||||
so.SetPhaseForTest(phase);
|
||||
so.SetPriorityForTest(priority);
|
||||
return so;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using YachtDice.Modifiers.Core;
|
||||
using YachtDice.Modifiers.Definition;
|
||||
using YachtDice.Modifiers.Runtime;
|
||||
|
||||
namespace YachtDice.Modifiers.Effects
|
||||
{
|
||||
[CreateAssetMenu(fileName = "MultiplyPerDieEffect", menuName = "YachtDice/Modifiers/Effects/Multiply Per Die")]
|
||||
public class MultiplyPerDieEffect : Effect
|
||||
{
|
||||
[Tooltip("Multiplier to apply per matching die.")]
|
||||
[SerializeField] private float multiplierPerDie = 1f;
|
||||
|
||||
[Tooltip("Die face value to match (1-6). 0 = any/all dice.")]
|
||||
[SerializeField, Range(0, 6)] private int targetDieValue;
|
||||
|
||||
public override UniTask Apply(ModifierContext context, ModifierInstance instance)
|
||||
{
|
||||
if (context.DiceValues == null) return UniTask.CompletedTask;
|
||||
|
||||
for (int i = 0; i < context.DiceValues.Length; i++)
|
||||
{
|
||||
if (targetDieValue == 0 || context.DiceValues[i] == targetDieValue)
|
||||
context.Multiplier *= multiplierPerDie;
|
||||
}
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static MultiplyPerDieEffect CreateForTest(float multiplierPerDie, int targetDieValue = 0,
|
||||
ModifierPhase phase = ModifierPhase.Multiplicative, int priority = 0)
|
||||
{
|
||||
var so = CreateInstance<MultiplyPerDieEffect>();
|
||||
so.multiplierPerDie = multiplierPerDie;
|
||||
so.targetDieValue = targetDieValue;
|
||||
so.SetPhaseForTest(phase);
|
||||
so.SetPriorityForTest(priority);
|
||||
return so;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ namespace YachtDice.Player
|
||||
{
|
||||
public class DiceCollection
|
||||
{
|
||||
private readonly List<DiсeDefinition> ownedDice = new();
|
||||
private readonly List<DiceDefinitionSO> ownedDice = new();
|
||||
|
||||
public event Action OnChanged;
|
||||
|
||||
public IReadOnlyList<DiсeDefinition> OwnedDice => ownedDice;
|
||||
public IReadOnlyList<DiceDefinitionSO> OwnedDice => ownedDice;
|
||||
|
||||
public void Add(DiсeDefinition definition)
|
||||
public void Add(DiceDefinitionSO definition)
|
||||
{
|
||||
if (definition == null) return;
|
||||
if (OwnsById(definition.Id)) return;
|
||||
@@ -21,7 +21,7 @@ namespace YachtDice.Player
|
||||
OnChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Remove(DiсeDefinition definition)
|
||||
public void Remove(DiceDefinitionSO definition)
|
||||
{
|
||||
if (ownedDice.Remove(definition))
|
||||
OnChanged?.Invoke();
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace YachtDice.Shop
|
||||
case ModifierDefinition modifier:
|
||||
inventoryModel.AddModifier(modifier);
|
||||
break;
|
||||
case DiсeDefinition die:
|
||||
diceCollection.Add(die);
|
||||
case DiceDefinitionSO dice:
|
||||
diceCollection.Add(dice);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Add_IncreasesCount()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Add_DuplicateId_Ignored()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
collection.Add(die);
|
||||
@@ -47,7 +47,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void OwnsById_ReturnsTrueWhenOwned()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Remove_DecreasesCount()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
collection.Remove(die);
|
||||
@@ -74,7 +74,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void GetSaveData_ReturnsIds()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
|
||||
@@ -86,8 +86,8 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void LoadSaveData_RestoresDice()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiсeDefinition> { die });
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiceDefinitionSO> { die });
|
||||
var ids = new List<string> { "standard_d6" };
|
||||
|
||||
collection.LoadSaveData(ids, catalog);
|
||||
@@ -99,7 +99,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void LoadSaveData_SkipsMissingIds()
|
||||
{
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiсeDefinition>());
|
||||
var catalog = DiceCatalog.CreateForTest(new List<DiceDefinitionSO>());
|
||||
var ids = new List<string> { "nonexistent" };
|
||||
|
||||
collection.LoadSaveData(ids, catalog);
|
||||
@@ -110,7 +110,7 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Clear_RemovesAll()
|
||||
{
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
|
||||
collection.Add(die);
|
||||
collection.Clear();
|
||||
@@ -124,7 +124,7 @@ namespace YachtDice.Tests
|
||||
bool fired = false;
|
||||
collection.OnChanged += () => fired = true;
|
||||
|
||||
var die = StandardDiсe.CreateStandardD6ForTest();
|
||||
var die = StandardDiceSO.CreateStandardD6ForTest();
|
||||
collection.Add(die);
|
||||
|
||||
Assert.IsTrue(fired);
|
||||
|
||||
@@ -41,12 +41,12 @@ namespace YachtDice.Tests
|
||||
};
|
||||
}
|
||||
|
||||
// ── AddPerDieEffect ─────────────────────────────────────────
|
||||
// ── AddPerDiceEffect ─────────────────────────────────────────
|
||||
|
||||
[Test]
|
||||
public void AddPerDieEffect_CountsMatchingDice()
|
||||
public void AddPerDiceEffect_CountsMatchingDice()
|
||||
{
|
||||
var effect = AddPerDieEffect.CreateForTest(10, targetDieValue: 1);
|
||||
var effect = AddPerDiceEffect.CreateForTest(10, targetDiceValue: 1);
|
||||
var ctx = CreateContext(5, new[] { 1, 1, 3, 4, 1 });
|
||||
var inst = CreateInstance();
|
||||
|
||||
@@ -56,9 +56,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddPerDieEffect_ZeroTarget_CountsAllDice()
|
||||
public void AddPerDiceEffect_ZeroTarget_CountsAllDice()
|
||||
{
|
||||
var effect = AddPerDieEffect.CreateForTest(2, targetDieValue: 0);
|
||||
var effect = AddPerDiceEffect.CreateForTest(2, targetDiceValue: 0);
|
||||
var ctx = CreateContext(10, new[] { 1, 2, 3, 4, 5 });
|
||||
var inst = CreateInstance();
|
||||
|
||||
@@ -68,9 +68,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddPerDieEffect_NoMatches_ZeroBonus()
|
||||
public void AddPerDiceEffect_NoMatches_ZeroBonus()
|
||||
{
|
||||
var effect = AddPerDieEffect.CreateForTest(10, targetDieValue: 6);
|
||||
var effect = AddPerDiceEffect.CreateForTest(10, targetDiceValue: 6);
|
||||
var ctx = CreateContext(5, new[] { 1, 2, 3, 4, 5 });
|
||||
var inst = CreateInstance();
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddPerDieEffect_ScalesWithStacks()
|
||||
public void AddPerDiceEffect_ScalesWithStacks()
|
||||
{
|
||||
var effect = AddPerDieEffect.CreateForTest(10, targetDieValue: 1);
|
||||
var effect = AddPerDiceEffect.CreateForTest(10, targetDiceValue: 1);
|
||||
var ctx = CreateContext(5, new[] { 1, 1, 3, 4, 1 });
|
||||
var inst = CreateInstance();
|
||||
inst.Stacks = 2;
|
||||
@@ -119,12 +119,12 @@ namespace YachtDice.Tests
|
||||
Assert.AreEqual(45, ctx.FlatBonus); // 15 * 3 stacks
|
||||
}
|
||||
|
||||
// ── MultiplyPerDieEffect ────────────────────────────────────
|
||||
// ── MultiplyPerDiceEffect ────────────────────────────────────
|
||||
|
||||
[Test]
|
||||
public void MultiplyPerDieEffect_MultipliesPerMatch()
|
||||
public void MultiplyPerDiceEffect_MultipliesPerMatch()
|
||||
{
|
||||
var effect = MultiplyPerDieEffect.CreateForTest(2f, targetDieValue: 6);
|
||||
var effect = MultiplyPerDiceEffect.CreateForTest(2f, targetDiceValue: 6);
|
||||
var ctx = CreateContext(18, new[] { 6, 6, 6, 1, 2 });
|
||||
var inst = CreateInstance();
|
||||
|
||||
@@ -134,9 +134,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultiplyPerDieEffect_NoMatches_MultiplierUnchanged()
|
||||
public void MultiplyPerDiceEffect_NoMatches_MultiplierUnchanged()
|
||||
{
|
||||
var effect = MultiplyPerDieEffect.CreateForTest(3f, targetDieValue: 6);
|
||||
var effect = MultiplyPerDiceEffect.CreateForTest(3f, targetDiceValue: 6);
|
||||
var ctx = CreateContext(10, new[] { 1, 2, 3, 4, 5 });
|
||||
var inst = CreateInstance();
|
||||
|
||||
|
||||
@@ -186,8 +186,8 @@ namespace YachtDice.Tests
|
||||
[Test]
|
||||
public void Execute_MultipleModifiers_CorrectOrder()
|
||||
{
|
||||
var perDieAdd = AddPerDieEffect.CreateForTest(2, targetDieValue: 3, phase: ModifierPhase.Additive);
|
||||
var perDieMul = MultiplyPerDieEffect.CreateForTest(1.5f, targetDieValue: 3, phase: ModifierPhase.Multiplicative);
|
||||
var perDieAdd = AddPerDiceEffect.CreateForTest(2, targetDiceValue: 3, phase: ModifierPhase.Additive);
|
||||
var perDieMul = MultiplyPerDiceEffect.CreateForTest(1.5f, targetDiceValue: 3, phase: ModifierPhase.Multiplicative);
|
||||
var flatAdd = AddFlatScoreEffect.CreateForTest(10, ModifierPhase.Additive, priority: 10);
|
||||
var finalMul = MultiplyScoreEffect.CreateForTest(2f, ModifierPhase.Multiplicative, priority: 10);
|
||||
|
||||
@@ -283,12 +283,12 @@ namespace YachtDice.Tests
|
||||
Assert.IsTrue(result.DebugLog.Count > 0);
|
||||
}
|
||||
|
||||
// ── DieValue Condition ──────────────────────────────────────
|
||||
// ── DiceValue Condition ──────────────────────────────────────
|
||||
|
||||
[Test]
|
||||
public void Execute_DieValueCondition_OnlyTriggersOnMatch()
|
||||
public void Execute_DiceValueCondition_OnlyTriggersOnMatch()
|
||||
{
|
||||
var condition = DieValueCondition.CreateForTest(6, minCount: 3);
|
||||
var condition = DiceValueCondition.CreateForTest(6, minCount: 3);
|
||||
var effect = AddFlatScoreEffect.CreateForTest(100);
|
||||
|
||||
var def = CreateDef("sixes-bonus", TriggerType.OnCategoryScored,
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace YachtDice.Tests
|
||||
private CategoryDefinition twosCategory;
|
||||
private CategoryDefinition chanceCategory;
|
||||
private CategoryCatalog catalog;
|
||||
private DiсeDefinition _standardDiсe;
|
||||
private DiceDefinitionSO standardDice;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_standardDiсe = DiсeDefinition.CreateForTest<StandardDiсe>("d6", "d6");
|
||||
standardDice = DiceDefinitionSO.CreateForTest<StandardDiceSO>("d6", "d6");
|
||||
|
||||
yachtCategory = NOfAKindCategory.CreateForTest("yacht", "Яхта", 5, fixedScoreMode: true, score: 50);
|
||||
onesCategory = SumOfValueCategory.CreateForTest("ones", "Единицы", 1);
|
||||
@@ -43,7 +43,7 @@ namespace YachtDice.Tests
|
||||
Object.DestroyImmediate(twosCategory);
|
||||
Object.DestroyImmediate(chanceCategory);
|
||||
Object.DestroyImmediate(catalog);
|
||||
Object.DestroyImmediate(_standardDiсe);
|
||||
Object.DestroyImmediate(standardDice);
|
||||
}
|
||||
|
||||
private ScoringSystem CreateScoringSystem()
|
||||
@@ -56,7 +56,7 @@ namespace YachtDice.Tests
|
||||
{
|
||||
var dice = new DiceInstance[values.Length];
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
dice[i] = new DiceInstance(_standardDiсe, values[i]);
|
||||
dice[i] = new DiceInstance(standardDice, values[i]);
|
||||
return dice;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TryPurchase_DieItem_AddsToDiceCollection()
|
||||
public void TryPurchase_DiceItem_AddsToDiceCollection()
|
||||
{
|
||||
var die = DiсeDefinition.CreateForTest<StandardDiсe>("test_die", shopPrice: 100);
|
||||
var die = DiceDefinitionSO.CreateForTest<StandardDiceSO>("test_die", shopPrice: 100);
|
||||
|
||||
bool result = shop.TryPurchase(die);
|
||||
|
||||
@@ -152,9 +152,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TryPurchase_DieItem_CannotBeBoughtTwice()
|
||||
public void TryPurchase_DiceItem_CannotBeBoughtTwice()
|
||||
{
|
||||
var die = DiсeDefinition.CreateForTest<StandardDiсe>("unique_die", shopPrice: 100);
|
||||
var die = DiceDefinitionSO.CreateForTest<StandardDiceSO>("unique_die", shopPrice: 100);
|
||||
|
||||
shop.TryPurchase(die);
|
||||
bool secondResult = shop.TryPurchase(die);
|
||||
@@ -165,9 +165,9 @@ namespace YachtDice.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItemState_Die_Owned_AfterPurchase()
|
||||
public void GetItemState_Dice_Owned_AfterPurchase()
|
||||
{
|
||||
var die = DiсeDefinition.CreateForTest<StandardDiсe>("die1", shopPrice: 50);
|
||||
var die = DiceDefinitionSO.CreateForTest<StandardDiceSO>("die1", shopPrice: 50);
|
||||
|
||||
shop.TryPurchase(die);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace YachtDice.UI
|
||||
SetRollButtonState(true, 0, 3);
|
||||
}
|
||||
|
||||
public void SetDieValue(int index, int value)
|
||||
public void SetDiceValue(int index, int value)
|
||||
{
|
||||
if (index >= 0 && index < diceValueTexts.Length)
|
||||
diceValueTexts[index].text = value.ToString();
|
||||
@@ -55,7 +55,7 @@ namespace YachtDice.UI
|
||||
diceValueTexts[i].text = values[i].ToString();
|
||||
}
|
||||
|
||||
public void SetDieLocked(int index, bool isLocked)
|
||||
public void SetDiceLocked(int index, bool isLocked)
|
||||
{
|
||||
if (index >= 0 && index < diceBackgrounds.Length)
|
||||
diceBackgrounds[index].color = isLocked ? lockedColor : unlockedColor;
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace YachtDice.UI
|
||||
|
||||
private void HandleDiceSettled(int index, int value)
|
||||
{
|
||||
dicePanelView.SetDieValue(index, value);
|
||||
dicePanelView.SetDiceValue(index, value);
|
||||
}
|
||||
|
||||
private void HandleScored(CategoryDefinition category, int finalScore)
|
||||
@@ -261,7 +261,7 @@ namespace YachtDice.UI
|
||||
gameManager.ToggleDiceLock(index);
|
||||
|
||||
bool isLocked = diceManager.IsLocked(index);
|
||||
dicePanelView.SetDieLocked(index, isLocked);
|
||||
dicePanelView.SetDiceLocked(index, isLocked);
|
||||
}
|
||||
|
||||
private void HandleCategorySelected(CategoryDefinition category)
|
||||
|
||||
Reference in New Issue
Block a user