using System; using System.Collections.Generic; using System.Globalization; using System.IO; using CsvHelper; namespace UPWG.Core { public class InvalidMoveException : Exception { public InvalidMoveException() { } public InvalidMoveException(string message) : base(message) { } } public enum MoveType { Strike, Aerial, Hold, Throw, Pin, } [Flags] public enum BodyParts { Arms = 1, Legs = 2, Head = 4, Body = 8, All = Arms | Legs | Head | Body, } public class Move { public string Name { get; set; } public MoveType Type { get; set; } public uint Rank { get; set; } // can it be done? public double BaseChance { get; set; } //public MomentumLevel RequiredMomentum { get; set; } public BodyParts PartsRestrained { get; set; } public BodyParts PartsUtilized { get; set; } // what does it do? public int BasePopularity { get; set; } public int BaseOffense { get; set; } } public static class MoveDatabase { public static readonly Dictionary Moves = new(); public static void Initialize() { using var reader = new StreamReader("Data/moves.csv"); using var csv = new CsvReader(reader, CultureInfo.InvariantCulture); var records = csv.GetRecords(); foreach (var record in records) { Moves[record.Name] = record; } } public static Move Lookup(string name) { return Moves[name]; } } }