Merge pull request #178 from appelemac/magic-items

Externalized pokemon data
This commit is contained in:
Master Kwoth 2016-04-03 21:26:04 +02:00
commit ac93aa1dba
30 changed files with 784 additions and 887 deletions

View File

@ -26,7 +26,6 @@ namespace NadekoBot.Classes
conn.CreateTable<CurrencyState>(); conn.CreateTable<CurrencyState>();
conn.CreateTable<CurrencyTransaction>(); conn.CreateTable<CurrencyTransaction>();
conn.CreateTable<Donator>(); conn.CreateTable<Donator>();
conn.CreateTable<PokeMoves>();
conn.CreateTable<UserPokeTypes>(); conn.CreateTable<UserPokeTypes>();
conn.CreateTable<UserQuote>(); conn.CreateTable<UserQuote>();
conn.CreateTable<Reminder>(); conn.CreateTable<Reminder>();

View File

@ -14,6 +14,10 @@ namespace NadekoBot.Classes.JSONModels
[JsonIgnore] [JsonIgnore]
public List<Quote> Quotes { get; set; } = new List<Quote>(); public List<Quote> Quotes { get; set; } = new List<Quote>();
[JsonIgnore]
public List<PokemonType> PokemonTypes { get; set; } = new List<PokemonType>();
public List<string> RotatingStatuses { get; set; } = new List<string>(); public List<string> RotatingStatuses { get; set; } = new List<string>();
public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel(); public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel();
public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>(); public HashSet<ulong> ServerBlacklist { get; set; } = new HashSet<ulong>();
@ -25,6 +29,7 @@ namespace NadekoBot.Classes.JSONModels
143515953525817344 143515953525817344
}; };
public string[] _8BallResponses { get; set; } = public string[] _8BallResponses { get; set; } =
{ {
"Most definitely yes", "Most definitely yes",
@ -78,6 +83,7 @@ namespace NadekoBot.Classes.JSONModels
public string CurrencySign { get; set; } = "🌸"; public string CurrencySign { get; set; } = "🌸";
public string CurrencyName { get; set; } = "NadekoFlower"; public string CurrencyName { get; set; } = "NadekoFlower";
} }
public class CommandPrefixesModel public class CommandPrefixesModel
@ -127,4 +133,5 @@ namespace NadekoBot.Classes.JSONModels
public override string ToString() => public override string ToString() =>
$"{Text}\n\t*-{Author}*"; $"{Text}\n\t*-{Author}*";
} }
} }

View File

@ -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<PokemonMultiplier> multi)
{
Name = n;
Icon = i;
Moves = m;
Multipliers = multi;
}
public string Name { get; set; }
public List<PokemonMultiplier> 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; }
}
}

View File

@ -9,6 +9,6 @@ namespace NadekoBot.Classes._DataModels
class UserPokeTypes : IDataModel class UserPokeTypes : IDataModel
{ {
public long UserId { get; set; } public long UserId { get; set; }
public int type { get; set; } public string type { get; set; }
} }
} }

View File

@ -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; }
}
}

View File

@ -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<string, int> DefaultMovesList = new Dictionary<string, int>()
{
{"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}
};
}
}

View File

