Skip to content

Commit

Permalink
feat: multiple add custom modifier data check in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillu1 committed Dec 14, 2024
1 parent 13f2728 commit 59c46e1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ModiBuff/ModiBuff.Tests/ModifierRecipeDataTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using ModiBuff.Core;
using ModiBuff.Core.Units;
using NUnit.Framework;
Expand All @@ -13,14 +14,26 @@ public void LegalActionUnitType()
const EnemyUnitType enemyType = EnemyUnitType.Goblin;
AddEnemySelfBuff("AddDamage", enemyType)
.Effect(new AddDamageEffect(5), EffectOn.Init);
AddRecipe("AddDamageApplier" + enemyType)
.Effect(new AddDamageEffect(5), EffectOn.Init)
.Data(new AddModifierCommonData<EnemyUnitType>(ModifierAddType.Applier, enemyType));
AddEnemySelfBuff("AddDamage", EnemyUnitType.Slime)
.Effect(new AddDamageEffect(5), EffectOn.Init);
AddRecipe("AddDamageAdvanced" + enemyType)
.Effect(new AddDamageEffect(5), EffectOn.Init)
.Data(new AddModifierCommonData<GoblinModifierActionType, EnemyUnitType>(
GoblinModifierActionType.OnSurrender, EnemyUnitType.Goblin));
Setup();

Unit.AddModifierSelf("AddDamage" + enemyType);

Assert.AreEqual(UnitDamage + 5, Unit.Damage);

var enemySelfModifiers = new List<int>();
foreach ((int id, var data) in ModifierRecipes.GetModifierData<AddModifierCommonData<EnemyUnitType>>())
var addModifierCommonData = ModifierRecipes.GetModifierData<AddModifierCommonData<EnemyUnitType>>();
Assert.AreEqual(addModifierCommonData.Length, 3);
Assert.AreEqual(addModifierCommonData.Count(d => d.Data.UnitType == enemyType), 2);
foreach ((int id, var data) in addModifierCommonData)
if (data.UnitType == enemyType && data.ModifierType == ModifierAddType.Self)
enemySelfModifiers.Add(id);

Expand Down

0 comments on commit 59c46e1

Please sign in to comment.