diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index 4727fa54..1544a4a6 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -15,7 +15,8 @@ namespace NadekoBot.Classes.JSONModels public List Quotes { get; set; } = new List(); [JsonIgnore] - public List PokemonMoves { get; set; } = new List(); + public List PokemonTypes { get; set; } = new List(); + public List RotatingStatuses { get; set; } = new List(); public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel(); diff --git a/NadekoBot/Classes/JSONModels/PokeMove.cs b/NadekoBot/Classes/JSONModels/PokeMove.cs deleted file mode 100644 index 419009ea..00000000 --- a/NadekoBot/Classes/JSONModels/PokeMove.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NadekoBot.Classes.JSONModels -{ - public class PokeMove - { - public PokeMove(string n, string t) - { - name = n; - type = t; - } - public string name { get; set; } = ""; - public string type { get; set; } = ""; - } -} diff --git a/NadekoBot/Classes/JSONModels/PokemonType.cs b/NadekoBot/Classes/JSONModels/PokemonType.cs new file mode 100644 index 00000000..02e50e2f --- /dev/null +++ b/NadekoBot/Classes/JSONModels/PokemonType.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NadekoBot.Classes.JSONModels +{ + public class PokemonType + { + public PokemonType(string n, string i, string[] m, List multi) + { + Name = n; + Icon = i; + Moves = m; + Multipliers = multi; + } + public string Name { get; set; } + public List Multipliers { get; set; } + public string Icon { get; set; } + public string[] Moves { get; set; } + } + public class PokemonMultiplier + { + public PokemonMultiplier(string t, double m) + { + Type = t; + Multiplication = m; + } + public string Type { get; set; } + public double Multiplication { get; set; } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs index b52ee0f4..ffe60c5b 100644 --- a/NadekoBot/Modules/Pokemon/PokemonModule.cs +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -2,10 +2,9 @@ using Discord.Modules; using NadekoBot.Classes; using NadekoBot.Classes._DataModels; +using NadekoBot.Classes.JSONModels; using NadekoBot.Classes.Permissions; using NadekoBot.Extensions; -using NadekoBot.Modules.Pokemon.PokeTypes; -using NadekoBot.Modules.Pokemon.PokeTypes.Extensions; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -24,28 +23,52 @@ namespace NadekoBot.Modules.Pokemon } - private int GetDamage(PokeType usertype, PokeType targetType) + private int GetDamage(PokemonType usertype, PokemonType targetType) { var rng = new Random(); int damage = rng.Next(40, 60); - var multiplier = usertype.Multiplier(targetType); - damage = (int)(damage * multiplier); + foreach (PokemonMultiplier Multiplier in usertype.Multipliers) + { + if (Multiplier.Type == targetType.Name) + { + var multiplier = Multiplier.Multiplication; + damage = (int)(damage * multiplier); + } + } + return damage; } - private PokeType GetPokeType(ulong id) + private PokemonType GetPokeType(ulong id) { var db = DbHandler.Instance.GetAllRows(); Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); if (setTypes.ContainsKey((long)id)) { - return PokemonTypesMain.stringToPokeType(setTypes[(long)id])?? new PokemonTypes.NormalType(); + return stringToPokemonType(setTypes[(long)id]); } + int count = NadekoBot.Config.PokemonTypes.Count; - int remainder = Math.Abs((int)(id % 18)); + int remainder = Math.Abs((int)(id % (ulong) count)); - return PokemonTypesMain.IntToPokeType(remainder); + return NadekoBot.Config.PokemonTypes[remainder]; + } + + + + private PokemonType stringToPokemonType(string v) + { + var str = v.ToUpperInvariant(); + var list = NadekoBot.Config.PokemonTypes; + foreach (PokemonType p in list) + { + if (str == p.Name) + { + return p; + } + } + return null; } public override void Install(ModuleManager manager) @@ -111,9 +134,9 @@ namespace NadekoBot.Modules.Pokemon } //Check whether move can be used - PokeType userType = GetPokeType(e.User.Id); + PokemonType userType = GetPokeType(e.User.Id); - var enabledMoves = userType.GetMoves(); + var enabledMoves = userType.Moves; if (!enabledMoves.Contains(move.ToLowerInvariant())) { await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use `{Prefix}ml` to see moves you can use"); @@ -121,13 +144,13 @@ namespace NadekoBot.Modules.Pokemon } //get target type - PokeType targetType = GetPokeType(target.Id); + PokemonType targetType = GetPokeType(target.Id); //generate damage int damage = GetDamage(userType, targetType); //apply damage to target targetStats.Hp -= damage; - var response = $"{e.User.Mention} used **{move}**{userType.Image} on {target.Mention}{targetType.Image} for **{damage}** damage"; + var response = $"{e.User.Mention} used **{move}**{userType.Icon} on {target.Mention}{targetType.Icon} for **{damage}** damage"; //Damage type if (damage < 40) @@ -177,11 +200,11 @@ namespace NadekoBot.Modules.Pokemon .Do(async e => { var userType = GetPokeType(e.User.Id); - var movesList = userType.GetMoves(); + var movesList = userType.Moves; var str = $"**Moves for `{userType.Name}` type.**"; foreach (string m in movesList) { - str += $"\n{userType.Image}{m}"; + str += $"\n{userType.Icon}{m}"; } await e.Channel.SendMessage(str); }); @@ -253,7 +276,7 @@ namespace NadekoBot.Modules.Pokemon return; } var pType = GetPokeType(usr.Id); - await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.Name.ToLowerInvariant()}**{pType.Image}"); + await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.Name.ToLowerInvariant()}**{pType.Icon}"); }); @@ -265,7 +288,7 @@ namespace NadekoBot.Modules.Pokemon var targetTypeStr = e.GetArg("targetType")?.ToUpperInvariant(); if (string.IsNullOrWhiteSpace(targetTypeStr)) return; - var targetType = PokemonTypesMain.stringToPokeType(targetTypeStr); + var targetType = stringToPokemonType(targetTypeStr); if (targetType == null) { await e.Channel.SendMessage("Invalid type specified. Type must be one of:\nNORMAL, FIRE, WATER, ELECTRIC, GRASS, ICE, FIGHTING, POISON, GROUND, FLYING, PSYCHIC, BUG, ROCK, GHOST, DRAGON, DARK, STEEL"); @@ -273,7 +296,7 @@ namespace NadekoBot.Modules.Pokemon } if (targetType == GetPokeType(e.User.Id)) { - await e.Channel.SendMessage($"Your type is already {targetType.Name.ToLowerInvariant()}{targetType.Image}"); + await e.Channel.SendMessage($"Your type is already {targetType.Name.ToLowerInvariant()}{targetType.Icon}"); return; } @@ -303,7 +326,7 @@ namespace NadekoBot.Modules.Pokemon //Now for the response - await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeStr}{targetType.Image} for a {NadekoBot.Config.CurrencySign}"); + await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeStr}{targetType.Icon} for a {NadekoBot.Config.CurrencySign}"); }); }); } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs deleted file mode 100644 index 00da7d7c..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs +++ /dev/null @@ -1,38 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class BugType : PokeType - { - static readonly string name = "BUG"; - public static int numType = 11; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 0.5; - case "GRASS": return 2; - case "FIGHTING": return 0.5; - case "POISON": return 0.5; - case "FLYING": return 0.5; - case "GHOST": return 0.5; - case "PSYCHIC": return 2; - case "ROCK": return 0.5; - case "FAIRY": return 0.5; - case "DARK": return 2; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "🐛"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs deleted file mode 100644 index 2b9287ed..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs +++ /dev/null @@ -1,32 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class DarkType : PokeType - { - static readonly string name = "DARK"; - public static int numType = 15; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIGHTING": return 0.5; - case "PSYCHIC": return 2; - case "GHOST": return 2; - case "DARK": return 0.5; - case "FAIRY": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "🕶"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs deleted file mode 100644 index ae448af9..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs +++ /dev/null @@ -1,35 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class DragonType : PokeType - { - static readonly string name = "DRAGON"; - public static int numType = 14; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "DRAGON": return 2; - case "STEEL": return 0.5; - case "FAIRY": return 0; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - - - public string Image => "🐉"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs deleted file mode 100644 index 9e44767e..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs +++ /dev/null @@ -1,37 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class ElectricType : PokeType - { - static readonly string name = "ELECTRIC"; - public static int numType = 3; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "WATER": return 2; - case "ELECTRIC": return 0.5; - case "GRASS": return 2; - case "GROUND": return 0; - case "FLYING": return 2; - case "DRAGON": return 0.5; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - - public string Image => "⚡️"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FairyType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FairyType.cs deleted file mode 100644 index 17c40b93..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FairyType.cs +++ /dev/null @@ -1,33 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class FairyType : PokeType - { - static readonly string name = "FAIRY"; - public static int numType = 17; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIGHTING": return 2; - case "FIRE": return 0.5; - case "DARK": return 0.5; - case "POISON": return 0.5; - case "STEEL": return 2; - case "DRAGON": return 2; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "💫"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs deleted file mode 100644 index a972595f..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs +++ /dev/null @@ -1,42 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class FightingType : PokeType - { - static readonly string name = "FIGHTING"; - public static int numType = 6; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "NORMAL": return 2; - case "ICE": return 2; - case "POISON": return 0.5; - case "FLYING": return 0.5; - case "PSYCHIC": return 0.5; - case "BUG": return 0.5; - case "ROCK": return 2; - case "GHOST": return 0; - case "DARK": return 2; - case "STEEL": return 2; - case "FAIRY": return 0.5; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - - public string Image => "✊"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs deleted file mode 100644 index 4504f7c7..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs +++ /dev/null @@ -1,36 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - - - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class FireType : PokeType - { - static readonly string name = "FIRE"; - public static int numType = 1; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 0.5; - case "WATER": return 0.5; - case "GRASS": return 2; - case "ICE": return 2; - case "BUG": return 2; - case "ROCK": return 0.5; - case "DRAGON": return 0.5; - case "STEEL": return 2; - default: return 1; - } - } - List moves = new List(); - public string Name => name; - - public string Image => "🔥"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs deleted file mode 100644 index afd65972..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs +++ /dev/null @@ -1,38 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class FlyingType : PokeType - { - static readonly string name = "FLYING"; - public static int numType = 9; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "ELECTRIC": return 0.5; - case "GRASS": return 2; - case "FIGHTING": return 2; - case "BUG": return 2; - case "ROCK": return 0.5; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - - - public string Image => "☁"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs deleted file mode 100644 index f902c403..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs +++ /dev/null @@ -1,37 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class GhostType : PokeType - { - static readonly string name = "GHOST"; - public static int numType = 13; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "NORMAL": return 0; - case "PSYCHIC": return 2; - case "GHOST": return 2; - case "DARK": return 0.5; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - - - public string Image => "👻"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs deleted file mode 100644 index f861c719..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs +++ /dev/null @@ -1,39 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class GrassType : PokeType - { - static readonly string name = "GRASS"; - public static int numType = 4; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 0.5; - case "WATER": return 0.5; - case "GRASS": return 2; - case "ICE": return 2; - case "BUG": return 2; - case "ROCK": return 0.5; - case "DRAGON": return 0.5; - case "STEEL": return 2; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - - public string Image => "🌿"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs deleted file mode 100644 index a09d398c..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs +++ /dev/null @@ -1,35 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class GroundType : PokeType - { - static readonly string name = "GROUND"; - public static int numType = 8; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 2; - case "ELECTRIC": return 2; - case "GRASS": return 0.5; - case "POISON": return 0.5; - case "FLYING": return 0; - case "BUG": return 0.5; - case "ROCK": return 2; - case "STEEL": return 2; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "🗻"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs deleted file mode 100644 index d06b8227..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs +++ /dev/null @@ -1,28 +0,0 @@ -using NadekoBot.Classes; -using NadekoBot.Classes._DataModels; -using NadekoBot.Classes.JSONModels; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions -{ - public static class IPokeTypeExtensions - { - public static List GetMoves(this PokeType poketype) - { - var moveSet = NadekoBot.Config.PokemonMoves; - List moves = new List(); - foreach (PokeMove p in moveSet) - { - if (p.type == poketype.Name) - { - if (!moves.Contains(p.name)) - { - moves.Add(p.name); - } - } - } - return moves; - } - } - -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs deleted file mode 100644 index 2afc203d..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs +++ /dev/null @@ -1,35 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class IceType : PokeType - { - static readonly string name = "ICE"; - public static int numType = 5; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 0.5; - case "WATER": return 0.5; - case "GRASS": return 2; - case "ICE": return 0.5; - case "GROUND": return 2; - case "FLYING": return 2; - case "DRAGON": return 2; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "❄"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs deleted file mode 100644 index 1554ddbe..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs +++ /dev/null @@ -1,30 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class NormalType : PokeType - { - static readonly string name = "NORMAL"; - public static int type_num = 0; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - case "ROCK": return 0.5; - case "GHOST": return 0; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "⭕️"; - - public int Num => type_num; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs deleted file mode 100644 index ab1a0e3e..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs +++ /dev/null @@ -1,34 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class PoisonType : PokeType - { - static readonly string name = "POISON"; - public static int numType = 7; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "GRASS": return 2; - case "POISON": return 0.5; - case "GROUND": return 0.5; - case "ROCK": return 0.5; - case "GHOST": return 0.5; - case "STEEL": return 0; - case "FAIRY": return 2; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "☠"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs deleted file mode 100644 index 36db3a9c..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs +++ /dev/null @@ -1,65 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokemonTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokeTypes -{ - public interface PokeType - { - string Image { get; } - string Name { get; } - int Num { get; } - double Multiplier(PokeType target); - } - public class PokemonTypesMain - { - - public static PokeType stringToPokeType(string newType) - { - - foreach (PokeType t in TypeList) - { - if (t.Name == newType.ToUpperInvariant()) - { - return t; - } - } - return new NormalType(); - } - - //These classes can use all methods (except getMoves) - public static List TypeList = new List() - { - new NormalType(), - new FireType(), - new WaterType(), - new ElectricType(), - new GrassType(), - new IceType(), - new FightingType(), - new PoisonType(), - new GroundType(), - new FlyingType(), - new PsychicType(), - new BugType(), - new RockType(), - new GhostType(), - new DragonType(), - new DarkType(), - new SteelType(), - new FairyType() - }; - - public static PokeType IntToPokeType(int id) - { - foreach (PokeType t in TypeList) - { - if (t.Num == id) - { - return t; - } - } - return null; - } - - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs deleted file mode 100644 index e675091f..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs +++ /dev/null @@ -1,35 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class PsychicType : PokeType - { - static readonly string name = "PSYCHIC"; - public static int numType = 10; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIGHTING": return 2; - case "POISON": return 2; - case "PSYCHIC": return 0.5; - case "DARK": return 0; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - - - - public string Name => name; - - public string Image => "🔮"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs deleted file mode 100644 index eafd1803..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs +++ /dev/null @@ -1,34 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class RockType : PokeType - { - static readonly string name = "ROCK"; - public static int numType = 12; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 2; - case "ICE": return 2; - case "FIGHTING": return 0.5; - case "GROUND": return 0.5; - case "FLYING": return 2; - case "BUG": return 2; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "💎"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs deleted file mode 100644 index 73427039..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs +++ /dev/null @@ -1,33 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class SteelType : PokeType - { - static readonly string name = "STEEL"; - public static int numType = 16; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 0.5; - case "WATER": return 0.5; - case "ELECTRIC": return 0.5; - case "ICE": return 2; - case "ROCK": return 2; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "🔩"; - - public int Num => numType; - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs deleted file mode 100644 index 2b6c49d8..00000000 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs +++ /dev/null @@ -1,33 +0,0 @@ -using NadekoBot.Modules.Pokemon.PokeTypes; -using System.Collections.Generic; - -namespace NadekoBot.Modules.Pokemon.PokemonTypes -{ - class WaterType : PokeType - { - static readonly string name = "WATER"; - public static int numType = 2; - - public double Multiplier(PokeType target) - { - switch (target.Name) - { - - case "FIRE": return 2; - case "WATER": return 0.5; - case "GRASS": return 0.5; - case "GROUND": return 2; - case "ROCK": return 2; - case "DRAGON": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public string Name => name; - - public string Image => "💦"; - - public int Num => numType; - } -} diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index f6e1fa31..9e5b06b2 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -66,7 +66,7 @@ namespace NadekoBot { Config = JsonConvert.DeserializeObject(File.ReadAllText("data/config.json")); Config.Quotes = JsonConvert.DeserializeObject>(File.ReadAllText("data/quotes.json")); - Config.PokemonMoves = JsonConvert.DeserializeObject>(File.ReadAllText("data/moves.json")); + Config.PokemonTypes = JsonConvert.DeserializeObject>(File.ReadAllText("data/PokemonTypes.json")); } catch { diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index d444273c..26d675a1 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -131,7 +131,7 @@ - + @@ -200,26 +200,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/NadekoBot/bin/Debug/data/PokemonTypes.json b/NadekoBot/bin/Debug/data/PokemonTypes.json new file mode 100644 index 00000000..750044f1 --- /dev/null +++ b/NadekoBot/bin/Debug/data/PokemonTypes.json @@ -0,0 +1,695 @@ +[ + { + "Name": "NORMAL", + "Multipliers": [ + { + "Type": "ROCK", + "Multiplication": 0.5 + }, + { + "Type": "GHOST", + "Multiplication": 0 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "sonic boom", + "quick attack", + "doubleslap", + "headbutt" + ], + "Icon": "⭕️" + }, + { + "Name": "FIRE", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 0.5 + }, + { + "Type": "WATER", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "ICE", + "Multiplication": 2 + }, + { + "Type": "BUG", + "Multiplication": 2 + }, + { + "Type": "ROCK", + "Multiplication": 0.5 + }, + { + "Type": "DRAGON", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 2 + } + ], + "Moves": [ + "incinerate", + "ember", + "fire punch", + "fiery dance" + ], + "Icon": "🔥" + }, + { + "Name": "WATER", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 2 + }, + { + "Type": "WATER", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 0.5 + }, + { + "Type": "GROUND", + "Multiplication": 2 + }, + { + "Type": "ROCK", + "Multiplication": 2 + }, + { + "Type": "DRAGON", + "Multiplication": 0.5 + } + ], + "Moves": [ + "bubblebeam", + "dive", + "whirlpool", + "aqua tail" + ], + "Icon": "💦" + }, + { + "Name": "ELECTRIC", + "Multipliers": [ + { + "Type": "WATER", + "Multiplication": 2 + }, + { + "Type": "ELECTRIC", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "GROUND", + "Multiplication": 0 + }, + { + "Type": "FLYING", + "Multiplication": 2 + }, + { + "Type": "DRAGON", + "Multiplication": 0.5 + } + ], + "Moves": [ + "nuzzle", + "thunderbolt", + "thundershock", + "discharge" + ], + "Icon": "⚡" + }, + { + "Name": "GRASS", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 0.5 + }, + { + "Type": "WATER", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "ICE", + "Multiplication": 2 + }, + { + "Type": "BUG", + "Multiplication": 2 + }, + { + "Type": "ROCK", + "Multiplication": 0.5 + }, + { + "Type": "DRAGON", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 2 + } + ], + "Moves": [ + "absorb", + "mega drain", + "vine whip", + "razor leaf" + ], + "Icon": "🌿" + }, + { + "Name": "ICE", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 0.5 + }, + { + "Type": "WATER", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "ICE", + "Multiplication": 0.5 + }, + { + "Type": "GROUND", + "Multiplication": 2 + }, + { + "Type": "FLYING", + "Multiplication": 2 + }, + { + "Type": "DRAGON", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "ice ball", + "powder snow", + "avalanche", + "icy wind" + ], + "Icon": "❄" + }, + { + "Name": "FIGHTING", + "Multipliers": [ + { + "Type": "NORMAL", + "Multiplication": 2 + }, + { + "Type": "ICE", + "Multiplication": 2 + }, + { + "Type": "POISON", + "Multiplication": 0.5 + }, + { + "Type": "FLYING", + "Multiplication": 0.5 + }, + { + "Type": "PSYCHIC", + "Multiplication": 0.5 + }, + { + "Type": "BUG", + "Multiplication": 0.5 + }, + { + "Type": "ROCK", + "Multiplication": 2 + }, + { + "Type": "GHOST", + "Multiplication": 0 + }, + { + "Type": "DARK", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 2 + }, + { + "Type": "FAIRY", + "Multiplication": 0.5 + } + ], + "Moves": [ + "low kick", + "force palm", + "mach punch", + "double kick" + ], + "Icon": "✊" + }, + { + "Name": "POISON", + "Multipliers": [ + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "POISON", + "Multiplication": 0.5 + }, + { + "Type": "GROUND", + "Multiplication": 0.5 + }, + { + "Type": "ROCK", + "Multiplication": 0.5 + }, + { + "Type": "GHOST", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 0 + }, + { + "Type": "FAIRY", + "Multiplication": 2 + } + ], + "Moves": [ + "acid", + "smog", + "sludge", + "poison jab" + ], + "Icon": "☠" + }, + { + "Name": "GROUND", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 2 + }, + { + "Type": "ELECTRIC", + "Multiplication": 2 + }, + { + "Type": "GRASS", + "Multiplication": 0.5 + }, + { + "Type": "POISON", + "Multiplication": 0.5 + }, + { + "Type": "FLYING", + "Multiplication": 0 + }, + { + "Type": "BUG", + "Multiplication": 0.5 + }, + { + "Type": "ROCK", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 2 + } + ], + "Moves": [ + "mud-slap", + "earthquake", + "bulldoze", + "dig" + ], + "Icon": "🗻" + }, + { + "Name": "FLYING", + "Multipliers": [ + { + "Type": "ELECTRIC", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "FIGHTING", + "Multiplication": 2 + }, + { + "Type": "BUG", + "Multiplication": 2 + }, + { + "Type": "ROCK", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "peck", + "pluck", + "gust", + "aerial ace" + ], + "Icon": "☁" + }, + { + "Name": "PSYCHIC", + "Multipliers": [ + { + "Type": "FIGHTING", + "Multiplication": 2 + }, + { + "Type": "POISON", + "Multiplication": 2 + }, + { + "Type": "PSYCHIC", + "Multiplication": 0.5 + }, + { + "Type": "DARK", + "Multiplication": 0 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "confusion", + "psybeam", + "psywave", + "heart stamp" + ], + "Icon": "🔮" + }, + { + "Name": "BUG", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 0.5 + }, + { + "Type": "GRASS", + "Multiplication": 2 + }, + { + "Type": "FIGHTING", + "Multiplication": 0.5 + }, + { + "Type": "POISON", + "Multiplication": 0.5 + }, + { + "Type": "FLYING", + "Multiplication": 0.5 + }, + { + "Type": "PSYCHIC", + "Multiplication": 2 + }, + { + "Type": "ROCK", + "Multiplication": 0.5 + }, + { + "Type": "DARK", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + }, + { + "Type": "FAIRY", + "Multiplication": 0.5 + } + ], + "Moves": [ + "bug bite", + "infestation", + "x-scissors", + "twineedle" + ], + "Icon": "🐛" + }, + { + "Name": "ROCK", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 2 + }, + { + "Type": "ICE", + "Multiplication": 2 + }, + { + "Type": "FIGHTING", + "Multiplication": 0.5 + }, + { + "Type": "GROUND", + "Multiplication": 0.5 + }, + { + "Type": "FLYING", + "Multiplication": 2 + }, + { + "Type": "BUG", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "rock throw", + "rollout", + "rock tomb", + "rock blast" + ], + "Icon": "💎" + }, + { + "Name": "GHOST", + "Multipliers": [ + { + "Type": "NORMAL", + "Multiplication": 0 + }, + { + "Type": "PSYCHIC", + "Multiplication": 2 + }, + { + "Type": "GHOST", + "Multiplication": 2 + }, + { + "Type": "DARK", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "astonish", + "night shade", + "lick", + "ominous wind", + "hex" + ], + "Icon": "👻" + }, + { + "Name": "DRAGON", + "Multipliers": [ + { + "Type": "DRAGON", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + }, + { + "Type": "FAIRY", + "Multiplication": 0 + } + ], + "Moves": [ + "dragon tail", + "dragon rage", + "dragonbreath", + "twister" + ], + "Icon": "🐉" + }, + { + "Name": "DARK", + "Multipliers": [ + { + "Type": "FIGHTING", + "Multiplication": 0.5 + }, + { + "Type": "PSYCHIC", + "Multiplication": 2 + }, + { + "Type": "GHOST", + "Multiplication": 2 + }, + { + "Type": "DARK", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + }, + { + "Type": "FAIRY", + "Multiplication": 0.5 + } + ], + "Moves": [ + "pursuit", + "assurance", + "bite", + "faint attack" + ], + "Icon": "🕶" + }, + { + "Name": "STEEL", + "Multipliers": [ + { + "Type": "FIRE", + "Multiplication": 0.5 + }, + { + "Type": "WATER", + "Multiplication": 0.5 + }, + { + "Type": "ELECTRIC", + "Multiplication": 0.5 + }, + { + "Type": "ICE", + "Multiplication": 2 + }, + { + "Type": "ROCK", + "Multiplication": 2 + }, + { + "Type": "STEEL", + "Multiplication": 0.5 + } + ], + "Moves": [ + "bullet punch", + "metal burst", + "gear grind", + "magnet bomb" + ], + "Icon": "🔩" + }, + { + "Name": "FAIRY", + "Multipliers": [ + { + "Type": "FIGHTING", + "Multiplication": 2 + }, + { + "Type": "FIRE", + "Multiplication": 0.5 + }, + { + "Type": "DARK", + "Multiplication": 0.5 + }, + { + "Type": "POISON", + "Multiplication": 0.5 + }, + { + "Type": "STEEL", + "Multiplication": 2 + }, + { + "Type": "DRAGON", + "Multiplication": 2 + } + ], + "Moves": [ + "fairy wind", + "draining kiss", + "dazzling gleam", + "play rough" + ], + "Icon": "💫" + } +] \ No newline at end of file diff --git a/NadekoBot/bin/Debug/data/moves.json b/NadekoBot/bin/Debug/data/moves.json deleted file mode 100644 index 5814f5cd..00000000 --- a/NadekoBot/bin/Debug/data/moves.json +++ /dev/null @@ -1,294 +0,0 @@ -[ - { - "name": "sonic boom", - "type": "NORMAL" - }, - { - "name": "quick attack", - "type": "NORMAL" - }, - { - "name": "doubleslap", - "type": "NORMAL" - }, - { - "name": "headbutt", - "type": "NORMAL" - }, - { - "name": "incinerate", - "type": "FIRE" - }, - { - "name": "ember", - "type": "FIRE" - }, - { - "name": "fire punch", - "type": "FIRE" - }, - { - "name": "fiery dance", - "type": "FIRE" - }, - { - "name": "bubblebeam", - "type": "WATER" - }, - { - "name": "dive", - "type": "WATER" - }, - { - "name": "whirlpool", - "type": "WATER" - }, - { - "name": "aqua tail", - "type": "WATER" - }, - { - "name": "nuzzle", - "type": "ELECTRIC" - }, - { - "name": "thunderbolt", - "type": "ELECTRIC" - }, - { - "name": "thundershock", - "type": "ELECTRIC" - }, - { - "name": "discharge", - "type": "ELECTRIC" - }, - { - "name": "absorb", - "type": "GRASS" - }, - { - "name": "mega drain", - "type": "GRASS" - }, - { - "name": "vine whip", - "type": "GRASS" - }, - { - "name": "razor leaf", - "type": "GRASS" - }, - { - "name": "ice ball", - "type": "ICE" - }, - { - "name": "powder snow", - "type": "ICE" - }, - { - "name": "avalanche", - "type": "ICE" - }, - { - "name": "icy wind", - "type": "ICE" - }, - { - "name": "low kick", - "type": "FIGHTING" - }, - { - "name": "force palm", - "type": "FIGHTING" - }, - { - "name": "mach punch", - "type": "FIGHTING" - }, - { - "name": "double kick", - "type": "FIGHTING" - }, - { - "name": "acid", - "type": "POISON" - }, - { - "name": "smog", - "type": "POISON" - }, - { - "name": "sludge", - "type": "POISON" - }, - { - "name": "poison jab", - "type": "POISON" - }, - { - "name": "mud-slap", - "type": "GROUND" - }, - { - "name": "boomerang", - "type": "GROUND" - }, - { - "name": "bulldoze", - "type": "GROUND" - }, - { - "name": "dig", - "type": "GROUND" - }, - { - "name": "peck", - "type": "FLY" - }, - { - "name": "pluck", - "type": "FLY" - }, - { - "name": "gust", - "type": "FLY" - }, - { - "name": "aerial ace", - "type": "FLY" - }, - { - "name": "confusion", - "type": "PSYCHIC" - }, - { - "name": "psybeam", - "type": "PSYCHIC" - }, - { - "name": "psywave", - "type": "PSYCHIC" - }, - { - "name": "heart stamp", - "type": "PSYCHIC" - }, - { - "name": "bug bite", - "type": "BUG" - }, - { - "name": "infestation", - "type": "BUG" - }, - { - "name": "x-scissor", - "type": "BUG" - }, - { - "name": "twineedle", - "type": "BUG" - }, - { - "name": "rock throw", - "type": "ROCK" - }, - { - "name": "rollout", - "type": "ROCK" - }, - { - "name": "rock tomb", - "type": "ROCK" - }, - { - "name": "rock blast", - "type": "ROCK" - }, - { - "name": "astonish", - "type": "GHOST" - }, - { - "name": "night shade", - "type": "GHOST" - }, - { - "name": "lick", - "type": "GHOST" - }, - { - "name": "ominous wind", - "type": "GHOST" - }, - { - "name": "hex", - "type": "GHOST" - }, - { - "name": "dragon tail", - "type": "DRAGON" - }, - { - "name": "dragon rage", - "type": "DRAGON" - }, - { - "name": "dragonbreath", - "type": "DRAGON" - }, - { - "name": "twister", - "type": "DRAGON" - }, - { - "name": "pursuit", - "type": "DARK" - }, - { - "name": "assurance", - "type": "DARK" - }, - { - "name": "bite", - "type": "DARK" - }, - { - "name": "faint attack", - "type": "DARK" - }, - { - "name": "bullet punch", - "type": "STEEL" - }, - { - "name": "metal burst", - "type": "STEEL" - }, - { - "name": "gear grind", - "type": "STEEL" - }, - { - "name": "magnet bomb", - "type": "STEEL" - }, - { - "name": "fairy wind", - "type": "FAIRY" - }, - { - "name": "draining kiss", - "type": "FAIRY" - }, - { - "name": "dazzling gleam", - "type": "FAIRY" - }, - { - "name": "play rough", - "type": "FAIRY" - } - ] \ No newline at end of file