Implements several more moves
This commit is contained in:
@@ -28,6 +28,8 @@ public interface IReadOnlyTypeLibrary
|
||||
/// This is equivalent to running get_single_effectiveness on each defending type, and multiplying the results with each other.
|
||||
/// </summary>
|
||||
float GetEffectiveness(TypeIdentifier attacking, IReadOnlyList<TypeIdentifier> defending);
|
||||
|
||||
IEnumerable<(TypeIdentifier type, float effectiveness)> GetAllEffectivenessFromAttacking(TypeIdentifier attacking);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -70,6 +72,17 @@ public class TypeLibrary : IReadOnlyTypeLibrary
|
||||
defending.Aggregate<TypeIdentifier, float>(1,
|
||||
(current, type) => current * GetSingleEffectiveness(attacking, type));
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(TypeIdentifier, float)> GetAllEffectivenessFromAttacking(TypeIdentifier attacking)
|
||||
{
|
||||
if (attacking.Value < 1 || attacking.Value > _effectiveness.Count)
|
||||
throw new ArgumentOutOfRangeException(nameof(attacking));
|
||||
for (var i = 0; i < _effectiveness.Count; i++)
|
||||
{
|
||||
yield return (new TypeIdentifier((byte)(i + 1)), _effectiveness[attacking.Value - 1][i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a new type in the library.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user