changes to pokemon part 1

This commit is contained in:
Master Kwoth 2016-03-28 16:44:39 +02:00
parent d83a5474a9
commit a76fd7c7c9
25 changed files with 309 additions and 629 deletions

View File

@ -1,19 +1,23 @@
using System.Collections.Generic; using NadekoBot.Classes._DataModels;
using System.Linq;
using SQLite; using SQLite;
using NadekoBot.Classes._DataModels;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
namespace NadekoBot.Classes { namespace NadekoBot.Classes
internal class DbHandler { {
internal class DbHandler
{
public static DbHandler Instance { get; } = new DbHandler(); public static DbHandler Instance { get; } = new DbHandler();
private string FilePath { get; } = "data/nadekobot.sqlite"; private string FilePath { get; } = "data/nadekobot.sqlite";
static DbHandler() { } static DbHandler() { }
public DbHandler() { public DbHandler()
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
conn.CreateTable<Stats>(); conn.CreateTable<Stats>();
conn.CreateTable<Command>(); conn.CreateTable<Command>();
conn.CreateTable<Announcement>(); conn.CreateTable<Announcement>();
@ -23,44 +27,55 @@ namespace NadekoBot.Classes {
conn.CreateTable<CurrencyTransaction>(); conn.CreateTable<CurrencyTransaction>();
conn.CreateTable<Donator>(); conn.CreateTable<Donator>();
conn.CreateTable<PokeMoves>(); conn.CreateTable<PokeMoves>();
conn.CreateTable<userPokeTypes>();
conn.CreateTable<UserQuote>(); conn.CreateTable<UserQuote>();
conn.Execute(Queries.TransactionTriggerQuery); conn.Execute(Queries.TransactionTriggerQuery);
} }
} }
internal void InsertData<T>(T o) where T : IDataModel { internal void InsertData<T>(T o) where T : IDataModel
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
conn.Insert(o, typeof(T)); conn.Insert(o, typeof(T));
} }
} }
internal void InsertMany<T>(T objects) where T : IEnumerable<IDataModel> { internal void InsertMany<T>(T objects) where T : IEnumerable<IDataModel>
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
conn.InsertAll(objects); conn.InsertAll(objects);
} }
} }
internal void UpdateData<T>(T o) where T : IDataModel { internal void UpdateData<T>(T o) where T : IDataModel
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
conn.Update(o, typeof(T)); conn.Update(o, typeof(T));
} }
} }
internal HashSet<T> GetAllRows<T>() where T : IDataModel, new() { internal HashSet<T> GetAllRows<T>() where T : IDataModel, new()
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
return new HashSet<T>(conn.Table<T>()); return new HashSet<T>(conn.Table<T>());
} }
} }
internal CurrencyState GetStateByUserId(long id) { internal CurrencyState GetStateByUserId(long id)
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
return conn.Table<CurrencyState>().Where(x => x.UserId == id).FirstOrDefault(); return conn.Table<CurrencyState>().Where(x => x.UserId == id).FirstOrDefault();
} }
} }
internal T Delete<T>(int id) where T : IDataModel, new() { internal T Delete<T>(int id) where T : IDataModel, new()
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
var found = conn.Find<T>(id); var found = conn.Find<T>(id);
if (found != null) if (found != null)
conn.Delete<T>(found.Id); conn.Delete<T>(found.Id);
@ -71,8 +86,10 @@ namespace NadekoBot.Classes {
/// <summary> /// <summary>
/// Updates an existing object or creates a new one /// Updates an existing object or creates a new one
/// </summary> /// </summary>
internal void Save<T>(T o) where T : IDataModel, new() { internal void Save<T>(T o) where T : IDataModel, new()
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
var found = conn.Find<T>(o.Id); var found = conn.Find<T>(o.Id);
if (found == null) if (found == null)
conn.Insert(o, typeof(T)); conn.Insert(o, typeof(T));
@ -81,8 +98,10 @@ namespace NadekoBot.Classes {
} }
} }
internal T GetRandom<T>(Expression<Func<T, bool>> p) where T : IDataModel, new() { internal T GetRandom<T>(Expression<Func<T, bool>> p) where T : IDataModel, new()
using (var conn = new SQLiteConnection(FilePath)) { {
using (var conn = new SQLiteConnection(FilePath))
{
var r = new Random(); var r = new Random();
return conn.Table<T>().Where(p).ToList().OrderBy(x => r.Next()).FirstOrDefault(); return conn.Table<T>().Where(p).ToList().OrderBy(x => r.Next()).FirstOrDefault();
} }
@ -90,13 +109,14 @@ namespace NadekoBot.Classes {
} }
} }
public static class Queries { public static class Queries
{
public static string TransactionTriggerQuery = @" public static string TransactionTriggerQuery = @"
CREATE TRIGGER IF NOT EXISTS OnTransactionAdded CREATE TRIGGER IF NOT EXISTS OnTransactionAdded
AFTER INSERT ON CurrencyTransaction AFTER INSERT ON CurrencyTransaction
BEGIN BEGIN
INSERT OR REPLACE INTO CurrencyState (Id, UserId, Value, DateAdded) INSERT OR REPLACE INTO CurrencyState (Id, UserId, Value, DateAdded)
VALUES (COALESCE((SELECT Id from CurrencyState where UserId = NEW.UserId),(SELECT COALESCE(MAX(Id),0)+1 from CurrencyState)), VALUES (COALESCE((SELECT Id from CurrencyState where UserId = NEW.UserId),(SELECT COALESCE(MAX(Id),0)+1 from CurrencyState)),
NEW.UserId, NEW.UserId,
COALESCE((SELECT Value+New.Value FROM CurrencyState Where UserId = NEW.UserId),NEW.Value), COALESCE((SELECT Value+New.Value FROM CurrencyState Where UserId = NEW.UserId),NEW.Value),
NEW.DateAdded); NEW.DateAdded);

View File

@ -94,7 +94,7 @@ namespace NadekoBot.Classes.JSONModels
public string Gambling { get; set; } = "$"; public string Gambling { get; set; } = "$";
public string Permissions { get; set; } = ";"; public string Permissions { get; set; } = ";";
public string Programming { get; set; } = "%"; public string Programming { get; set; } = "%";
public string Pokemon { get; set; } = "poke"; public string Pokemon { get; set; } = ">";
} }
public static class ConfigHandler public static class ConfigHandler

