Implements dataloading
This commit is contained in:
@@ -77,7 +77,7 @@ public class TypeLibrary : IReadOnlyTypeLibrary
|
||||
{
|
||||
var id = new TypeIdentifier((byte)( _types.Count + 1));
|
||||
_types.Add(name, id);
|
||||
_effectiveness.Add(new List<float>(_types.Count));
|
||||
_effectiveness.Add(Enumerable.Repeat(1.0f, _effectiveness.Count).ToList());
|
||||
foreach (var list in _effectiveness)
|
||||
{
|
||||
list.Add(1);
|
||||
|
||||
@@ -20,14 +20,14 @@ public interface ISecondaryEffect
|
||||
/// <summary>
|
||||
/// Parameters for the effect.
|
||||
/// </summary>
|
||||
public IReadOnlyDictionary<StringKey, object> Parameters { get; }
|
||||
public IReadOnlyDictionary<StringKey, object?> Parameters { get; }
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public class SecondaryEffectImpl : ISecondaryEffect
|
||||
{
|
||||
/// <inheritdoc cref="SecondaryEffectImpl" />
|
||||
public SecondaryEffectImpl(float chance, StringKey name, IReadOnlyDictionary<StringKey, object> parameters)
|
||||
public SecondaryEffectImpl(float chance, StringKey name, IReadOnlyDictionary<StringKey, object?> parameters)
|
||||
{
|
||||
Chance = chance;
|
||||
Name = name;
|
||||
@@ -41,5 +41,5 @@ public class SecondaryEffectImpl : ISecondaryEffect
|
||||
public StringKey Name { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyDictionary<StringKey, object> Parameters { get; }
|
||||
public IReadOnlyDictionary<StringKey, object?> Parameters { get; }
|
||||
}
|
||||
@@ -11,19 +11,19 @@ public interface IAbility : INamedValue
|
||||
/// The name of the script effect of the ability. This should refer to the name of the script that will be executed
|
||||
/// when the ability is triggered.
|
||||
/// </summary>
|
||||
StringKey Effect { get; }
|
||||
StringKey? Effect { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The parameters for the script effect of the ability.
|
||||
/// </summary>
|
||||
IReadOnlyDictionary<StringKey, object> Parameters { get; }
|
||||
IReadOnlyDictionary<StringKey, object?> Parameters { get; }
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public class AbilityImpl : IAbility
|
||||
{
|
||||
/// <inheritdoc cref="AbilityImpl" />
|
||||
public AbilityImpl(StringKey name, StringKey effect, IReadOnlyDictionary<StringKey, object> parameters)
|
||||
public AbilityImpl(StringKey name, StringKey? effect, IReadOnlyDictionary<StringKey, object?> parameters)
|
||||
{
|
||||
Name = name;
|
||||
Effect = effect;
|
||||
@@ -34,10 +34,10 @@ public class AbilityImpl : IAbility
|
||||
public StringKey Name { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public StringKey Effect { get; }
|
||||
public StringKey? Effect { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyDictionary<StringKey, object> Parameters { get; }
|
||||
public IReadOnlyDictionary<StringKey, object?> Parameters { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ public record LevelEvolution : IEvolution
|
||||
/// <summary>
|
||||
/// The level at which the Pokémon evolves.
|
||||
/// </summary>
|
||||
public required uint Level { get; init; }
|
||||
public required LevelInt Level { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
@@ -35,7 +35,7 @@ public record LevelGenderEvolution : IEvolution
|
||||
/// <summary>
|
||||
/// The level at which the Pokémon evolves.
|
||||
/// </summary>
|
||||
public required uint Level { get; init; }
|
||||
public required LevelInt Level { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The gender the Pokémon needs to have to evolve
|
||||
@@ -227,7 +227,7 @@ public record CustomEvolution : IEvolution
|
||||
/// <summary>
|
||||
/// The parameters of the custom evolution method.
|
||||
/// </summary>
|
||||
public required IReadOnlyDictionary<StringKey, object> Parameters { get; init; }
|
||||
public required IReadOnlyDictionary<StringKey, object?> Parameters { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
|
||||
@@ -114,8 +114,6 @@ public class FormImpl : IForm
|
||||
throw new ArgumentException("A form must have at least one type.");
|
||||
if (Abilities.Count == 0)
|
||||
throw new ArgumentException("A form must have at least one ability.");
|
||||
if (HiddenAbilities.Count == 0)
|
||||
throw new ArgumentException("A form must have at least one hidden ability.");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user