Moved PokemonTypes to json
This commit is contained in:
@ -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<UserPokeTypes>();
|
||||
Dictionary<long, string> 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}");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<string> GetMoves(this PokeType poketype)
|
||||
{
|
||||
var moveSet = NadekoBot.Config.PokemonMoves;
|
||||
List<string> moves = new List<string>();
|
||||
foreach (PokeMove p in moveSet)
|
||||
{
|
||||
if (p.type == poketype.Name)
|
||||
{
|
||||
if (!moves.Contains(p.name))
|
||||
{
|
||||
moves.Add(p.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moves;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user