Skip to content

Commit

Permalink
Use IAppliedMarkings<bool> and IAppliedMarkings<MarkingColor>
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey85 committed Jan 21, 2024
1 parent 6cd62b0 commit 5cb5d10
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Pkmds.Web/Extensions/PKMExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static int GetMarking(this PKM pokemon, int index)
{
if (pokemon is not IAppliedMarkings appliedMarkings)
{
throw new ArgumentException("Pokemon does not implement IAppliedMarkings", nameof(pokemon));
throw new ArgumentException("Pokémon does not implement IAppliedMarkings", nameof(pokemon));
}

if ((uint)index >= appliedMarkings.MarkingCount)
Expand All @@ -32,10 +32,9 @@ public static int GetMarking(this PKM pokemon, int index)

return pokemon switch
{
IAppliedMarkings7 markings7 => (int)markings7.GetMarking(index),
IAppliedMarkings4 markings4 => markings4.GetMarking(index) ? 1 : 0,
IAppliedMarkings3 markings3 => markings3.GetMarking(index) ? 1 : 0,
_ => throw new ArgumentException("Pokemon does not implement IAppliedMarkings", nameof(pokemon)),
IAppliedMarkings<bool> b => b.GetMarking(index) ? 1 : 0,
IAppliedMarkings<MarkingColor> c => (int)c.GetMarking(index),
_ => throw new ArgumentException("Pokémon does not implement IAppliedMarkings", nameof(pokemon)),
};
}
}

0 comments on commit 5cb5d10

Please sign in to comment.