Even more moves

This commit is contained in:
2025-04-19 13:01:10 +02:00
parent c22ad1a793
commit 807acf1947
19 changed files with 505 additions and 19 deletions

View File

@@ -8533,7 +8533,10 @@
"contact",
"protect",
"mirror"
]
],
"effect": {
"name": "pursuit"
}
},
{
"name": "quash",
@@ -8547,7 +8550,10 @@
"flags": [
"protect",
"mirror"
]
],
"effect": {
"name": "quash"
}
},
{
"name": "quick_attack",
@@ -8563,6 +8569,7 @@
"protect",
"mirror"
]
// No secondary effect
},
{
"name": "quick_guard",
@@ -8575,7 +8582,10 @@
"category": "status",
"flags": [
"snatch"
]
],
"effect": {
"name": "quick_guard"
}
},
{
"name": "quiver_dance",
@@ -8589,7 +8599,15 @@
"flags": [
"snatch",
"dance"
]
],
"effect": {
"name": "change_multiple_user_stat_boosts",
"parameters": {
"specialAttack": 1,
"specialDefense": 1,
"speed": 1
}
}
},
{
"name": "rage",
@@ -8604,7 +8622,10 @@
"contact",
"protect",
"mirror"
]
],
"effect": {
"name": "rage"
}
},
{
"name": "rage_powder",
@@ -8617,7 +8638,10 @@
"category": "status",
"flags": [
"powder"
]
],
"effect": {
"name": "rage_powder"
}
},
{
"name": "rain_dance",
@@ -8628,7 +8652,10 @@
"priority": 0,
"target": "All",
"category": "status",
"flags": []
"flags": [],
"effect": {
"name": "rain_dance"
}
},
{
"name": "rapid_spin",
@@ -8643,7 +8670,10 @@
"contact",
"protect",
"mirror"
]
],
"effect": {
"name": "rapid_spin"
}
},
{
"name": "razor_leaf",
@@ -8657,7 +8687,10 @@
"flags": [
"protect",
"mirror"
]
],
"effect": {
"name": "increased_critical_stage"
}
},
{
"name": "razor_shell",
@@ -8672,7 +8705,14 @@
"contact",
"protect",
"mirror"
]
],
"effect": {
"name": "change_target_defense",
"chance": 50,
"parameters": {
"amount": -1
}
}
},
{
"name": "razor_wind",
@@ -8687,7 +8727,10 @@
"charge",
"protect",
"mirror"
]
],
"effect": {
"name": "razor_wind"
}
},
{
"name": "recover",
@@ -8701,7 +8744,13 @@
"flags": [
"snatch",
"heal"
]
],
"effect": {
"name": "heal_percent",
"parameters": {
"healPercent": 0.5
}
}
},
{
"name": "recycle",

View File

@@ -0,0 +1,107 @@
using Moq;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.Models.Choices;
namespace PkmnLib.Tests.Dynamic;
public class ChoiceQueueTests
{
[Test]
public async Task ChoiceQueue_MovePokemonChoiceNext()
{
var pokemon1 = new Mock<IPokemon>();
var pokemon2 = new Mock<IPokemon>();
var pokemon3 = new Mock<IPokemon>();
var pokemon4 = new Mock<IPokemon>();
var choice1 = new Mock<ITurnChoice>();
choice1.Setup(c => c.User).Returns(pokemon1.Object);
var choice2 = new Mock<ITurnChoice>();
choice2.Setup(c => c.User).Returns(pokemon2.Object);
var choice3 = new Mock<ITurnChoice>();
choice3.Setup(c => c.User).Returns(pokemon3.Object);
var choice4 = new Mock<ITurnChoice>();
choice4.Setup(c => c.User).Returns(pokemon4.Object);
var queue = new BattleChoiceQueue([choice1.Object, choice2.Object, choice3.Object, choice4.Object]);
var result = queue.MovePokemonChoiceNext(pokemon3.Object);
await Assert.That(result).IsTrue();
await Assert.That(queue.Dequeue()).IsEqualTo(choice3.Object);
}
[Test]
public async Task ChoiceQueue_MovePokemonChoiceNextFailsIfAlreadyExecuted()
{
var pokemon1 = new Mock<IPokemon>();
var pokemon2 = new Mock<IPokemon>();
var pokemon3 = new Mock<IPokemon>();
var pokemon4 = new Mock<IPokemon>();
var choice1 = new Mock<ITurnChoice>();
choice1.Setup(c => c.User).Returns(pokemon1.Object);
var choice2 = new Mock<ITurnChoice>();
choice2.Setup(c => c.User).Returns(pokemon2.Object);
var choice3 = new Mock<ITurnChoice>();
choice3.Setup(c => c.User).Returns(pokemon3.Object);
var choice4 = new Mock<ITurnChoice>();
choice4.Setup(c => c.User).Returns(pokemon4.Object);
var queue = new BattleChoiceQueue([choice1.Object, choice2.Object, choice3.Object, choice4.Object]);
queue.Dequeue();
var result = queue.MovePokemonChoiceNext(pokemon1.Object);
await Assert.That(result).IsFalse();
await Assert.That(queue.Dequeue()).IsEqualTo(choice2.Object);
}
[Test]
public async Task ChoiceQueue_MovePokemonChoiceLast()
{
var pokemon1 = new Mock<IPokemon>();
var pokemon2 = new Mock<IPokemon>();
var pokemon3 = new Mock<IPokemon>();
var pokemon4 = new Mock<IPokemon>();
var choice1 = new Mock<ITurnChoice>();
choice1.Setup(c => c.User).Returns(pokemon1.Object);
var choice2 = new Mock<ITurnChoice>();
choice2.Setup(c => c.User).Returns(pokemon2.Object);
var choice3 = new Mock<ITurnChoice>();
choice3.Setup(c => c.User).Returns(pokemon3.Object);
var choice4 = new Mock<ITurnChoice>();
choice4.Setup(c => c.User).Returns(pokemon4.Object);
var queue = new BattleChoiceQueue([choice1.Object, choice2.Object, choice3.Object, choice4.Object]);
var result = queue.MovePokemonChoiceLast(pokemon2.Object);
await Assert.That(result).IsTrue();
await Assert.That(queue.Dequeue()).IsEqualTo(choice1.Object);
await Assert.That(queue.Dequeue()).IsEqualTo(choice3.Object);
await Assert.That(queue.Dequeue()).IsEqualTo(choice4.Object);
await Assert.That(queue.Dequeue()).IsEqualTo(choice2.Object);
}
[Test]
public async Task ChoiceQueue_MovePokemonChoiceLastFailsIfAlreadyExecuted()
{
var pokemon1 = new Mock<IPokemon>();
var pokemon2 = new Mock<IPokemon>();
var pokemon3 = new Mock<IPokemon>();
var pokemon4 = new Mock<IPokemon>();
var choice1 = new Mock<ITurnChoice>();
choice1.Setup(c => c.User).Returns(pokemon1.Object);
var choice2 = new Mock<ITurnChoice>();
choice2.Setup(c => c.User).Returns(pokemon2.Object);
var choice3 = new Mock<ITurnChoice>();
choice3.Setup(c => c.User).Returns(pokemon3.Object);
var choice4 = new Mock<ITurnChoice>();
choice4.Setup(c => c.User).Returns(pokemon4.Object);
var queue = new BattleChoiceQueue([choice1.Object, choice2.Object, choice3.Object, choice4.Object]);
queue.Dequeue();
var result = queue.MovePokemonChoiceLast(pokemon1.Object);
await Assert.That(result).IsFalse();
await Assert.That(queue.Dequeue()).IsEqualTo(choice2.Object);
await Assert.That(queue.Dequeue()).IsEqualTo(choice3.Object);
await Assert.That(queue.Dequeue()).IsEqualTo(choice4.Object);
}
}

View File

@@ -10,18 +10,19 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CSPath" Version="0.0.4" />
<PackageReference Include="Moq" Version="4.20.70"/>
<PackageReference Include="CSPath" Version="0.0.4"/>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="TUnit" Version="0.5.18" />
<PackageReference Include="System.Linq.Async" Version="6.0.1"/>
<PackageReference Include="TUnit" Version="0.5.18"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PkmnLib.Dataloader\PkmnLib.Dataloader.csproj"/>
<ProjectReference Include="..\PkmnLib.Dynamic\PkmnLib.Dynamic.csproj"/>
<ProjectReference Include="..\PkmnLib.Static\PkmnLib.Static.csproj"/>
<ProjectReference Include="..\Plugins\PkmnLib.Plugin.Gen7\PkmnLib.Plugin.Gen7.csproj" />
<ProjectReference Include="..\Plugins\PkmnLib.Plugin.Gen7\PkmnLib.Plugin.Gen7.csproj"/>
</ItemGroup>
<ItemGroup>
@@ -42,7 +43,7 @@
</Target>
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".." />
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High"/>
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".."/>
</Target>
</Project>