changes to pokemon part 1
This commit is contained in:
parent
d83a5474a9
commit
a76fd7c7c9
@ -1,19 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using SQLite;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace NadekoBot.Classes {
|
||||
internal class DbHandler {
|
||||
namespace NadekoBot.Classes
|
||||
{
|
||||
internal class DbHandler
|
||||
{
|
||||
public static DbHandler Instance { get; } = new DbHandler();
|
||||
|
||||
private string FilePath { get; } = "data/nadekobot.sqlite";
|
||||
|
||||
static DbHandler() { }
|
||||
public DbHandler() {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
public DbHandler()
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
conn.CreateTable<Stats>();
|
||||
conn.CreateTable<Command>();
|
||||
conn.CreateTable<Announcement>();
|
||||
@ -23,44 +27,55 @@ namespace NadekoBot.Classes {
|
||||
conn.CreateTable<CurrencyTransaction>();
|
||||
conn.CreateTable<Donator>();
|
||||
conn.CreateTable<PokeMoves>();
|
||||
conn.CreateTable<userPokeTypes>();
|
||||
conn.CreateTable<UserQuote>();
|
||||
conn.Execute(Queries.TransactionTriggerQuery);
|
||||
}
|
||||
}
|
||||
|
||||
internal void InsertData<T>(T o) where T : IDataModel {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal void InsertData<T>(T o) where T : IDataModel
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
conn.Insert(o, typeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
internal void InsertMany<T>(T objects) where T : IEnumerable<IDataModel> {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal void InsertMany<T>(T objects) where T : IEnumerable<IDataModel>
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
conn.InsertAll(objects);
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdateData<T>(T o) where T : IDataModel {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal void UpdateData<T>(T o) where T : IDataModel
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
conn.Update(o, typeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
internal HashSet<T> GetAllRows<T>() where T : IDataModel, new() {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal HashSet<T> GetAllRows<T>() where T : IDataModel, new()
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
return new HashSet<T>(conn.Table<T>());
|
||||
}
|
||||
}
|
||||
|
||||
internal CurrencyState GetStateByUserId(long id) {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal CurrencyState GetStateByUserId(long id)
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
return conn.Table<CurrencyState>().Where(x => x.UserId == id).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
internal T Delete<T>(int id) where T : IDataModel, new() {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal T Delete<T>(int id) where T : IDataModel, new()
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
var found = conn.Find<T>(id);
|
||||
if (found != null)
|
||||
conn.Delete<T>(found.Id);
|
||||
@ -71,8 +86,10 @@ namespace NadekoBot.Classes {
|
||||
/// <summary>
|
||||
/// Updates an existing object or creates a new one
|
||||
/// </summary>
|
||||
internal void Save<T>(T o) where T : IDataModel, new() {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal void Save<T>(T o) where T : IDataModel, new()
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
var found = conn.Find<T>(o.Id);
|
||||
if (found == null)
|
||||
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() {
|
||||
using (var conn = new SQLiteConnection(FilePath)) {
|
||||
internal T GetRandom<T>(Expression<Func<T, bool>> p) where T : IDataModel, new()
|
||||
{
|
||||
using (var conn = new SQLiteConnection(FilePath))
|
||||
{
|
||||
var r = new Random();
|
||||
return conn.Table<T>().Where(p).ToList().OrderBy(x => r.Next()).FirstOrDefault();
|
||||
}
|
||||
@ -90,7 +109,8 @@ namespace NadekoBot.Classes {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Queries {
|
||||
public static class Queries
|
||||
{
|
||||
public static string TransactionTriggerQuery = @"
|
||||
CREATE TRIGGER IF NOT EXISTS OnTransactionAdded
|
||||
AFTER INSERT ON CurrencyTransaction
|
||||
|
@ -94,7 +94,7 @@ namespace NadekoBot.Classes.JSONModels
|
||||
public string Gambling { get; set; } = "$";
|
||||
public string Permissions { get; set; } = ";";
|
||||
public string Programming { get; set; } = "%";
|
||||
public string Pokemon { get; set; } = "poke";
|
||||
public string Pokemon { get; set; } = ">";
|
||||
}
|
||||
|
||||
public static class ConfigHandler
|
||||
|
@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using NadekoBot.Classes.JSONModels;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Classes {
|
||||
internal class SpecificConfigurations {
|
||||
namespace NadekoBot.Classes
|
||||
{
|
||||
internal class SpecificConfigurations
|
||||
{
|
||||
public static SpecificConfigurations Default { get; } = new SpecificConfigurations();
|
||||
public static bool Instantiated { get; private set; }
|
||||
|
||||
@ -17,14 +18,19 @@ namespace NadekoBot.Classes {
|
||||
|
||||
static SpecificConfigurations() { }
|
||||
|
||||
private SpecificConfigurations() {
|
||||
private SpecificConfigurations()
|
||||
{
|
||||
|
||||
if (File.Exists(filePath)) {
|
||||
try {
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
configs = JsonConvert
|
||||
.DeserializeObject<ConcurrentDictionary<ulong, ServerSpecificConfig>>(
|
||||
File.ReadAllText(filePath));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Deserialization failing: {ex}");
|
||||
}
|
||||
}
|
||||
@ -42,14 +48,17 @@ namespace NadekoBot.Classes {
|
||||
|
||||
private readonly object saveLock = new object();
|
||||
|
||||
public void Save() {
|
||||
lock (saveLock) {
|
||||
public void Save()
|
||||
{
|
||||
lock (saveLock)
|
||||
{
|
||||
File.WriteAllText(filePath, JsonConvert.SerializeObject(configs, Formatting.Indented));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ServerSpecificConfig : INotifyPropertyChanged {
|
||||
internal class ServerSpecificConfig : INotifyPropertyChanged
|
||||
{
|
||||
[JsonProperty("VoicePlusTextEnabled")]
|
||||
private bool voicePlusTextEnabled;
|
||||
[JsonIgnore]
|
||||
@ -78,7 +87,8 @@ namespace NadekoBot.Classes {
|
||||
set {
|
||||
listOfSelfAssignableRoles = value;
|
||||
if (value != null)
|
||||
listOfSelfAssignableRoles.CollectionChanged += (s, e) => {
|
||||
listOfSelfAssignableRoles.CollectionChanged += (s, e) =>
|
||||
{
|
||||
if (!SpecificConfigurations.Instantiated) return;
|
||||
OnPropertyChanged();
|
||||
};
|
||||
@ -92,34 +102,39 @@ namespace NadekoBot.Classes {
|
||||
set {
|
||||
observingStreams = value;
|
||||
if (value != null)
|
||||
observingStreams.CollectionChanged += (s, e) => {
|
||||
observingStreams.CollectionChanged += (s, e) =>
|
||||
{
|
||||
if (!SpecificConfigurations.Instantiated) return;
|
||||
OnPropertyChanged();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public ServerSpecificConfig() {
|
||||
public ServerSpecificConfig()
|
||||
{
|
||||
ListOfSelfAssignableRoles = new ObservableCollection<ulong>();
|
||||
ObservingStreams = new ObservableCollection<StreamNotificationConfig>();
|
||||
}
|
||||
|
||||
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");
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
public class StreamNotificationConfig : IEquatable<StreamNotificationConfig> {
|
||||
public class StreamNotificationConfig : IEquatable<StreamNotificationConfig>
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public StreamType Type { get; set; }
|
||||
public ulong ServerId { get; set; }
|
||||
public ulong ChannelId { get; set; }
|
||||
public bool LastStatus { get; set; }
|
||||
|
||||
public enum StreamType {
|
||||
public enum StreamType
|
||||
{
|
||||
Twitch,
|
||||
Beam,
|
||||
Hitbox,
|
||||
@ -131,7 +146,8 @@ namespace NadekoBot.Classes {
|
||||
this.Type == other.Type &&
|
||||
this.ServerId == other.ServerId;
|
||||
|
||||
public override int GetHashCode() {
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (int)((int)ServerId + Username.Length + (int)Type);
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
class PokeStats
|
||||
{
|
||||
//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
|
||||
public int MovesMade { get; set; } = 0;
|
||||
//Last people attacked
|
||||
|
@ -1,40 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord.Modules;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Commands;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using NadekoBot.Classes.Permissions;
|
||||
using System.Collections.Concurrent;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
|
||||
class PokemonGame : DiscordModule
|
||||
class PokemonModule : DiscordModule
|
||||
{
|
||||
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>();
|
||||
|
||||
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)
|
||||
{
|
||||
manager.CreateCommands("", cgb =>
|
||||
{
|
||||
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
||||
cgb.AddCheck(PermissionChecker.Instance);
|
||||
|
||||
commands.ForEach(cmd => cmd.Init(cgb));
|
||||
|
||||
@ -54,11 +70,11 @@ namespace NadekoBot.Modules.Pokemon
|
||||
// Checking stats first, then move
|
||||
//Set up the userstats
|
||||
PokeStats userStats;
|
||||
userStats = Stats.GetOrAdd(e.User.Id, defaultStats());
|
||||
userStats = Stats.GetOrAdd(e.User.Id, new PokeStats());
|
||||
|
||||
//Check if able to move
|
||||
//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!");
|
||||
return;
|
||||
@ -75,17 +91,17 @@ namespace NadekoBot.Modules.Pokemon
|
||||
}
|
||||
//get target stats
|
||||
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 (targetStats.HP <= 0)
|
||||
if (targetStats.Hp <= 0)
|
||||
{
|
||||
await e.Channel.SendMessage($"{target.Mention} has already fainted!");
|
||||
return;
|
||||
}
|
||||
|
||||
//Check whether move can be used
|
||||
IPokeType userType = getPokeType(e.User.Id);
|
||||
PokeType userType = GetPokeType(e.User.Id);
|
||||
|
||||
var enabledMoves = userType.GetMoves();
|
||||
if (!enabledMoves.Contains(move.ToLowerInvariant()))
|
||||
@ -95,13 +111,13 @@ namespace NadekoBot.Modules.Pokemon
|
||||
}
|
||||
|
||||
//get target type
|
||||
IPokeType targetType = getPokeType(target.Id);
|
||||
PokeType targetType = GetPokeType(target.Id);
|
||||
//generate damage
|
||||
int damage = getDamage(userType, targetType);
|
||||
int damage = GetDamage(userType, targetType);
|
||||
//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
|
||||
if (damage < 40)
|
||||
@ -119,13 +135,13 @@ namespace NadekoBot.Modules.Pokemon
|
||||
|
||||
//check fainted
|
||||
|
||||
if (targetStats.HP <= 0)
|
||||
if (targetStats.Hp <= 0)
|
||||
{
|
||||
response += $"\n**{target.Name}** has fainted!";
|
||||
}
|
||||
else
|
||||
{
|
||||
response += $"\n**{target.Name}** has {targetStats.HP} HP remaining";
|
||||
response += $"\n**{target.Name}** has {targetStats.Hp} HP remaining";
|
||||
}
|
||||
|
||||
//update other stats
|
||||
@ -149,12 +165,12 @@ namespace NadekoBot.Modules.Pokemon
|
||||
.Description("Lists the moves you are able to use")
|
||||
.Do(async e =>
|
||||
{
|
||||
var userType = getPokeType(e.User.Id);
|
||||
var userType = GetPokeType(e.User.Id);
|
||||
List<string> movesList = userType.GetMoves();
|
||||
var str = "**Moves:**";
|
||||
var str = $"**Moves for `{userType.Name}` type.**";
|
||||
foreach (string m in movesList)
|
||||
{
|
||||
str += $"\n{userType.GetImage()}{m}";
|
||||
str += $"\n{userType.Image}{m}";
|
||||
}
|
||||
await e.Channel.SendMessage(str);
|
||||
});
|
||||
@ -168,7 +184,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
//Implement NadekoFlowers????
|
||||
string newMove = e.GetArg("movename").ToLowerInvariant();
|
||||
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);
|
||||
if (db.Contains(newMove))
|
||||
{
|
||||
@ -183,7 +199,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
type = typeNum
|
||||
});
|
||||
});
|
||||
await e.Channel.SendMessage($"Added {newType.GetImage()}{newMove}");
|
||||
await e.Channel.SendMessage($"Added {newType.Image}{newMove}");
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "heal")
|
||||
@ -201,8 +217,8 @@ namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
|
||||
var targetStats = Stats[usr.Id];
|
||||
int HP = targetStats.HP;
|
||||
if (targetStats.HP == BaseHealth)
|
||||
int HP = targetStats.Hp;
|
||||
if (targetStats.Hp == targetStats.MaxHp)
|
||||
{
|
||||
await e.Channel.SendMessage($"{usr.Name} already has full HP!");
|
||||
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!");
|
||||
return;
|
||||
}
|
||||
var up = (usr.Id == e.User.Id) ? "yourself" : usr.Name;
|
||||
await FlowersHandler.RemoveFlowersAsync(e.User, $"heal {up}", amount);
|
||||
var target = (usr.Id == e.User.Id) ? "yourself" : usr.Name;
|
||||
await FlowersHandler.RemoveFlowersAsync(e.User, $"Poke-Heal {target}", amount);
|
||||
//healing
|
||||
targetStats.HP = BaseHealth;
|
||||
targetStats.Hp = targetStats.MaxHp;
|
||||
if (HP < 0)
|
||||
{
|
||||
//Could heal only for half HP?
|
||||
Stats[usr.Id].HP = (BaseHealth / 2);
|
||||
await e.Channel.SendMessage($"{e.User.Name} revived {usr.Name} for 🌸");
|
||||
Stats[usr.Id].Hp = (targetStats.MaxHp / 2);
|
||||
await e.Channel.SendMessage($"{e.User.Name} revived {usr.Name} with one {NadekoBot.Config.CurrencySign}");
|
||||
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;
|
||||
}
|
||||
else
|
||||
@ -246,8 +262,8 @@ namespace NadekoBot.Modules.Pokemon
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
return;
|
||||
}
|
||||
var pType = getPokeType(usr.Id);
|
||||
await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.GetName().ToLowerInvariant()}**{pType.GetImage()}");
|
||||
var pType = GetPokeType(usr.Id);
|
||||
await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.Name.ToLowerInvariant()}**{pType.Image}");
|
||||
|
||||
});
|
||||
|
||||
@ -279,7 +295,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
var t = PokemonTypesMain.IntToPokeType(m.type);
|
||||
|
||||
str += $"\n{t.GetImage()}{m.move}";
|
||||
str += $"\n{t.Image}{m.move}";
|
||||
}
|
||||
|
||||
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");
|
||||
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;
|
||||
}
|
||||
|
||||
@ -325,54 +341,15 @@ namespace NadekoBot.Modules.Pokemon
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.userPokeTypes
|
||||
{
|
||||
UserId = (long)e.User.Id,
|
||||
type = targetType.GetNum()
|
||||
type = targetType.Num
|
||||
});
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class BugType : IPokeType
|
||||
class BugType : PokeType
|
||||
{
|
||||
static readonly string name = "BUG";
|
||||
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;
|
||||
@ -33,24 +27,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "🐛";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🐛";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class DarkType : IPokeType
|
||||
class DarkType : PokeType
|
||||
{
|
||||
static readonly string name = "DARK";
|
||||
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;
|
||||
@ -29,24 +23,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "🕶";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🕶";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class DragonType : IPokeType
|
||||
class DragonType : PokeType
|
||||
{
|
||||
static readonly string name = "DRAGON";
|
||||
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;
|
||||
@ -29,21 +23,12 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🐉";
|
||||
}
|
||||
public string Image => "🐉";
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class ElectricType : IPokeType
|
||||
class ElectricType : PokeType
|
||||
{
|
||||
static readonly string name = "ELECTRIC";
|
||||
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;
|
||||
@ -33,20 +27,11 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "⚡️";
|
||||
}
|
||||
public string Image => "⚡️";
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class FightingType : IPokeType
|
||||
class FightingType : PokeType
|
||||
{
|
||||
static readonly string name = "FIGHTING";
|
||||
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;
|
||||
@ -37,20 +31,11 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "✊";
|
||||
}
|
||||
public string Image => "✊";
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,18 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class FireType : IPokeType
|
||||
class FireType : PokeType
|
||||
{
|
||||
static readonly string name = "FIRE";
|
||||
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;
|
||||
@ -33,25 +27,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "🔥";
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🔥";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class FlyingType : IPokeType
|
||||
class FlyingType : PokeType
|
||||
{
|
||||
static readonly string name = "FLYING";
|
||||
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;
|
||||
@ -33,21 +27,12 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "☁";
|
||||
}
|
||||
public string Image => "☁";
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class GhostType : IPokeType
|
||||
class GhostType : PokeType
|
||||
{
|
||||
static readonly string name = "GHOST";
|
||||
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;
|
||||
@ -32,21 +26,12 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "👻";
|
||||
}
|
||||
public string Image => "👻";
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class GrassType : IPokeType
|
||||
class GrassType : PokeType
|
||||
{
|
||||
static readonly string name = "GRASS";
|
||||
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;
|
||||
@ -35,20 +29,11 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🌿";
|
||||
}
|
||||
public string Image => "🌿";
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class GroundType : IPokeType
|
||||
class GroundType : PokeType
|
||||
{
|
||||
static readonly string name = "GROUND";
|
||||
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;
|
||||
@ -32,24 +26,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "🗻";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🗻";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions
|
||||
{
|
||||
public static class IPokeTypeExtensions
|
||||
{
|
||||
public static List<string> GetMoves(this IPokeType poketype)
|
||||
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.GetNum())
|
||||
if (p.type == poketype.Num)
|
||||
{
|
||||
if (!moves.Contains(p.move))
|
||||
{
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class IceType : IPokeType
|
||||
class IceType : PokeType
|
||||
{
|
||||
static readonly string name = "ICE";
|
||||
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;
|
||||
@ -32,23 +26,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "❄";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "❄";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,18 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class NormalType : IPokeType
|
||||
class NormalType : PokeType
|
||||
{
|
||||
static readonly string name = "NORMAL";
|
||||
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 "GHOST": return 0;
|
||||
case "STEEL": return 0.5;
|
||||
@ -29,24 +21,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "⭕️";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "⭕️";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return type_num;
|
||||
}
|
||||
public int Num => type_num;
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class PoisonType : IPokeType
|
||||
class PoisonType : PokeType
|
||||
{
|
||||
static readonly string name = "POISON";
|
||||
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;
|
||||
@ -31,23 +24,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "☠";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "☠";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using NadekoBot.Modules.Pokemon.PokemonTypes;
|
||||
using NadekoBot.Modules.Pokemon.PokemonTypes;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon.PokeTypes
|
||||
{
|
||||
|
||||
public interface IPokeType
|
||||
public interface PokeType
|
||||
{
|
||||
|
||||
string GetImage();
|
||||
string GetName();
|
||||
int GetNum();
|
||||
double GetMagnifier(IPokeType target);
|
||||
string Image { get; }
|
||||
string Name { get; }
|
||||
int Num { get; }
|
||||
double Multiplier(PokeType target);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -30,26 +26,8 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes
|
||||
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)
|
||||
public static List<IPokeType> TypeList = new List<IPokeType>()
|
||||
public static List<PokeType> TypeList = new List<PokeType>()
|
||||
{
|
||||
new NormalType(),
|
||||
new FireType(),
|
||||
@ -70,11 +48,11 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes
|
||||
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;
|
||||
}
|
||||
|
@ -1,23 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class PsychicType : IPokeType
|
||||
class PsychicType : PokeType
|
||||
{
|
||||
static readonly string name = "PSYCHIC";
|
||||
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;
|
||||
@ -33,21 +26,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "💫";
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "💫";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class RockType : IPokeType
|
||||
class RockType : PokeType
|
||||
{
|
||||
static readonly string name = "ROCK";
|
||||
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;
|
||||
@ -31,24 +25,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "💎";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "💎";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class SteelType : IPokeType
|
||||
class SteelType : PokeType
|
||||
{
|
||||
static readonly string name = "STEEL";
|
||||
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;
|
||||
@ -30,23 +24,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "🔩";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🔩";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,16 @@
|
||||
using System;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes;
|
||||
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
|
||||
{
|
||||
class WaterType : IPokeType
|
||||
class WaterType : PokeType
|
||||
{
|
||||
static readonly string name = "WATER";
|
||||
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;
|
||||
@ -30,23 +24,10 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public string Image => "💦";
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "💦";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
public int Num => numType;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using NadekoBot.Commands;
|
||||
using NadekoBot.Modules;
|
||||
using NadekoBot.Modules.Gambling;
|
||||
using NadekoBot.Modules.Pokemon;
|
||||
using NadekoBot.Modules.Translator;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,7 +15,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Modules.Translator;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
@ -167,7 +167,7 @@ namespace NadekoBot
|
||||
modules.Add(new Searches(), "Searches", ModuleFilter.None);
|
||||
modules.Add(new NSFW(), "NSFW", 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);
|
||||
if (!string.IsNullOrWhiteSpace(Creds.TrelloAppKey))
|
||||
modules.Add(new Trello(), "Trello", ModuleFilter.None);
|
||||
|
Loading…
Reference in New Issue
Block a user