Merge pull request #161 from appelemac/magic-items
Pokemon game redone, thx @appelemac
This commit is contained in:
commit
d83a5474a9
@ -22,6 +22,8 @@ namespace NadekoBot.Classes {
|
||||
conn.CreateTable<CurrencyState>();
|
||||
conn.CreateTable<CurrencyTransaction>();
|
||||
conn.CreateTable<Donator>();
|
||||
conn.CreateTable<PokeMoves>();
|
||||
conn.CreateTable<userPokeTypes>();
|
||||
conn.CreateTable<UserQuote>();
|
||||
conn.Execute(Queries.TransactionTriggerQuery);
|
||||
}
|
||||
|
@ -94,6 +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 static class ConfigHandler
|
||||
|
14
NadekoBot/Classes/_DataModels/PokeTypes.cs
Normal file
14
NadekoBot/Classes/_DataModels/PokeTypes.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Classes._DataModels
|
||||
{
|
||||
class userPokeTypes : IDataModel
|
||||
{
|
||||
public long UserId { get; set; }
|
||||
public int type { get; set; }
|
||||
}
|
||||
}
|
15
NadekoBot/Classes/_DataModels/pokemoves.cs
Normal file
15
NadekoBot/Classes/_DataModels/pokemoves.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Classes._DataModels
|
||||
{
|
||||
class PokeMoves : IDataModel
|
||||
{
|
||||
public string move { get; set; }
|
||||
public int type { get; set; }
|
||||
public long UserId { get; internal set; }
|
||||
}
|
||||
}
|
@ -1,30 +1,28 @@
|
||||
using Discord.Commands;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Discord.Modules;
|
||||
using NadekoBot.Commands;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace NadekoBot.Modules
|
||||
{
|
||||
internal class Games : DiscordModule
|
||||
{
|
||||
namespace NadekoBot.Modules {
|
||||
internal class Games : DiscordModule {
|
||||
private readonly Random rng = new Random();
|
||||
|
||||
public Games()
|
||||
{
|
||||
public Games() {
|
||||
commands.Add(new Trivia(this));
|
||||
commands.Add(new SpeedTyping(this));
|
||||
commands.Add(new PollCommand(this));
|
||||
//commands.Add(new BetrayGame(this));
|
||||
|
||||
}
|
||||
|
||||
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Games;
|
||||
|
||||
public override void Install(ModuleManager manager)
|
||||
{
|
||||
manager.CreateCommands("", cgb =>
|
||||
{
|
||||
public override void Install(ModuleManager manager) {
|
||||
manager.CreateCommands("", cgb => {
|
||||
|
||||
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
||||
|
||||
@ -33,8 +31,7 @@ namespace NadekoBot.Modules
|
||||
cgb.CreateCommand(Prefix + "choose")
|
||||
.Description("Chooses a thing from a list of things\n**Usage**: >choose Get up;Sleep;Sleep more")
|
||||
.Parameter("list", Discord.Commands.ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
.Do(async e => {
|
||||
var arg = e.GetArg("list");
|
||||
if (string.IsNullOrWhiteSpace(arg))
|
||||
return;
|
||||
@ -47,69 +44,23 @@ namespace NadekoBot.Modules
|
||||
cgb.CreateCommand(Prefix + "8ball")
|
||||
.Description("Ask the 8ball a yes/no question.")
|
||||
.Parameter("question", Discord.Commands.ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
.Do(async e => {
|
||||
var question = e.GetArg("question");
|
||||
if (string.IsNullOrWhiteSpace(question))
|
||||
return;
|
||||
try
|
||||
{
|
||||
try {
|
||||
await e.Channel.SendMessage(
|
||||
$":question: **Question**: `{question}` \n🎱 **8Ball Answers**: `{NadekoBot.Config._8BallResponses[rng.Next(0, NadekoBot.Config._8BallResponses.Length)]}`");
|
||||
}
|
||||
catch { }
|
||||
} catch { }
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "attack")
|
||||
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: >attack strike @User")
|
||||
.Parameter("attack_type", Discord.Commands.ParameterType.Required)
|
||||
.Parameter("target", Discord.Commands.ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
if (usr == null)
|
||||
{
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
return;
|
||||
}
|
||||
var usrType = GetType(usr.Id);
|
||||
var response = "";
|
||||
var dmg = GetDamage(usrType, e.GetArg("attack_type").ToLowerInvariant());
|
||||
response = e.GetArg("attack_type") + (e.GetArg("attack_type") == "splash" ? "es " : "s ") + $"{usr.Mention}{GetImage(usrType)} for {dmg}\n";
|
||||
if (dmg >= 65)
|
||||
{
|
||||
response += "It's super effective!";
|
||||
}
|
||||
else if (dmg <= 35)
|
||||
{
|
||||
response += "Ineffective!";
|
||||
}
|
||||
await e.Channel.SendMessage($"{ e.User.Mention }{GetImage(GetType(e.User.Id))} {response}");
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "poketype")
|
||||
.Parameter("target", Discord.Commands.ParameterType.Required)
|
||||
.Description("Gets the users element type. Use this to do more damage with strike!")
|
||||
.Do(async e =>
|
||||
{
|
||||
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
if (usr == null)
|
||||
{
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
return;
|
||||
}
|
||||
var t = GetType(usr.Id);
|
||||
await e.Channel.SendMessage($"{usr.Name}'s type is {GetImage(t)} {t}");
|
||||
});
|
||||
cgb.CreateCommand(Prefix + "rps")
|
||||
.Description("Play a game of rocket paperclip scissors with nadkeo.\n**Usage**: >rps scissors")
|
||||
.Parameter("input", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
.Do(async e => {
|
||||
var input = e.GetArg("input").Trim();
|
||||
int pick;
|
||||
switch (input)
|
||||
{
|
||||
switch (input) {
|
||||
case "r":
|
||||
case "rock":
|
||||
case "rocket":
|
||||
@ -145,8 +96,7 @@ namespace NadekoBot.Modules
|
||||
.Description("Prints a customizable Linux interjection")
|
||||
.Parameter("gnu", ParameterType.Required)
|
||||
.Parameter("linux", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
.Do(async e => {
|
||||
var guhnoo = e.Args[0];
|
||||
var loonix = e.Args[1];
|
||||
|
||||
@ -161,104 +111,8 @@ There really is a {loonix}, and these people are using it, but it is just a part
|
||||
});
|
||||
});
|
||||
}
|
||||
/*
|
||||
|
||||
🌿 or 🍃 or 🌱 Grass
|
||||
⚡ Electric
|
||||
❄ Ice
|
||||
☁ Fly
|
||||
🔥 Fire
|
||||
💧 or 💦 Water
|
||||
⭕ Normal
|
||||
🐛 Insect
|
||||
🌟 or 💫 or ✨ Fairy
|
||||
*/
|
||||
|
||||
private string GetImage(PokeType t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case PokeType.WATER:
|
||||
return "💦";
|
||||
case PokeType.GRASS:
|
||||
return "🌿";
|
||||
case PokeType.FIRE:
|
||||
return "🔥";
|
||||
case PokeType.ELECTRICAL:
|
||||
return "⚡️";
|
||||
default:
|
||||
return "⭕️";
|
||||
}
|
||||
}
|
||||
|
||||
private int GetDamage(PokeType targetType, string v)
|
||||
{
|
||||
var rng = new Random();
|
||||
switch (v)
|
||||
{
|
||||
case "splash": //water
|
||||
if (targetType == PokeType.FIRE)
|
||||
return rng.Next(65, 100);
|
||||
else if (targetType == PokeType.ELECTRICAL)
|
||||
return rng.Next(0, 35);
|
||||
else
|
||||
return rng.Next(40, 60);
|
||||
case "strike": //grass
|
||||
if (targetType == PokeType.ELECTRICAL)
|
||||
return rng.Next(65, 100);
|
||||
else if (targetType == PokeType.FIRE)
|
||||
return rng.Next(0, 35);
|
||||
else
|
||||
return rng.Next(40, 60);
|
||||
case "burn": //fire
|
||||
case "flame":
|
||||
if (targetType == PokeType.GRASS)
|
||||
return rng.Next(65, 100);
|
||||
else if (targetType == PokeType.WATER)
|
||||
return rng.Next(0, 35);
|
||||
else
|
||||
return rng.Next(40, 60);
|
||||
case "surge": //electrical
|
||||
case "electrocute":
|
||||
if (targetType == PokeType.WATER)
|
||||
return rng.Next(65, 100);
|
||||
else if (targetType == PokeType.GRASS)
|
||||
return rng.Next(0, 35);
|
||||
else
|
||||
return rng.Next(40, 60);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private PokeType GetType(ulong id)
|
||||
{
|
||||
if (id == 113760353979990024)
|
||||
return PokeType.FIRE;
|
||||
|
||||
var remainder = id % 10;
|
||||
if (remainder < 3)
|
||||
return PokeType.WATER;
|
||||
else if (remainder >= 3 && remainder < 5)
|
||||
{
|
||||
return PokeType.GRASS;
|
||||
}
|
||||
else if (remainder >= 5 && remainder < 8)
|
||||
{
|
||||
return PokeType.FIRE;
|
||||
}
|
||||
else {
|
||||
return PokeType.ELECTRICAL;
|
||||
}
|
||||
}
|
||||
|
||||
private enum PokeType
|
||||
{
|
||||
WATER, GRASS, FIRE, ELECTRICAL
|
||||
}
|
||||
|
||||
private string GetRPSPick(int i)
|
||||
{
|
||||
private string GetRPSPick(int i) {
|
||||
if (i == 0)
|
||||
return "rocket";
|
||||
else if (i == 1)
|
||||
|
87
NadekoBot/Modules/Pokemon/DefaultMoves.cs
Normal file
87
NadekoBot/Modules/Pokemon/DefaultMoves.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
class DefaultMoves
|
||||
{
|
||||
|
||||
public static Dictionary<string, int> DefaultMovesList = new Dictionary<string, int>()
|
||||
{
|
||||
{"sonic boom",0},
|
||||
{"quick attack",0},
|
||||
{"doubleslap",0},
|
||||
{"headbutt",0},
|
||||
{"incinerate",1},
|
||||
{"ember",1},
|
||||
{"fire punch",1},
|
||||
{"fiery dance",1},
|
||||
{"bubblebeam",2},
|
||||
{"dive",2},
|
||||
{"whirlpool",2},
|
||||
{"aqua tail",2},
|
||||
{"nuzzle",3},
|
||||
{"thunderbolt",3},
|
||||
{"thundershock",3},
|
||||
{"discharge",3},
|
||||
{"absorb",4},
|
||||
{"mega drain",4},
|
||||
{"vine whip",4},
|
||||
{"razor leaf",4},
|
||||
{"ice ball",5},
|
||||
{"powder snow",5},
|
||||
{"avalanche",5},
|
||||
{"icy wind",5},
|
||||
{"low kick",6},
|
||||
{"force palm",6},
|
||||
{"mach punch",6},
|
||||
{"double kick",6},
|
||||
{"acid",7},
|
||||
{"smog",7},
|
||||
{"sludge",7},
|
||||
{"poison jab",7},
|
||||
{"mud-slap",8},
|
||||
{"boomerang",8},
|
||||
{"bulldoze",8},
|
||||
{"dig",8},
|
||||
{"peck",9},
|
||||
{"pluck",9},
|
||||
{"gust",9},
|
||||
{"aerial ace",9},
|
||||
{"confusion",10},
|
||||
{"psybeam",10},
|
||||
{"psywave",10},
|
||||
{"heart stamp",10},
|
||||
{"bug bite",11},
|
||||
{"infestation",11},
|
||||
{"x-scissor",11},
|
||||
{"twineedle",11},
|
||||
{"rock throw",12},
|
||||
{"rollout",12},
|
||||
{"rock tomb",12},
|
||||
{"rock blast",12},
|
||||
{"astonish",13},
|
||||
{"night shade",13},
|
||||
{"lick",13},
|
||||
{"ominous wind",13},
|
||||
{"hex",13},
|
||||
{"dragon tail",14},
|
||||
{"dragon rage",14},
|
||||
{"dragonbreath",14},
|
||||
{"twister",14},
|
||||
{"pursuit",15},
|
||||
{"assurance",15},
|
||||
{"bite",15},
|
||||
{"faint attack",15},
|
||||
{"bullet punch",16},
|
||||
{"metal burst",16},
|
||||
{"gear grind",16},
|
||||
{"magnet bomb",16}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
18
NadekoBot/Modules/Pokemon/PokeStats.cs
Normal file
18
NadekoBot/Modules/Pokemon/PokeStats.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
class PokeStats
|
||||
{
|
||||
//Health left
|
||||
public int HP { get; set; } = 500;
|
||||
//Amount of moves made since last time attacked
|
||||
public int MovesMade { get; set; } = 0;
|
||||
//Last people attacked
|
||||
public List<ulong> LastAttacked { get; set; } = new List<ulong>();
|
||||
}
|
||||
}
|
381
NadekoBot/Modules/Pokemon/PokemonModule.cs
Normal file
381
NadekoBot/Modules/Pokemon/PokemonModule.cs
Normal file
@ -0,0 +1,381 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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.Modules.Pokemon.PokeTypes;
|
||||
using NadekoBot.Modules.Pokemon.PokeTypes.Extensions;
|
||||
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
|
||||
class PokemonGame : 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 PokemonGame()
|
||||
{
|
||||
//Something?
|
||||
}
|
||||
public override void Install(ModuleManager manager)
|
||||
{
|
||||
manager.CreateCommands("", cgb =>
|
||||
{
|
||||
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
||||
|
||||
commands.ForEach(cmd => cmd.Init(cgb));
|
||||
|
||||
cgb.CreateCommand(Prefix + "attack")
|
||||
.Description("Attacks a target with the given move")
|
||||
.Parameter("move", ParameterType.Required)
|
||||
.Parameter("target", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
var move = e.GetArg("move");
|
||||
var target = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
if (target == null)
|
||||
{
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
return;
|
||||
}
|
||||
// Checking stats first, then move
|
||||
//Set up the userstats
|
||||
PokeStats userStats;
|
||||
userStats = Stats.GetOrAdd(e.User.Id, defaultStats());
|
||||
|
||||
//Check if able to move
|
||||
//User not able if HP < 0, has made more than 4 attacks
|
||||
if (userStats.HP < 0)
|
||||
{
|
||||
await e.Channel.SendMessage($"{e.User.Mention} has fainted and was not able to move!");
|
||||
return;
|
||||
}
|
||||
if (userStats.MovesMade >= 5)
|
||||
{
|
||||
await e.Channel.SendMessage($"{e.User.Mention} has used too many moves in a row and was not able to move!");
|
||||
return;
|
||||
}
|
||||
if (userStats.LastAttacked.Contains(target.Id))
|
||||
{
|
||||
await e.Channel.SendMessage($"{e.User.Mention} can't attack again without retaliation!");
|
||||
return;
|
||||
}
|
||||
//get target stats
|
||||
PokeStats targetStats;
|
||||
targetStats = Stats.GetOrAdd(target.Id, defaultStats());
|
||||
|
||||
//If target's HP is below 0, no use attacking
|
||||
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);
|
||||
|
||||
var enabledMoves = userType.GetMoves();
|
||||
if (!enabledMoves.Contains(move.ToLowerInvariant()))
|
||||
{
|
||||
await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use {Prefix}listmoves to see moves you can use");
|
||||
return;
|
||||
}
|
||||
|
||||
//get target type
|
||||
IPokeType targetType = getPokeType(target.Id);
|
||||
//generate damage
|
||||
int damage = getDamage(userType, targetType);
|
||||
//apply damage to target
|
||||
targetStats.HP -= damage;
|
||||
|
||||
var response = $"{e.User.Mention} used **{move}**{userType.GetImage()} on {target.Mention}{targetType.GetImage()} for **{damage}** damage";
|
||||
|
||||
//Damage type
|
||||
if (damage < 40)
|
||||
{
|
||||
response += "\nIt's not effective..";
|
||||
}
|
||||
else if (damage > 60)
|
||||
{
|
||||
response += "\nIt's super effective!";
|
||||
}
|
||||
else
|
||||
{
|
||||
response += "\nIt's somewhat effective";
|
||||
}
|
||||
|
||||
//check fainted
|
||||
|
||||
if (targetStats.HP <= 0)
|
||||
{
|
||||
response += $"\n**{target.Name}** has fainted!";
|
||||
}
|
||||
else
|
||||
{
|
||||
response += $"\n**{target.Name}** has {targetStats.HP} HP remaining";
|
||||
}
|
||||
|
||||
//update other stats
|
||||
userStats.LastAttacked.Add(target.Id);
|
||||
userStats.MovesMade++;
|
||||
targetStats.MovesMade = 0;
|
||||
if (targetStats.LastAttacked.Contains(e.User.Id))
|
||||
{
|
||||
targetStats.LastAttacked.Remove(e.User.Id);
|
||||
}
|
||||
|
||||
//update dictionary
|
||||
//This can stay the same right?
|
||||
Stats[e.User.Id] = userStats;
|
||||
Stats[target.Id] = targetStats;
|
||||
|
||||
await e.Channel.SendMessage(response);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "listmoves")
|
||||
.Description("Lists the moves you are able to use")
|
||||
.Do(async e =>
|
||||
{
|
||||
var userType = getPokeType(e.User.Id);
|
||||
List<string> movesList = userType.GetMoves();
|
||||
var str = "**Moves:**";
|
||||
foreach (string m in movesList)
|
||||
{
|
||||
str += $"\n{userType.GetImage()}{m}";
|
||||
}
|
||||
await e.Channel.SendMessage(str);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "addmove")
|
||||
.Description($"Adds move given to database.\n**Usage**: {Prefix}addmove flame fire")
|
||||
.Parameter("movename", ParameterType.Required)
|
||||
.Parameter("movetype", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
//Implement NadekoFlowers????
|
||||
string newMove = e.GetArg("movename").ToLowerInvariant();
|
||||
var newType = PokemonTypesMain.stringToPokeType(e.GetArg("movetype").ToUpperInvariant());
|
||||
int typeNum = newType.GetNum();
|
||||
var db = DbHandler.Instance.GetAllRows<PokeMoves>().Select(x => x.move);
|
||||
if (db.Contains(newMove))
|
||||
{
|
||||
await e.Channel.SendMessage($"{newMove} already exists");
|
||||
return;
|
||||
}
|
||||
await Task.Run(() =>
|
||||
{
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
|
||||
{
|
||||
move = newMove,
|
||||
type = typeNum
|
||||
});
|
||||
});
|
||||
await e.Channel.SendMessage($"Added {newType.GetImage()}{newMove}");
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "heal")
|
||||
.Description($"Heals someone. Revives those that fainted. Costs a NadekoFlower \n**Usage**:{Prefix}revive @someone")
|
||||
.Parameter("target", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
if (usr == null)
|
||||
{
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
return;
|
||||
}
|
||||
if (Stats.ContainsKey(usr.Id))
|
||||
{
|
||||
|
||||
var targetStats = Stats[usr.Id];
|
||||
int HP = targetStats.HP;
|
||||
if (targetStats.HP == BaseHealth)
|
||||
{
|
||||
await e.Channel.SendMessage($"{usr.Name} already has full HP!");
|
||||
return;
|
||||
}
|
||||
//Payment~
|
||||
var amount = 1;
|
||||
var pts = Classes.DbHandler.Instance.GetStateByUserId((long)e.User.Id)?.Value ?? 0;
|
||||
if (pts < amount)
|
||||
{
|
||||
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);
|
||||
//healing
|
||||
targetStats.HP = BaseHealth;
|
||||
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 🌸");
|
||||
return;
|
||||
}
|
||||
await e.Channel.SendMessage($"{e.User.Name} healed {usr.Name} for {BaseHealth - HP} HP with a 🌸");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await e.Channel.SendMessage($"{usr.Name} already has full HP!");
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "type")
|
||||
.Description($"Get the poketype of the target.\n**Usage**: {Prefix}type @someone")
|
||||
.Parameter("target", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
if (usr == null)
|
||||
{
|
||||
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()}");
|
||||
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "setdefaultmoves")
|
||||
.Description($"Sets the moves DB to the default state and returns them all **OWNER ONLY**")
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
//clear DB
|
||||
var db = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
foreach (PokeMoves p in db)
|
||||
{
|
||||
DbHandler.Instance.Delete<PokeMoves>(p.Id);
|
||||
}
|
||||
|
||||
foreach (var entry in DefaultMoves.DefaultMovesList)
|
||||
{
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
|
||||
{
|
||||
move = entry.Key,
|
||||
type = entry.Value
|
||||
});
|
||||
}
|
||||
|
||||
var str = "**Reset moves to default**.\n**Moves:**";
|
||||
//could sort, but meh
|
||||
var dbMoves = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
foreach (PokeMoves m in dbMoves)
|
||||
{
|
||||
var t = PokemonTypesMain.IntToPokeType(m.type);
|
||||
|
||||
str += $"\n{t.GetImage()}{m.move}";
|
||||
}
|
||||
|
||||
await e.Channel.SendMessage(str);
|
||||
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "settype")
|
||||
.Description($"Set your poketype. Costs a NadekoFlower.\n**Usage**: {Prefix}settype fire")
|
||||
.Parameter("targetType", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
var targetTypeString = e.GetArg("targetType");
|
||||
var targetType = PokemonTypesMain.stringToPokeType(targetTypeString.ToUpperInvariant());
|
||||
if (targetType == null)
|
||||
{
|
||||
await e.Channel.SendMessage("Invalid type specified. Type must be one of:\nNORMAL, FIRE, WATER, ELECTRIC, GRASS, ICE, FIGHTING, POISON, GROUND, FLYING, PSYCHIC, BUG, ROCK, GHOST, DRAGON, DARK, STEEL");
|
||||
return;
|
||||
}
|
||||
if (targetType == getPokeType(e.User.Id))
|
||||
{
|
||||
await e.Channel.SendMessage($"Your type is already {targetType.GetName().ToLowerInvariant()}{targetType.GetImage()}");
|
||||
return;
|
||||
}
|
||||
|
||||
//Payment~
|
||||
var amount = 1;
|
||||
var pts = Classes.DbHandler.Instance.GetStateByUserId((long)e.User.Id)?.Value ?? 0;
|
||||
if (pts < amount)
|
||||
{
|
||||
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;
|
||||
}
|
||||
await FlowersHandler.RemoveFlowersAsync(e.User, $"set usertype to {targetTypeString}", amount);
|
||||
//Actually changing the type here
|
||||
var preTypes = DbHandler.Instance.GetAllRows<userPokeTypes>();
|
||||
Dictionary<long, int> Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id);
|
||||
if (Dict.ContainsKey((long)e.User.Id))
|
||||
{
|
||||
//delete previous type
|
||||
DbHandler.Instance.Delete<userPokeTypes>(Dict[(long)e.User.Id]);
|
||||
}
|
||||
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.userPokeTypes
|
||||
{
|
||||
UserId = (long)e.User.Id,
|
||||
type = targetType.GetNum()
|
||||
});
|
||||
|
||||
//Now for the response
|
||||
|
||||
await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeString}{targetType.GetImage()} 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
56
NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs
Normal file
56
NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "BUG";
|
||||
public static int numType = 11;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 0.5;
|
||||
case "GRASS": return 2;
|
||||
case "FIGHTING": return 0.5;
|
||||
case "POISON": return 0.5;
|
||||
case "FLYING": return 0.5;
|
||||
case "PSYCHIC": return 2;
|
||||
case "ROCK": return 0.5;
|
||||
case "DARK": return 2;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🐛";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
52
NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs
Normal file
52
NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "DARK";
|
||||
public static int numType = 15;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIGHTING": return 0.5;
|
||||
case "PSYCHIC": return 2;
|
||||
case "GHOST": return 2;
|
||||
case "DARK": return 0.5;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🕶";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
49
NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs
Normal file
49
NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "DRAGON";
|
||||
public static int numType = 14;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "DRAGON": return 2;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🐉";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
52
NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs
Normal file
52
NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "ELECTRIC";
|
||||
public static int numType = 3;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "WATER": return 2;
|
||||
case "ELECTRIC": return 0.5;
|
||||
case "GRASS": return 2;
|
||||
case "GROUND": return 0;
|
||||
case "FLYING": return 2;
|
||||
case "DRAGON": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "⚡️";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
56
NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs
Normal file
56
NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "FIGHTING";
|
||||
public static int numType = 6;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "NORMAL": return 2;
|
||||
case "ICE": return 2;
|
||||
case "POISON": return 0.5;
|
||||
case "FLYING": return 0.5;
|
||||
case "PSYCHIC": return 0.5;
|
||||
case "BUG": return 0.5;
|
||||
case "ROCK": return 2;
|
||||
case "GHOST": return 0;
|
||||
case "DARK": return 2;
|
||||
case "STEEL": return 2;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "✊";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
57
NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs
Normal file
57
NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "FIRE";
|
||||
public static int numType = 1;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 0.5;
|
||||
case "WATER": return 0.5;
|
||||
case "GRASS": return 2;
|
||||
case "ICE": return 2;
|
||||
case "BUG": return 2;
|
||||
case "ROCK": return 0.5;
|
||||
case "DRAGON": return 0.5;
|
||||
case "STEEL": return 2;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🔥";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
53
NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs
Normal file
53
NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "FLYING";
|
||||
public static int numType = 9;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "ELECTRIC": return 0.5;
|
||||
case "GRASS": return 2;
|
||||
case "FIGHTING": return 2;
|
||||
case "BUG": return 2;
|
||||
case "ROCK": return 0.5;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "☁";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
52
NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs
Normal file
52
NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "GHOST";
|
||||
public static int numType = 13;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "NORMAL": return 0;
|
||||
case "PSYCHIC": return 2;
|
||||
case "GHOST": return 2;
|
||||
case "DARK": return 0.5;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "👻";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
54
NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs
Normal file
54
NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "GRASS";
|
||||
public static int numType = 4;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 0.5;
|
||||
case "WATER": return 0.5;
|
||||
case "GRASS": return 2;
|
||||
case "ICE": return 2;
|
||||
case "BUG": return 2;
|
||||
case "ROCK": return 0.5;
|
||||
case "DRAGON": return 0.5;
|
||||
case "STEEL": return 2;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🌿";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
55
NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs
Normal file
55
NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "GROUND";
|
||||
public static int numType = 8;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 2;
|
||||
case "ELECTRIC": return 2;
|
||||
case "GRASS": return 0.5;
|
||||
case "POISON": return 0.5;
|
||||
case "FLYING": return 0;
|
||||
case "BUG": return 0.5;
|
||||
case "ROCK": return 2;
|
||||
case "STEEL": return 2;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🗻";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions
|
||||
{
|
||||
public static class IPokeTypeExtensions
|
||||
{
|
||||
public static List<string> GetMoves(this IPokeType poketype)
|
||||
{
|
||||
var db = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
List<string> moves = new List<string>();
|
||||
foreach (PokeMoves p in db)
|
||||
{
|
||||
if (p.type == poketype.GetNum())
|
||||
{
|
||||
if (!moves.Contains(p.move))
|
||||
{
|
||||
moves.Add(p.move);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moves;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
54
NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs
Normal file
54
NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "ICE";
|
||||
public static int numType = 5;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 0.5;
|
||||
case "WATER": return 0.5;
|
||||
case "GRASS": return 2;
|
||||
case "ICE": return 0.5;
|
||||
case "GROUND": return 2;
|
||||
case "FLYING": return 2;
|
||||
case "DRAGON": return 2;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "❄";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
52
NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs
Normal file
52
NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "NORMAL";
|
||||
public static int type_num = 0;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "ROCK": return 0.5;
|
||||
case "GHOST": return 0;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "⭕️";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return type_num;
|
||||
}
|
||||
}
|
||||
}
|
53
NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs
Normal file
53
NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "POISON";
|
||||
public static int numType = 7;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "GRASS": return 2;
|
||||
case "POISON": return 0.5;
|
||||
case "GROUND": return 0.5;
|
||||
case "ROCK": return 0.5;
|
||||
case "GHOST": return 0.5;
|
||||
case "STEEL": return 0;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "☠";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
86
NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs
Normal file
86
NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System.Collections.Generic;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using NadekoBot.Modules.Pokemon.PokemonTypes;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon.PokeTypes
|
||||
{
|
||||
|
||||
public interface IPokeType
|
||||
{
|
||||
|
||||
string GetImage();
|
||||
string GetName();
|
||||
int GetNum();
|
||||
double GetMagnifier(IPokeType target);
|
||||
}
|
||||
public class PokemonTypesMain
|
||||
{
|
||||
|
||||
public static IPokeType stringToPokeType(string newType)
|
||||
{
|
||||
|
||||
foreach (IPokeType t in TypeList)
|
||||
{
|
||||
if (t.GetName() == newType)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
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>()
|
||||
{
|
||||
new NormalType(),
|
||||
new FireType(),
|
||||
new WaterType(),
|
||||
new ElectricType(),
|
||||
new GrassType(),
|
||||
new IceType(),
|
||||
new FightingType(),
|
||||
new PoisonType(),
|
||||
new GroundType(),
|
||||
new FlyingType(),
|
||||
new PsychicType(),
|
||||
new BugType(),
|
||||
new RockType(),
|
||||
new GhostType(),
|
||||
new DragonType(),
|
||||
new DarkType(),
|
||||
new SteelType()
|
||||
};
|
||||
|
||||
public static IPokeType IntToPokeType(int id)
|
||||
{
|
||||
foreach (IPokeType t in TypeList)
|
||||
{
|
||||
if (t.GetNum() == id)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
53
NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs
Normal file
53
NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "PSYCHIC";
|
||||
public static int numType = 10;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIGHTING": return 2;
|
||||
case "POISON": return 2;
|
||||
case "PSYCHIC": return 0.5;
|
||||
case "DARK": return 0;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "💫";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
54
NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs
Normal file
54
NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "ROCK";
|
||||
public static int numType = 12;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 2;
|
||||
case "ICE": return 2;
|
||||
case "FIGHTING": return 0.5;
|
||||
case "GROUND": return 0.5;
|
||||
case "FLYING": return 2;
|
||||
case "BUG": return 2;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "💎";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
52
NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs
Normal file
52
NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "STEEL";
|
||||
public static int numType = -1;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 0.5;
|
||||
case "WATER": return 0.5;
|
||||
case "ELECTRIC": return 0.5;
|
||||
case "ICE": return 2;
|
||||
case "ROCK": return 2;
|
||||
case "STEEL": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "🔩";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
52
NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs
Normal file
52
NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
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
|
||||
{
|
||||
static readonly string name = "WATER";
|
||||
public static int numType = 2;
|
||||
|
||||
public double GetMagnifier(IPokeType target)
|
||||
{
|
||||
switch (target.GetName())
|
||||
{
|
||||
|
||||
case "FIRE": return 2;
|
||||
case "WATER": return 0.5;
|
||||
case "GRASS": return 0.5;
|
||||
case "GROUND": return 2;
|
||||
case "ROCK": return 2;
|
||||
case "DRAGON": return 0.5;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
List<string> moves = new List<string>();
|
||||
|
||||
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public string GetImage()
|
||||
{
|
||||
return "💦";
|
||||
}
|
||||
|
||||
public int GetNum()
|
||||
{
|
||||
return numType;
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using NadekoBot.Classes.JSONModels;
|
||||
using NadekoBot.Commands;
|
||||
using NadekoBot.Modules;
|
||||
using NadekoBot.Modules.Gambling;
|
||||
using NadekoBot.Modules.Translator;
|
||||
using NadekoBot.Modules.Pokemon;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,6 +14,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Modules.Translator;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
@ -164,9 +165,10 @@ namespace NadekoBot
|
||||
modules.Add(new Games(), "Games", ModuleFilter.None);
|
||||
modules.Add(new Music(), "Music", ModuleFilter.None);
|
||||
modules.Add(new Searches(), "Searches", ModuleFilter.None);
|
||||
modules.Add(new TranslatorModule(), "Translator", 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 TranslatorModule(), "Translator", ModuleFilter.None);
|
||||
if (!string.IsNullOrWhiteSpace(Creds.TrelloAppKey))
|
||||
modules.Add(new Trello(), "Trello", ModuleFilter.None);
|
||||
|
||||
|
@ -143,6 +143,8 @@
|
||||
<Compile Include="Classes\_DataModels\CurrencyTransactionModel.cs" />
|
||||
<Compile Include="Classes\_DataModels\Donator.cs" />
|
||||
<Compile Include="Classes\_DataModels\IDataModel.cs" />
|
||||
<Compile Include="Classes\_DataModels\pokemoves.cs" />
|
||||
<Compile Include="Classes\_DataModels\PokeTypes.cs" />
|
||||
<Compile Include="Classes\_DataModels\RequestModel.cs" />
|
||||
<Compile Include="Classes\_DataModels\StatsModel.cs" />
|
||||
<Compile Include="Classes\_DataModels\TypingArticleModel.cs" />
|
||||
@ -186,6 +188,28 @@
|
||||
<Compile Include="Modules\NSFW.cs" />
|
||||
<Compile Include="Modules\Permissions.cs" />
|
||||
<Compile Include="Commands\RatelimitCommand.cs" />
|
||||
<Compile Include="Modules\Pokemon\DefaultMoves.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonModule.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\IPokeTypeExtensions.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\PokeType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\PsychicType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\BugType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\RockType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\GhostType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\Dragontype.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\DarkType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\SteelType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\WaterType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\ElectricType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\GrassType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\IceType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\FightingType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\PoisonType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\GroundType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\FlyingType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\FireType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokemonTypes\NormalType.cs" />
|
||||
<Compile Include="Modules\Pokemon\PokeStats.cs" />
|
||||
<Compile Include="Modules\Searches.cs" />
|
||||
<Compile Include="Modules\Translator\Helpers\GoogleTranslator.cs" />
|
||||
<Compile Include="Modules\Translator\TranslateCommand.cs" />
|
||||
|
@ -15,7 +15,8 @@
|
||||
"Games": ">",
|
||||
"Gambling": "$",
|
||||
"Permissions": ";",
|
||||
"Programming": "%"
|
||||
"Programming": "%",
|
||||
"Pokemon": "poke"
|
||||
},
|
||||
"ServerBlacklist": [],
|
||||
"ChannelBlacklist": [],
|
||||
|
Loading…
Reference in New Issue
Block a user