View File

@ -1,15 +1,16 @@
using System; using Newtonsoft.Json;
using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using NadekoBot.Classes.JSONModels;
using Newtonsoft.Json;
namespace NadekoBot.Classes { namespace NadekoBot.Classes
internal class SpecificConfigurations { {
internal class SpecificConfigurations
{
public static SpecificConfigurations Default { get; } = new SpecificConfigurations(); public static SpecificConfigurations Default { get; } = new SpecificConfigurations();
public static bool Instantiated { get; private set; } public static bool Instantiated { get; private set; }
@ -17,14 +18,19 @@ namespace NadekoBot.Classes {
static SpecificConfigurations() { } static SpecificConfigurations() { }
private SpecificConfigurations() { private SpecificConfigurations()
{
if (File.Exists(filePath)) { if (File.Exists(filePath))
try { {
try
{
configs = JsonConvert configs = JsonConvert
.DeserializeObject<ConcurrentDictionary<ulong, ServerSpecificConfig>>( .DeserializeObject<ConcurrentDictionary<ulong, ServerSpecificConfig>>(
File.ReadAllText(filePath)); File.ReadAllText(filePath));
} catch (Exception ex) { }
catch (Exception ex)
{
Console.WriteLine($"Deserialization failing: {ex}"); Console.WriteLine($"Deserialization failing: {ex}");
} }
} }
@ -42,14 +48,17 @@ namespace NadekoBot.Classes {
private readonly object saveLock = new object(); private readonly object saveLock = new object();
public void Save() { public void Save()
lock (saveLock) { {
lock (saveLock)
{
File.WriteAllText(filePath, JsonConvert.SerializeObject(configs, Formatting.Indented)); File.WriteAllText(filePath, JsonConvert.SerializeObject(configs, Formatting.Indented));
} }
} }
} }
internal class ServerSpecificConfig : INotifyPropertyChanged { internal class ServerSpecificConfig : INotifyPropertyChanged
{
[JsonProperty("VoicePlusTextEnabled")] [JsonProperty("VoicePlusTextEnabled")]
private bool voicePlusTextEnabled; private bool voicePlusTextEnabled;
[JsonIgnore] [JsonIgnore]
@ -78,7 +87,8 @@ namespace NadekoBot.Classes {
set { set {
listOfSelfAssignableRoles = value; listOfSelfAssignableRoles = value;
if (value != null) if (value != null)
listOfSelfAssignableRoles.CollectionChanged += (s, e) => { listOfSelfAssignableRoles.CollectionChanged += (s, e) =>
{
if (!SpecificConfigurations.Instantiated) return; if (!SpecificConfigurations.Instantiated) return;
OnPropertyChanged(); OnPropertyChanged();
}; };
@ -92,34 +102,39 @@ namespace NadekoBot.Classes {
set { set {
observingStreams = value; observingStreams = value;
if (value != null) if (value != null)
observingStreams.CollectionChanged += (s, e) => { observingStreams.CollectionChanged += (s, e) =>
{
if (!SpecificConfigurations.Instantiated) return; if (!SpecificConfigurations.Instantiated) return;
OnPropertyChanged(); OnPropertyChanged();
}; };
} }
} }
public ServerSpecificConfig() { public ServerSpecificConfig()
{
ListOfSelfAssignableRoles = new ObservableCollection<ulong>(); ListOfSelfAssignableRoles = new ObservableCollection<ulong>();
ObservingStreams = new ObservableCollection<StreamNotificationConfig>(); ObservingStreams = new ObservableCollection<StreamNotificationConfig>();
} }
public event PropertyChangedEventHandler PropertyChanged = delegate { SpecificConfigurations.Default.Save(); }; public event PropertyChangedEventHandler PropertyChanged = delegate { SpecificConfigurations.Default.Save(); };
private void OnPropertyChanged([CallerMemberName] string propertyName = null) { private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
Console.WriteLine("property changed"); Console.WriteLine("property changed");
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
} }
} }
public class StreamNotificationConfig : IEquatable<StreamNotificationConfig> { public class StreamNotificationConfig : IEquatable<StreamNotificationConfig>
{
public string Username { get; set; } public string Username { get; set; }
public StreamType Type { get; set; } public StreamType Type { get; set; }
public ulong ServerId { get; set; } public ulong ServerId { get; set; }
public ulong ChannelId { get; set; } public ulong ChannelId { get; set; }
public bool LastStatus { get; set; } public bool LastStatus { get; set; }
public enum StreamType { public enum StreamType
{
Twitch, Twitch,
Beam, Beam,
Hitbox, Hitbox,
@ -131,7 +146,8 @@ namespace NadekoBot.Classes {
this.Type == other.Type && this.Type == other.Type &&
this.ServerId == other.ServerId; this.ServerId == other.ServerId;
public override int GetHashCode() { public override int GetHashCode()
{
return (int)((int)ServerId + Username.Length + (int)Type); return (int)((int)ServerId + Username.Length + (int)Type);
} }
} }

View File

@ -1,15 +1,12 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NadekoBot.Modules.Pokemon namespace NadekoBot.Modules.Pokemon
{ {
class PokeStats class PokeStats
{ {
//Health left //Health left
public int HP { get; set; } = 500; public int Hp { get; set; } = 500;
public int MaxHp { get; } = 500;
//Amount of moves made since last time attacked //Amount of moves made since last time attacked
public int MovesMade { get; set; } = 0; public int MovesMade { get; set; } = 0;
//Last people attacked //Last people attacked

View File

@ -1,40 +1,56 @@
using System; using Discord.Commands;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Modules; using Discord.Modules;
using Discord.Commands;
using NadekoBot.Commands;
using NadekoBot.Classes; using NadekoBot.Classes;
using NadekoBot.Extensions;
using NadekoBot.Classes._DataModels; using NadekoBot.Classes._DataModels;
using NadekoBot.Classes.Permissions; using NadekoBot.Classes.Permissions;
using System.Collections.Concurrent; using NadekoBot.Extensions;
using NadekoBot.Modules.Pokemon.PokeTypes; using NadekoBot.Modules.Pokemon.PokeTypes;
using NadekoBot.Modules.Pokemon.PokeTypes.Extensions; using NadekoBot.Modules.Pokemon.PokeTypes.Extensions;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace NadekoBot.Modules.Pokemon namespace NadekoBot.Modules.Pokemon
{ {
class PokemonModule : DiscordModule
class PokemonGame : DiscordModule
{ {
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Pokemon; public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Pokemon;
public readonly int BaseHealth = 500;
//private Dictionary<ulong, Pokestats> stats = new Dictionary<ulong, Pokestats>();
private ConcurrentDictionary<ulong, PokeStats> Stats = new ConcurrentDictionary<ulong, PokeStats>(); private ConcurrentDictionary<ulong, PokeStats> Stats = new ConcurrentDictionary<ulong, PokeStats>();
public PokemonModule() { }
public PokemonGame() private int GetDamage(PokeType usertype, PokeType targetType)
{ {
//Something? var rng = new Random();
int damage = rng.Next(40, 60);
var multiplier = usertype.Multiplier(targetType);
damage = (int)(damage * multiplier);
return damage;
} }
private PokeType GetPokeType(ulong id)
{
var db = DbHandler.Instance.GetAllRows<userPokeTypes>();
Dictionary<long, int> setTypes = db.ToDictionary(x => x.UserId, y => y.type);
if (setTypes.ContainsKey((long)id))
{
return PokemonTypesMain.IntToPokeType(setTypes[(long)id]);
}
int remainder = (int)id % 16;
return PokemonTypesMain.IntToPokeType(remainder);
}
public override void Install(ModuleManager manager) public override void Install(ModuleManager manager)
{ {
manager.CreateCommands("", cgb => manager.CreateCommands("", cgb =>
{ {
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance); cgb.AddCheck(PermissionChecker.Instance);
commands.ForEach(cmd => cmd.Init(cgb)); commands.ForEach(cmd => cmd.Init(cgb));
@ -54,11 +70,11 @@ namespace NadekoBot.Modules.Pokemon
// Checking stats first, then move // Checking stats first, then move
//Set up the userstats //Set up the userstats
PokeStats userStats; PokeStats userStats;
userStats = Stats.GetOrAdd(e.User.Id, defaultStats()); userStats = Stats.GetOrAdd(e.User.Id, new PokeStats());
//Check if able to move //Check if able to move
//User not able if HP < 0, has made more than 4 attacks //User not able if HP < 0, has made more than 4 attacks
if (userStats.HP < 0) if (userStats.Hp < 0)
{ {
await e.Channel.SendMessage($"{e.User.Mention} has fainted and was not able to move!"); await e.Channel.SendMessage($"{e.User.Mention} has fainted and was not able to move!");
return; return;
@ -75,17 +91,17 @@ namespace NadekoBot.Modules.Pokemon
} }
//get target stats //get target stats
PokeStats targetStats; PokeStats targetStats;
targetStats = Stats.GetOrAdd(target.Id, defaultStats()); targetStats = Stats.GetOrAdd(target.Id, new PokeStats());
//If target's HP is below 0, no use attacking //If target's HP is below 0, no use attacking
if (targetStats.HP <= 0) if (targetStats.Hp <= 0)
{ {
await e.Channel.SendMessage($"{target.Mention} has already fainted!"); await e.Channel.SendMessage($"{target.Mention} has already fainted!");
return; return;
} }
//Check whether move can be used //Check whether move can be used
IPokeType userType = getPokeType(e.User.Id); PokeType userType = GetPokeType(e.User.Id);
var enabledMoves = userType.GetMoves(); var enabledMoves = userType.GetMoves();
if (!enabledMoves.Contains(move.ToLowerInvariant())) if (!enabledMoves.Contains(move.ToLowerInvariant()))
@ -95,13 +111,13 @@ namespace NadekoBot.Modules.Pokemon
} }
//get target type //get target type
IPokeType targetType = getPokeType(target.Id); PokeType 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.GetImage()} on {target.Mention}{targetType.GetImage()} for **{damage}** damage"; var response = $"{e.User.Mention} used **{move}**{userType.Image} on {target.Mention}{targetType.Image} for **{damage}** damage";
//Damage type //Damage type
if (damage < 40) if (damage < 40)
@ -119,13 +135,13 @@ namespace NadekoBot.Modules.Pokemon
//check fainted //check fainted
if (targetStats.HP <= 0) if (targetStats.Hp <= 0)
{ {
response += $"\n**{target.Name}** has fainted!"; response += $"\n**{target.Name}** has fainted!";
} }
else else
{ {
response += $"\n**{target.Name}** has {targetStats.HP} HP remaining"; response += $"\n**{target.Name}** has {targetStats.Hp} HP remaining";
} }
//update other stats //update other stats
@ -149,12 +165,12 @@ namespace NadekoBot.Modules.Pokemon
.Description("Lists the moves you are able to use") .Description("Lists the moves you are able to use")
.Do(async e => .Do(async e =>
{ {
var userType = getPokeType(e.User.Id); var userType = GetPokeType(e.User.Id);
List<string> movesList = userType.GetMoves(); List<string> movesList = userType.GetMoves();
var str = "**Moves:**"; var str = $"**Moves for `{userType.Name}` type.**";
foreach (string m in movesList) foreach (string m in movesList)
{ {
str += $"\n{userType.GetImage()}{m}"; str += $"\n{userType.Image}{m}";
} }
await e.Channel.SendMessage(str); await e.Channel.SendMessage(str);
}); });
@ -168,7 +184,7 @@ namespace NadekoBot.Modules.Pokemon
//Implement NadekoFlowers???? //Implement NadekoFlowers????
string newMove = e.GetArg("movename").ToLowerInvariant(); string newMove = e.GetArg("movename").ToLowerInvariant();
var newType = PokemonTypesMain.stringToPokeType(e.GetArg("movetype").ToUpperInvariant()); var newType = PokemonTypesMain.stringToPokeType(e.GetArg("movetype").ToUpperInvariant());
int typeNum = newType.GetNum(); int typeNum = newType.Num;
var db = DbHandler.Instance.GetAllRows<PokeMoves>().Select(x => x.move); var db = DbHandler.Instance.GetAllRows<PokeMoves>().Select(x => x.move);
if (db.Contains(newMove)) if (db.Contains(newMove))
{ {
@ -183,7 +199,7 @@ namespace NadekoBot.Modules.Pokemon
type = typeNum type = typeNum
}); });
}); });
await e.Channel.SendMessage($"Added {newType.GetImage()}{newMove}"); await e.Channel.SendMessage($"Added {newType.Image}{newMove}");
}); });
cgb.CreateCommand(Prefix + "heal") cgb.CreateCommand(Prefix + "heal")
@ -201,8 +217,8 @@ namespace NadekoBot.Modules.Pokemon
{ {
var targetStats = Stats[usr.Id]; var targetStats = Stats[usr.Id];
int HP = targetStats.HP; int HP = targetStats.Hp;
if (targetStats.HP == BaseHealth) if (targetStats.Hp == targetStats.MaxHp)
{ {
await e.Channel.SendMessage($"{usr.Name} already has full HP!"); await e.Channel.SendMessage($"{usr.Name} already has full HP!");
return; return;
@ -215,18 +231,18 @@ namespace NadekoBot.Modules.Pokemon
await e.Channel.SendMessage($"{e.User.Mention} you don't have enough NadekoFlowers! \nYou still need {amount - pts} to be able to do this!"); await e.Channel.SendMessage($"{e.User.Mention} you don't have enough NadekoFlowers! \nYou still need {amount - pts} to be able to do this!");
return; return;
} }
var up = (usr.Id == e.User.Id) ? "yourself" : usr.Name; var target = (usr.Id == e.User.Id) ? "yourself" : usr.Name;
await FlowersHandler.RemoveFlowersAsync(e.User, $"heal {up}", amount); await FlowersHandler.RemoveFlowersAsync(e.User, $"Poke-Heal {target}", amount);
//healing //healing
targetStats.HP = BaseHealth; targetStats.Hp = targetStats.MaxHp;
if (HP < 0) if (HP < 0)
{ {
//Could heal only for half HP? //Could heal only for half HP?
Stats[usr.Id].HP = (BaseHealth / 2); Stats[usr.Id].Hp = (targetStats.MaxHp / 2);
await e.Channel.SendMessage($"{e.User.Name} revived {usr.Name} for 🌸"); await e.Channel.SendMessage($"{e.User.Name} revived {usr.Name} with one {NadekoBot.Config.CurrencySign}");
return; return;
} }
await e.Channel.SendMessage($"{e.User.Name} healed {usr.Name} for {BaseHealth - HP} HP with a 🌸"); await e.Channel.SendMessage($"{e.User.Name} healed {usr.Name} for {targetStats.MaxHp - HP} HP with a 🌸");
return; return;
} }
else else
@ -246,8 +262,8 @@ namespace NadekoBot.Modules.Pokemon
await e.Channel.SendMessage("No such person."); await e.Channel.SendMessage("No such person.");
return; return;
} }
var pType = getPokeType(usr.Id); var pType = GetPokeType(usr.Id);
await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.GetName().ToLowerInvariant()}**{pType.GetImage()}"); await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.Name.ToLowerInvariant()}**{pType.Image}");
}); });
@ -262,7 +278,7 @@ namespace NadekoBot.Modules.Pokemon
{ {
DbHandler.Instance.Delete<PokeMoves>(p.Id); DbHandler.Instance.Delete<PokeMoves>(p.Id);
} }
foreach (var entry in DefaultMoves.DefaultMovesList) foreach (var entry in DefaultMoves.DefaultMovesList)
{ {
DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
@ -279,7 +295,7 @@ namespace NadekoBot.Modules.Pokemon
{ {
var t = PokemonTypesMain.IntToPokeType(m.type); var t = PokemonTypesMain.IntToPokeType(m.type);
str += $"\n{t.GetImage()}{m.move}"; str += $"\n{t.Image}{m.move}";
} }
await e.Channel.SendMessage(str); await e.Channel.SendMessage(str);
@ -298,9 +314,9 @@ namespace NadekoBot.Modules.Pokemon
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");
return; return;
} }
if (targetType == getPokeType(e.User.Id)) if (targetType == GetPokeType(e.User.Id))
{ {
await e.Channel.SendMessage($"Your type is already {targetType.GetName().ToLowerInvariant()}{targetType.GetImage()}"); await e.Channel.SendMessage($"Your type is already {targetType.Name.ToLowerInvariant()}{targetType.Image}");
return; return;
} }
@ -325,54 +341,15 @@ namespace NadekoBot.Modules.Pokemon
DbHandler.Instance.InsertData(new Classes._DataModels.userPokeTypes DbHandler.Instance.InsertData(new Classes._DataModels.userPokeTypes
{ {
UserId = (long)e.User.Id, UserId = (long)e.User.Id,
type = targetType.GetNum() type = targetType.Num
}); });
//Now for the response //Now for the response
await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeString}{targetType.GetImage()} for a 🌸"); await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeString}{targetType.Image} for a 🌸");
}); });
}); });
} }
private int getDamage(IPokeType usertype, IPokeType targetType)
{
Random rng = new Random();
int damage = rng.Next(40, 60);
double multiplier = 1;
multiplier = usertype.GetMagnifier(targetType);
damage = (int)(damage * multiplier);
return damage;
}
private IPokeType getPokeType(ulong id)
{
var db = DbHandler.Instance.GetAllRows<userPokeTypes>();
Dictionary<long, int> setTypes = db.ToDictionary(x => x.UserId, y => y.type);
if (setTypes.ContainsKey((long)id))
{
return PokemonTypesMain.IntToPokeType(setTypes[(long)id]);
}
int remainder = (int)id % 16;
return PokemonTypesMain.IntToPokeType(remainder);
}
private PokeStats defaultStats()
{
PokeStats s = new PokeStats();
s.HP = BaseHealth;
return s;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class BugType : IPokeType class BugType : PokeType
{ {
static readonly string name = "BUG"; static readonly string name = "BUG";
public static int numType = 11; public static int numType = 11;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 0.5; case "FIRE": return 0.5;
@ -33,24 +27,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "🐛";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "🐛";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class DarkType : IPokeType class DarkType : PokeType
{ {
static readonly string name = "DARK"; static readonly string name = "DARK";
public static int numType = 15; public static int numType = 15;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIGHTING": return 0.5; case "FIGHTING": return 0.5;
@ -29,24 +23,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "🕶";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "🕶";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class DragonType : IPokeType class DragonType : PokeType
{ {
static readonly string name = "DRAGON"; static readonly string name = "DRAGON";
public static int numType = 14; public static int numType = 14;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "DRAGON": return 2; case "DRAGON": return 2;
@ -26,24 +20,15 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage()
{
return "🐉";
}
public int GetNum()
{ public string Image => "🐉";
return numType;
} public int Num => numType;
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class ElectricType : IPokeType class ElectricType : PokeType
{ {
static readonly string name = "ELECTRIC"; static readonly string name = "ELECTRIC";
public static int numType = 3; public static int numType = 3;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "WATER": return 2; case "WATER": return 2;
@ -30,23 +24,14 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage()
{
return "⚡️";
}
public int GetNum()
{ public string Image => "⚡️";
return numType;
} public int Num => numType;
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class FightingType : IPokeType class FightingType : PokeType
{ {
static readonly string name = "FIGHTING"; static readonly string name = "FIGHTING";
public static int numType = 6; public static int numType = 6;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "NORMAL": return 2; case "NORMAL": return 2;
@ -34,23 +28,14 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage()
{
return "✊";
}
public int GetNum()
{ public string Image => "✊";
return numType;
} public int Num => numType;
} }
} }

View File

@ -1,24 +1,18 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class FireType : IPokeType class FireType : PokeType
{ {
static readonly string name = "FIRE"; static readonly string name = "FIRE";
public static int numType = 1; public static int numType = 1;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 0.5; case "FIRE": return 0.5;
@ -33,25 +27,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "🔥";
public int Num => numType;
public string GetName()
{
return name;
}
public string GetImage()
{
return "🔥";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class FlyingType : IPokeType class FlyingType : PokeType
{ {
static readonly string name = "FLYING"; static readonly string name = "FLYING";
public static int numType = 9; public static int numType = 9;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "ELECTRIC": return 0.5; case "ELECTRIC": return 0.5;
@ -30,24 +24,15 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage()
{
return "☁";
}
public int GetNum()
{ public string Image => "☁";
return numType;
} public int Num => numType;
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class GhostType : IPokeType class GhostType : PokeType
{ {
static readonly string name = "GHOST"; static readonly string name = "GHOST";
public static int numType = 13; public static int numType = 13;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "NORMAL": return 0; case "NORMAL": return 0;
@ -29,24 +23,15 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage()
{
return "👻";
}
public int GetNum()
{ public string Image => "👻";
return numType;
} public int Num => numType;
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class GrassType : IPokeType class GrassType : PokeType
{ {
static readonly string name = "GRASS"; static readonly string name = "GRASS";
public static int numType = 4; public static int numType = 4;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 0.5; case "FIRE": return 0.5;
@ -32,23 +26,14 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage()
{
return "🌿";
}
public int GetNum()
{ public string Image => "🌿";
return numType;
} public int Num => numType;
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class GroundType : IPokeType class GroundType : PokeType
{ {
static readonly string name = "GROUND"; static readonly string name = "GROUND";
public static int numType = 8; public static int numType = 8;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 2; case "FIRE": return 2;
@ -32,24 +26,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "🗻";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "🗻";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

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

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class IceType : IPokeType class IceType : PokeType
{ {
static readonly string name = "ICE"; static readonly string name = "ICE";
public static int numType = 5; public static int numType = 5;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 0.5; case "FIRE": return 0.5;
@ -32,23 +26,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "❄";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "❄";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,26 +1,18 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class NormalType : IPokeType class NormalType : PokeType
{ {
static readonly string name = "NORMAL"; static readonly string name = "NORMAL";
public static int type_num = 0; public static int type_num = 0;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "ROCK": return 0.5; case "ROCK": return 0.5;
case "GHOST": return 0; case "GHOST": return 0;
case "STEEL": return 0.5; case "STEEL": return 0.5;
@ -29,24 +21,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "⭕️";
public string GetName() public int Num => type_num;
{
return name;
}
public string GetImage()
{
return "⭕️";
}
public int GetNum()
{
return type_num;
}
} }
} }

View File

@ -1,23 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class PoisonType : IPokeType class PoisonType : PokeType
{ {
static readonly string name = "POISON"; static readonly string name = "POISON";
public static int numType = 7; public static int numType = 7;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "GRASS": return 2; case "GRASS": return 2;
@ -31,23 +24,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "☠";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "☠";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,28 +1,24 @@
using System.Collections.Generic; using NadekoBot.Modules.Pokemon.PokemonTypes;
using NadekoBot.Classes; using System.Collections.Generic;
using NadekoBot.Classes._DataModels;
using NadekoBot.Modules.Pokemon.PokemonTypes;
namespace NadekoBot.Modules.Pokemon.PokeTypes namespace NadekoBot.Modules.Pokemon.PokeTypes
{ {
public interface PokeType
public interface IPokeType
{ {
string Image { get; }
string GetImage(); string Name { get; }
string GetName(); int Num { get; }
int GetNum(); double Multiplier(PokeType target);
double GetMagnifier(IPokeType target);
} }
public class PokemonTypesMain public class PokemonTypesMain
{ {
public static IPokeType stringToPokeType(string newType) public static PokeType stringToPokeType(string newType)
{ {
foreach (IPokeType t in TypeList) foreach (PokeType t in TypeList)
{ {
if (t.GetName() == newType) if (t.Name == newType)
{ {
return t; return t;
} }
@ -30,26 +26,8 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes
return null; return null;
} }
//public static List<string> getMoves(int numType)
//{
// var db = DbHandler.Instance.GetAllRows<PokeMoves>();
// List<string> moves = new List<string>();
// foreach (PokeMoves p in db)
// {
// if (p.type == numType)
// {
// if (!moves.Contains(p.move))
// {
// moves.Add(p.move);
// }
// }
// }
// return moves;
//}
//These classes can use all methods (except getMoves) //These classes can use all methods (except getMoves)
public static List<IPokeType> TypeList = new List<IPokeType>() public static List<PokeType> TypeList = new List<PokeType>()
{ {
new NormalType(), new NormalType(),
new FireType(), new FireType(),
@ -70,11 +48,11 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes
new SteelType() new SteelType()
}; };
public static IPokeType IntToPokeType(int id) public static PokeType IntToPokeType(int id)
{ {
foreach (IPokeType t in TypeList) foreach (PokeType t in TypeList)
{ {
if (t.GetNum() == id) if (t.Num == id)
{ {
return t; return t;
} }

View File

@ -1,23 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels;
using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class PsychicType : IPokeType class PsychicType : PokeType
{ {
static readonly string name = "PSYCHIC"; static readonly string name = "PSYCHIC";
public static int numType = 10; public static int numType = 10;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIGHTING": return 2; case "FIGHTING": return 2;
@ -30,24 +23,13 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string GetName()
{
return name;
}
public string Name => name;
public string GetImage() public string Image => "💫";
{
return "💫";
}
public int GetNum() public int Num => numType;
{
return numType;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class RockType : IPokeType class RockType : PokeType
{ {
static readonly string name = "ROCK"; static readonly string name = "ROCK";
public static int numType = 12; public static int numType = 12;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 2; case "FIRE": return 2;
@ -31,24 +25,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "💎";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "💎";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class SteelType : IPokeType class SteelType : PokeType
{ {
static readonly string name = "STEEL"; static readonly string name = "STEEL";
public static int numType = -1; public static int numType = -1;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 0.5; case "FIRE": return 0.5;
@ -30,23 +24,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "🔩";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "🔩";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -1,22 +1,16 @@
using System; using NadekoBot.Modules.Pokemon.PokeTypes;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NadekoBot.Modules.Pokemon;
using NadekoBot.Classes;
using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokeTypes; using NadekoBot.Modules.Pokemon.PokeTypes;
namespace NadekoBot.Modules.Pokemon.PokemonTypes namespace NadekoBot.Modules.Pokemon.PokemonTypes
{ {
class WaterType : IPokeType class WaterType : PokeType
{ {
static readonly string name = "WATER"; static readonly string name = "WATER";
public static int numType = 2; public static int numType = 2;
public double GetMagnifier(IPokeType target) public double Multiplier(PokeType target)
{ {
switch (target.GetName()) switch (target.Name)
{ {
case "FIRE": return 2; case "FIRE": return 2;
@ -30,23 +24,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
} }
List<string> moves = new List<string>(); List<string> moves = new List<string>();
public string Name => name;
public string Image => "💦";
public string GetName() public int Num => numType;
{
return name;
}
public string GetImage()
{
return "💦";
}
public int GetNum()
{
return numType;
}
} }
} }

View File

@ -7,6 +7,7 @@ using NadekoBot.Commands;
using NadekoBot.Modules; using NadekoBot.Modules;
using NadekoBot.Modules.Gambling; using NadekoBot.Modules.Gambling;
using NadekoBot.Modules.Pokemon; using NadekoBot.Modules.Pokemon;
using NadekoBot.Modules.Translator;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -14,7 +15,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using NadekoBot.Modules.Translator;
namespace NadekoBot namespace NadekoBot
{ {
@ -167,7 +167,7 @@ namespace NadekoBot
modules.Add(new Searches(), "Searches", ModuleFilter.None); modules.Add(new Searches(), "Searches", ModuleFilter.None);
modules.Add(new NSFW(), "NSFW", ModuleFilter.None); modules.Add(new NSFW(), "NSFW", ModuleFilter.None);
modules.Add(new ClashOfClans(), "ClashOfClans", ModuleFilter.None); modules.Add(new ClashOfClans(), "ClashOfClans", ModuleFilter.None);
modules.Add(new PokemonGame(), "Pokegame", ModuleFilter.None); modules.Add(new PokemonModule(), "Pokegame", ModuleFilter.None);
modules.Add(new TranslatorModule(), "Translator", ModuleFilter.None); modules.Add(new TranslatorModule(), "Translator", ModuleFilter.None);
if (!string.IsNullOrWhiteSpace(Creds.TrelloAppKey)) if (!string.IsNullOrWhiteSpace(Creds.TrelloAppKey))
modules.Add(new Trello(), "Trello", ModuleFilter.None); modules.Add(new Trello(), "Trello", ModuleFilter.None);