@ -2,10 +2,9 @@
using Discord.Modules; using Discord.Modules;
using NadekoBot.Classes; using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Classes._DataModels;
using NadekoBot.Classes.JSONModels;
using NadekoBot.Classes.Permissions; using NadekoBot.Classes.Permissions;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using NadekoBot.Modules.Pokemon.PokeTypes;
using NadekoBot.Modules.Pokemon.PokeTypes.Extensions;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@ -21,37 +20,55 @@ namespace NadekoBot.Modules.Pokemon
public PokemonModule() public PokemonModule()
{ {
DbHandler.Instance.DeleteAll<PokeMoves>();
DbHandler.Instance.InsertMany(
DefaultMoves.DefaultMovesList.Select(move => new PokeMoves
{
move = move.Key,
type = move.Value
}));
} }
private int GetDamage(PokeType usertype, PokeType targetType) private int GetDamage(PokemonType usertype, PokemonType targetType)
{ {
var rng = new Random(); var rng = new Random();
int damage = rng.Next(40, 60); int damage = rng.Next(40, 60);
var multiplier = usertype.Multiplier(targetType); foreach (PokemonMultiplier Multiplier in usertype.Multipliers)
{
if (Multiplier.Type == targetType.Name)
{
var multiplier = Multiplier.Multiplication;
damage = (int)(damage * multiplier); damage = (int)(damage * multiplier);
}
}
return damage; return damage;
} }
private PokeType GetPokeType(ulong id) private PokemonType GetPokeType(ulong id)
{ {
var db = DbHandler.Instance.GetAllRows<UserPokeTypes>(); var db = DbHandler.Instance.GetAllRows<UserPokeTypes>();
Dictionary<long, int> setTypes = db.ToDictionary(x => x.UserId, y => y.type); Dictionary<long, string> setTypes = db.ToDictionary(x => x.UserId, y => y.type);
if (setTypes.ContainsKey((long)id)) if (setTypes.ContainsKey((long)id))
{ {
return PokemonTypesMain.IntToPokeType(setTypes[(long)id]); return stringToPokemonType(setTypes[(long)id]);
}
int count = NadekoBot.Config.PokemonTypes.Count;
int remainder = Math.Abs((int)(id % (ulong) count));
return NadekoBot.Config.PokemonTypes[remainder];
} }
int remainder = Math.Abs((int)(id % 18));
return PokemonTypesMain.IntToPokeType(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) public override void Install(ModuleManager manager)
@ -117,23 +134,23 @@ namespace NadekoBot.Modules.Pokemon
} }
//Check whether move can be used //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())) 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; return;
} }
//get target type //get target type
PokeType targetType = GetPokeType(target.Id); PokemonType targetType = GetPokeType(target.Id);
//generate damage //generate damage
int damage = GetDamage(userType, targetType); int damage = GetDamage(userType, targetType);
//apply damage to target //apply damage to target
targetStats.Hp -= damage; 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 //Damage type
if (damage < 40) if (damage < 40)
@ -183,11 +200,11 @@ namespace NadekoBot.Modules.Pokemon
.Do(async e => .Do(async e =>
{ {
var userType = GetPokeType(e.User.Id); var userType = GetPokeType(e.User.Id);
List<string> movesList = userType.GetMoves(); var movesList = userType.Moves;
var str = $"**Moves for `{userType.Name}` type.**"; var str = $"**Moves for `{userType.Name}` type.**";
foreach (string m in movesList) foreach (string m in movesList)
{ {
str += $"\n{userType.Image}{m}"; str += $"\n{userType.Icon}{m}";
} }
await e.Channel.SendMessage(str); await e.Channel.SendMessage(str);
}); });
@ -259,7 +276,7 @@ namespace NadekoBot.Modules.Pokemon
return; return;
} }
var pType = GetPokeType(usr.Id); 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}");
}); });
@ -271,7 +288,7 @@ namespace NadekoBot.Modules.Pokemon
var targetTypeStr = e.GetArg("targetType")?.ToUpperInvariant(); var targetTypeStr = e.GetArg("targetType")?.ToUpperInvariant();
if (string.IsNullOrWhiteSpace(targetTypeStr)) if (string.IsNullOrWhiteSpace(targetTypeStr))
return; return;
var targetType = PokemonTypesMain.stringToPokeType(targetTypeStr); var targetType = stringToPokemonType(targetTypeStr);
if (targetType == null) 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"); 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");
@ -279,7 +296,7 @@ namespace NadekoBot.Modules.Pokemon
} }
if (targetType == GetPokeType(e.User.Id)) 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; return;
} }
@ -304,12 +321,12 @@ namespace NadekoBot.Modules.Pokemon
DbHandler.Instance.InsertData(new UserPokeTypes DbHandler.Instance.InsertData(new UserPokeTypes
{ {
UserId = (long)e.User.Id, UserId = (long)e.User.Id,
type = targetType.Num type = targetType.Name
}); });
//Now for the response //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}");
}); });
}); });
} }

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🐛";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🕶";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🐉";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "⚡️";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "💫";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "✊";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🔥";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "☁";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "👻";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🌿";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🗻";
public int Num => numType;
}
}

View File

@ -1,27 +0,0 @@
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
using System.Collections.Generic;
namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions
{
public static class IPokeTypeExtensions
{
public static List<string> GetMoves(this PokeType poketype)
{
var db = DbHandler.Instance.GetAllRows<PokeMoves>();
List<string> moves = new List<string>();
foreach (PokeMoves p in db)
{
if (p.type == poketype.Num)
{
if (!moves.Contains(p.move))
{
moves.Add(p.move);
}
}
}
return moves;
}
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "❄";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "⭕️";
public int Num => type_num;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "☠";
public int Num => numType;
}
}

