From 4a758b412f2333acace12e51cc70469411578a5f Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 2 Apr 2016 22:18:44 +0200 Subject: [PATCH 1/3] Removed hardcoded pokemoves --- NadekoBot/Modules/Pokemon/DefaultMoves.cs | 91 ---------------------- NadekoBot/Modules/Pokemon/PokemonModule.cs | 8 +- NadekoBot/NadekoBot.csproj | 1 - 3 files changed, 1 insertion(+), 99 deletions(-) delete mode 100644 NadekoBot/Modules/Pokemon/DefaultMoves.cs diff --git a/NadekoBot/Modules/Pokemon/DefaultMoves.cs b/NadekoBot/Modules/Pokemon/DefaultMoves.cs deleted file mode 100644 index 4cdba343..00000000 --- a/NadekoBot/Modules/Pokemon/DefaultMoves.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NadekoBot.Modules.Pokemon -{ - class DefaultMoves - { - - public static Dictionary DefaultMovesList = new Dictionary() - { - {"sonic boom",0}, - {"quick attack",0}, - {"doubleslap",0}, - {"headbutt",0}, - {"incinerate",1}, - {"ember",1}, - {"fire punch",1}, - {"fiery dance",1}, - {"bubblebeam",2}, - {"dive",2}, - {"whirlpool",2}, - {"aqua tail",2}, - {"nuzzle",3}, - {"thunderbolt",3}, - {"thundershock",3}, - {"discharge",3}, - {"absorb",4}, - {"mega drain",4}, - {"vine whip",4}, - {"razor leaf",4}, - {"ice ball",5}, - {"powder snow",5}, - {"avalanche",5}, - {"icy wind",5}, - {"low kick",6}, - {"force palm",6}, - {"mach punch",6}, - {"double kick",6}, - {"acid",7}, - {"smog",7}, - {"sludge",7}, - {"poison jab",7}, - {"mud-slap",8}, - {"boomerang",8}, - {"bulldoze",8}, - {"dig",8}, - {"peck",9}, - {"pluck",9}, - {"gust",9}, - {"aerial ace",9}, - {"confusion",10}, - {"psybeam",10}, - {"psywave",10}, - {"heart stamp",10}, - {"bug bite",11}, - {"infestation",11}, - {"x-scissor",11}, - {"twineedle",11}, - {"rock throw",12}, - {"rollout",12}, - {"rock tomb",12}, - {"rock blast",12}, - {"astonish",13}, - {"night shade",13}, - {"lick",13}, - {"ominous wind",13}, - {"hex",13}, - {"dragon tail",14}, - {"dragon rage",14}, - {"dragonbreath",14}, - {"twister",14}, - {"pursuit",15}, - {"assurance",15}, - {"bite",15}, - {"faint attack",15}, - {"bullet punch",16}, - {"metal burst",16}, - {"gear grind",16}, - {"magnet bomb",16}, - {"fairy wind",17}, - {"draining kiss",17}, - {"dazzling gleam",17}, - {"play rough",17} - }; - - - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs index ed181485..8ddf25e9 100644 --- a/NadekoBot/Modules/Pokemon/PokemonModule.cs +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -21,13 +21,7 @@ namespace NadekoBot.Modules.Pokemon public PokemonModule() { - DbHandler.Instance.DeleteAll(); - DbHandler.Instance.InsertMany( - DefaultMoves.DefaultMovesList.Select(move => new PokeMoves - { - move = move.Key, - type = move.Value - })); + } private int GetDamage(PokeType usertype, PokeType targetType) diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index 4d233b8c..c43cd975 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -199,7 +199,6 @@ - From ca1710158669bbc27cb56ee8fb64916978fd9d61 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 2 Apr 2016 23:17:42 +0200 Subject: [PATCH 2/3] moved PokemonMoves to their own json --- NadekoBot/Classes/DBHandler.cs | 1 - NadekoBot/Classes/JSONModels/Configuration.cs | 6 + NadekoBot/Classes/JSONModels/PokeMove.cs | 19 ++ NadekoBot/Classes/_DataModels/PokeTypes.cs | 2 +- NadekoBot/Classes/_DataModels/pokemoves.cs | 15 - NadekoBot/Modules/Pokemon/PokemonModule.cs | 10 +- .../PokemonTypes/IPokeTypeExtensions.cs | 11 +- .../Modules/Pokemon/PokemonTypes/PokeType.cs | 4 +- NadekoBot/NadekoBot.cs | 1 + NadekoBot/NadekoBot.csproj | 2 +- NadekoBot/bin/Debug/data/moves.json | 294 ++++++++++++++++++ 11 files changed, 335 insertions(+), 30 deletions(-) create mode 100644 NadekoBot/Classes/JSONModels/PokeMove.cs delete mode 100644 NadekoBot/Classes/_DataModels/pokemoves.cs create mode 100644 NadekoBot/bin/Debug/data/moves.json diff --git a/NadekoBot/Classes/DBHandler.cs b/NadekoBot/Classes/DBHandler.cs index c6488a27..a3063b38 100644 --- a/NadekoBot/Classes/DBHandler.cs +++ b/NadekoBot/Classes/DBHandler.cs @@ -26,7 +26,6 @@ namespace NadekoBot.Classes conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); - conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index 1bfcd92d..4727fa54 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -14,6 +14,9 @@ namespace NadekoBot.Classes.JSONModels [JsonIgnore] public List Quotes { get; set; } = new List(); + [JsonIgnore] + public List PokemonMoves { get; set; } = new List(); + public List RotatingStatuses { get; set; } = new List(); public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel(); public HashSet ServerBlacklist { get; set; } = new HashSet(); @@ -25,6 +28,7 @@ namespace NadekoBot.Classes.JSONModels 143515953525817344 }; + public string[] _8BallResponses { get; set; } = { "Most definitely yes", @@ -78,6 +82,7 @@ namespace NadekoBot.Classes.JSONModels public string CurrencySign { get; set; } = "🌸"; public string CurrencyName { get; set; } = "NadekoFlower"; + } public class CommandPrefixesModel @@ -127,4 +132,5 @@ namespace NadekoBot.Classes.JSONModels public override string ToString() => $"{Text}\n\t*-{Author}*"; } + } diff --git a/NadekoBot/Classes/JSONModels/PokeMove.cs b/NadekoBot/Classes/JSONModels/PokeMove.cs new file mode 100644 index 00000000..419009ea --- /dev/null +++ b/NadekoBot/Classes/JSONModels/PokeMove.cs @@ -0,0 +1,19 @@ +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/_DataModels/PokeTypes.cs b/NadekoBot/Classes/_DataModels/PokeTypes.cs index d4cceac2..0410eb7f 100644 --- a/NadekoBot/Classes/_DataModels/PokeTypes.cs +++ b/NadekoBot/Classes/_DataModels/PokeTypes.cs @@ -9,6 +9,6 @@ namespace NadekoBot.Classes._DataModels class UserPokeTypes : IDataModel { public long UserId { get; set; } - public int type { get; set; } + public string type { get; set; } } } diff --git a/NadekoBot/Classes/_DataModels/pokemoves.cs b/NadekoBot/Classes/_DataModels/pokemoves.cs deleted file mode 100644 index bacbed68..00000000 --- a/NadekoBot/Classes/_DataModels/pokemoves.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NadekoBot.Classes._DataModels -{ - class PokeMoves : IDataModel - { - public string move { get; set; } - public int type { get; set; } - public long UserId { get; internal set; } - } -} diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs index 8ddf25e9..b52ee0f4 100644 --- a/NadekoBot/Modules/Pokemon/PokemonModule.cs +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -37,10 +37,10 @@ namespace NadekoBot.Modules.Pokemon { var db = DbHandler.Instance.GetAllRows(); - Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); + Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); if (setTypes.ContainsKey((long)id)) { - return PokemonTypesMain.IntToPokeType(setTypes[(long)id]); + return PokemonTypesMain.stringToPokeType(setTypes[(long)id])?? new PokemonTypes.NormalType(); } int remainder = Math.Abs((int)(id % 18)); @@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Pokemon var enabledMoves = userType.GetMoves(); if (!enabledMoves.Contains(move.ToLowerInvariant())) { - await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use {Prefix}listmoves to see moves you can use"); + await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use `{Prefix}ml` to see moves you can use"); return; } @@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Pokemon .Do(async e => { var userType = GetPokeType(e.User.Id); - List movesList = userType.GetMoves(); + var movesList = userType.GetMoves(); var str = $"**Moves for `{userType.Name}` type.**"; foreach (string m in movesList) { @@ -298,7 +298,7 @@ namespace NadekoBot.Modules.Pokemon DbHandler.Instance.InsertData(new UserPokeTypes { UserId = (long)e.User.Id, - type = targetType.Num + type = targetType.Name }); //Now for the response diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs index 1b81790e..d06b8227 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs @@ -1,5 +1,6 @@ using NadekoBot.Classes; using NadekoBot.Classes._DataModels; +using NadekoBot.Classes.JSONModels; using System.Collections.Generic; namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions @@ -8,15 +9,15 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions { public static List GetMoves(this PokeType poketype) { - var db = DbHandler.Instance.GetAllRows(); + var moveSet = NadekoBot.Config.PokemonMoves; List moves = new List(); - foreach (PokeMoves p in db) + foreach (PokeMove p in moveSet) { - if (p.type == poketype.Num) + if (p.type == poketype.Name) { - if (!moves.Contains(p.move)) + if (!moves.Contains(p.name)) { - moves.Add(p.move); + moves.Add(p.name); } } } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs index efde0905..36db3a9c 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs @@ -18,12 +18,12 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes foreach (PokeType t in TypeList) { - if (t.Name == newType) + if (t.Name == newType.ToUpperInvariant()) { return t; } } - return null; + return new NormalType(); } //These classes can use all methods (except getMoves) diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 6442839f..f6e1fa31 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -66,6 +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")); } catch { diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index c43cd975..d444273c 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -131,6 +131,7 @@ + @@ -150,7 +151,6 @@ - diff --git a/NadekoBot/bin/Debug/data/moves.json b/NadekoBot/bin/Debug/data/moves.json new file mode 100644 index 00000000..5814f5cd --- /dev/null +++ b/NadekoBot/bin/Debug/data/moves.json @@ -0,0 +1,294 @@ +[ + { + "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 From 7f7215f6ec7b6d022b322aecb877fbbb3d59c166 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 3 Apr 2016 12:52:59 +0200 Subject: [PATCH 3/3] Moved PokemonTypes to json --- NadekoBot/Classes/JSONModels/Configuration.cs | 3 +- NadekoBot/Classes/JSONModels/PokeMove.cs | 19 - NadekoBot/Classes/JSONModels/PokemonType.cs | 33 + NadekoBot/Modules/Pokemon/PokemonModule.cs | 61 +- .../Modules/Pokemon/PokemonTypes/BugType.cs | 38 - .../Modules/Pokemon/PokemonTypes/DarkType.cs | 32 - .../Pokemon/PokemonTypes/Dragontype.cs | 35 - .../Pokemon/PokemonTypes/ElectricType.cs | 37 - .../Modules/Pokemon/PokemonTypes/FairyType.cs | 33 - .../Pokemon/PokemonTypes/FightingType.cs | 42 -- .../Modules/Pokemon/PokemonTypes/FireType.cs | 36 - .../Pokemon/PokemonTypes/FlyingType.cs | 38 - .../Modules/Pokemon/PokemonTypes/GhostType.cs | 37 - .../Modules/Pokemon/PokemonTypes/GrassType.cs | 39 - .../Pokemon/PokemonTypes/GroundType.cs | 35 - .../PokemonTypes/IPokeTypeExtensions.cs | 28 - .../Modules/Pokemon/PokemonTypes/IceType.cs | 35 - .../Pokemon/PokemonTypes/NormalType.cs | 30 - .../Pokemon/PokemonTypes/PoisonType.cs | 34 - .../Modules/Pokemon/PokemonTypes/PokeType.cs | 65 -- .../Pokemon/PokemonTypes/PsychicType.cs | 35 - .../Modules/Pokemon/PokemonTypes/RockType.cs | 34 - .../Modules/Pokemon/PokemonTypes/SteelType.cs | 33 - .../Modules/Pokemon/PokemonTypes/WaterType.cs | 33 - NadekoBot/NadekoBot.cs | 2 +- NadekoBot/NadekoBot.csproj | 22 +- NadekoBot/bin/Debug/data/PokemonTypes.json | 695 ++++++++++++++++++ NadekoBot/bin/Debug/data/moves.json | 294 -------- 28 files changed, 774 insertions(+), 1084 deletions(-) delete mode 100644 NadekoBot/Classes/JSONModels/PokeMove.cs create mode 100644 NadekoBot/Classes/JSONModels/PokemonType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FairyType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs delete mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs create mode 100644 NadekoBot/bin/Debug/data/PokemonTypes.json delete mode 100644 NadekoBot/bin/Debug/data/moves.json 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