21 lines
680 B
C#
21 lines
680 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using PkmnLib.Dataloader.Models;
|
|
using PkmnLib.Static.Moves;
|
|
using PkmnLib.Static.Utils;
|
|
|
|
namespace PkmnLib.Dataloader;
|
|
|
|
internal static class CommonDataLoaderHelper
|
|
{
|
|
internal static ISecondaryEffect? ParseEffect(this SerializedMoveEffect? effect)
|
|
{
|
|
if (effect == null)
|
|
return null;
|
|
var name = effect.Name;
|
|
var chance = effect.Chance;
|
|
var parameters = effect.Parameters?.ToDictionary(x => (StringKey)x.Key, x => x.Value.ToParameter()) ??
|
|
new Dictionary<StringKey, object?>();
|
|
return new SecondaryEffectImpl(chance, name, parameters);
|
|
}
|
|
} |