View File

@ -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)
{
return t;
}
}
return null;
}
//These classes can use all methods (except getMoves)
public static List<PokeType> TypeList = new List<PokeType>()
{
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;
}
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🔮";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "💎";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "🔩";
public int Num => numType;
}
}

View File

@ -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<string> moves = new List<string>();
public string Name => name;
public string Image => "💦";
public int Num => numType;
}
}

View File

@ -66,6 +66,7 @@ namespace NadekoBot
{ {
Config = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText("data/config.json")); Config = JsonConvert.DeserializeObject<Configuration>(File.ReadAllText("data/config.json"));
Config.Quotes = JsonConvert.DeserializeObject<List<Quote>>(File.ReadAllText("data/quotes.json")); Config.Quotes = JsonConvert.DeserializeObject<List<Quote>>(File.ReadAllText("data/quotes.json"));
Config.PokemonTypes = JsonConvert.DeserializeObject<List<PokemonType>>(File.ReadAllText("data/PokemonTypes.json"));
} }
catch catch
{ {

View File

@ -131,6 +131,7 @@
<Compile Include="Classes\JSONModels\LocalizedStrings.cs" /> <Compile Include="Classes\JSONModels\LocalizedStrings.cs" />
<Compile Include="Classes\JSONModels\MagicItem.cs" /> <Compile Include="Classes\JSONModels\MagicItem.cs" />
<Compile Include="Classes\JSONModels\MangaResult.cs" /> <Compile Include="Classes\JSONModels\MangaResult.cs" />
<Compile Include="Classes\JSONModels\PokemonType.cs" />
<Compile Include="Classes\JSONModels\_JSONModels.cs" /> <Compile Include="Classes\JSONModels\_JSONModels.cs" />
<Compile Include="Classes\Leet.cs" /> <Compile Include="Classes\Leet.cs" />
<Compile Include="Classes\Music\MusicControls.cs" /> <Compile Include="Classes\Music\MusicControls.cs" />
@ -150,7 +151,6 @@
<Compile Include="Classes\_DataModels\CurrencyTransactionModel.cs" /> <Compile Include="Classes\_DataModels\CurrencyTransactionModel.cs" />
<Compile Include="Classes\_DataModels\Donator.cs" /> <Compile Include="Classes\_DataModels\Donator.cs" />
<Compile Include="Classes\_DataModels\IDataModel.cs" /> <Compile Include="Classes\_DataModels\IDataModel.cs" />
<Compile Include="Classes\_DataModels\pokemoves.cs" />
<Compile Include="Classes\_DataModels\PokeTypes.cs" /> <Compile Include="Classes\_DataModels\PokeTypes.cs" />
<Compile Include="Classes\_DataModels\Reminder.cs" /> <Compile Include="Classes\_DataModels\Reminder.cs" />
<Compile Include="Classes\_DataModels\RequestModel.cs" /> <Compile Include="Classes\_DataModels\RequestModel.cs" />
@ -199,28 +199,7 @@
<Compile Include="Modules\NSFW.cs" /> <Compile Include="Modules\NSFW.cs" />
<Compile Include="Modules\Permissions.cs" /> <Compile Include="Modules\Permissions.cs" />
<Compile Include="Modules\Administration\Commands\RatelimitCommand.cs" /> <Compile Include="Modules\Administration\Commands\RatelimitCommand.cs" />
<Compile Include="Modules\Pokemon\DefaultMoves.cs" />
<Compile Include="Modules\Pokemon\PokemonModule.cs" /> <Compile Include="Modules\Pokemon\PokemonModule.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\FairyType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\IPokeTypeExtensions.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\PokeType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\PsychicType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\BugType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\RockType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\GhostType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\Dragontype.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\DarkType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\SteelType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\WaterType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\ElectricType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\GrassType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\IceType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\FightingType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\PoisonType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\GroundType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\FlyingType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\FireType.cs" />
<Compile Include="Modules\Pokemon\PokemonTypes\NormalType.cs" />
<Compile Include="Modules\Pokemon\PokeStats.cs" /> <Compile Include="Modules\Pokemon\PokeStats.cs" />
<Compile Include="Modules\Searches.cs" /> <Compile Include="Modules\Searches.cs" />
<Compile Include="Modules\Search\Commands\ConverterCommand.cs" /> <Compile Include="Modules\Search\Commands\ConverterCommand.cs" />

View File

@ -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": "💫"
}
]