From 2e9aa4106f667f7a76f27fd4d796eea72162b9d0 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 14:59:37 +0100 Subject: [PATCH 01/20] TEST~~~~TEST testing if this'll work =.= --- NadekoBot/Modules/Games.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs index 3dd8d46f..36b4f46d 100644 --- a/NadekoBot/Modules/Games.cs +++ b/NadekoBot/Modules/Games.cs @@ -16,6 +16,7 @@ namespace NadekoBot.Modules { commands.Add(new SpeedTyping(this)); commands.Add(new PollCommand(this)); //commands.Add(new BetrayGame(this)); + //EDIT TEST } public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Games; From 8b3355f8c70c2b38f26ae30110e22aca728e1752 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 15:18:26 +0100 Subject: [PATCH 02/20] Pokemon game O.O --- NadekoBot/Classes/_DataModels/PokeTypes.cs | 14 + NadekoBot/Classes/_DataModels/pokemoves.cs | 15 + NadekoBot/Modules/Pokegame/Pokegame.cs | 331 ++++++ NadekoBot/Modules/Pokegame/PokemonTypes.cs | 1072 ++++++++++++++++++++ NadekoBot/Modules/Pokegame/pokestats.cs | 18 + NadekoBot/NadekoBot.cs | 2 + NadekoBot/NadekoBot.csproj | 5 + 7 files changed, 1457 insertions(+) create mode 100644 NadekoBot/Classes/_DataModels/PokeTypes.cs create mode 100644 NadekoBot/Classes/_DataModels/pokemoves.cs create mode 100644 NadekoBot/Modules/Pokegame/Pokegame.cs create mode 100644 NadekoBot/Modules/Pokegame/PokemonTypes.cs create mode 100644 NadekoBot/Modules/Pokegame/pokestats.cs diff --git a/NadekoBot/Classes/_DataModels/PokeTypes.cs b/NadekoBot/Classes/_DataModels/PokeTypes.cs new file mode 100644 index 00000000..432d918c --- /dev/null +++ b/NadekoBot/Classes/_DataModels/PokeTypes.cs @@ -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 PokeTypes : IDataModel + { + public long UserId { get; set; } + public int type { get; set; } + } +} diff --git a/NadekoBot/Classes/_DataModels/pokemoves.cs b/NadekoBot/Classes/_DataModels/pokemoves.cs new file mode 100644 index 00000000..bacbed68 --- /dev/null +++ b/NadekoBot/Classes/_DataModels/pokemoves.cs @@ -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; } + } +} diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs new file mode 100644 index 00000000..45605222 --- /dev/null +++ b/NadekoBot/Modules/Pokegame/Pokegame.cs @@ -0,0 +1,331 @@ +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; + +namespace NadekoBot.Modules.pokegame +{ + class Pokegame : DiscordModule + { + public override string Prefix { get; } = "poke"; + public readonly int BASEHEALTH = 500; + private Dictionary stats = new Dictionary(); + + public Pokegame() + { + //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.Required) + .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; + if (stats.ContainsKey(e.User.Id)) + { + userstats = stats[e.User.Id]; + } else + { + //not really necessary now + userstats = defaultStats(); + stats.Add(e.User.Id, userstats); + } + //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} is 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; + if (stats.ContainsKey(target.Id)) + { + targetstats = stats[target.Id]; + } + else + { + targetstats = defaultStats(); + stats.Add(target.Id, targetstats); + } + //If target's HP is below 0, no use attacking + if (targetstats.HP < 0) + { + await e.Channel.SendMessage($"{target.Name} has already fainted!"); + return; + } + + //Check whether move can be used + pokegame.PokemonTypes.PokeType 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 + pokegame.PokemonTypes.PokeType 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} on {target.Name} 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 + 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); + var 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("move"); + var newType = PokemonTypes.stringToPokeType( e.GetArg("type").ToUpperInvariant()); + int typeNum = newType.getNum(); + var db = DbHandler.Instance.GetAllRows().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 + "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 = PokemonTypes.stringToPokeType(targetTypeString); + 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"); + } + //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(); + Dictionary Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id); + if (Dict.ContainsKey((long)e.User.Id)) + { + //delete previous type + DbHandler.Instance.Delete(Dict[(long)e.User.Id]); + } + + DbHandler.Instance.InsertData(new Classes._DataModels.PokeTypes + { + UserId = (long)e.User.Id, + type = targetType.getNum() + }); + }); + }); + } + + private int getDamage(PokemonTypes.PokeType usertype, PokemonTypes.PokeType 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 pokegame.PokemonTypes.PokeType getPokeType(ulong id) + { + + var db = DbHandler.Instance.GetAllRows(); + Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); + if (setTypes.ContainsKey((long)id)) + { + return PokemonTypes.intToPokeType(setTypes[(long) id]); + } + + int remainder = (int) id % 16; + + return PokemonTypes.intToPokeType(remainder); + + + } + + private Pokestats defaultStats() + { + Pokestats s = new Pokestats(); + s.HP = BASEHEALTH; + return s; + } + + + } +} diff --git a/NadekoBot/Modules/Pokegame/PokemonTypes.cs b/NadekoBot/Modules/Pokegame/PokemonTypes.cs new file mode 100644 index 00000000..b3304cce --- /dev/null +++ b/NadekoBot/Modules/Pokegame/PokemonTypes.cs @@ -0,0 +1,1072 @@ +using NadekoBot.Classes; +using NadekoBot.Classes._DataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + + + +namespace NadekoBot.Modules.pokegame +{ + public class PokemonTypes + { + public interface PokeType + { + string getImage(); + string getName(); + int getNum(); + List getMoves(); + double getMagnifier(PokeType target); + void updateMoves(); + } + public static PokeType stringToPokeType(string newType) + { + + foreach (PokeType t in typeList) + { + if (t.getName() == newType) + { + return t; + } + } + return null; + } + + public static List typeList = new List() + { + new Type_NORMAL(), + new Type_FIRE(), + new Type_WATER(), + new Type_ELECTRIC(), + new Type_GRASS(), + new Type_ICE(), + new Type_FIGHTING(), + new Type_POISON(), + new Type_GROUND(), + new Type_FLYING(), + new Type_PSYCHIC(), + new Type_BUG(), + new Type_ROCK(), + new Type_GHOST(), + new Type_DRAGON(), + new Type_DARK(), + new Type_STEEL() + }; + + public static PokeType intToPokeType(int id) + { + foreach(PokeType t in typeList) + { + if (t.getNum() == id) + { + return t; + } + } + return null; + } + + class Type_NORMAL : PokeType + { + static readonly string name = "NORMAL"; + public static int type_num = 0; + + public double getMagnifier(PokeType target) + { + switch (target.getName()) + { + + case "ROCK": return 0.5; + case "GHOST": return 0; + case "STEEL": return 0.5; + default: return 1; + } + } + List moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "⭕️"; + } + + public int getNum() + { + return type_num; + } + } + class Type_FIRE : PokeType + { + static readonly string name = "FIRE"; + public static int type_num = 1; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🔥"; + } + + public int getNum() + { + return type_num; + } + } + class Type_WATER : PokeType + { + static readonly string name = "WATER"; + public static int type_num = 2; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "💦"; + } + + public int getNum() + { + return type_num; + } + } + class Type_ELECTRIC : PokeType + { + static readonly string name = "ELECTRIC"; + public static int type_num = 3; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "⚡️"; + } + + public int getNum() + { + return type_num; + } + } + class Type_GRASS : PokeType + { + static readonly string name = "GRASS"; + public static int type_num = 4; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "🌿"; + } + + public int getNum() + { + return type_num; + } + } + class Type_ICE : PokeType + { + static readonly string name = "ICE"; + public static int type_num = 5; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "❄"; + } + + public int getNum() + { + return type_num; + } + } + class Type_FIGHTING : PokeType + { + static readonly string name = "FIGHTING"; + public static int type_num = 6; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "✊"; + } + + public int getNum() + { + return type_num; + } + } + class Type_POISON : PokeType + { + static readonly string name = "POISON"; + public static int type_num = 7; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "☠"; + } + + public int getNum() + { + return type_num; + } + } + class Type_GROUND : PokeType + { + static readonly string name = "GROUND"; + public static int type_num = 8; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🗻"; + } + + public int getNum() + { + return type_num; + } + } + class Type_FLYING : PokeType + { + static readonly string name = "FLYING"; + public static int type_num = 9; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "☁"; + } + + public int getNum() + { + return type_num; + } + } + class Type_PSYCHIC : PokeType + { + static readonly string name = "PSYCHIC"; + public static int type_num = 10; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "💫"; + } + + public int getNum() + { + return type_num; + } + } + class Type_BUG : PokeType + { + static readonly string name = "BUG"; + public static int type_num = 11; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🐛"; + } + + public int getNum() + { + return type_num; + } + } + class Type_ROCK : PokeType + { + static readonly string name = "ROCK"; + public static int type_num = 12; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "💎"; + } + + public int getNum() + { + return type_num; + } + } + class Type_GHOST : PokeType + { + static readonly string name = "GHOST"; + public static int type_num = 13; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "👻"; + } + + public int getNum() + { + return type_num; + } + } + class Type_DRAGON : PokeType + { + static readonly string name = "DRAGON"; + public static int type_num = 14; + + public double getMagnifier(PokeType target) + { + switch (target.getName()) + { + + case "DRAGON": return 2; + case "STEEL": return 0.5; + default: return 1; + } + } + List moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🐉"; + } + + public int getNum() + { + return type_num; + } + } + class Type_DARK : PokeType + { + static readonly string name = "DARK"; + public static int type_num = 15; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🕶"; + } + + public int getNum() + { + return type_num; + } + } + class Type_STEEL : PokeType + { + static readonly string name = "STEEL"; + public static int type_num = -1; + + public double getMagnifier(PokeType 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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "🔩"; + } + + public int getNum() + { + return type_num; + } + } + + } +} + +namespace PokeTypeExtensions +{ + + public static class PokeTypeExtension + { + + + static int numberToType(this NadekoBot.Modules.pokegame.PokemonTypes.PokeType t) + { + return t.getNum(); + } + } +} \ No newline at end of file diff --git a/NadekoBot/Modules/Pokegame/pokestats.cs b/NadekoBot/Modules/Pokegame/pokestats.cs new file mode 100644 index 00000000..08c5da82 --- /dev/null +++ b/NadekoBot/Modules/Pokegame/pokestats.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NadekoBot.Modules.pokegame +{ + 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 lastAttacked { get; set; } = new List(); + } +} diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 4cb35898..96905743 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -6,6 +6,7 @@ using NadekoBot.Classes.JSONModels; using NadekoBot.Commands; using NadekoBot.Modules; using NadekoBot.Modules.Gambling; +using NadekoBot.Modules.pokegame; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -165,6 +166,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 Pokegame(), "Pokegame", ModuleFilter.None); if (!string.IsNullOrWhiteSpace(Creds.TrelloAppKey)) modules.Add(new Trello(), "Trello", ModuleFilter.None); diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index b0db5876..d45aefac 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -141,6 +141,8 @@ + + @@ -184,6 +186,9 @@ + + + From f7807d0b9ad083a2fafae8dfd9ff4b5cae99437d Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 15:23:27 +0100 Subject: [PATCH 03/20] Removed remnants in games.cs --- NadekoBot/Modules/Games.cs | 119 ------------------------------------- 1 file changed, 119 deletions(-) diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs index 36b4f46d..4c875885 100644 --- a/NadekoBot/Modules/Games.cs +++ b/NadekoBot/Modules/Games.cs @@ -54,40 +54,6 @@ namespace NadekoBot.Modules { } 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) @@ -145,91 +111,6 @@ 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) { if (i == 0) From 7812d66e4a8b214b9c1937a976ca5652080ce6c4 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 16:52:33 +0100 Subject: [PATCH 04/20] Added pokedefaultmoves to set defaultmoves --- NadekoBot/Modules/Pokegame/Pokegame.cs | 92 ++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 12 deletions(-) diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs index 45605222..62e9bf63 100644 --- a/NadekoBot/Modules/Pokegame/Pokegame.cs +++ b/NadekoBot/Modules/Pokegame/Pokegame.cs @@ -9,6 +9,7 @@ using NadekoBot.Commands; using NadekoBot.Classes; using NadekoBot.Extensions; using NadekoBot.Classes._DataModels; +using NadekoBot.Classes.Permissions; namespace NadekoBot.Modules.pokegame { @@ -49,7 +50,8 @@ namespace NadekoBot.Modules.pokegame if (stats.ContainsKey(e.User.Id)) { userstats = stats[e.User.Id]; - } else + } + else { //not really necessary now userstats = defaultStats(); @@ -108,12 +110,13 @@ namespace NadekoBot.Modules.pokegame targetstats.HP -= damage; var response = $"{e.User.Mention} used {move} on {target.Name} for {damage} damage"; - + //Damage type if (damage < 40) { response += "\nIt's not effective.."; - } else if (damage > 60) + } + else if (damage > 60) { response += "\nIt's super effective!"; } @@ -121,9 +124,9 @@ namespace NadekoBot.Modules.pokegame { response += "\nIt's somewhat effective"; } - + //check fainted - + if (targetstats.HP < 0) { response += $"\n{target.Name} has fainted!"; @@ -167,10 +170,11 @@ namespace NadekoBot.Modules.pokegame .Description($"Adds move given to database.\n**Usage**: {Prefix}addmove flame fire") .Parameter("movename", ParameterType.Required) .Parameter("movetype", ParameterType.Required) - .Do(async e => { + .Do(async e => + { //Implement NadekoFlowers???? string newMove = e.GetArg("move"); - var newType = PokemonTypes.stringToPokeType( e.GetArg("type").ToUpperInvariant()); + var newType = PokemonTypes.stringToPokeType(e.GetArg("type").ToUpperInvariant()); int typeNum = newType.getNum(); var db = DbHandler.Instance.GetAllRows().Select(x => x.move); if (db.Contains(newMove)) @@ -202,7 +206,7 @@ namespace NadekoBot.Modules.pokegame } if (stats.ContainsKey(usr.Id)) { - + var targetStats = stats[usr.Id]; int HP = targetStats.HP; if (targetStats.HP == BASEHEALTH) @@ -254,6 +258,67 @@ namespace NadekoBot.Modules.pokegame }); + cgb.CreateCommand(Prefix + "defaultmoves") + .Description($"Sets the moves DB to the default state **OWNER ONLY**") + .AddCheck(SimpleCheckers.OwnerOnly()) + .Do(async e => + { + //clear DB + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + DbHandler.Instance.Delete(p.Id); + } + + Dictionary defaultmoves = new Dictionary() + { + {"flame",1}, + {"hack",3}, + {"scare",13}, + {"splash",2}, + {"flame",1}, + {"freeze",5}, + {"strike",4}, + {"surge",3}, + {"electrocute",3}, + {"surf",2}, + {"mellow",4}, + {"flamethrower",1}, + {"thundershock",3}, + {"lava",12}, + {"fly",9}, + {"control",10}, + {"sting",11}, + {"poison",7}, + {"confusion",10}, + {"breathe",14}, + {"ultrabash",6}, + {"punch",6}, + {"blind",15}, + {"scare",13}, + {"earthquake",8}, + {"rocksmash",12}, + {"transform",0}, + {"bulldoze",8}, + {"frustate",0}, + {"confide",0}, + {"metronome",0}, + {"dracometeor",14}, + {"outrage",14} + }; + + foreach (KeyValuePair entry in defaultmoves) + { + DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves + { + move = entry.Key, + type = entry.Value + }); + } + await e.Send("done"); + + }); + cgb.CreateCommand(Prefix + "settype") .Description($"Set your poketype. Costs a NadekoFlower.\n**Usage**: {Prefix}settype fire") .Parameter("targetType", ParameterType.Required) @@ -292,6 +357,9 @@ namespace NadekoBot.Modules.pokegame }); } + + + private int getDamage(PokemonTypes.PokeType usertype, PokemonTypes.PokeType targetType) { Random rng = new Random(); @@ -309,13 +377,13 @@ namespace NadekoBot.Modules.pokegame Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); if (setTypes.ContainsKey((long)id)) { - return PokemonTypes.intToPokeType(setTypes[(long) id]); + return PokemonTypes.intToPokeType(setTypes[(long)id]); } - int remainder = (int) id % 16; + int remainder = (int)id % 16; return PokemonTypes.intToPokeType(remainder); - + } @@ -326,6 +394,6 @@ namespace NadekoBot.Modules.pokegame return s; } - + } } From 6a0f7a46cfa6ac9ea0edd7ceadb1bb3a1e01ef8a Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 19:47:14 +0100 Subject: [PATCH 05/20] Fixed DB bug --- NadekoBot/Classes/DBHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NadekoBot/Classes/DBHandler.cs b/NadekoBot/Classes/DBHandler.cs index f003b94b..51cb91e7 100644 --- a/NadekoBot/Classes/DBHandler.cs +++ b/NadekoBot/Classes/DBHandler.cs @@ -22,6 +22,8 @@ namespace NadekoBot.Classes { conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); + conn.CreateTable(); + conn.CreateTable(); conn.CreateTable(); conn.Execute(Queries.TransactionTriggerQuery); } From 1cd7a0cdebf8c274a48577a6dfdf844b36d94867 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 20:23:05 +0100 Subject: [PATCH 06/20] Fix defaultmoves --- NadekoBot/Modules/Pokegame/Pokegame.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs index 62e9bf63..2b25e280 100644 --- a/NadekoBot/Modules/Pokegame/Pokegame.cs +++ b/NadekoBot/Modules/Pokegame/Pokegame.cs @@ -173,7 +173,7 @@ namespace NadekoBot.Modules.pokegame .Do(async e => { //Implement NadekoFlowers???? - string newMove = e.GetArg("move"); + string newMove = e.GetArg("move").ToLowerInvariant(); var newType = PokemonTypes.stringToPokeType(e.GetArg("type").ToUpperInvariant()); int typeNum = newType.getNum(); var db = DbHandler.Instance.GetAllRows().Select(x => x.move); @@ -276,7 +276,6 @@ namespace NadekoBot.Modules.pokegame {"hack",3}, {"scare",13}, {"splash",2}, - {"flame",1}, {"freeze",5}, {"strike",4}, {"surge",3}, @@ -295,7 +294,6 @@ namespace NadekoBot.Modules.pokegame {"ultrabash",6}, {"punch",6}, {"blind",15}, - {"scare",13}, {"earthquake",8}, {"rocksmash",12}, {"transform",0}, @@ -325,7 +323,7 @@ namespace NadekoBot.Modules.pokegame .Do(async e => { var targetTypeString = e.GetArg("targetType"); - var targetType = PokemonTypes.stringToPokeType(targetTypeString); + var targetType = PokemonTypes.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"); @@ -358,7 +356,7 @@ namespace NadekoBot.Modules.pokegame } - + private int getDamage(PokemonTypes.PokeType usertype, PokemonTypes.PokeType targetType) { From 9d4d608a3d452d87419f88eb1e41d3f8fe4b6e9f Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 20:36:34 +0100 Subject: [PATCH 07/20] Fixed addmove stupid innocent bug, you were --- NadekoBot/Modules/Pokegame/Pokegame.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs index 2b25e280..d31e9d10 100644 --- a/NadekoBot/Modules/Pokegame/Pokegame.cs +++ b/NadekoBot/Modules/Pokegame/Pokegame.cs @@ -61,7 +61,7 @@ namespace NadekoBot.Modules.pokegame //User not able if HP < 0, has made more than 4 attacks if (userstats.HP < 0) { - await e.Channel.SendMessage($"{e.User.Mention} is fainted and was not able to move!"); + await e.Channel.SendMessage($"{e.User.Mention} has fainted and was not able to move!"); return; } if (userstats.movesMade >= 5) @@ -88,7 +88,7 @@ namespace NadekoBot.Modules.pokegame //If target's HP is below 0, no use attacking if (targetstats.HP < 0) { - await e.Channel.SendMessage($"{target.Name} has already fainted!"); + await e.Channel.SendMessage($"{target.Mention} has already fainted!"); return; } @@ -98,7 +98,7 @@ namespace NadekoBot.Modules.pokegame 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"); + await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use {Prefix}listmoves to see moves you can use"); return; } @@ -109,7 +109,7 @@ namespace NadekoBot.Modules.pokegame //apply damage to target targetstats.HP -= damage; - var response = $"{e.User.Mention} used {move} on {target.Name} for {damage} damage"; + var response = $"{e.User.Mention} used **{move}** on {target.Mention} for **{damage}** damage"; //Damage type if (damage < 40) @@ -129,11 +129,11 @@ namespace NadekoBot.Modules.pokegame if (targetstats.HP < 0) { - response += $"\n{target.Name} has fainted!"; + 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 @@ -173,8 +173,8 @@ namespace NadekoBot.Modules.pokegame .Do(async e => { //Implement NadekoFlowers???? - string newMove = e.GetArg("move").ToLowerInvariant(); - var newType = PokemonTypes.stringToPokeType(e.GetArg("type").ToUpperInvariant()); + string newMove = e.GetArg("movename").ToLowerInvariant(); + var newType = PokemonTypes.stringToPokeType(e.GetArg("movetype").ToUpperInvariant()); int typeNum = newType.getNum(); var db = DbHandler.Instance.GetAllRows().Select(x => x.move); if (db.Contains(newMove)) From 84e20cbd83cd912bf7d594511a64058af9f46501 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 20:51:33 +0100 Subject: [PATCH 08/20] response to settype & lists all moves after resetting to defaultmoves --- NadekoBot/Modules/Pokegame/Pokegame.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs index d31e9d10..cd5b2ceb 100644 --- a/NadekoBot/Modules/Pokegame/Pokegame.cs +++ b/NadekoBot/Modules/Pokegame/Pokegame.cs @@ -313,8 +313,19 @@ namespace NadekoBot.Modules.pokegame type = entry.Value }); } - await e.Send("done"); - + + var str = "Reset moves.\n**Moves:**"; + //could sort, but meh + var dbMoves = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves m in dbMoves) + { + var t = PokemonTypes.intToPokeType(m.type); + + str += $"\n{t.getImage()}{m.move}"; + } + + await e.Channel.SendMessage(str); + }); cgb.CreateCommand(Prefix + "settype") @@ -351,6 +362,10 @@ namespace NadekoBot.Modules.pokegame 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 🌸"); }); }); } From 88ed05127b42eec908663f4dcf7814f56d8fbd2e Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 26 Mar 2016 21:03:44 +0100 Subject: [PATCH 09/20] Settype bugfixing --- NadekoBot/Modules/Pokegame/Pokegame.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs index cd5b2ceb..8bda3a9e 100644 --- a/NadekoBot/Modules/Pokegame/Pokegame.cs +++ b/NadekoBot/Modules/Pokegame/Pokegame.cs @@ -338,7 +338,14 @@ namespace NadekoBot.Modules.pokegame 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; From 53b5803f25bb5b3d9d7f7e847c959748402624ee Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 27 Mar 2016 10:57:30 +0200 Subject: [PATCH 10/20] Merge to single file, implemented most suggestions --- NadekoBot/Classes/JSONModels/Configuration.cs | 1 + NadekoBot/Modules/Pokegame/Pokegame.cs | 419 ---------------- NadekoBot/Modules/Pokegame/pokestats.cs | 18 - .../PokemonTypes.cs => PokemonModule.cs} | 453 +++++++++++++++++- NadekoBot/NadekoBot.csproj | 4 +- 5 files changed, 433 insertions(+), 462 deletions(-) delete mode 100644 NadekoBot/Modules/Pokegame/Pokegame.cs delete mode 100644 NadekoBot/Modules/Pokegame/pokestats.cs rename NadekoBot/Modules/{Pokegame/PokemonTypes.cs => PokemonModule.cs} (61%) diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index dcd8920f..0de62d26 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -89,6 +89,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 { diff --git a/NadekoBot/Modules/Pokegame/Pokegame.cs b/NadekoBot/Modules/Pokegame/Pokegame.cs deleted file mode 100644 index 8bda3a9e..00000000 --- a/NadekoBot/Modules/Pokegame/Pokegame.cs +++ /dev/null @@ -1,419 +0,0 @@ -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; - -namespace NadekoBot.Modules.pokegame -{ - class Pokegame : DiscordModule - { - public override string Prefix { get; } = "poke"; - public readonly int BASEHEALTH = 500; - private Dictionary stats = new Dictionary(); - - public Pokegame() - { - //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.Required) - .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; - if (stats.ContainsKey(e.User.Id)) - { - userstats = stats[e.User.Id]; - } - else - { - //not really necessary now - userstats = defaultStats(); - stats.Add(e.User.Id, userstats); - } - //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; - if (stats.ContainsKey(target.Id)) - { - targetstats = stats[target.Id]; - } - else - { - targetstats = defaultStats(); - stats.Add(target.Id, targetstats); - } - //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 - pokegame.PokemonTypes.PokeType 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 - pokegame.PokemonTypes.PokeType 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}** on {target.Mention} 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 - 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); - var 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 = PokemonTypes.stringToPokeType(e.GetArg("movetype").ToUpperInvariant()); - int typeNum = newType.getNum(); - var db = DbHandler.Instance.GetAllRows().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 + "defaultmoves") - .Description($"Sets the moves DB to the default state **OWNER ONLY**") - .AddCheck(SimpleCheckers.OwnerOnly()) - .Do(async e => - { - //clear DB - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - DbHandler.Instance.Delete(p.Id); - } - - Dictionary defaultmoves = new Dictionary() - { - {"flame",1}, - {"hack",3}, - {"scare",13}, - {"splash",2}, - {"freeze",5}, - {"strike",4}, - {"surge",3}, - {"electrocute",3}, - {"surf",2}, - {"mellow",4}, - {"flamethrower",1}, - {"thundershock",3}, - {"lava",12}, - {"fly",9}, - {"control",10}, - {"sting",11}, - {"poison",7}, - {"confusion",10}, - {"breathe",14}, - {"ultrabash",6}, - {"punch",6}, - {"blind",15}, - {"earthquake",8}, - {"rocksmash",12}, - {"transform",0}, - {"bulldoze",8}, - {"frustate",0}, - {"confide",0}, - {"metronome",0}, - {"dracometeor",14}, - {"outrage",14} - }; - - foreach (KeyValuePair entry in defaultmoves) - { - DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves - { - move = entry.Key, - type = entry.Value - }); - } - - var str = "Reset moves.\n**Moves:**"; - //could sort, but meh - var dbMoves = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves m in dbMoves) - { - var t = PokemonTypes.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 = PokemonTypes.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(); - Dictionary Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id); - if (Dict.ContainsKey((long)e.User.Id)) - { - //delete previous type - DbHandler.Instance.Delete(Dict[(long)e.User.Id]); - } - - DbHandler.Instance.InsertData(new Classes._DataModels.PokeTypes - { - 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(PokemonTypes.PokeType usertype, PokemonTypes.PokeType 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 pokegame.PokemonTypes.PokeType getPokeType(ulong id) - { - - var db = DbHandler.Instance.GetAllRows(); - Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); - if (setTypes.ContainsKey((long)id)) - { - return PokemonTypes.intToPokeType(setTypes[(long)id]); - } - - int remainder = (int)id % 16; - - return PokemonTypes.intToPokeType(remainder); - - - } - - private Pokestats defaultStats() - { - Pokestats s = new Pokestats(); - s.HP = BASEHEALTH; - return s; - } - - - } -} diff --git a/NadekoBot/Modules/Pokegame/pokestats.cs b/NadekoBot/Modules/Pokegame/pokestats.cs deleted file mode 100644 index 08c5da82..00000000 --- a/NadekoBot/Modules/Pokegame/pokestats.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace NadekoBot.Modules.pokegame -{ - 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 lastAttacked { get; set; } = new List(); - } -} diff --git a/NadekoBot/Modules/Pokegame/PokemonTypes.cs b/NadekoBot/Modules/PokemonModule.cs similarity index 61% rename from NadekoBot/Modules/Pokegame/PokemonTypes.cs rename to NadekoBot/Modules/PokemonModule.cs index b3304cce..616fce14 100644 --- a/NadekoBot/Modules/Pokegame/PokemonTypes.cs +++ b/NadekoBot/Modules/PokemonModule.cs @@ -1,15 +1,436 @@ -using NadekoBot.Classes; -using NadekoBot.Classes._DataModels; -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; 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; namespace NadekoBot.Modules.pokegame +{ + using Modules.pokegame.poketypes; + class Pokegame : DiscordModule + { + public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Pokemon; + public readonly int BASEHEALTH = 500; + //private Dictionary stats = new Dictionary(); + private ConcurrentDictionary stats = new ConcurrentDictionary(); + public Pokegame() + { + //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"); + Discord.User target = null; + if (!string.IsNullOrWhiteSpace(e.GetArg("target"))) + { + + target = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault(); + if (target == null) + { + await e.Channel.SendMessage("No such person."); + return; + } + } else + { + 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 + PokemonTypes.PokeType 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 + PokemonTypes.PokeType 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}** on {target.Mention} 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 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 = PokemonTypes.stringToPokeType(e.GetArg("movetype").ToUpperInvariant()); + int typeNum = newType.getNum(); + var db = DbHandler.Instance.GetAllRows().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 + "defaultmoves") + .Description($"Sets the moves DB to the default state **OWNER ONLY**") + .AddCheck(SimpleCheckers.OwnerOnly()) + .Do(async e => + { + //clear DB + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + DbHandler.Instance.Delete(p.Id); + } + + Dictionary defaultmoves = new Dictionary() + { + {"flame",1}, + {"hack",3}, + {"scare",13}, + {"splash",2}, + {"freeze",5}, + {"strike",4}, + {"surge",3}, + {"electrocute",3}, + {"surf",2}, + {"mellow",4}, + {"flamethrower",1}, + {"thundershock",3}, + {"lava",12}, + {"fly",9}, + {"control",10}, + {"sting",11}, + {"poison",7}, + {"confusion",10}, + {"breathe",14}, + {"ultrabash",6}, + {"punch",6}, + {"blind",15}, + {"earthquake",8}, + {"rocksmash",12}, + {"transform",0}, + {"bulldoze",8}, + {"frustate",0}, + {"confide",0}, + {"metronome",0}, + {"dracometeor",14}, + {"outrage",14} + }; + + foreach (KeyValuePair entry in defaultmoves) + { + DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves + { + move = entry.Key, + type = entry.Value + }); + } + + var str = "Reset moves.\n**Moves:**"; + //could sort, but meh + var dbMoves = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves m in dbMoves) + { + var t = PokemonTypes.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 = PokemonTypes.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(); + Dictionary Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id); + if (Dict.ContainsKey((long)e.User.Id)) + { + //delete previous type + DbHandler.Instance.Delete(Dict[(long)e.User.Id]); + } + + DbHandler.Instance.InsertData(new Classes._DataModels.PokeTypes + { + 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(PokemonTypes.PokeType usertype, PokemonTypes.PokeType 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 PokemonTypes.PokeType getPokeType(ulong id) + { + + var db = DbHandler.Instance.GetAllRows(); + Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); + if (setTypes.ContainsKey((long)id)) + { + return PokemonTypes.intToPokeType(setTypes[(long)id]); + } + + int remainder = (int)id % 16; + + return PokemonTypes.intToPokeType(remainder); + + + } + + private Pokestats defaultStats() + { + Pokestats s = new Pokestats(); + s.HP = BASEHEALTH; + return s; + } + + + } + 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 lastAttacked { get; set; } = new List(); + } +} + + +//Not sure this is what you wanted? + + + +namespace NadekoBot.Modules.pokegame.poketypes { public class PokemonTypes { @@ -24,7 +445,7 @@ namespace NadekoBot.Modules.pokegame } public static PokeType stringToPokeType(string newType) { - + foreach (PokeType t in typeList) { if (t.getName() == newType) @@ -58,7 +479,7 @@ namespace NadekoBot.Modules.pokegame public static PokeType intToPokeType(int id) { - foreach(PokeType t in typeList) + foreach (PokeType t in typeList) { if (t.getNum() == id) { @@ -68,7 +489,7 @@ namespace NadekoBot.Modules.pokegame return null; } - class Type_NORMAL : PokeType + class Type_NORMAL : PokeType { static readonly string name = "NORMAL"; public static int type_num = 0; @@ -123,7 +544,7 @@ namespace NadekoBot.Modules.pokegame return type_num; } } - class Type_FIRE : PokeType + class Type_FIRE : PokeType { static readonly string name = "FIRE"; public static int type_num = 1; @@ -183,7 +604,7 @@ namespace NadekoBot.Modules.pokegame return type_num; } } - class Type_WATER : PokeType + class Type_WATER : PokeType { static readonly string name = "WATER"; public static int type_num = 2; @@ -1057,16 +1478,4 @@ namespace NadekoBot.Modules.pokegame } } -namespace PokeTypeExtensions -{ - public static class PokeTypeExtension - { - - - static int numberToType(this NadekoBot.Modules.pokegame.PokemonTypes.PokeType t) - { - return t.getNum(); - } - } -} \ No newline at end of file diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index d45aefac..8da82223 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -186,9 +186,7 @@ - - - + From 5496531bf249d28b7f933dfad41e994de2ae858e Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 27 Mar 2016 11:07:52 +0200 Subject: [PATCH 11/20] Should do it~ --- NadekoBot/Modules/Games.cs | 2 +- NadekoBot/bin/Debug/data/config_example.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs index 4c875885..9321859a 100644 --- a/NadekoBot/Modules/Games.cs +++ b/NadekoBot/Modules/Games.cs @@ -16,7 +16,7 @@ namespace NadekoBot.Modules { commands.Add(new SpeedTyping(this)); commands.Add(new PollCommand(this)); //commands.Add(new BetrayGame(this)); - //EDIT TEST + } public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Games; diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index 13198eee..92d971ef 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -15,7 +15,8 @@ "Games": ">", "Gambling": "$", "Permissions": ";", - "Programming": "%" + "Programming": "%", + "Pokemon": "poke" }, "ServerBlacklist": [], "ChannelBlacklist": [], From 6eca7745d3887692c903ea28fcdd7aad0e0df4e1 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 27 Mar 2016 14:55:49 +0200 Subject: [PATCH 12/20] Division LOTS OF WORK, THIS WAS --- NadekoBot/Classes/DBHandler.cs | 2 +- NadekoBot/Classes/_DataModels/PokeTypes.cs | 2 +- NadekoBot/Modules/Pokemon/PokeStats.cs | 12 + NadekoBot/Modules/Pokemon/PokemonModule.cs | 435 +++++ .../Modules/Pokemon/PokemonTypes/BugType.cs | 73 + .../Modules/Pokemon/PokemonTypes/DarkType.cs | 69 + .../Pokemon/PokemonTypes/Dragontype.cs | 66 + .../Pokemon/PokemonTypes/ElectricType.cs | 69 + .../Pokemon/PokemonTypes/FightingType.cs | 73 + .../Modules/Pokemon/PokemonTypes/FireType.cs | 74 + .../Pokemon/PokemonTypes/FlyingType.cs | 70 + .../Modules/Pokemon/PokemonTypes/GhostType.cs | 69 + .../Modules/Pokemon/PokemonTypes/GrassType.cs | 71 + .../Pokemon/PokemonTypes/GroundType.cs | 72 + .../Modules/Pokemon/PokemonTypes/IceType.cs | 71 + .../Pokemon/PokemonTypes/NormalType.cs | 69 + .../Pokemon/PokemonTypes/PoisonType.cs | 70 + .../Modules/Pokemon/PokemonTypes/PokeType.cs | 91 + .../Pokemon/PokemonTypes/PsychicType.cs | 69 + .../Modules/Pokemon/PokemonTypes/RockType.cs | 71 + .../Modules/Pokemon/PokemonTypes/SteelType.cs | 69 + .../Modules/Pokemon/PokemonTypes/WaterType.cs | 69 + NadekoBot/Modules/PokemonModule.cs | 1481 ----------------- NadekoBot/NadekoBot.cs | 4 +- NadekoBot/NadekoBot.csproj | 21 +- 25 files changed, 1756 insertions(+), 1486 deletions(-) create mode 100644 NadekoBot/Modules/Pokemon/PokeStats.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonModule.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs delete mode 100644 NadekoBot/Modules/PokemonModule.cs diff --git a/NadekoBot/Classes/DBHandler.cs b/NadekoBot/Classes/DBHandler.cs index 51cb91e7..fd54899f 100644 --- a/NadekoBot/Classes/DBHandler.cs +++ b/NadekoBot/Classes/DBHandler.cs @@ -23,7 +23,7 @@ namespace NadekoBot.Classes { conn.CreateTable(); conn.CreateTable(); conn.CreateTable(); - conn.CreateTable(); + conn.CreateTable(); conn.CreateTable(); conn.Execute(Queries.TransactionTriggerQuery); } diff --git a/NadekoBot/Classes/_DataModels/PokeTypes.cs b/NadekoBot/Classes/_DataModels/PokeTypes.cs index 432d918c..3661540a 100644 --- a/NadekoBot/Classes/_DataModels/PokeTypes.cs +++ b/NadekoBot/Classes/_DataModels/PokeTypes.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace NadekoBot.Classes._DataModels { - class PokeTypes : IDataModel + class userPokeTypes : IDataModel { public long UserId { get; set; } public int type { get; set; } diff --git a/NadekoBot/Modules/Pokemon/PokeStats.cs b/NadekoBot/Modules/Pokemon/PokeStats.cs new file mode 100644 index 00000000..dca9d31f --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokeStats.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NadekoBot.Modules.Pokemon +{ + class PokeStats + { + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs new file mode 100644 index 00000000..8bf71139 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -0,0 +1,435 @@ +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; + +namespace NadekoBot.Modules.Pokemon +{ + + class PokemonGame : DiscordModule + { + public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Pokemon; + public readonly int BASEHEALTH = 500; + //private Dictionary stats = new Dictionary(); + private ConcurrentDictionary stats = new ConcurrentDictionary(); + + + 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"); + Discord.User target = null; + if (!string.IsNullOrWhiteSpace(e.GetArg("target"))) + { + + target = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault(); + if (target == null) + { + await e.Channel.SendMessage("No such person."); + return; + } + } else + { + 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 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().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 + "defaultmoves") + .Description($"Sets the moves DB to the default state **OWNER ONLY**") + .AddCheck(SimpleCheckers.OwnerOnly()) + .Do(async e => + { + //clear DB + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + DbHandler.Instance.Delete(p.Id); + } + + Dictionary defaultmoves = new Dictionary() + { + {"flame",1}, + {"hack",3}, + {"scare",13}, + {"splash",2}, + {"freeze",5}, + {"strike",4}, + {"surge",3}, + {"electrocute",3}, + {"surf",2}, + {"mellow",4}, + {"flamethrower",1}, + {"thundershock",3}, + {"lava",12}, + {"fly",9}, + {"control",10}, + {"sting",11}, + {"poison",7}, + {"confusion",10}, + {"breathe",14}, + {"ultrabash",6}, + {"punch",6}, + {"blind",15}, + {"earthquake",8}, + {"rocksmash",12}, + {"transform",0}, + {"bulldoze",8}, + {"frustate",0}, + {"confide",0}, + {"metronome",0}, + {"dracometeor",14}, + {"outrage",14} + }; + + foreach (KeyValuePair entry in defaultmoves) + { + DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves + { + move = entry.Key, + type = entry.Value + }); + } + + var str = "Reset moves.\n**Moves:**"; + //could sort, but meh + var dbMoves = DbHandler.Instance.GetAllRows(); + 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(); + Dictionary Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id); + if (Dict.ContainsKey((long)e.User.Id)) + { + //delete previous type + DbHandler.Instance.Delete(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(); + Dictionary 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; + } + + + } + 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 lastAttacked { get; set; } = new List(); + } +} + + +//Not sure this is what you wanted? + + + + diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs new file mode 100644 index 00000000..d7d6014a --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs @@ -0,0 +1,73 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🐛"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs new file mode 100644 index 00000000..98ba6a68 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🕶"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs new file mode 100644 index 00000000..435675b7 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs @@ -0,0 +1,66 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🐉"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs new file mode 100644 index 00000000..25aaa15e --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "⚡️"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs new file mode 100644 index 00000000..3f22ec33 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs @@ -0,0 +1,73 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "✊"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs new file mode 100644 index 00000000..bf6f8eb0 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs @@ -0,0 +1,74 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🔥"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs new file mode 100644 index 00000000..7d7c1d54 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs @@ -0,0 +1,70 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "☁"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs new file mode 100644 index 00000000..8db5b678 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "👻"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs new file mode 100644 index 00000000..cab50981 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs @@ -0,0 +1,71 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "🌿"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs new file mode 100644 index 00000000..b1eb5ec4 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs @@ -0,0 +1,72 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "🗻"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs new file mode 100644 index 00000000..36cffe65 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs @@ -0,0 +1,71 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "❄"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs new file mode 100644 index 00000000..a6127865 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == type_num) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "⭕️"; + } + + public int getNum() + { + return type_num; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs new file mode 100644 index 00000000..f0cf19d1 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs @@ -0,0 +1,70 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "☠"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs new file mode 100644 index 00000000..75e265ea --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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(); + List getMoves(); + double getMagnifier(IPokeType target); + void updateMoves(); + } + public class PokemonTypesMain + { + + public static IPokeType stringToPokeType(string newType) + { + + foreach (IPokeType t in typeList) + { + if (t.getName() == newType) + { + return t; + } + } + return null; + } + + //These classes can use all methods (except getMoves) + public static List typeList = new List() + { + 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; + } + + + + + + + + + + + + + + + + + + + + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs new file mode 100644 index 00000000..1f1603ad --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "💫"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs new file mode 100644 index 00000000..4a48b9a7 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs @@ -0,0 +1,71 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + + public string getImage() + { + return "💎"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs new file mode 100644 index 00000000..f34e1ff2 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "🔩"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs new file mode 100644 index 00000000..9ee96880 --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs @@ -0,0 +1,69 @@ +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 moves = new List(); + + public List getMoves() + { + updateMoves(); + return moves; + } + + + public string getName() + { + return name; + } + + public void updateMoves() + { + var db = DbHandler.Instance.GetAllRows(); + foreach (PokeMoves p in db) + { + if (p.type == numType) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + } + public string getImage() + { + return "💦"; + } + + public int getNum() + { + return numType; + } + } +} diff --git a/NadekoBot/Modules/PokemonModule.cs b/NadekoBot/Modules/PokemonModule.cs deleted file mode 100644 index 616fce14..00000000 --- a/NadekoBot/Modules/PokemonModule.cs +++ /dev/null @@ -1,1481 +0,0 @@ -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; - - -namespace NadekoBot.Modules.pokegame -{ - using Modules.pokegame.poketypes; - class Pokegame : DiscordModule - { - public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Pokemon; - public readonly int BASEHEALTH = 500; - //private Dictionary stats = new Dictionary(); - private ConcurrentDictionary stats = new ConcurrentDictionary(); - public Pokegame() - { - //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"); - Discord.User target = null; - if (!string.IsNullOrWhiteSpace(e.GetArg("target"))) - { - - target = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault(); - if (target == null) - { - await e.Channel.SendMessage("No such person."); - return; - } - } else - { - 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 - PokemonTypes.PokeType 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 - PokemonTypes.PokeType 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}** on {target.Mention} 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 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 = PokemonTypes.stringToPokeType(e.GetArg("movetype").ToUpperInvariant()); - int typeNum = newType.getNum(); - var db = DbHandler.Instance.GetAllRows().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 + "defaultmoves") - .Description($"Sets the moves DB to the default state **OWNER ONLY**") - .AddCheck(SimpleCheckers.OwnerOnly()) - .Do(async e => - { - //clear DB - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - DbHandler.Instance.Delete(p.Id); - } - - Dictionary defaultmoves = new Dictionary() - { - {"flame",1}, - {"hack",3}, - {"scare",13}, - {"splash",2}, - {"freeze",5}, - {"strike",4}, - {"surge",3}, - {"electrocute",3}, - {"surf",2}, - {"mellow",4}, - {"flamethrower",1}, - {"thundershock",3}, - {"lava",12}, - {"fly",9}, - {"control",10}, - {"sting",11}, - {"poison",7}, - {"confusion",10}, - {"breathe",14}, - {"ultrabash",6}, - {"punch",6}, - {"blind",15}, - {"earthquake",8}, - {"rocksmash",12}, - {"transform",0}, - {"bulldoze",8}, - {"frustate",0}, - {"confide",0}, - {"metronome",0}, - {"dracometeor",14}, - {"outrage",14} - }; - - foreach (KeyValuePair entry in defaultmoves) - { - DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves - { - move = entry.Key, - type = entry.Value - }); - } - - var str = "Reset moves.\n**Moves:**"; - //could sort, but meh - var dbMoves = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves m in dbMoves) - { - var t = PokemonTypes.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 = PokemonTypes.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(); - Dictionary Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id); - if (Dict.ContainsKey((long)e.User.Id)) - { - //delete previous type - DbHandler.Instance.Delete(Dict[(long)e.User.Id]); - } - - DbHandler.Instance.InsertData(new Classes._DataModels.PokeTypes - { - 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(PokemonTypes.PokeType usertype, PokemonTypes.PokeType 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 PokemonTypes.PokeType getPokeType(ulong id) - { - - var db = DbHandler.Instance.GetAllRows(); - Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); - if (setTypes.ContainsKey((long)id)) - { - return PokemonTypes.intToPokeType(setTypes[(long)id]); - } - - int remainder = (int)id % 16; - - return PokemonTypes.intToPokeType(remainder); - - - } - - private Pokestats defaultStats() - { - Pokestats s = new Pokestats(); - s.HP = BASEHEALTH; - return s; - } - - - } - 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 lastAttacked { get; set; } = new List(); - } -} - - -//Not sure this is what you wanted? - - - -namespace NadekoBot.Modules.pokegame.poketypes -{ - public class PokemonTypes - { - public interface PokeType - { - string getImage(); - string getName(); - int getNum(); - List getMoves(); - double getMagnifier(PokeType target); - void updateMoves(); - } - public static PokeType stringToPokeType(string newType) - { - - foreach (PokeType t in typeList) - { - if (t.getName() == newType) - { - return t; - } - } - return null; - } - - public static List typeList = new List() - { - new Type_NORMAL(), - new Type_FIRE(), - new Type_WATER(), - new Type_ELECTRIC(), - new Type_GRASS(), - new Type_ICE(), - new Type_FIGHTING(), - new Type_POISON(), - new Type_GROUND(), - new Type_FLYING(), - new Type_PSYCHIC(), - new Type_BUG(), - new Type_ROCK(), - new Type_GHOST(), - new Type_DRAGON(), - new Type_DARK(), - new Type_STEEL() - }; - - public static PokeType intToPokeType(int id) - { - foreach (PokeType t in typeList) - { - if (t.getNum() == id) - { - return t; - } - } - return null; - } - - class Type_NORMAL : PokeType - { - static readonly string name = "NORMAL"; - public static int type_num = 0; - - public double getMagnifier(PokeType target) - { - switch (target.getName()) - { - - case "ROCK": return 0.5; - case "GHOST": return 0; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "⭕️"; - } - - public int getNum() - { - return type_num; - } - } - class Type_FIRE : PokeType - { - static readonly string name = "FIRE"; - public static int type_num = 1; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "🔥"; - } - - public int getNum() - { - return type_num; - } - } - class Type_WATER : PokeType - { - static readonly string name = "WATER"; - public static int type_num = 2; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "💦"; - } - - public int getNum() - { - return type_num; - } - } - class Type_ELECTRIC : PokeType - { - static readonly string name = "ELECTRIC"; - public static int type_num = 3; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "⚡️"; - } - - public int getNum() - { - return type_num; - } - } - class Type_GRASS : PokeType - { - static readonly string name = "GRASS"; - public static int type_num = 4; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "🌿"; - } - - public int getNum() - { - return type_num; - } - } - class Type_ICE : PokeType - { - static readonly string name = "ICE"; - public static int type_num = 5; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "❄"; - } - - public int getNum() - { - return type_num; - } - } - class Type_FIGHTING : PokeType - { - static readonly string name = "FIGHTING"; - public static int type_num = 6; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "✊"; - } - - public int getNum() - { - return type_num; - } - } - class Type_POISON : PokeType - { - static readonly string name = "POISON"; - public static int type_num = 7; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "☠"; - } - - public int getNum() - { - return type_num; - } - } - class Type_GROUND : PokeType - { - static readonly string name = "GROUND"; - public static int type_num = 8; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "🗻"; - } - - public int getNum() - { - return type_num; - } - } - class Type_FLYING : PokeType - { - static readonly string name = "FLYING"; - public static int type_num = 9; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "☁"; - } - - public int getNum() - { - return type_num; - } - } - class Type_PSYCHIC : PokeType - { - static readonly string name = "PSYCHIC"; - public static int type_num = 10; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "💫"; - } - - public int getNum() - { - return type_num; - } - } - class Type_BUG : PokeType - { - static readonly string name = "BUG"; - public static int type_num = 11; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "🐛"; - } - - public int getNum() - { - return type_num; - } - } - class Type_ROCK : PokeType - { - static readonly string name = "ROCK"; - public static int type_num = 12; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "💎"; - } - - public int getNum() - { - return type_num; - } - } - class Type_GHOST : PokeType - { - static readonly string name = "GHOST"; - public static int type_num = 13; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "👻"; - } - - public int getNum() - { - return type_num; - } - } - class Type_DRAGON : PokeType - { - static readonly string name = "DRAGON"; - public static int type_num = 14; - - public double getMagnifier(PokeType target) - { - switch (target.getName()) - { - - case "DRAGON": return 2; - case "STEEL": return 0.5; - default: return 1; - } - } - List moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "🐉"; - } - - public int getNum() - { - return type_num; - } - } - class Type_DARK : PokeType - { - static readonly string name = "DARK"; - public static int type_num = 15; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - - public string getImage() - { - return "🕶"; - } - - public int getNum() - { - return type_num; - } - } - class Type_STEEL : PokeType - { - static readonly string name = "STEEL"; - public static int type_num = -1; - - public double getMagnifier(PokeType 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 moves = new List(); - - public List getMoves() - { - updateMoves(); - return moves; - } - - - public string getName() - { - return name; - } - - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() - { - return "🔩"; - } - - public int getNum() - { - return type_num; - } - } - - } -} - - diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 96905743..d3e8df01 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -6,7 +6,7 @@ using NadekoBot.Classes.JSONModels; using NadekoBot.Commands; using NadekoBot.Modules; using NadekoBot.Modules.Gambling; -using NadekoBot.Modules.pokegame; +using NadekoBot.Modules.Pokemon; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -166,7 +166,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 Pokegame(), "Pokegame", ModuleFilter.None); + modules.Add(new PokemonGame(), "Pokegame", ModuleFilter.None); if (!string.IsNullOrWhiteSpace(Creds.TrelloAppKey)) modules.Add(new Trello(), "Trello", ModuleFilter.None); diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index 46d81154..c1e5e3ea 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -188,7 +188,26 @@ - + + + + + + + + + + + + + + + + + + + + From 41a6b849346eae0c7b5c34e590c30236d5f09609 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 27 Mar 2016 16:28:04 +0200 Subject: [PATCH 13/20] >magicitems added It's all working, though I'm not sure why it's also in the config_example.... --- NadekoBot/Classes/JSONModels/Configuration.cs | 9 + NadekoBot/Modules/Games.cs | 9 + NadekoBot/NadekoBot.cs | 1 + NadekoBot/bin/Debug/data/config_example.json | 1 + NadekoBot/bin/Debug/data/magicitems.json | 435 ++++++++++++++++++ 5 files changed, 455 insertions(+) create mode 100644 NadekoBot/bin/Debug/data/magicitems.json diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index 0de62d26..6b643e81 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -12,6 +12,7 @@ namespace NadekoBot.Classes.JSONModels { [JsonIgnore] public List Quotes { get; set; } = new List(); + public List MagicItems { get; set; } = new List(); public List RotatingStatuses { get; set; } = new List(); public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel(); @@ -118,4 +119,12 @@ namespace NadekoBot.Classes.JSONModels { public override string ToString() => $"{Text}\n\t*-{Author}*"; } + public class MagicItem + { + public string Name { get; set; } + public string Description { get; set; } + + public override string ToString() => + $"🌟**{Name}**\n\t*{Description}*"; + } } diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs index 9321859a..408564af 100644 --- a/NadekoBot/Modules/Games.cs +++ b/NadekoBot/Modules/Games.cs @@ -92,6 +92,15 @@ namespace NadekoBot.Modules { await e.Channel.SendMessage(msg); }); + cgb.CreateCommand(Prefix + "magicitem") + .Description("Draw a magic item randomly.") + .Do(async e => + { + await + e.Channel.SendMessage( + NadekoBot.Config.MagicItems[new Random().Next(0, NadekoBot.Config.MagicItems.Count)].ToString()); + }); + cgb.CreateCommand(Prefix + "linux") .Description("Prints a customizable Linux interjection") .Parameter("gnu", ParameterType.Required) diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index d3e8df01..c86e4116 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -63,6 +63,7 @@ namespace NadekoBot { Config = JsonConvert.DeserializeObject(File.ReadAllText("data/config.json")); Config.Quotes = JsonConvert.DeserializeObject>(File.ReadAllText("data/quotes.json")); + Config.MagicItems = JsonConvert.DeserializeObject>(File.ReadAllText("data/magicitems.json")); } catch { diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index 92d971ef..d29c7781 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -2,6 +2,7 @@ "DontJoinServers": false, "ForwardMessages": true, "IsRotatingStatus": false, + "MagicItems": [], "RotatingStatuses": [], "CommandPrefixes": { "Administration": ".", diff --git a/NadekoBot/bin/Debug/data/magicitems.json b/NadekoBot/bin/Debug/data/magicitems.json new file mode 100644 index 00000000..ceed9dfe --- /dev/null +++ b/NadekoBot/bin/Debug/data/magicitems.json @@ -0,0 +1,435 @@ +[ +{ "Name":"Ace of Spades", + "Description":"An ace of spades from a standard + card deck. No matter where you store it on your body, you will always be + able to find it in your right sleeve afterwards." +}, +{ "Name":"Arrow of Euarere", + "Description":"A silver arrow, suspended on a + string. It always points to the person holding the string." +}, +{ "Name":"Amulet of Extra Amulet Slot", + "Description":"This amulet allows you to gain the + benefit from two magical amulets rather than one. It cannot be further + enchanted." +}, +{ "Name":"Amulet of Feather Fall", + "Description":"When worn, this amulet turns into a + feather and falls to the ground." +}, +{ "Name":"Anti-Matches", + "Description":"A box of matches. Striking one will + make it begin to drip water from the tip while the match shrivels away. + The amount of water a match releases is about enough to fill a + tablespoon." +}, +{ "Name":"Artist's Bludgeon, The", + "Description":"Inanimate objects hit with this + bludgeon will receive no damage; they will however change color." +}, +{ "Name":"Attentive Guardsman's Pike", + "Description":"These ornate and deadly-looking + ceremonial pikes are reach weapons and appear to weigh at least 20 lbs, + not counting the weight of the fluttering banners that can be unfurled + for parade use. Constructed of shadowstuff, they weigh one pound, and + inflict only a single point of damage on an attack, being almost entirely + for show, although they also have the unique property of remaining in + place when set (although unable to support more than 20 lbs), allowing a + 'resting his eyes' guardsman to prop it up and leave it standing under + its own power, while his hand sags off of it." +}, +{ "Name":"Attentive Guardsman's Tabard", + "Description":"A dozen of these tabards were + fashioned for palace guardsmen in the Empire of Sard, 250 miles from the + nearest enemy. The bearer is placed under a glamour that causes him to + appear alert and awake, even if his eyes are closed and he is snoring + lightly." +}, +{ "Name":"Axe of Big Numbers", + "Description":"This axe shouts \"Big numbers + baby, come on!\" whenever it is swung, but always deals 1 damage or + less." +}, +{ "Name":"Axe of Empathy", + "Description":"Every time you hit something with + this +5 greataxe, you get dealt an equal amount of damage. Both you and + the thing you hit are then healed the amount of damage dealt by the axe, + even if either are dead. The Axe hopes you have learned your lesson." +}, +{ "Name":"Axe of Pain", + "Description":"The axe is always moaning and + groaning with pain." +}, +{ "Name":"Baby Oil", + "Description":"An aphrodisiac made from the finest + mashed babies. Strangely unpopular in the upper planes, the judgmental + prudes." +}, +{ "Name":"Bag of Faerie Gold", + "Description":"This sack appears to be full of gold + coins and jewels. When one attempts to spend them, however, the glamour + on them soon vanishes, revealing them to be nothing but leaves and + pebbles. Obviously, most shopkeepers will not be happy about this, and no + amount of 'we didn't know, I swear!' will change their mind." +}, +{ "Name":"Bag of Holding", + "Description":"This item functions as a normal + backpack, however when attempting to retrieve an item, a calm female + voice tells them there is a wait time of 4d10 minutes before they can + retrieve their item (actual time is stated time plus 6d6 additional + minutes). During this wait, the bag plays either annoying muzak or advertisements + for the bag's creator's other products/services. Upon attempting to + retrieve an item, there is a chance that the wrong item is retrieved, or + that the intended item is simply missing. Obtaining the original item + requires an additional 4d10+6d6 minutes and has only a 5% chance of + success." +}, +{ "Name":"Bag of Holding (Alternate)", + "Description":"This sack needs a hug!" +}, +{ "Name":"Bag of Trading", + "Description":"You can take one thing out of the + bag for each object you put in the bag. However, you have no control over + what you get, and there are no trade-backs. Past research seems to imply + there's some sort of correlation to what gets you what, but it's + extremely convoluted and far from understood." +}, +{ "Name":"Bag of Trick", + "Description":"This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." +}, +{ "Name":"Bag of Unholding", + "Description":"Quite a large backpack but even the + smallest item doesn't fit." +}, +{ "Name":"Bagpipe of Stealth", + "Description":"Grants the user invisibility as long as it is being played." +}, +{ "Name":"Ball of Eyes", + "Description":"A snow-globe filled with miniature + eyeballs. When shaken, it grants the user a blurry, jittery vision of + some future event." +}, +{ "Name":"Banana Walkie-Talkies", + "Description":"There exist two, and only two, of + these items in the world. One of which is possessed by a cranky and + lonely half-orc. It appears to be an innocuous wooden banana with a coat + of faded yellow paint. When an end (doesn't matter which one) is placed + against your ear, you can hear a ringing followed by a *click* and a + half-orc yelling at you for waking him up at this ungodly hour. If you + drop the banana or \"hang up,\" the call ends. If you stay and + listen, the half-orc will yell at you, call out obscenities, and start + going on about his daily problems and mishaps in his love life. Every so + often (2% chance/day), the banana will ring while you are sleeping and + the half-orc will want to talk to you about his problems." +}, +{ "Name":"Barrel of Holding", + "Description":"This large wooden barrel measuring + √(12/π) feet in diameter and 5 feet in height can hold up to + 15 cubic feet of matter." +}, +{ "Name":"Beam Sword of Severed Nerves", + "Description":"A beam sword. It cannot cut anything + but nerve strings. Will pass through any other material leaving no harm." +}, +{ "Name":"Belt of Pants", + "Description":"This belt creates illusory pants on + the wearer. The wearer can suppress the illusion at will" +}, +{ "Name":"Belt of Tightening", + "Description":"Every time you put this belt on, all + of your clothes permanently shrink a fraction of a millimeter. The effect + is compound." +}, +{ "Name":"Belt of Unbathed Breath", + "Description":"When worn around the waist, allows + the user to breathe underwater. Does not function when wet." +}, +{ "Name":"Boogie Skeleton", + "Description":"This pile of bones is small, such as + one that might be obtained from a bird or a toad, though it can look as + though it came from any creature. When a song is sung or played in the + vicinity of the skeleton, it begins to dance appropriately. As soon as + the music stops, it collapses into the pile of bones again. The skeleton, + when dancing, can be no larger than Diminutive." +}, +{ "Name":"Book of Canon", + "Description":"A book that automatically transforms + into a copy of the sacred text of any religion, translated into the + language the user is most familiar with." +}, +{ "Name":"Book of Confusion", + "Description":"The letters in this book always + appear to be upside down, even if viewed from different directions at the + same time. The book is a bad novel about zombies." +}, +{ "Name":"Book of Curses", + "Description":"When opened, the book verbally + berates anyone in the immediate vicinity, calling into question their + combat ability, intellect, personal hygiene, lineage and profession of + their mothers, and other delightful insults. Once closed the book + continues shouting (although it is muffled) until placed inside a bag or + some other similar container for 1d4+1 minutes and ignored. Replying to + the book in any other way causes the insults to get louder and more + childish the more time you spend replying to it." +}, +{ "Name":"Book of Exalted Deeds", + "Description":"Contains a listing of some of the + finest houses ever sold and the specifics of the titles to the + properties." +}, +{ "Name":"Boots of Levitation", + "Description":"These boots levitate a few inches + off the ground when not worn." +}, +{ "Name":"Boots of Stylishness", + "Description":"Knee high black boots that are + always clean and shiny. They never take in water, thus feet are always + dry." +}, +{ "Name":"Boots of Walking", + "Description":"The wearer of the boots cannot run, + nor can he take a double move action, and takes a -5 to Tumble checks. + These boots are made for walkin', and that's just what they'll do." +}, +{ "Name":"Bottle of Air", + "Description":"It's a bottle. Full of air. + Congratulations." +}, +{ "Name":"Bottomless Beer Mug", + "Description":"Any liquid poured into this mug + treats the bottom as incorporeal, but solid objects don't" +}, +{ "Name":"Bowl of Comfortable Warmth", + "Description":"Any liquid in the bowl will feel + comfortably warm, so icy cold water will feel like it's a bit over room + temperature. Do note, however, that it's still icy cold water, it just + feels warmer." +}, +{ "Name":"Box of Mild Interest", + "Description":"If this box is held in two hands and + shaken, taking a standard action, it may generate an effect (all spell + effects are CL 3). Roll 1d20. +1: Hold Person on the user +2: Hold Person on the closest + non-using creature +3: Dancing Lights as desired by the + holder +4: Sleep on the holder +5: Sleep on a creature of the + holder’s choice +6: Holder takes 1 force damage, no + save +7-20: No effect" +}, +{ "Name":"Breastplate of Secret Detection", + "Description":"If the wearer of this breastplate + gains a piece of information that is somehow connected to the concealment + of a hidden conspiracy or plot, a live and still wet red herring forms on + the inside of the armor." +}, +{ "Name":"Bullying Gloves", + "Description":"At random intervals, these gloves + instil the wearer with a near-irresistible urge to hit themselves." +}, +{ "Name":"Bunyan’s Belt", + "Description":"When worn, causes an enormous, bushy + black beard to appear on the wearer’s face." +}, +{ "Name":"Cape of Resistance", + "Description":"When this item is placed on any + living thing it somehow manages to fall off, untie itself, slip past the + owner’s neck entirely, or otherwise avoid being worn." +}, +{ "Name":"Case of the Litigator", + "Description":"Translates any document placed in + the case into legal jargon; non-reversible. Does not confer the ability + to understand legal jargon." +}, +{ "Name":"Cat of Schrodinger", + "Description":"When this cat is not being observed + in any way it is both dead and alive. When something observes it, it + suddenly becomes either dead or alive with a 50% chance of either." +}, +{ "Name":"Chair of Steadiness", + "Description":"This chair can be moved but cannot + be tipped over by anything less than a DC 35 Strength check." +}, +{ "Name":"Charles", + "Description":"This small, unremarkable figurine of + a gnome refuses to be called anything but Charles. No other name will + leave the lips of the speaker. It has no other powers." +}, +{ "Name":"Chime of Interruption", + "Description":"This instrument can be struck once + every round, which takes a standard action. On any round the chime is + activated the user may ready one action without spending an action to do + so." +}, +{ "Name":"Chime of Opening", + "Description":"Commonly affixed to or near doors, + when pressed it emits a sound on the interior of the owner’s home to let + them know guests have arrived." +}, +{ "Name":"Chime of Opening (Alternate)", + "Description":"When struck against a solid surface, + this chime emits a loud click, and opens along its length, to reveal a + tiny compartment adequate to conceal a single 'smoke' worth of pipeweed + or a blowgun needle. When the compartment is closed, it is seamless and + can be detected only with a DC 20 Search check. If hit with an instrument + such as a small mallet, it chimes." +}, +{ "Name":"Cloak of Billowing", + "Description":"This black and silver cloak will + always billow dramatically behind the wearer, it has no other effects." +}, +{ "Name":"Cloak of Displacement, Minor", + "Description":"This item appears to be a normal + cloak, but when worn by a character its magical properties distort and + warp reality. When any attack is made against the wearer the cloak has a + 20% chance of falling off, no matter how it is secured." +}, +{ "Name":"Compacting hammer", + "Description":"The force imparted by it is + multiplied, but is spread around the surface of a struck object facing + inward." +}, +{ "Name":"Cymbal of Symbols", + "Description":"This musical instrument enables the + user to comprehend dead languages, but only while they are deafened by + noise." +}, +{ "Name":"Dagger of Told Secrets", + "Description":"A simple-looking dagger. If used to + backstab someone to death, it will whisper your most embarrassing secret + to that person." +}, +{ "Name":"Dagger of Untold Secrets", + "Description":"A simple looking dagger. If used to + backstab someone to death, it will whisper the most embarrassing secret + of that person to you." +}, +{ "Name":"Decanter of Endless Sorrow", + "Description":"A pewter flask that produces + limitless alcohol when held to their lips by someone who is troubled. It + gets them drunk but they never feel any better." +}, +{ "Name":"Diadem of Brothaurity", + "Description":"When wearing this headpiece, you are + as elegant and well-spoken as a famous diplomat or regent, but you can't + stop calling everyone bro." +}, +{ "Name":"Enchanted Book of Collected Stories", + "Description":"Opening this will cause miniature + creatures/people to pour out and preform a chapter from the book much + like a theater." +}, +{ "Name":"Fade to Black Belt", + "Description":"The wearer of this belt will be + unable to remember any sexual encounter begun while they were wearing the + belt." +}, +{ "Name":"Focusing Ring", + "Description":"The digit on which this ring is worn + can be viewed in extremely high definition from a great distance." +}, +{ "Name":"Gloves of Tinkering", + "Description":"Wearing the gloves will make you + able to almost repair any broken item. However, you will always end up + with pieces from the item that don't seem to fit anywhere." +}, +{ "Name":"Greater Staff of Random Summoning", + "Description":"Summons a random creature at a + random place. You could be summoning a giant Ogre on the other side of + the globe for all you know." +}, +{ "Name":"Hoarder's Wand", + "Description":"Does nothing but for some reason you + think it might be important later in your quest." +}, +{ "Name":"Hood of Offensive Facades", + "Description":"This hood will change your identity + in the eyes of others to the appearance of the person they most + personally dislike." +}, +{ "Name":"Hood Of Worrisome Facades", + "Description":"This hood will change your identity + in the eyes of others, however the identity used will be random." +}, +{ "Name":"Indestructible Notebook of Memories", + "Description":"This otherwise normal notepad of + normal notepad size cannot be damaged or destroyed, and anything written + in it cannot be obscured or defaced. It also has unlimited pages despite + its finite size. However, the data it holds only lasts as long as the + writer independently remembers it, and decays in exact proportion to the + relevant memories. Remember who and when, but not where? Then the words + describing the location in that particular entry are the only ones gone." +}, +{ "Name":"Intransigent Rod", + "Description":"When the button on this artifact is + pressed in, the holder's opinions solidify and they become impossible to + convince." +}, +{ "Name":"Lunchbox of Delicious Unfulfillment", + "Description":"This lunchbox will hold whatever + food you desire. However you will never get full and the food will + deliver no nourishment." +}, +{ "Name":"Mattress of Poverty, The", + "Description":"No matter how you fluff this + gorgeous, thick, mattress, you will always sleep on the thin part of it." +}, +{ "Name":"Mug O' Dissatisfaction", + "Description":"A mug that always produces a + steaming hot cup of coffee or tea when tapped on the bottom. It conjures + the opposite of what the tapper prefers, so if you like tea you get + coffee and vice versa. Handing the full mug to another person will make + the drink in it transform to the opposite of that persons preferences." +}, +{ "Name":"Murder Dagger", + "Description":"All damage it would deal is instead + replaced by the target being harassed by crows for that many hours." +}, +{ "Name":"Needle Of Learned Compromise", + "Description":"This needle will create beautiful + tattoos of any design, however they hurt a tiny bit more. When used to + sew it is entirely normal." +}, +{ "Name":"Portable Dark Tavern Corner", + "Description":"Consisting of two wooden boards + connected by a hinge, this artifact draws those nearby into assuming it + is a perfect spot to conduct seedy business." +}, +{ "Name":"Ring of First Impression", + "Description":"Wearing the ring will make you able + to perform a perfect handshake with the hand wearing it." +}, +{ "Name":"Sack of Hive Eggs", + "Description":"Crushing one of the numerous tiny + eggs will cause the thoughts of everybody in the proximity to merge. + Everybody can hear what you think and you can hear everybody." +}, +{ "Name":"Shoes of the Restless Traveler", + "Description":"These shoes allow their user to run + for miles without feeling fatigue, but if they try to do anything else + with it (walk, sit down, jump), they will instantly trip" +}, +{ "Name":"Sword of Parrying", + "Description":"Parries every attack, swinging it + yourself will force it to \"parry\" your opponents weapon/attack + even though he/she/it is defenseless." +}, +{ "Name":"Vorpal Grindstone", + "Description":"It can \"sharpen\" any + object to become vorpal. Any object." +}, +{ "Name":"Water Hat, The", + "Description":"A small red hat, when worn, causes + water to pour from the wearer's fingers at the speed and pressure of a + kitchen faucet at half power." +}, +{ "Name":"Wineskin of the Eternal Primary", + "Description":"This wineskin never runs out of + water, but even the tiniest sip makes you have to go, like, super bad. + Right now." +}, +] \ No newline at end of file From 7c6e1918e8629226c174f41a402c31fecf4065f3 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 27 Mar 2016 18:36:42 +0200 Subject: [PATCH 14/20] Changed defaultmoves From LawlyPoppz --- NadekoBot/Modules/Pokemon/PokemonModule.cs | 113 ++++++++++++++------- 1 file changed, 76 insertions(+), 37 deletions(-) diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs index 8bf71139..9d8973ce 100644 --- a/NadekoBot/Modules/Pokemon/PokemonModule.cs +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -15,14 +15,14 @@ using NadekoBot.Modules.Pokemon.PokeTypes; namespace NadekoBot.Modules.Pokemon { - + class PokemonGame : DiscordModule { public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Pokemon; public readonly int BASEHEALTH = 500; //private Dictionary stats = new Dictionary(); private ConcurrentDictionary stats = new ConcurrentDictionary(); - + public PokemonGame() { @@ -53,7 +53,8 @@ namespace NadekoBot.Modules.Pokemon await e.Channel.SendMessage("No such person."); return; } - } else + } + else { await e.Channel.SendMessage("No such person."); return; @@ -62,7 +63,7 @@ namespace NadekoBot.Modules.Pokemon //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) @@ -83,7 +84,7 @@ namespace NadekoBot.Modules.Pokemon //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) { @@ -272,37 +273,75 @@ namespace NadekoBot.Modules.Pokemon Dictionary defaultmoves = new Dictionary() { - {"flame",1}, - {"hack",3}, - {"scare",13}, - {"splash",2}, - {"freeze",5}, - {"strike",4}, - {"surge",3}, - {"electrocute",3}, - {"surf",2}, - {"mellow",4}, - {"flamethrower",1}, + {"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}, - {"lava",12}, - {"fly",9}, - {"control",10}, - {"sting",11}, - {"poison",7}, - {"confusion",10}, - {"breathe",14}, - {"ultrabash",6}, - {"punch",6}, - {"blind",15}, - {"earthquake",8}, - {"rocksmash",12}, - {"transform",0}, + {"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}, - {"frustate",0}, - {"confide",0}, - {"metronome",0}, - {"dracometeor",14}, - {"outrage",14} + {"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} }; foreach (KeyValuePair entry in defaultmoves) @@ -323,7 +362,7 @@ namespace NadekoBot.Modules.Pokemon str += $"\n{t.getImage()}{m.move}"; } - + await e.Channel.SendMessage(str); }); @@ -377,8 +416,8 @@ namespace NadekoBot.Modules.Pokemon }); } - - + + private int getDamage(IPokeType usertype, IPokeType targetType) { From 5ab3267ea11e9da4f8083995353812ee3c4e5a4c Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 27 Mar 2016 22:02:21 +0200 Subject: [PATCH 15/20] Json made better --- NadekoBot/bin/Debug/data/magicitems.json | 669 ++++++++--------------- 1 file changed, 234 insertions(+), 435 deletions(-) diff --git a/NadekoBot/bin/Debug/data/magicitems.json b/NadekoBot/bin/Debug/data/magicitems.json index ceed9dfe..ae3b751c 100644 --- a/NadekoBot/bin/Debug/data/magicitems.json +++ b/NadekoBot/bin/Debug/data/magicitems.json @@ -1,435 +1,234 @@ -[ -{ "Name":"Ace of Spades", - "Description":"An ace of spades from a standard - card deck. No matter where you store it on your body, you will always be - able to find it in your right sleeve afterwards." -}, -{ "Name":"Arrow of Euarere", - "Description":"A silver arrow, suspended on a - string. It always points to the person holding the string." -}, -{ "Name":"Amulet of Extra Amulet Slot", - "Description":"This amulet allows you to gain the - benefit from two magical amulets rather than one. It cannot be further - enchanted." -}, -{ "Name":"Amulet of Feather Fall", - "Description":"When worn, this amulet turns into a - feather and falls to the ground." -}, -{ "Name":"Anti-Matches", - "Description":"A box of matches. Striking one will - make it begin to drip water from the tip while the match shrivels away. - The amount of water a match releases is about enough to fill a - tablespoon." -}, -{ "Name":"Artist's Bludgeon, The", - "Description":"Inanimate objects hit with this - bludgeon will receive no damage; they will however change color." -}, -{ "Name":"Attentive Guardsman's Pike", - "Description":"These ornate and deadly-looking - ceremonial pikes are reach weapons and appear to weigh at least 20 lbs, - not counting the weight of the fluttering banners that can be unfurled - for parade use. Constructed of shadowstuff, they weigh one pound, and - inflict only a single point of damage on an attack, being almost entirely - for show, although they also have the unique property of remaining in - place when set (although unable to support more than 20 lbs), allowing a - 'resting his eyes' guardsman to prop it up and leave it standing under - its own power, while his hand sags off of it." -}, -{ "Name":"Attentive Guardsman's Tabard", - "Description":"A dozen of these tabards were - fashioned for palace guardsmen in the Empire of Sard, 250 miles from the - nearest enemy. The bearer is placed under a glamour that causes him to - appear alert and awake, even if his eyes are closed and he is snoring - lightly." -}, -{ "Name":"Axe of Big Numbers", - "Description":"This axe shouts \"Big numbers - baby, come on!\" whenever it is swung, but always deals 1 damage or - less." -}, -{ "Name":"Axe of Empathy", - "Description":"Every time you hit something with - this +5 greataxe, you get dealt an equal amount of damage. Both you and - the thing you hit are then healed the amount of damage dealt by the axe, - even if either are dead. The Axe hopes you have learned your lesson." -}, -{ "Name":"Axe of Pain", - "Description":"The axe is always moaning and - groaning with pain." -}, -{ "Name":"Baby Oil", - "Description":"An aphrodisiac made from the finest - mashed babies. Strangely unpopular in the upper planes, the judgmental - prudes." -}, -{ "Name":"Bag of Faerie Gold", - "Description":"This sack appears to be full of gold - coins and jewels. When one attempts to spend them, however, the glamour - on them soon vanishes, revealing them to be nothing but leaves and - pebbles. Obviously, most shopkeepers will not be happy about this, and no - amount of 'we didn't know, I swear!' will change their mind." -}, -{ "Name":"Bag of Holding", - "Description":"This item functions as a normal - backpack, however when attempting to retrieve an item, a calm female - voice tells them there is a wait time of 4d10 minutes before they can - retrieve their item (actual time is stated time plus 6d6 additional - minutes). During this wait, the bag plays either annoying muzak or advertisements - for the bag's creator's other products/services. Upon attempting to - retrieve an item, there is a chance that the wrong item is retrieved, or - that the intended item is simply missing. Obtaining the original item - requires an additional 4d10+6d6 minutes and has only a 5% chance of - success." -}, -{ "Name":"Bag of Holding (Alternate)", - "Description":"This sack needs a hug!" -}, -{ "Name":"Bag of Trading", - "Description":"You can take one thing out of the - bag for each object you put in the bag. However, you have no control over - what you get, and there are no trade-backs. Past research seems to imply - there's some sort of correlation to what gets you what, but it's - extremely convoluted and far from understood." -}, -{ "Name":"Bag of Trick", - "Description":"This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." -}, -{ "Name":"Bag of Unholding", - "Description":"Quite a large backpack but even the - smallest item doesn't fit." -}, -{ "Name":"Bagpipe of Stealth", - "Description":"Grants the user invisibility as long as it is being played." -}, -{ "Name":"Ball of Eyes", - "Description":"A snow-globe filled with miniature - eyeballs. When shaken, it grants the user a blurry, jittery vision of - some future event." -}, -{ "Name":"Banana Walkie-Talkies", - "Description":"There exist two, and only two, of - these items in the world. One of which is possessed by a cranky and - lonely half-orc. It appears to be an innocuous wooden banana with a coat - of faded yellow paint. When an end (doesn't matter which one) is placed - against your ear, you can hear a ringing followed by a *click* and a - half-orc yelling at you for waking him up at this ungodly hour. If you - drop the banana or \"hang up,\" the call ends. If you stay and - listen, the half-orc will yell at you, call out obscenities, and start - going on about his daily problems and mishaps in his love life. Every so - often (2% chance/day), the banana will ring while you are sleeping and - the half-orc will want to talk to you about his problems." -}, -{ "Name":"Barrel of Holding", - "Description":"This large wooden barrel measuring - √(12/π) feet in diameter and 5 feet in height can hold up to - 15 cubic feet of matter." -}, -{ "Name":"Beam Sword of Severed Nerves", - "Description":"A beam sword. It cannot cut anything - but nerve strings. Will pass through any other material leaving no harm." -}, -{ "Name":"Belt of Pants", - "Description":"This belt creates illusory pants on - the wearer. The wearer can suppress the illusion at will" -}, -{ "Name":"Belt of Tightening", - "Description":"Every time you put this belt on, all - of your clothes permanently shrink a fraction of a millimeter. The effect - is compound." -}, -{ "Name":"Belt of Unbathed Breath", - "Description":"When worn around the waist, allows - the user to breathe underwater. Does not function when wet." -}, -{ "Name":"Boogie Skeleton", - "Description":"This pile of bones is small, such as - one that might be obtained from a bird or a toad, though it can look as - though it came from any creature. When a song is sung or played in the - vicinity of the skeleton, it begins to dance appropriately. As soon as - the music stops, it collapses into the pile of bones again. The skeleton, - when dancing, can be no larger than Diminutive." -}, -{ "Name":"Book of Canon", - "Description":"A book that automatically transforms - into a copy of the sacred text of any religion, translated into the - language the user is most familiar with." -}, -{ "Name":"Book of Confusion", - "Description":"The letters in this book always - appear to be upside down, even if viewed from different directions at the - same time. The book is a bad novel about zombies." -}, -{ "Name":"Book of Curses", - "Description":"When opened, the book verbally - berates anyone in the immediate vicinity, calling into question their - combat ability, intellect, personal hygiene, lineage and profession of - their mothers, and other delightful insults. Once closed the book - continues shouting (although it is muffled) until placed inside a bag or - some other similar container for 1d4+1 minutes and ignored. Replying to - the book in any other way causes the insults to get louder and more - childish the more time you spend replying to it." -}, -{ "Name":"Book of Exalted Deeds", - "Description":"Contains a listing of some of the - finest houses ever sold and the specifics of the titles to the - properties." -}, -{ "Name":"Boots of Levitation", - "Description":"These boots levitate a few inches - off the ground when not worn." -}, -{ "Name":"Boots of Stylishness", - "Description":"Knee high black boots that are - always clean and shiny. They never take in water, thus feet are always - dry." -}, -{ "Name":"Boots of Walking", - "Description":"The wearer of the boots cannot run, - nor can he take a double move action, and takes a -5 to Tumble checks. - These boots are made for walkin', and that's just what they'll do." -}, -{ "Name":"Bottle of Air", - "Description":"It's a bottle. Full of air. - Congratulations." -}, -{ "Name":"Bottomless Beer Mug", - "Description":"Any liquid poured into this mug - treats the bottom as incorporeal, but solid objects don't" -}, -{ "Name":"Bowl of Comfortable Warmth", - "Description":"Any liquid in the bowl will feel - comfortably warm, so icy cold water will feel like it's a bit over room - temperature. Do note, however, that it's still icy cold water, it just - feels warmer." -}, -{ "Name":"Box of Mild Interest", - "Description":"If this box is held in two hands and - shaken, taking a standard action, it may generate an effect (all spell - effects are CL 3). Roll 1d20. -1: Hold Person on the user -2: Hold Person on the closest - non-using creature -3: Dancing Lights as desired by the - holder -4: Sleep on the holder -5: Sleep on a creature of the - holder’s choice -6: Holder takes 1 force damage, no - save -7-20: No effect" -}, -{ "Name":"Breastplate of Secret Detection", - "Description":"If the wearer of this breastplate - gains a piece of information that is somehow connected to the concealment - of a hidden conspiracy or plot, a live and still wet red herring forms on - the inside of the armor." -}, -{ "Name":"Bullying Gloves", - "Description":"At random intervals, these gloves - instil the wearer with a near-irresistible urge to hit themselves." -}, -{ "Name":"Bunyan’s Belt", - "Description":"When worn, causes an enormous, bushy - black beard to appear on the wearer’s face." -}, -{ "Name":"Cape of Resistance", - "Description":"When this item is placed on any - living thing it somehow manages to fall off, untie itself, slip past the - owner’s neck entirely, or otherwise avoid being worn." -}, -{ "Name":"Case of the Litigator", - "Description":"Translates any document placed in - the case into legal jargon; non-reversible. Does not confer the ability - to understand legal jargon." -}, -{ "Name":"Cat of Schrodinger", - "Description":"When this cat is not being observed - in any way it is both dead and alive. When something observes it, it - suddenly becomes either dead or alive with a 50% chance of either." -}, -{ "Name":"Chair of Steadiness", - "Description":"This chair can be moved but cannot - be tipped over by anything less than a DC 35 Strength check." -}, -{ "Name":"Charles", - "Description":"This small, unremarkable figurine of - a gnome refuses to be called anything but Charles. No other name will - leave the lips of the speaker. It has no other powers." -}, -{ "Name":"Chime of Interruption", - "Description":"This instrument can be struck once - every round, which takes a standard action. On any round the chime is - activated the user may ready one action without spending an action to do - so." -}, -{ "Name":"Chime of Opening", - "Description":"Commonly affixed to or near doors, - when pressed it emits a sound on the interior of the owner’s home to let - them know guests have arrived." -}, -{ "Name":"Chime of Opening (Alternate)", - "Description":"When struck against a solid surface, - this chime emits a loud click, and opens along its length, to reveal a - tiny compartment adequate to conceal a single 'smoke' worth of pipeweed - or a blowgun needle. When the compartment is closed, it is seamless and - can be detected only with a DC 20 Search check. If hit with an instrument - such as a small mallet, it chimes." -}, -{ "Name":"Cloak of Billowing", - "Description":"This black and silver cloak will - always billow dramatically behind the wearer, it has no other effects." -}, -{ "Name":"Cloak of Displacement, Minor", - "Description":"This item appears to be a normal - cloak, but when worn by a character its magical properties distort and - warp reality. When any attack is made against the wearer the cloak has a - 20% chance of falling off, no matter how it is secured." -}, -{ "Name":"Compacting hammer", - "Description":"The force imparted by it is - multiplied, but is spread around the surface of a struck object facing - inward." -}, -{ "Name":"Cymbal of Symbols", - "Description":"This musical instrument enables the - user to comprehend dead languages, but only while they are deafened by - noise." -}, -{ "Name":"Dagger of Told Secrets", - "Description":"A simple-looking dagger. If used to - backstab someone to death, it will whisper your most embarrassing secret - to that person." -}, -{ "Name":"Dagger of Untold Secrets", - "Description":"A simple looking dagger. If used to - backstab someone to death, it will whisper the most embarrassing secret - of that person to you." -}, -{ "Name":"Decanter of Endless Sorrow", - "Description":"A pewter flask that produces - limitless alcohol when held to their lips by someone who is troubled. It - gets them drunk but they never feel any better." -}, -{ "Name":"Diadem of Brothaurity", - "Description":"When wearing this headpiece, you are - as elegant and well-spoken as a famous diplomat or regent, but you can't - stop calling everyone bro." -}, -{ "Name":"Enchanted Book of Collected Stories", - "Description":"Opening this will cause miniature - creatures/people to pour out and preform a chapter from the book much - like a theater." -}, -{ "Name":"Fade to Black Belt", - "Description":"The wearer of this belt will be - unable to remember any sexual encounter begun while they were wearing the - belt." -}, -{ "Name":"Focusing Ring", - "Description":"The digit on which this ring is worn - can be viewed in extremely high definition from a great distance." -}, -{ "Name":"Gloves of Tinkering", - "Description":"Wearing the gloves will make you - able to almost repair any broken item. However, you will always end up - with pieces from the item that don't seem to fit anywhere." -}, -{ "Name":"Greater Staff of Random Summoning", - "Description":"Summons a random creature at a - random place. You could be summoning a giant Ogre on the other side of - the globe for all you know." -}, -{ "Name":"Hoarder's Wand", - "Description":"Does nothing but for some reason you - think it might be important later in your quest." -}, -{ "Name":"Hood of Offensive Facades", - "Description":"This hood will change your identity - in the eyes of others to the appearance of the person they most - personally dislike." -}, -{ "Name":"Hood Of Worrisome Facades", - "Description":"This hood will change your identity - in the eyes of others, however the identity used will be random." -}, -{ "Name":"Indestructible Notebook of Memories", - "Description":"This otherwise normal notepad of - normal notepad size cannot be damaged or destroyed, and anything written - in it cannot be obscured or defaced. It also has unlimited pages despite - its finite size. However, the data it holds only lasts as long as the - writer independently remembers it, and decays in exact proportion to the - relevant memories. Remember who and when, but not where? Then the words - describing the location in that particular entry are the only ones gone." -}, -{ "Name":"Intransigent Rod", - "Description":"When the button on this artifact is - pressed in, the holder's opinions solidify and they become impossible to - convince." -}, -{ "Name":"Lunchbox of Delicious Unfulfillment", - "Description":"This lunchbox will hold whatever - food you desire. However you will never get full and the food will - deliver no nourishment." -}, -{ "Name":"Mattress of Poverty, The", - "Description":"No matter how you fluff this - gorgeous, thick, mattress, you will always sleep on the thin part of it." -}, -{ "Name":"Mug O' Dissatisfaction", - "Description":"A mug that always produces a - steaming hot cup of coffee or tea when tapped on the bottom. It conjures - the opposite of what the tapper prefers, so if you like tea you get - coffee and vice versa. Handing the full mug to another person will make - the drink in it transform to the opposite of that persons preferences." -}, -{ "Name":"Murder Dagger", - "Description":"All damage it would deal is instead - replaced by the target being harassed by crows for that many hours." -}, -{ "Name":"Needle Of Learned Compromise", - "Description":"This needle will create beautiful - tattoos of any design, however they hurt a tiny bit more. When used to - sew it is entirely normal." -}, -{ "Name":"Portable Dark Tavern Corner", - "Description":"Consisting of two wooden boards - connected by a hinge, this artifact draws those nearby into assuming it - is a perfect spot to conduct seedy business." -}, -{ "Name":"Ring of First Impression", - "Description":"Wearing the ring will make you able - to perform a perfect handshake with the hand wearing it." -}, -{ "Name":"Sack of Hive Eggs", - "Description":"Crushing one of the numerous tiny - eggs will cause the thoughts of everybody in the proximity to merge. - Everybody can hear what you think and you can hear everybody." -}, -{ "Name":"Shoes of the Restless Traveler", - "Description":"These shoes allow their user to run - for miles without feeling fatigue, but if they try to do anything else - with it (walk, sit down, jump), they will instantly trip" -}, -{ "Name":"Sword of Parrying", - "Description":"Parries every attack, swinging it - yourself will force it to \"parry\" your opponents weapon/attack - even though he/she/it is defenseless." -}, -{ "Name":"Vorpal Grindstone", - "Description":"It can \"sharpen\" any - object to become vorpal. Any object." -}, -{ "Name":"Water Hat, The", - "Description":"A small red hat, when worn, causes - water to pour from the wearer's fingers at the speed and pressure of a - kitchen faucet at half power." -}, -{ "Name":"Wineskin of the Eternal Primary", - "Description":"This wineskin never runs out of - water, but even the tiniest sip makes you have to go, like, super bad. - Right now." -}, -] \ No newline at end of file +[{ + "Name": "Ace of Spades", + "Description": "An ace of spades from a standard card deck. No matter where you store it on your body, you will always be able to find it in your right sleeve afterwards." +}, { + "Name": "Arrow of Euarere", + "Description": "A silver arrow, suspended on a string. It always points to the person holding the string." +}, { + "Name": "Amulet of Extra Amulet Slot", + "Description": "This amulet allows you to gain the benefit from two magical amulets rather than one. It cannot be further enchanted." +}, { + "Name": "Amulet of Feather Fall", + "Description": "When worn, this amulet turns into a feather and falls to the ground." +}, { + "Name": "Anti-Matches", + "Description": "A box of matches. Striking one will make it begin to drip water from the tip while the match shrivels away. The amount of water a match releases is about enough to fill a tablespoon." +}, { + "Name": "Artist's Bludgeon, The", + "Description": "Inanimate objects hit with this bludgeon will receive no damage; they will however change color." +}, { + "Name": "Attentive Guardsman's Pike", + "Description": "These ornate and deadly-looking ceremonial pikes are reach weapons and appear to weigh at least 20 lbs, not counting the weight of the fluttering banners that can be unfurled for parade use. Constructed of shadowstuff, they weigh one pound, and inflict only a single point of damage on an attack, being almost entirely for show, although they also have the unique property of remaining in place when set (although unable to support more than 20 lbs), allowing a 'resting his eyes' guardsman to prop it up and leave it standing under its own power, while his hand sags off of it." +}, { + "Name": "Attentive Guardsman's Tabard", + "Description": "A dozen of these tabards were fashioned for palace guardsmen in the Empire of Sard, 250 miles from the nearest enemy. The bearer is placed under a glamour that causes him to appear alert and awake, even if his eyes are closed and he is snoring lightly." +}, { + "Name": "Axe of Big Numbers", + "Description": "This axe shouts \"Big numbers baby, come on!\" whenever it is swung, but always deals 1 damage or less." +}, { + "Name": "Axe of Empathy", + "Description": "Every time you hit something with this +5 greataxe, you get dealt an equal amount of damage. Both you and the thing you hit are then healed the amount of damage dealt by the axe, even if either are dead. The Axe hopes you have learned your lesson." +}, { + "Name": "Axe of Pain", + "Description": "The axe is always moaning and groaning with pain." +}, { + "Name": "Baby Oil", + "Description": "An aphrodisiac made from the finest mashed babies. Strangely unpopular in the upper planes, the judgmental prudes." +}, { + "Name": "Bag of Faerie Gold", + "Description": "This sack appears to be full of gold coins and jewels. When one attempts to spend them, however, the glamour on them soon vanishes, revealing them to be nothing but leaves and pebbles. Obviously, most shopkeepers will not be happy about this, and no amount of 'we didn't know, I swear!' will change their mind." +}, { + "Name": "Bag of Holding", + "Description": "This item functions as a normal backpack, however when attempting to retrieve an item, a calm female voice tells them there is a wait time of 4d10 minutes before they can retrieve their item (actual time is stated time plus 6d6 additional minutes). During this wait, the bag plays either annoying muzak or advertisements for the bag's creator's other products/services. Upon attempting to retrieve an item, there is a chance that the wrong item is retrieved, or that the intended item is simply missing. Obtaining the original item requires an additional 4d10+6d6 minutes and has only a 5% chance of success." +}, { + "Name": "Bag of Holding (Alternate)", + "Description": "This sack needs a hug!" +}, { + "Name": "Bag of Trading", + "Description": "You can take one thing out of the bag for each object you put in the bag. However, you have no control over what you get, and there are no trade-backs. Past research seems to imply there's some sort of correlation to what gets you what, but it's extremely convoluted and far from understood." +}, { + "Name": "Bag of Trick", + "Description": "This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." +}, { + "Name": "Bag of Unholding", + "Description": "Quite a large backpack but even the smallest item doesn't fit." +}, { + "Name": "Bagpipe of Stealth", + "Description": "Grants the user invisibility as long as it is being played." +}, { + "Name": "Ball of Eyes", + "Description": "A snow-globe filled with miniature eyeballs. When shaken, it grants the user a blurry, jittery vision of some future event." +}, { + "Name": "Banana Walkie-Talkies", + "Description": "There exist two, and only two, of these items in the world. One of which is possessed by a cranky and lonely half-orc. It appears to be an innocuous wooden banana with a coat of faded yellow paint. When an end (doesn't matter which one) is placed against your ear, you can hear a ringing followed by a *click* and a half-orc yelling at you for waking him up at this ungodly hour. If you drop the banana or \"hang up,\" the call ends. If you stay and listen, the half-orc will yell at you, call out obscenities, and start going on about his daily problems and mishaps in his love life. Every so often (2% chance/day), the banana will ring while you are sleeping and the half-orc will want to talk to you about his problems." +}, { + "Name": "Barrel of Holding", + "Description": "This large wooden barrel measuring √(12/π) feet in diameter and 5 feet in height can hold up to 15 cubic feet of matter." +}, { + "Name": "Beam Sword of Severed Nerves", + "Description": "A beam sword. It cannot cut anything but nerve strings. Will pass through any other material leaving no harm." +}, { + "Name": "Belt of Pants", + "Description": "This belt creates illusory pants on the wearer. The wearer can suppress the illusion at will" +}, { + "Name": "Belt of Tightening", + "Description": "Every time you put this belt on, all of your clothes permanently shrink a fraction of a millimeter. The effect is compound." +}, { + "Name": "Belt of Unbathed Breath", + "Description": "When worn around the waist, allows the user to breathe underwater. Does not function when wet." +}, { + "Name": "Boogie Skeleton", + "Description": "This pile of bones is small, such as one that might be obtained from a bird or a toad, though it can look as though it came from any creature. When a song is sung or played in the vicinity of the skeleton, it begins to dance appropriately. As soon as the music stops, it collapses into the pile of bones again. The skeleton, when dancing, can be no larger than Diminutive." +}, { + "Name": "Book of Canon", + "Description": "A book that automatically transforms into a copy of the sacred text of any religion, translated into the language the user is most familiar with." +}, { + "Name": "Book of Confusion", + "Description": "The letters in this book always appear to be upside down, even if viewed from different directions at the same time. The book is a bad novel about zombies." +}, { + "Name": "Book of Curses", + "Description": "When opened, the book verbally berates anyone in the immediate vicinity, calling into question their combat ability, intellect, personal hygiene, lineage and profession of their mothers, and other delightful insults. Once closed the book continues shouting (although it is muffled) until placed inside a bag or some other similar container for 1d4+1 minutes and ignored. Replying to the book in any other way causes the insults to get louder and more childish the more time you spend replying to it." +}, { + "Name": "Book of Exalted Deeds", + "Description": "Contains a listing of some of the finest houses ever sold and the specifics of the titles to the properties." +}, { + "Name": "Boots of Levitation", + "Description": "These boots levitate a few inches off the ground when not worn." +}, { + "Name": "Boots of Stylishness", + "Description": "Knee high black boots that are always clean and shiny. They never take in water, thus feet are always dry." +}, { + "Name": "Boots of Walking", + "Description": "The wearer of the boots cannot run, nor can he take a double move action, and takes a -5 to Tumble checks. These boots are made for walkin', and that's just what they'll do." +}, { + "Name": "Bottle of Air", + "Description": "It's a bottle. Full of air. Congratulations." +}, { + "Name": "Bottomless Beer Mug", + "Description": "Any liquid poured into this mug treats the bottom as incorporeal, but solid objects don't" +}, { + "Name": "Bowl of Comfortable Warmth", + "Description": "Any liquid in the bowl will feel comfortably warm, so icy cold water will feel like it's a bit over room temperature. Do note, however, that it's still icy cold water, it just feels warmer." +}, { + "Name": "Breastplate of Secret Detection", + "Description": "If the wearer of this breastplate gains a piece of information that is somehow connected to the concealment of a hidden conspiracy or plot, a live and still wet red herring forms on the inside of the armor." +}, { + "Name": "Bullying Gloves", + "Description": "At random intervals, these gloves instil the wearer with a near-irresistible urge to hit themselves." +}, { + "Name": "Bunyan’s Belt", + "Description": "When worn, causes an enormous, bushy black beard to appear on the wearer’s face." +}, { + "Name": "Cape of Resistance", + "Description": "When this item is placed on any living thing it somehow manages to fall off, untie itself, slip past the owner’s neck entirely, or otherwise avoid being worn." +}, { + "Name": "Case of the Litigator", + "Description": "Translates any document placed in the case into legal jargon; non-reversible. Does not confer the ability to understand legal jargon." +}, { + "Name": "Cat of Schrodinger", + "Description": "When this cat is not being observed in any way it is both dead and alive. When something observes it, it suddenly becomes either dead or alive with a 50% chance of either." +}, { + "Name": "Chair of Steadiness", + "Description": "This chair can be moved but cannot be tipped over by anything less than a DC 35 Strength check." +}, { + "Name": "Charles", + "Description": "This small, unremarkable figurine of a gnome refuses to be called anything but Charles. No other name will leave the lips of the speaker. It has no other powers." +}, { + "Name": "Chime of Interruption", + "Description": "This instrument can be struck once every round, which takes a standard action. On any round the chime is activated the user may ready one action without spending an action to do so." +}, { + "Name": "Chime of Opening", + "Description": "Commonly affixed to or near doors, when pressed it emits a sound on the interior of the owner’s home to let them know guests have arrived." +}, { + "Name": "Chime of Opening (Alternate)", + "Description": "When struck against a solid surface, this chime emits a loud click, and opens along its length, to reveal a tiny compartment adequate to conceal a single 'smoke' worth of pipeweed or a blowgun needle. When the compartment is closed, it is seamless and can be detected only with a DC 20 Search check. If hit with an instrument such as a small mallet, it chimes." +}, { + "Name": "Cloak of Billowing", + "Description": "This black and silver cloak will always billow dramatically behind the wearer, it has no other effects." +}, { + "Name": "Cloak of Displacement, Minor", + "Description": "This item appears to be a normal cloak, but when worn by a character its magical properties distort and warp reality. When any attack is made against the wearer the cloak has a 20% chance of falling off, no matter how it is secured." +}, { + "Name": "Compacting hammer", + "Description": "The force imparted by it is multiplied, but is spread around the surface of a struck object facing inward." +}, { + "Name": "Cymbal of Symbols", + "Description": "This musical instrument enables the user to comprehend dead languages, but only while they are deafened by noise." +}, { + "Name": "Dagger of Told Secrets", + "Description": "A simple-looking dagger. If used to backstab someone to death, it will whisper your most embarrassing secret to that person." +}, { + "Name": "Dagger of Untold Secrets", + "Description": "A simple looking dagger. If used to backstab someone to death, it will whisper the most embarrassing secret of that person to you." +}, { + "Name": "Decanter of Endless Sorrow", + "Description": "A pewter flask that produces limitless alcohol when held to their lips by someone who is troubled. It gets them drunk but they never feel any better." +}, { + "Name": "Diadem of Brothaurity", + "Description": "When wearing this headpiece, you are as elegant and well-spoken as a famous diplomat or regent, but you can't stop calling everyone bro." +}, { + "Name": "Enchanted Book of Collected Stories", + "Description": "Opening this will cause miniature creatures/people to pour out and preform a chapter from the book much like a theater." +}, { + "Name": "Fade to Black Belt", + "Description": "The wearer of this belt will be unable to remember any sexual encounter begun while they were wearing the belt." +}, { + "Name": "Focusing Ring", + "Description": "The digit on which this ring is worn can be viewed in extremely high definition from a great distance." +}, { + "Name": "Gloves of Tinkering", + "Description": "Wearing the gloves will make you able to almost repair any broken item. However, you will always end up with pieces from the item that don't seem to fit anywhere." +}, { + "Name": "Greater Staff of Random Summoning", + "Description": "Summons a random creature at a random place. You could be summoning a giant Ogre on the other side of the globe for all you know." +}, { + "Name": "Hoarder's Wand", + "Description": "Does nothing but for some reason you think it might be important later in your quest." +}, { + "Name": "Hood of Offensive Facades", + "Description": "This hood will change your identity in the eyes of others to the appearance of the person they most personally dislike." +}, { + "Name": "Hood Of Worrisome Facades", + "Description": "This hood will change your identity in the eyes of others, however the identity used will be random." +}, { + "Name": "Indestructible Notebook of Memories", + "Description": "This otherwise normal notepad of normal notepad size cannot be damaged or destroyed, and anything written in it cannot be obscured or defaced. It also has unlimited pages despite its finite size. However, the data it holds only lasts as long as the writer independently remembers it, and decays in exact proportion to the relevant memories. Remember who and when, but not where? Then the words describing the location in that particular entry are the only ones gone." +}, { + "Name": "Intransigent Rod", + "Description": "When the button on this artifact is pressed in, the holder's opinions solidify and they become impossible to convince." +}, { + "Name": "Lunchbox of Delicious Unfulfillment", + "Description": "This lunchbox will hold whatever food you desire. However you will never get full and the food will deliver no nourishment." +}, { + "Name": "Mattress of Poverty, The", + "Description": "No matter how you fluff this gorgeous, thick, mattress, you will always sleep on the thin part of it." +}, { + "Name": "Mug O' Dissatisfaction", + "Description": "A mug that always produces a steaming hot cup of coffee or tea when tapped on the bottom. It conjures the opposite of what the tapper prefers, so if you like tea you get coffee and vice versa. Handing the full mug to another person will make the drink in it transform to the opposite of that persons preferences." +}, { + "Name": "Murder Dagger", + "Description": "All damage it would deal is instead replaced by the target being harassed by crows for that many hours." +}, { + "Name": "Needle Of Learned Compromise", + "Description": "This needle will create beautiful tattoos of any design, however they hurt a tiny bit more. When used to sew it is entirely normal." +}, { + "Name": "Portable Dark Tavern Corner", + "Description": "Consisting of two wooden boards connected by a hinge, this artifact draws those nearby into assuming it is a perfect spot to conduct seedy business." +}, { + "Name": "Ring of First Impression", + "Description": "Wearing the ring will make you able to perform a perfect handshake with the hand wearing it." +}, { + "Name": "Sack of Hive Eggs", + "Description": "Crushing one of the numerous tiny eggs will cause the thoughts of everybody in the proximity to merge. Everybody can hear what you think and you can hear everybody." +}, { + "Name": "Shoes of the Restless Traveler", + "Description": "These shoes allow their user to run for miles without feeling fatigue, but if they try to do anything else with it (walk, sit down, jump), they will instantly trip" +}, { + "Name": "Sword of Parrying", + "Description": "Parries every attack, swinging it yourself will force it to \"parry\" your opponents weapon/attack even though he/she/it is defenseless." +}, { + "Name": "Vorpal Grindstone", + "Description": "It can \"sharpen\" any object to become vorpal. Any object." +}, { + "Name": "Water Hat, The", + "Description": "A small red hat, when worn, causes water to pour from the wearer's fingers at the speed \ No newline at end of file From ddbe51e33bfe312bbe6188cdd20b819cbf366485 Mon Sep 17 00:00:00 2001 From: appelemac Date: Mon, 28 Mar 2016 12:47:09 +0200 Subject: [PATCH 16/20] Revert "Json made better" This reverts commit 5ab3267ea11e9da4f8083995353812ee3c4e5a4c. --- NadekoBot/bin/Debug/data/magicitems.json | 669 +++++++++++++++-------- 1 file changed, 435 insertions(+), 234 deletions(-) diff --git a/NadekoBot/bin/Debug/data/magicitems.json b/NadekoBot/bin/Debug/data/magicitems.json index ae3b751c..ceed9dfe 100644 --- a/NadekoBot/bin/Debug/data/magicitems.json +++ b/NadekoBot/bin/Debug/data/magicitems.json @@ -1,234 +1,435 @@ -[{ - "Name": "Ace of Spades", - "Description": "An ace of spades from a standard card deck. No matter where you store it on your body, you will always be able to find it in your right sleeve afterwards." -}, { - "Name": "Arrow of Euarere", - "Description": "A silver arrow, suspended on a string. It always points to the person holding the string." -}, { - "Name": "Amulet of Extra Amulet Slot", - "Description": "This amulet allows you to gain the benefit from two magical amulets rather than one. It cannot be further enchanted." -}, { - "Name": "Amulet of Feather Fall", - "Description": "When worn, this amulet turns into a feather and falls to the ground." -}, { - "Name": "Anti-Matches", - "Description": "A box of matches. Striking one will make it begin to drip water from the tip while the match shrivels away. The amount of water a match releases is about enough to fill a tablespoon." -}, { - "Name": "Artist's Bludgeon, The", - "Description": "Inanimate objects hit with this bludgeon will receive no damage; they will however change color." -}, { - "Name": "Attentive Guardsman's Pike", - "Description": "These ornate and deadly-looking ceremonial pikes are reach weapons and appear to weigh at least 20 lbs, not counting the weight of the fluttering banners that can be unfurled for parade use. Constructed of shadowstuff, they weigh one pound, and inflict only a single point of damage on an attack, being almost entirely for show, although they also have the unique property of remaining in place when set (although unable to support more than 20 lbs), allowing a 'resting his eyes' guardsman to prop it up and leave it standing under its own power, while his hand sags off of it." -}, { - "Name": "Attentive Guardsman's Tabard", - "Description": "A dozen of these tabards were fashioned for palace guardsmen in the Empire of Sard, 250 miles from the nearest enemy. The bearer is placed under a glamour that causes him to appear alert and awake, even if his eyes are closed and he is snoring lightly." -}, { - "Name": "Axe of Big Numbers", - "Description": "This axe shouts \"Big numbers baby, come on!\" whenever it is swung, but always deals 1 damage or less." -}, { - "Name": "Axe of Empathy", - "Description": "Every time you hit something with this +5 greataxe, you get dealt an equal amount of damage. Both you and the thing you hit are then healed the amount of damage dealt by the axe, even if either are dead. The Axe hopes you have learned your lesson." -}, { - "Name": "Axe of Pain", - "Description": "The axe is always moaning and groaning with pain." -}, { - "Name": "Baby Oil", - "Description": "An aphrodisiac made from the finest mashed babies. Strangely unpopular in the upper planes, the judgmental prudes." -}, { - "Name": "Bag of Faerie Gold", - "Description": "This sack appears to be full of gold coins and jewels. When one attempts to spend them, however, the glamour on them soon vanishes, revealing them to be nothing but leaves and pebbles. Obviously, most shopkeepers will not be happy about this, and no amount of 'we didn't know, I swear!' will change their mind." -}, { - "Name": "Bag of Holding", - "Description": "This item functions as a normal backpack, however when attempting to retrieve an item, a calm female voice tells them there is a wait time of 4d10 minutes before they can retrieve their item (actual time is stated time plus 6d6 additional minutes). During this wait, the bag plays either annoying muzak or advertisements for the bag's creator's other products/services. Upon attempting to retrieve an item, there is a chance that the wrong item is retrieved, or that the intended item is simply missing. Obtaining the original item requires an additional 4d10+6d6 minutes and has only a 5% chance of success." -}, { - "Name": "Bag of Holding (Alternate)", - "Description": "This sack needs a hug!" -}, { - "Name": "Bag of Trading", - "Description": "You can take one thing out of the bag for each object you put in the bag. However, you have no control over what you get, and there are no trade-backs. Past research seems to imply there's some sort of correlation to what gets you what, but it's extremely convoluted and far from understood." -}, { - "Name": "Bag of Trick", - "Description": "This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." -}, { - "Name": "Bag of Unholding", - "Description": "Quite a large backpack but even the smallest item doesn't fit." -}, { - "Name": "Bagpipe of Stealth", - "Description": "Grants the user invisibility as long as it is being played." -}, { - "Name": "Ball of Eyes", - "Description": "A snow-globe filled with miniature eyeballs. When shaken, it grants the user a blurry, jittery vision of some future event." -}, { - "Name": "Banana Walkie-Talkies", - "Description": "There exist two, and only two, of these items in the world. One of which is possessed by a cranky and lonely half-orc. It appears to be an innocuous wooden banana with a coat of faded yellow paint. When an end (doesn't matter which one) is placed against your ear, you can hear a ringing followed by a *click* and a half-orc yelling at you for waking him up at this ungodly hour. If you drop the banana or \"hang up,\" the call ends. If you stay and listen, the half-orc will yell at you, call out obscenities, and start going on about his daily problems and mishaps in his love life. Every so often (2% chance/day), the banana will ring while you are sleeping and the half-orc will want to talk to you about his problems." -}, { - "Name": "Barrel of Holding", - "Description": "This large wooden barrel measuring √(12/π) feet in diameter and 5 feet in height can hold up to 15 cubic feet of matter." -}, { - "Name": "Beam Sword of Severed Nerves", - "Description": "A beam sword. It cannot cut anything but nerve strings. Will pass through any other material leaving no harm." -}, { - "Name": "Belt of Pants", - "Description": "This belt creates illusory pants on the wearer. The wearer can suppress the illusion at will" -}, { - "Name": "Belt of Tightening", - "Description": "Every time you put this belt on, all of your clothes permanently shrink a fraction of a millimeter. The effect is compound." -}, { - "Name": "Belt of Unbathed Breath", - "Description": "When worn around the waist, allows the user to breathe underwater. Does not function when wet." -}, { - "Name": "Boogie Skeleton", - "Description": "This pile of bones is small, such as one that might be obtained from a bird or a toad, though it can look as though it came from any creature. When a song is sung or played in the vicinity of the skeleton, it begins to dance appropriately. As soon as the music stops, it collapses into the pile of bones again. The skeleton, when dancing, can be no larger than Diminutive." -}, { - "Name": "Book of Canon", - "Description": "A book that automatically transforms into a copy of the sacred text of any religion, translated into the language the user is most familiar with." -}, { - "Name": "Book of Confusion", - "Description": "The letters in this book always appear to be upside down, even if viewed from different directions at the same time. The book is a bad novel about zombies." -}, { - "Name": "Book of Curses", - "Description": "When opened, the book verbally berates anyone in the immediate vicinity, calling into question their combat ability, intellect, personal hygiene, lineage and profession of their mothers, and other delightful insults. Once closed the book continues shouting (although it is muffled) until placed inside a bag or some other similar container for 1d4+1 minutes and ignored. Replying to the book in any other way causes the insults to get louder and more childish the more time you spend replying to it." -}, { - "Name": "Book of Exalted Deeds", - "Description": "Contains a listing of some of the finest houses ever sold and the specifics of the titles to the properties." -}, { - "Name": "Boots of Levitation", - "Description": "These boots levitate a few inches off the ground when not worn." -}, { - "Name": "Boots of Stylishness", - "Description": "Knee high black boots that are always clean and shiny. They never take in water, thus feet are always dry." -}, { - "Name": "Boots of Walking", - "Description": "The wearer of the boots cannot run, nor can he take a double move action, and takes a -5 to Tumble checks. These boots are made for walkin', and that's just what they'll do." -}, { - "Name": "Bottle of Air", - "Description": "It's a bottle. Full of air. Congratulations." -}, { - "Name": "Bottomless Beer Mug", - "Description": "Any liquid poured into this mug treats the bottom as incorporeal, but solid objects don't" -}, { - "Name": "Bowl of Comfortable Warmth", - "Description": "Any liquid in the bowl will feel comfortably warm, so icy cold water will feel like it's a bit over room temperature. Do note, however, that it's still icy cold water, it just feels warmer." -}, { - "Name": "Breastplate of Secret Detection", - "Description": "If the wearer of this breastplate gains a piece of information that is somehow connected to the concealment of a hidden conspiracy or plot, a live and still wet red herring forms on the inside of the armor." -}, { - "Name": "Bullying Gloves", - "Description": "At random intervals, these gloves instil the wearer with a near-irresistible urge to hit themselves." -}, { - "Name": "Bunyan’s Belt", - "Description": "When worn, causes an enormous, bushy black beard to appear on the wearer’s face." -}, { - "Name": "Cape of Resistance", - "Description": "When this item is placed on any living thing it somehow manages to fall off, untie itself, slip past the owner’s neck entirely, or otherwise avoid being worn." -}, { - "Name": "Case of the Litigator", - "Description": "Translates any document placed in the case into legal jargon; non-reversible. Does not confer the ability to understand legal jargon." -}, { - "Name": "Cat of Schrodinger", - "Description": "When this cat is not being observed in any way it is both dead and alive. When something observes it, it suddenly becomes either dead or alive with a 50% chance of either." -}, { - "Name": "Chair of Steadiness", - "Description": "This chair can be moved but cannot be tipped over by anything less than a DC 35 Strength check." -}, { - "Name": "Charles", - "Description": "This small, unremarkable figurine of a gnome refuses to be called anything but Charles. No other name will leave the lips of the speaker. It has no other powers." -}, { - "Name": "Chime of Interruption", - "Description": "This instrument can be struck once every round, which takes a standard action. On any round the chime is activated the user may ready one action without spending an action to do so." -}, { - "Name": "Chime of Opening", - "Description": "Commonly affixed to or near doors, when pressed it emits a sound on the interior of the owner’s home to let them know guests have arrived." -}, { - "Name": "Chime of Opening (Alternate)", - "Description": "When struck against a solid surface, this chime emits a loud click, and opens along its length, to reveal a tiny compartment adequate to conceal a single 'smoke' worth of pipeweed or a blowgun needle. When the compartment is closed, it is seamless and can be detected only with a DC 20 Search check. If hit with an instrument such as a small mallet, it chimes." -}, { - "Name": "Cloak of Billowing", - "Description": "This black and silver cloak will always billow dramatically behind the wearer, it has no other effects." -}, { - "Name": "Cloak of Displacement, Minor", - "Description": "This item appears to be a normal cloak, but when worn by a character its magical properties distort and warp reality. When any attack is made against the wearer the cloak has a 20% chance of falling off, no matter how it is secured." -}, { - "Name": "Compacting hammer", - "Description": "The force imparted by it is multiplied, but is spread around the surface of a struck object facing inward." -}, { - "Name": "Cymbal of Symbols", - "Description": "This musical instrument enables the user to comprehend dead languages, but only while they are deafened by noise." -}, { - "Name": "Dagger of Told Secrets", - "Description": "A simple-looking dagger. If used to backstab someone to death, it will whisper your most embarrassing secret to that person." -}, { - "Name": "Dagger of Untold Secrets", - "Description": "A simple looking dagger. If used to backstab someone to death, it will whisper the most embarrassing secret of that person to you." -}, { - "Name": "Decanter of Endless Sorrow", - "Description": "A pewter flask that produces limitless alcohol when held to their lips by someone who is troubled. It gets them drunk but they never feel any better." -}, { - "Name": "Diadem of Brothaurity", - "Description": "When wearing this headpiece, you are as elegant and well-spoken as a famous diplomat or regent, but you can't stop calling everyone bro." -}, { - "Name": "Enchanted Book of Collected Stories", - "Description": "Opening this will cause miniature creatures/people to pour out and preform a chapter from the book much like a theater." -}, { - "Name": "Fade to Black Belt", - "Description": "The wearer of this belt will be unable to remember any sexual encounter begun while they were wearing the belt." -}, { - "Name": "Focusing Ring", - "Description": "The digit on which this ring is worn can be viewed in extremely high definition from a great distance." -}, { - "Name": "Gloves of Tinkering", - "Description": "Wearing the gloves will make you able to almost repair any broken item. However, you will always end up with pieces from the item that don't seem to fit anywhere." -}, { - "Name": "Greater Staff of Random Summoning", - "Description": "Summons a random creature at a random place. You could be summoning a giant Ogre on the other side of the globe for all you know." -}, { - "Name": "Hoarder's Wand", - "Description": "Does nothing but for some reason you think it might be important later in your quest." -}, { - "Name": "Hood of Offensive Facades", - "Description": "This hood will change your identity in the eyes of others to the appearance of the person they most personally dislike." -}, { - "Name": "Hood Of Worrisome Facades", - "Description": "This hood will change your identity in the eyes of others, however the identity used will be random." -}, { - "Name": "Indestructible Notebook of Memories", - "Description": "This otherwise normal notepad of normal notepad size cannot be damaged or destroyed, and anything written in it cannot be obscured or defaced. It also has unlimited pages despite its finite size. However, the data it holds only lasts as long as the writer independently remembers it, and decays in exact proportion to the relevant memories. Remember who and when, but not where? Then the words describing the location in that particular entry are the only ones gone." -}, { - "Name": "Intransigent Rod", - "Description": "When the button on this artifact is pressed in, the holder's opinions solidify and they become impossible to convince." -}, { - "Name": "Lunchbox of Delicious Unfulfillment", - "Description": "This lunchbox will hold whatever food you desire. However you will never get full and the food will deliver no nourishment." -}, { - "Name": "Mattress of Poverty, The", - "Description": "No matter how you fluff this gorgeous, thick, mattress, you will always sleep on the thin part of it." -}, { - "Name": "Mug O' Dissatisfaction", - "Description": "A mug that always produces a steaming hot cup of coffee or tea when tapped on the bottom. It conjures the opposite of what the tapper prefers, so if you like tea you get coffee and vice versa. Handing the full mug to another person will make the drink in it transform to the opposite of that persons preferences." -}, { - "Name": "Murder Dagger", - "Description": "All damage it would deal is instead replaced by the target being harassed by crows for that many hours." -}, { - "Name": "Needle Of Learned Compromise", - "Description": "This needle will create beautiful tattoos of any design, however they hurt a tiny bit more. When used to sew it is entirely normal." -}, { - "Name": "Portable Dark Tavern Corner", - "Description": "Consisting of two wooden boards connected by a hinge, this artifact draws those nearby into assuming it is a perfect spot to conduct seedy business." -}, { - "Name": "Ring of First Impression", - "Description": "Wearing the ring will make you able to perform a perfect handshake with the hand wearing it." -}, { - "Name": "Sack of Hive Eggs", - "Description": "Crushing one of the numerous tiny eggs will cause the thoughts of everybody in the proximity to merge. Everybody can hear what you think and you can hear everybody." -}, { - "Name": "Shoes of the Restless Traveler", - "Description": "These shoes allow their user to run for miles without feeling fatigue, but if they try to do anything else with it (walk, sit down, jump), they will instantly trip" -}, { - "Name": "Sword of Parrying", - "Description": "Parries every attack, swinging it yourself will force it to \"parry\" your opponents weapon/attack even though he/she/it is defenseless." -}, { - "Name": "Vorpal Grindstone", - "Description": "It can \"sharpen\" any object to become vorpal. Any object." -}, { - "Name": "Water Hat, The", - "Description": "A small red hat, when worn, causes water to pour from the wearer's fingers at the speed \ No newline at end of file +[ +{ "Name":"Ace of Spades", + "Description":"An ace of spades from a standard + card deck. No matter where you store it on your body, you will always be + able to find it in your right sleeve afterwards." +}, +{ "Name":"Arrow of Euarere", + "Description":"A silver arrow, suspended on a + string. It always points to the person holding the string." +}, +{ "Name":"Amulet of Extra Amulet Slot", + "Description":"This amulet allows you to gain the + benefit from two magical amulets rather than one. It cannot be further + enchanted." +}, +{ "Name":"Amulet of Feather Fall", + "Description":"When worn, this amulet turns into a + feather and falls to the ground." +}, +{ "Name":"Anti-Matches", + "Description":"A box of matches. Striking one will + make it begin to drip water from the tip while the match shrivels away. + The amount of water a match releases is about enough to fill a + tablespoon." +}, +{ "Name":"Artist's Bludgeon, The", + "Description":"Inanimate objects hit with this + bludgeon will receive no damage; they will however change color." +}, +{ "Name":"Attentive Guardsman's Pike", + "Description":"These ornate and deadly-looking + ceremonial pikes are reach weapons and appear to weigh at least 20 lbs, + not counting the weight of the fluttering banners that can be unfurled + for parade use. Constructed of shadowstuff, they weigh one pound, and + inflict only a single point of damage on an attack, being almost entirely + for show, although they also have the unique property of remaining in + place when set (although unable to support more than 20 lbs), allowing a + 'resting his eyes' guardsman to prop it up and leave it standing under + its own power, while his hand sags off of it." +}, +{ "Name":"Attentive Guardsman's Tabard", + "Description":"A dozen of these tabards were + fashioned for palace guardsmen in the Empire of Sard, 250 miles from the + nearest enemy. The bearer is placed under a glamour that causes him to + appear alert and awake, even if his eyes are closed and he is snoring + lightly." +}, +{ "Name":"Axe of Big Numbers", + "Description":"This axe shouts \"Big numbers + baby, come on!\" whenever it is swung, but always deals 1 damage or + less." +}, +{ "Name":"Axe of Empathy", + "Description":"Every time you hit something with + this +5 greataxe, you get dealt an equal amount of damage. Both you and + the thing you hit are then healed the amount of damage dealt by the axe, + even if either are dead. The Axe hopes you have learned your lesson." +}, +{ "Name":"Axe of Pain", + "Description":"The axe is always moaning and + groaning with pain." +}, +{ "Name":"Baby Oil", + "Description":"An aphrodisiac made from the finest + mashed babies. Strangely unpopular in the upper planes, the judgmental + prudes." +}, +{ "Name":"Bag of Faerie Gold", + "Description":"This sack appears to be full of gold + coins and jewels. When one attempts to spend them, however, the glamour + on them soon vanishes, revealing them to be nothing but leaves and + pebbles. Obviously, most shopkeepers will not be happy about this, and no + amount of 'we didn't know, I swear!' will change their mind." +}, +{ "Name":"Bag of Holding", + "Description":"This item functions as a normal + backpack, however when attempting to retrieve an item, a calm female + voice tells them there is a wait time of 4d10 minutes before they can + retrieve their item (actual time is stated time plus 6d6 additional + minutes). During this wait, the bag plays either annoying muzak or advertisements + for the bag's creator's other products/services. Upon attempting to + retrieve an item, there is a chance that the wrong item is retrieved, or + that the intended item is simply missing. Obtaining the original item + requires an additional 4d10+6d6 minutes and has only a 5% chance of + success." +}, +{ "Name":"Bag of Holding (Alternate)", + "Description":"This sack needs a hug!" +}, +{ "Name":"Bag of Trading", + "Description":"You can take one thing out of the + bag for each object you put in the bag. However, you have no control over + what you get, and there are no trade-backs. Past research seems to imply + there's some sort of correlation to what gets you what, but it's + extremely convoluted and far from understood." +}, +{ "Name":"Bag of Trick", + "Description":"This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." +}, +{ "Name":"Bag of Unholding", + "Description":"Quite a large backpack but even the + smallest item doesn't fit." +}, +{ "Name":"Bagpipe of Stealth", + "Description":"Grants the user invisibility as long as it is being played." +}, +{ "Name":"Ball of Eyes", + "Description":"A snow-globe filled with miniature + eyeballs. When shaken, it grants the user a blurry, jittery vision of + some future event." +}, +{ "Name":"Banana Walkie-Talkies", + "Description":"There exist two, and only two, of + these items in the world. One of which is possessed by a cranky and + lonely half-orc. It appears to be an innocuous wooden banana with a coat + of faded yellow paint. When an end (doesn't matter which one) is placed + against your ear, you can hear a ringing followed by a *click* and a + half-orc yelling at you for waking him up at this ungodly hour. If you + drop the banana or \"hang up,\" the call ends. If you stay and + listen, the half-orc will yell at you, call out obscenities, and start + going on about his daily problems and mishaps in his love life. Every so + often (2% chance/day), the banana will ring while you are sleeping and + the half-orc will want to talk to you about his problems." +}, +{ "Name":"Barrel of Holding", + "Description":"This large wooden barrel measuring + √(12/π) feet in diameter and 5 feet in height can hold up to + 15 cubic feet of matter." +}, +{ "Name":"Beam Sword of Severed Nerves", + "Description":"A beam sword. It cannot cut anything + but nerve strings. Will pass through any other material leaving no harm." +}, +{ "Name":"Belt of Pants", + "Description":"This belt creates illusory pants on + the wearer. The wearer can suppress the illusion at will" +}, +{ "Name":"Belt of Tightening", + "Description":"Every time you put this belt on, all + of your clothes permanently shrink a fraction of a millimeter. The effect + is compound." +}, +{ "Name":"Belt of Unbathed Breath", + "Description":"When worn around the waist, allows + the user to breathe underwater. Does not function when wet." +}, +{ "Name":"Boogie Skeleton", + "Description":"This pile of bones is small, such as + one that might be obtained from a bird or a toad, though it can look as + though it came from any creature. When a song is sung or played in the + vicinity of the skeleton, it begins to dance appropriately. As soon as + the music stops, it collapses into the pile of bones again. The skeleton, + when dancing, can be no larger than Diminutive." +}, +{ "Name":"Book of Canon", + "Description":"A book that automatically transforms + into a copy of the sacred text of any religion, translated into the + language the user is most familiar with." +}, +{ "Name":"Book of Confusion", + "Description":"The letters in this book always + appear to be upside down, even if viewed from different directions at the + same time. The book is a bad novel about zombies." +}, +{ "Name":"Book of Curses", + "Description":"When opened, the book verbally + berates anyone in the immediate vicinity, calling into question their + combat ability, intellect, personal hygiene, lineage and profession of + their mothers, and other delightful insults. Once closed the book + continues shouting (although it is muffled) until placed inside a bag or + some other similar container for 1d4+1 minutes and ignored. Replying to + the book in any other way causes the insults to get louder and more + childish the more time you spend replying to it." +}, +{ "Name":"Book of Exalted Deeds", + "Description":"Contains a listing of some of the + finest houses ever sold and the specifics of the titles to the + properties." +}, +{ "Name":"Boots of Levitation", + "Description":"These boots levitate a few inches + off the ground when not worn." +}, +{ "Name":"Boots of Stylishness", + "Description":"Knee high black boots that are + always clean and shiny. They never take in water, thus feet are always + dry." +}, +{ "Name":"Boots of Walking", + "Description":"The wearer of the boots cannot run, + nor can he take a double move action, and takes a -5 to Tumble checks. + These boots are made for walkin', and that's just what they'll do." +}, +{ "Name":"Bottle of Air", + "Description":"It's a bottle. Full of air. + Congratulations." +}, +{ "Name":"Bottomless Beer Mug", + "Description":"Any liquid poured into this mug + treats the bottom as incorporeal, but solid objects don't" +}, +{ "Name":"Bowl of Comfortable Warmth", + "Description":"Any liquid in the bowl will feel + comfortably warm, so icy cold water will feel like it's a bit over room + temperature. Do note, however, that it's still icy cold water, it just + feels warmer." +}, +{ "Name":"Box of Mild Interest", + "Description":"If this box is held in two hands and + shaken, taking a standard action, it may generate an effect (all spell + effects are CL 3). Roll 1d20. +1: Hold Person on the user +2: Hold Person on the closest + non-using creature +3: Dancing Lights as desired by the + holder +4: Sleep on the holder +5: Sleep on a creature of the + holder’s choice +6: Holder takes 1 force damage, no + save +7-20: No effect" +}, +{ "Name":"Breastplate of Secret Detection", + "Description":"If the wearer of this breastplate + gains a piece of information that is somehow connected to the concealment + of a hidden conspiracy or plot, a live and still wet red herring forms on + the inside of the armor." +}, +{ "Name":"Bullying Gloves", + "Description":"At random intervals, these gloves + instil the wearer with a near-irresistible urge to hit themselves." +}, +{ "Name":"Bunyan’s Belt", + "Description":"When worn, causes an enormous, bushy + black beard to appear on the wearer’s face." +}, +{ "Name":"Cape of Resistance", + "Description":"When this item is placed on any + living thing it somehow manages to fall off, untie itself, slip past the + owner’s neck entirely, or otherwise avoid being worn." +}, +{ "Name":"Case of the Litigator", + "Description":"Translates any document placed in + the case into legal jargon; non-reversible. Does not confer the ability + to understand legal jargon." +}, +{ "Name":"Cat of Schrodinger", + "Description":"When this cat is not being observed + in any way it is both dead and alive. When something observes it, it + suddenly becomes either dead or alive with a 50% chance of either." +}, +{ "Name":"Chair of Steadiness", + "Description":"This chair can be moved but cannot + be tipped over by anything less than a DC 35 Strength check." +}, +{ "Name":"Charles", + "Description":"This small, unremarkable figurine of + a gnome refuses to be called anything but Charles. No other name will + leave the lips of the speaker. It has no other powers." +}, +{ "Name":"Chime of Interruption", + "Description":"This instrument can be struck once + every round, which takes a standard action. On any round the chime is + activated the user may ready one action without spending an action to do + so." +}, +{ "Name":"Chime of Opening", + "Description":"Commonly affixed to or near doors, + when pressed it emits a sound on the interior of the owner’s home to let + them know guests have arrived." +}, +{ "Name":"Chime of Opening (Alternate)", + "Description":"When struck against a solid surface, + this chime emits a loud click, and opens along its length, to reveal a + tiny compartment adequate to conceal a single 'smoke' worth of pipeweed + or a blowgun needle. When the compartment is closed, it is seamless and + can be detected only with a DC 20 Search check. If hit with an instrument + such as a small mallet, it chimes." +}, +{ "Name":"Cloak of Billowing", + "Description":"This black and silver cloak will + always billow dramatically behind the wearer, it has no other effects." +}, +{ "Name":"Cloak of Displacement, Minor", + "Description":"This item appears to be a normal + cloak, but when worn by a character its magical properties distort and + warp reality. When any attack is made against the wearer the cloak has a + 20% chance of falling off, no matter how it is secured." +}, +{ "Name":"Compacting hammer", + "Description":"The force imparted by it is + multiplied, but is spread around the surface of a struck object facing + inward." +}, +{ "Name":"Cymbal of Symbols", + "Description":"This musical instrument enables the + user to comprehend dead languages, but only while they are deafened by + noise." +}, +{ "Name":"Dagger of Told Secrets", + "Description":"A simple-looking dagger. If used to + backstab someone to death, it will whisper your most embarrassing secret + to that person." +}, +{ "Name":"Dagger of Untold Secrets", + "Description":"A simple looking dagger. If used to + backstab someone to death, it will whisper the most embarrassing secret + of that person to you." +}, +{ "Name":"Decanter of Endless Sorrow", + "Description":"A pewter flask that produces + limitless alcohol when held to their lips by someone who is troubled. It + gets them drunk but they never feel any better." +}, +{ "Name":"Diadem of Brothaurity", + "Description":"When wearing this headpiece, you are + as elegant and well-spoken as a famous diplomat or regent, but you can't + stop calling everyone bro." +}, +{ "Name":"Enchanted Book of Collected Stories", + "Description":"Opening this will cause miniature + creatures/people to pour out and preform a chapter from the book much + like a theater." +}, +{ "Name":"Fade to Black Belt", + "Description":"The wearer of this belt will be + unable to remember any sexual encounter begun while they were wearing the + belt." +}, +{ "Name":"Focusing Ring", + "Description":"The digit on which this ring is worn + can be viewed in extremely high definition from a great distance." +}, +{ "Name":"Gloves of Tinkering", + "Description":"Wearing the gloves will make you + able to almost repair any broken item. However, you will always end up + with pieces from the item that don't seem to fit anywhere." +}, +{ "Name":"Greater Staff of Random Summoning", + "Description":"Summons a random creature at a + random place. You could be summoning a giant Ogre on the other side of + the globe for all you know." +}, +{ "Name":"Hoarder's Wand", + "Description":"Does nothing but for some reason you + think it might be important later in your quest." +}, +{ "Name":"Hood of Offensive Facades", + "Description":"This hood will change your identity + in the eyes of others to the appearance of the person they most + personally dislike." +}, +{ "Name":"Hood Of Worrisome Facades", + "Description":"This hood will change your identity + in the eyes of others, however the identity used will be random." +}, +{ "Name":"Indestructible Notebook of Memories", + "Description":"This otherwise normal notepad of + normal notepad size cannot be damaged or destroyed, and anything written + in it cannot be obscured or defaced. It also has unlimited pages despite + its finite size. However, the data it holds only lasts as long as the + writer independently remembers it, and decays in exact proportion to the + relevant memories. Remember who and when, but not where? Then the words + describing the location in that particular entry are the only ones gone." +}, +{ "Name":"Intransigent Rod", + "Description":"When the button on this artifact is + pressed in, the holder's opinions solidify and they become impossible to + convince." +}, +{ "Name":"Lunchbox of Delicious Unfulfillment", + "Description":"This lunchbox will hold whatever + food you desire. However you will never get full and the food will + deliver no nourishment." +}, +{ "Name":"Mattress of Poverty, The", + "Description":"No matter how you fluff this + gorgeous, thick, mattress, you will always sleep on the thin part of it." +}, +{ "Name":"Mug O' Dissatisfaction", + "Description":"A mug that always produces a + steaming hot cup of coffee or tea when tapped on the bottom. It conjures + the opposite of what the tapper prefers, so if you like tea you get + coffee and vice versa. Handing the full mug to another person will make + the drink in it transform to the opposite of that persons preferences." +}, +{ "Name":"Murder Dagger", + "Description":"All damage it would deal is instead + replaced by the target being harassed by crows for that many hours." +}, +{ "Name":"Needle Of Learned Compromise", + "Description":"This needle will create beautiful + tattoos of any design, however they hurt a tiny bit more. When used to + sew it is entirely normal." +}, +{ "Name":"Portable Dark Tavern Corner", + "Description":"Consisting of two wooden boards + connected by a hinge, this artifact draws those nearby into assuming it + is a perfect spot to conduct seedy business." +}, +{ "Name":"Ring of First Impression", + "Description":"Wearing the ring will make you able + to perform a perfect handshake with the hand wearing it." +}, +{ "Name":"Sack of Hive Eggs", + "Description":"Crushing one of the numerous tiny + eggs will cause the thoughts of everybody in the proximity to merge. + Everybody can hear what you think and you can hear everybody." +}, +{ "Name":"Shoes of the Restless Traveler", + "Description":"These shoes allow their user to run + for miles without feeling fatigue, but if they try to do anything else + with it (walk, sit down, jump), they will instantly trip" +}, +{ "Name":"Sword of Parrying", + "Description":"Parries every attack, swinging it + yourself will force it to \"parry\" your opponents weapon/attack + even though he/she/it is defenseless." +}, +{ "Name":"Vorpal Grindstone", + "Description":"It can \"sharpen\" any + object to become vorpal. Any object." +}, +{ "Name":"Water Hat, The", + "Description":"A small red hat, when worn, causes + water to pour from the wearer's fingers at the speed and pressure of a + kitchen faucet at half power." +}, +{ "Name":"Wineskin of the Eternal Primary", + "Description":"This wineskin never runs out of + water, but even the tiniest sip makes you have to go, like, super bad. + Right now." +}, +] \ No newline at end of file From 671cc0130604e3d9a72b60bdeac9ad1857445d86 Mon Sep 17 00:00:00 2001 From: appelemac Date: Mon, 28 Mar 2016 13:26:14 +0200 Subject: [PATCH 17/20] Changed GetMoves to extension method, used PascalCase, --- NadekoBot/Modules/Pokemon/DefaultMoves.cs | 87 ++++++++ NadekoBot/Modules/Pokemon/PokeStats.cs | 6 + NadekoBot/Modules/Pokemon/PokemonModule.cs | 207 +++++------------- .../Modules/Pokemon/PokemonTypes/BugType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/DarkType.cs | 31 +-- .../Pokemon/PokemonTypes/Dragontype.cs | 31 +-- .../Pokemon/PokemonTypes/ElectricType.cs | 31 +-- .../Pokemon/PokemonTypes/FightingType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/FireType.cs | 31 +-- .../Pokemon/PokemonTypes/FlyingType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/GhostType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/GrassType.cs | 31 +-- .../Pokemon/PokemonTypes/GroundType.cs | 31 +-- .../PokemonTypes/IPokeTypeExtensions.cs | 27 +++ .../Modules/Pokemon/PokemonTypes/IceType.cs | 31 +-- .../Pokemon/PokemonTypes/NormalType.cs | 31 +-- .../Pokemon/PokemonTypes/PoisonType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/PokeType.cs | 65 +++--- .../Pokemon/PokemonTypes/PsychicType.cs | 34 +-- .../Modules/Pokemon/PokemonTypes/RockType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/SteelType.cs | 31 +-- .../Modules/Pokemon/PokemonTypes/WaterType.cs | 31 +-- NadekoBot/NadekoBot.csproj | 2 + 23 files changed, 330 insertions(+), 594 deletions(-) create mode 100644 NadekoBot/Modules/Pokemon/DefaultMoves.cs create mode 100644 NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs diff --git a/NadekoBot/Modules/Pokemon/DefaultMoves.cs b/NadekoBot/Modules/Pokemon/DefaultMoves.cs new file mode 100644 index 00000000..0072f6bf --- /dev/null +++ b/NadekoBot/Modules/Pokemon/DefaultMoves.cs @@ -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 DefaultMovesList = new Dictionary() + { + {"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} + }; + + + } +} diff --git a/NadekoBot/Modules/Pokemon/PokeStats.cs b/NadekoBot/Modules/Pokemon/PokeStats.cs index dca9d31f..0d9c9d34 100644 --- a/NadekoBot/Modules/Pokemon/PokeStats.cs +++ b/NadekoBot/Modules/Pokemon/PokeStats.cs @@ -8,5 +8,11 @@ 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 LastAttacked { get; set; } = new List(); } } diff --git a/NadekoBot/Modules/Pokemon/PokemonModule.cs b/NadekoBot/Modules/Pokemon/PokemonModule.cs index 9d8973ce..ac29c79c 100644 --- a/NadekoBot/Modules/Pokemon/PokemonModule.cs +++ b/NadekoBot/Modules/Pokemon/PokemonModule.cs @@ -12,16 +12,18 @@ 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; + public readonly int BaseHealth = 500; //private Dictionary stats = new Dictionary(); - private ConcurrentDictionary stats = new ConcurrentDictionary(); + private ConcurrentDictionary Stats = new ConcurrentDictionary(); public PokemonGame() @@ -43,60 +45,50 @@ namespace NadekoBot.Modules.Pokemon .Do(async e => { var move = e.GetArg("move"); - Discord.User target = null; - if (!string.IsNullOrWhiteSpace(e.GetArg("target"))) - { - - target = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault(); - if (target == null) - { - await e.Channel.SendMessage("No such person."); - return; - } - } - else + 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()); + 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) + if (userStats.HP < 0) { await e.Channel.SendMessage($"{e.User.Mention} has fainted and was not able to move!"); return; } - if (userstats.movesMade >= 5) + 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)) + 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()); + PokeStats targetStats; + targetStats = Stats.GetOrAdd(target.Id, defaultStats()); //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); + IPokeType userType = getPokeType(e.User.Id); - var EnabledMoves = usertype.getMoves(); - if (!EnabledMoves.Contains(move.ToLowerInvariant())) + 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; @@ -105,11 +97,11 @@ namespace NadekoBot.Modules.Pokemon //get target type IPokeType 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.GetImage()} on {target.Mention}{targetType.GetImage()} for **{damage}** damage"; //Damage type if (damage < 40) @@ -127,28 +119,28 @@ 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 - userstats.lastAttacked.Add(target.Id); - userstats.movesMade++; - targetstats.movesMade = 0; - if (targetstats.lastAttacked.Contains(e.User.Id)) + userStats.LastAttacked.Add(target.Id); + userStats.MovesMade++; + targetStats.MovesMade = 0; + if (targetStats.LastAttacked.Contains(e.User.Id)) { - targetstats.lastAttacked.Remove(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; + Stats[e.User.Id] = userStats; + Stats[target.Id] = targetStats; await e.Channel.SendMessage(response); }); @@ -158,11 +150,11 @@ namespace NadekoBot.Modules.Pokemon .Do(async e => { var userType = getPokeType(e.User.Id); - List movesList = userType.getMoves(); + List movesList = userType.GetMoves(); var str = "**Moves:**"; foreach (string m in movesList) { - str += $"\n{userType.getImage()}{m}"; + str += $"\n{userType.GetImage()}{m}"; } await e.Channel.SendMessage(str); }); @@ -176,7 +168,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.GetNum(); var db = DbHandler.Instance.GetAllRows().Select(x => x.move); if (db.Contains(newMove)) { @@ -191,7 +183,7 @@ namespace NadekoBot.Modules.Pokemon type = typeNum }); }); - await e.Channel.SendMessage($"Added {newType.getImage()}{newMove}"); + await e.Channel.SendMessage($"Added {newType.GetImage()}{newMove}"); }); cgb.CreateCommand(Prefix + "heal") @@ -205,12 +197,12 @@ namespace NadekoBot.Modules.Pokemon await e.Channel.SendMessage("No such person."); return; } - if (stats.ContainsKey(usr.Id)) + if (Stats.ContainsKey(usr.Id)) { - var targetStats = stats[usr.Id]; + var targetStats = Stats[usr.Id]; int HP = targetStats.HP; - if (targetStats.HP == BASEHEALTH) + if (targetStats.HP == BaseHealth) { await e.Channel.SendMessage($"{usr.Name} already has full HP!"); return; @@ -226,15 +218,15 @@ namespace NadekoBot.Modules.Pokemon var up = (usr.Id == e.User.Id) ? "yourself" : usr.Name; await FlowersHandler.RemoveFlowersAsync(e.User, $"heal {up}", amount); //healing - targetStats.HP = BASEHEALTH; + targetStats.HP = BaseHealth; if (HP < 0) { //Could heal only for half HP? - stats[usr.Id].HP = (BASEHEALTH / 2); + 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 🌸"); + await e.Channel.SendMessage($"{e.User.Name} healed {usr.Name} for {BaseHealth - HP} HP with a 🌸"); return; } else @@ -255,12 +247,12 @@ namespace NadekoBot.Modules.Pokemon return; } var pType = getPokeType(usr.Id); - await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.getName().ToLowerInvariant()}**{pType.getImage()}"); + await e.Channel.SendMessage($"Type of {usr.Name} is **{pType.GetName().ToLowerInvariant()}**{pType.GetImage()}"); }); - cgb.CreateCommand(Prefix + "defaultmoves") - .Description($"Sets the moves DB to the default state **OWNER ONLY**") + 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 => { @@ -270,81 +262,8 @@ namespace NadekoBot.Modules.Pokemon { DbHandler.Instance.Delete(p.Id); } - - Dictionary defaultmoves = new Dictionary() - { - {"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} - }; - - foreach (KeyValuePair entry in defaultmoves) + + foreach (var entry in DefaultMoves.DefaultMovesList) { DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves { @@ -353,14 +272,14 @@ namespace NadekoBot.Modules.Pokemon }); } - var str = "Reset moves.\n**Moves:**"; + var str = "**Reset moves to default**.\n**Moves:**"; //could sort, but meh var dbMoves = DbHandler.Instance.GetAllRows(); foreach (PokeMoves m in dbMoves) { - var t = PokemonTypesMain.intToPokeType(m.type); + var t = PokemonTypesMain.IntToPokeType(m.type); - str += $"\n{t.getImage()}{m.move}"; + str += $"\n{t.GetImage()}{m.move}"; } await e.Channel.SendMessage(str); @@ -381,7 +300,7 @@ namespace NadekoBot.Modules.Pokemon } 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.GetName().ToLowerInvariant()}{targetType.GetImage()}"); return; } @@ -406,12 +325,12 @@ namespace NadekoBot.Modules.Pokemon DbHandler.Instance.InsertData(new Classes._DataModels.userPokeTypes { UserId = (long)e.User.Id, - type = targetType.getNum() + type = targetType.GetNum() }); //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.GetImage()} for a 🌸"); }); }); } @@ -424,7 +343,7 @@ namespace NadekoBot.Modules.Pokemon Random rng = new Random(); int damage = rng.Next(40, 60); double multiplier = 1; - multiplier = usertype.getMagnifier(targetType); + multiplier = usertype.GetMagnifier(targetType); damage = (int)(damage * multiplier); return damage; } @@ -436,39 +355,27 @@ namespace NadekoBot.Modules.Pokemon Dictionary setTypes = db.ToDictionary(x => x.UserId, y => y.type); if (setTypes.ContainsKey((long)id)) { - return PokemonTypesMain.intToPokeType(setTypes[(long)id]); + return PokemonTypesMain.IntToPokeType(setTypes[(long)id]); } int remainder = (int)id % 16; - return PokemonTypesMain.intToPokeType(remainder); + return PokemonTypesMain.IntToPokeType(remainder); } - private Pokestats defaultStats() + private PokeStats defaultStats() { - Pokestats s = new Pokestats(); - s.HP = BASEHEALTH; + PokeStats s = new PokeStats(); + s.HP = BaseHealth; return s; } } - 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 lastAttacked { get; set; } = new List(); - } } -//Not sure this is what you wanted? - - diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs index d7d6014a..2df84631 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/BugType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "BUG"; public static int numType = 11; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 0.5; @@ -33,39 +33,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "🐛"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs index 98ba6a68..54f69e2d 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/DarkType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "DARK"; public static int numType = 15; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIGHTING": return 0.5; @@ -29,39 +29,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "🕶"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs index 435675b7..e7168ffc 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/Dragontype.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "DRAGON"; public static int numType = 14; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "DRAGON": return 2; @@ -26,39 +26,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "🐉"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs index 25aaa15e..3cb77723 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/ElectricType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "ELECTRIC"; public static int numType = 3; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "WATER": return 2; @@ -30,38 +30,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "⚡️"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs index 3f22ec33..3d4603ed 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/FightingType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "FIGHTING"; public static int numType = 6; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "NORMAL": return 2; @@ -34,38 +34,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "✊"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs index bf6f8eb0..6995799a 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/FireType.cs @@ -16,9 +16,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "FIRE"; public static int numType = 1; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 0.5; @@ -34,39 +34,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "🔥"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs index 7d7c1d54..8f26875b 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/FlyingType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "FLYING"; public static int numType = 9; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "ELECTRIC": return 0.5; @@ -30,39 +30,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "☁"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs index 8db5b678..83c35504 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/GhostType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "GHOST"; public static int numType = 13; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "NORMAL": return 0; @@ -29,39 +29,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "👻"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs index cab50981..1fc34dd6 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/GrassType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "GRASS"; public static int numType = 4; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 0.5; @@ -32,38 +32,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "🌿"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs index b1eb5ec4..9795aa77 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/GroundType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "GROUND"; public static int numType = 8; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 2; @@ -32,39 +32,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "🗻"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs new file mode 100644 index 00000000..08d354cf --- /dev/null +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/IPokeTypeExtensions.cs @@ -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 GetMoves(this IPokeType poketype) + { + var db = DbHandler.Instance.GetAllRows(); + List moves = new List(); + foreach (PokeMoves p in db) + { + if (p.type == poketype.GetNum()) + { + if (!moves.Contains(p.move)) + { + moves.Add(p.move); + } + } + } + return moves; + } + } + + } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs index 36cffe65..1d1156ad 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/IceType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "ICE"; public static int numType = 5; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 0.5; @@ -32,38 +32,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "❄"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs index a6127865..3052b4e1 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/NormalType.cs @@ -16,9 +16,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "NORMAL"; public static int type_num = 0; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "ROCK": return 0.5; @@ -29,39 +29,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == type_num) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "⭕️"; } - public int getNum() + public int GetNum() { return type_num; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs index f0cf19d1..9c30dfae 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PoisonType.cs @@ -15,9 +15,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "POISON"; public static int numType = 7; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "GRASS": return 2; @@ -31,38 +31,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "☠"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs index 75e265ea..6c47e466 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PokeType.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using NadekoBot.Classes; using NadekoBot.Classes._DataModels; using NadekoBot.Modules.Pokemon.PokemonTypes; @@ -12,12 +8,11 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes public interface IPokeType { - string getImage(); - string getName(); - int getNum(); - List getMoves(); - double getMagnifier(IPokeType target); - void updateMoves(); + + string GetImage(); + string GetName(); + int GetNum(); + double GetMagnifier(IPokeType target); } public class PokemonTypesMain { @@ -25,9 +20,9 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes public static IPokeType stringToPokeType(string newType) { - foreach (IPokeType t in typeList) + foreach (IPokeType t in TypeList) { - if (t.getName() == newType) + if (t.GetName() == newType) { return t; } @@ -35,8 +30,26 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes return null; } + //public static List getMoves(int numType) + //{ + // var db = DbHandler.Instance.GetAllRows(); + // List moves = new List(); + // 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 typeList = new List() + public static List TypeList = new List() { new NormalType(), new FireType(), @@ -57,11 +70,11 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes new SteelType() }; - public static IPokeType intToPokeType(int id) + public static IPokeType IntToPokeType(int id) { - foreach (IPokeType t in typeList) + foreach (IPokeType t in TypeList) { - if (t.getNum() == id) + if (t.GetNum() == id) { return t; } @@ -69,23 +82,5 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes return null; } - - - - - - - - - - - - - - - - - - } } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs index 1f1603ad..1972c197 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/PsychicType.cs @@ -5,7 +5,8 @@ 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.Classes._DataModels; +using NadekoBot.Modules.Pokemon.PokeTypes; namespace NadekoBot.Modules.Pokemon.PokemonTypes { @@ -14,9 +15,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "PSYCHIC"; public static int numType = 10; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIGHTING": return 2; @@ -29,39 +30,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "💫"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs index 4a48b9a7..76b7ae44 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/RockType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "ROCK"; public static int numType = 12; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 2; @@ -31,39 +31,22 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } + - public string getImage() + public string GetImage() { return "💎"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs index f34e1ff2..ff8b554b 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/SteelType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "STEEL"; public static int numType = -1; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 0.5; @@ -30,38 +30,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "🔩"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs b/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs index 9ee96880..e5cfeaaa 100644 --- a/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs +++ b/NadekoBot/Modules/Pokemon/PokemonTypes/WaterType.cs @@ -14,9 +14,9 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes static readonly string name = "WATER"; public static int numType = 2; - public double getMagnifier(IPokeType target) + public double GetMagnifier(IPokeType target) { - switch (target.getName()) + switch (target.GetName()) { case "FIRE": return 2; @@ -30,38 +30,21 @@ namespace NadekoBot.Modules.Pokemon.PokemonTypes } List moves = new List(); - public List getMoves() - { - updateMoves(); - return moves; - } + - public string getName() + public string GetName() { return name; } - public void updateMoves() - { - var db = DbHandler.Instance.GetAllRows(); - foreach (PokeMoves p in db) - { - if (p.type == numType) - { - if (!moves.Contains(p.move)) - { - moves.Add(p.move); - } - } - } - } - public string getImage() + + public string GetImage() { return "💦"; } - public int getNum() + public int GetNum() { return numType; } diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index c1e5e3ea..858557ba 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -188,7 +188,9 @@ + + From 76d56e63d36dd72a7d1dd7be7d256ed3903ab840 Mon Sep 17 00:00:00 2001 From: appelemac Date: Mon, 28 Mar 2016 15:31:01 +0200 Subject: [PATCH 18/20] Revert ">magicitems added" This reverts commit 41a6b849346eae0c7b5c34e590c30236d5f09609. --- NadekoBot/Classes/JSONModels/Configuration.cs | 9 - NadekoBot/Modules/Games.cs | 9 - NadekoBot/NadekoBot.cs | 1 - NadekoBot/bin/Debug/data/config_example.json | 1 - NadekoBot/bin/Debug/data/magicitems.json | 435 ------------------ 5 files changed, 455 deletions(-) delete mode 100644 NadekoBot/bin/Debug/data/magicitems.json diff --git a/NadekoBot/Classes/JSONModels/Configuration.cs b/NadekoBot/Classes/JSONModels/Configuration.cs index e0919cf0..a528cc37 100644 --- a/NadekoBot/Classes/JSONModels/Configuration.cs +++ b/NadekoBot/Classes/JSONModels/Configuration.cs @@ -13,7 +13,6 @@ namespace NadekoBot.Classes.JSONModels [JsonIgnore] public List Quotes { get; set; } = new List(); - public List MagicItems { get; set; } = new List(); public List RotatingStatuses { get; set; } = new List(); public CommandPrefixesModel CommandPrefixes { get; set; } = new CommandPrefixesModel(); @@ -128,12 +127,4 @@ namespace NadekoBot.Classes.JSONModels public override string ToString() => $"{Text}\n\t*-{Author}*"; } - public class MagicItem - { - public string Name { get; set; } - public string Description { get; set; } - - public override string ToString() => - $"🌟**{Name}**\n\t*{Description}*"; - } } diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs index 408564af..9321859a 100644 --- a/NadekoBot/Modules/Games.cs +++ b/NadekoBot/Modules/Games.cs @@ -92,15 +92,6 @@ namespace NadekoBot.Modules { await e.Channel.SendMessage(msg); }); - cgb.CreateCommand(Prefix + "magicitem") - .Description("Draw a magic item randomly.") - .Do(async e => - { - await - e.Channel.SendMessage( - NadekoBot.Config.MagicItems[new Random().Next(0, NadekoBot.Config.MagicItems.Count)].ToString()); - }); - cgb.CreateCommand(Prefix + "linux") .Description("Prints a customizable Linux interjection") .Parameter("gnu", ParameterType.Required) diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index c86e4116..d3e8df01 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -63,7 +63,6 @@ namespace NadekoBot { Config = JsonConvert.DeserializeObject(File.ReadAllText("data/config.json")); Config.Quotes = JsonConvert.DeserializeObject>(File.ReadAllText("data/quotes.json")); - Config.MagicItems = JsonConvert.DeserializeObject>(File.ReadAllText("data/magicitems.json")); } catch { diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index 702add40..0f4507e1 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -2,7 +2,6 @@ "DontJoinServers": false, "ForwardMessages": true, "IsRotatingStatus": false, - "MagicItems": [], "RotatingStatuses": [], "CommandPrefixes": { "Administration": ".", diff --git a/NadekoBot/bin/Debug/data/magicitems.json b/NadekoBot/bin/Debug/data/magicitems.json deleted file mode 100644 index ceed9dfe..00000000 --- a/NadekoBot/bin/Debug/data/magicitems.json +++ /dev/null @@ -1,435 +0,0 @@ -[ -{ "Name":"Ace of Spades", - "Description":"An ace of spades from a standard - card deck. No matter where you store it on your body, you will always be - able to find it in your right sleeve afterwards." -}, -{ "Name":"Arrow of Euarere", - "Description":"A silver arrow, suspended on a - string. It always points to the person holding the string." -}, -{ "Name":"Amulet of Extra Amulet Slot", - "Description":"This amulet allows you to gain the - benefit from two magical amulets rather than one. It cannot be further - enchanted." -}, -{ "Name":"Amulet of Feather Fall", - "Description":"When worn, this amulet turns into a - feather and falls to the ground." -}, -{ "Name":"Anti-Matches", - "Description":"A box of matches. Striking one will - make it begin to drip water from the tip while the match shrivels away. - The amount of water a match releases is about enough to fill a - tablespoon." -}, -{ "Name":"Artist's Bludgeon, The", - "Description":"Inanimate objects hit with this - bludgeon will receive no damage; they will however change color." -}, -{ "Name":"Attentive Guardsman's Pike", - "Description":"These ornate and deadly-looking - ceremonial pikes are reach weapons and appear to weigh at least 20 lbs, - not counting the weight of the fluttering banners that can be unfurled - for parade use. Constructed of shadowstuff, they weigh one pound, and - inflict only a single point of damage on an attack, being almost entirely - for show, although they also have the unique property of remaining in - place when set (although unable to support more than 20 lbs), allowing a - 'resting his eyes' guardsman to prop it up and leave it standing under - its own power, while his hand sags off of it." -}, -{ "Name":"Attentive Guardsman's Tabard", - "Description":"A dozen of these tabards were - fashioned for palace guardsmen in the Empire of Sard, 250 miles from the - nearest enemy. The bearer is placed under a glamour that causes him to - appear alert and awake, even if his eyes are closed and he is snoring - lightly." -}, -{ "Name":"Axe of Big Numbers", - "Description":"This axe shouts \"Big numbers - baby, come on!\" whenever it is swung, but always deals 1 damage or - less." -}, -{ "Name":"Axe of Empathy", - "Description":"Every time you hit something with - this +5 greataxe, you get dealt an equal amount of damage. Both you and - the thing you hit are then healed the amount of damage dealt by the axe, - even if either are dead. The Axe hopes you have learned your lesson." -}, -{ "Name":"Axe of Pain", - "Description":"The axe is always moaning and - groaning with pain." -}, -{ "Name":"Baby Oil", - "Description":"An aphrodisiac made from the finest - mashed babies. Strangely unpopular in the upper planes, the judgmental - prudes." -}, -{ "Name":"Bag of Faerie Gold", - "Description":"This sack appears to be full of gold - coins and jewels. When one attempts to spend them, however, the glamour - on them soon vanishes, revealing them to be nothing but leaves and - pebbles. Obviously, most shopkeepers will not be happy about this, and no - amount of 'we didn't know, I swear!' will change their mind." -}, -{ "Name":"Bag of Holding", - "Description":"This item functions as a normal - backpack, however when attempting to retrieve an item, a calm female - voice tells them there is a wait time of 4d10 minutes before they can - retrieve their item (actual time is stated time plus 6d6 additional - minutes). During this wait, the bag plays either annoying muzak or advertisements - for the bag's creator's other products/services. Upon attempting to - retrieve an item, there is a chance that the wrong item is retrieved, or - that the intended item is simply missing. Obtaining the original item - requires an additional 4d10+6d6 minutes and has only a 5% chance of - success." -}, -{ "Name":"Bag of Holding (Alternate)", - "Description":"This sack needs a hug!" -}, -{ "Name":"Bag of Trading", - "Description":"You can take one thing out of the - bag for each object you put in the bag. However, you have no control over - what you get, and there are no trade-backs. Past research seems to imply - there's some sort of correlation to what gets you what, but it's - extremely convoluted and far from understood." -}, -{ "Name":"Bag of Trick", - "Description":"This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." -}, -{ "Name":"Bag of Unholding", - "Description":"Quite a large backpack but even the - smallest item doesn't fit." -}, -{ "Name":"Bagpipe of Stealth", - "Description":"Grants the user invisibility as long as it is being played." -}, -{ "Name":"Ball of Eyes", - "Description":"A snow-globe filled with miniature - eyeballs. When shaken, it grants the user a blurry, jittery vision of - some future event." -}, -{ "Name":"Banana Walkie-Talkies", - "Description":"There exist two, and only two, of - these items in the world. One of which is possessed by a cranky and - lonely half-orc. It appears to be an innocuous wooden banana with a coat - of faded yellow paint. When an end (doesn't matter which one) is placed - against your ear, you can hear a ringing followed by a *click* and a - half-orc yelling at you for waking him up at this ungodly hour. If you - drop the banana or \"hang up,\" the call ends. If you stay and - listen, the half-orc will yell at you, call out obscenities, and start - going on about his daily problems and mishaps in his love life. Every so - often (2% chance/day), the banana will ring while you are sleeping and - the half-orc will want to talk to you about his problems." -}, -{ "Name":"Barrel of Holding", - "Description":"This large wooden barrel measuring - √(12/π) feet in diameter and 5 feet in height can hold up to - 15 cubic feet of matter." -}, -{ "Name":"Beam Sword of Severed Nerves", - "Description":"A beam sword. It cannot cut anything - but nerve strings. Will pass through any other material leaving no harm." -}, -{ "Name":"Belt of Pants", - "Description":"This belt creates illusory pants on - the wearer. The wearer can suppress the illusion at will" -}, -{ "Name":"Belt of Tightening", - "Description":"Every time you put this belt on, all - of your clothes permanently shrink a fraction of a millimeter. The effect - is compound." -}, -{ "Name":"Belt of Unbathed Breath", - "Description":"When worn around the waist, allows - the user to breathe underwater. Does not function when wet." -}, -{ "Name":"Boogie Skeleton", - "Description":"This pile of bones is small, such as - one that might be obtained from a bird or a toad, though it can look as - though it came from any creature. When a song is sung or played in the - vicinity of the skeleton, it begins to dance appropriately. As soon as - the music stops, it collapses into the pile of bones again. The skeleton, - when dancing, can be no larger than Diminutive." -}, -{ "Name":"Book of Canon", - "Description":"A book that automatically transforms - into a copy of the sacred text of any religion, translated into the - language the user is most familiar with." -}, -{ "Name":"Book of Confusion", - "Description":"The letters in this book always - appear to be upside down, even if viewed from different directions at the - same time. The book is a bad novel about zombies." -}, -{ "Name":"Book of Curses", - "Description":"When opened, the book verbally - berates anyone in the immediate vicinity, calling into question their - combat ability, intellect, personal hygiene, lineage and profession of - their mothers, and other delightful insults. Once closed the book - continues shouting (although it is muffled) until placed inside a bag or - some other similar container for 1d4+1 minutes and ignored. Replying to - the book in any other way causes the insults to get louder and more - childish the more time you spend replying to it." -}, -{ "Name":"Book of Exalted Deeds", - "Description":"Contains a listing of some of the - finest houses ever sold and the specifics of the titles to the - properties." -}, -{ "Name":"Boots of Levitation", - "Description":"These boots levitate a few inches - off the ground when not worn." -}, -{ "Name":"Boots of Stylishness", - "Description":"Knee high black boots that are - always clean and shiny. They never take in water, thus feet are always - dry." -}, -{ "Name":"Boots of Walking", - "Description":"The wearer of the boots cannot run, - nor can he take a double move action, and takes a -5 to Tumble checks. - These boots are made for walkin', and that's just what they'll do." -}, -{ "Name":"Bottle of Air", - "Description":"It's a bottle. Full of air. - Congratulations." -}, -{ "Name":"Bottomless Beer Mug", - "Description":"Any liquid poured into this mug - treats the bottom as incorporeal, but solid objects don't" -}, -{ "Name":"Bowl of Comfortable Warmth", - "Description":"Any liquid in the bowl will feel - comfortably warm, so icy cold water will feel like it's a bit over room - temperature. Do note, however, that it's still icy cold water, it just - feels warmer." -}, -{ "Name":"Box of Mild Interest", - "Description":"If this box is held in two hands and - shaken, taking a standard action, it may generate an effect (all spell - effects are CL 3). Roll 1d20. -1: Hold Person on the user -2: Hold Person on the closest - non-using creature -3: Dancing Lights as desired by the - holder -4: Sleep on the holder -5: Sleep on a creature of the - holder’s choice -6: Holder takes 1 force damage, no - save -7-20: No effect" -}, -{ "Name":"Breastplate of Secret Detection", - "Description":"If the wearer of this breastplate - gains a piece of information that is somehow connected to the concealment - of a hidden conspiracy or plot, a live and still wet red herring forms on - the inside of the armor." -}, -{ "Name":"Bullying Gloves", - "Description":"At random intervals, these gloves - instil the wearer with a near-irresistible urge to hit themselves." -}, -{ "Name":"Bunyan’s Belt", - "Description":"When worn, causes an enormous, bushy - black beard to appear on the wearer’s face." -}, -{ "Name":"Cape of Resistance", - "Description":"When this item is placed on any - living thing it somehow manages to fall off, untie itself, slip past the - owner’s neck entirely, or otherwise avoid being worn." -}, -{ "Name":"Case of the Litigator", - "Description":"Translates any document placed in - the case into legal jargon; non-reversible. Does not confer the ability - to understand legal jargon." -}, -{ "Name":"Cat of Schrodinger", - "Description":"When this cat is not being observed - in any way it is both dead and alive. When something observes it, it - suddenly becomes either dead or alive with a 50% chance of either." -}, -{ "Name":"Chair of Steadiness", - "Description":"This chair can be moved but cannot - be tipped over by anything less than a DC 35 Strength check." -}, -{ "Name":"Charles", - "Description":"This small, unremarkable figurine of - a gnome refuses to be called anything but Charles. No other name will - leave the lips of the speaker. It has no other powers." -}, -{ "Name":"Chime of Interruption", - "Description":"This instrument can be struck once - every round, which takes a standard action. On any round the chime is - activated the user may ready one action without spending an action to do - so." -}, -{ "Name":"Chime of Opening", - "Description":"Commonly affixed to or near doors, - when pressed it emits a sound on the interior of the owner’s home to let - them know guests have arrived." -}, -{ "Name":"Chime of Opening (Alternate)", - "Description":"When struck against a solid surface, - this chime emits a loud click, and opens along its length, to reveal a - tiny compartment adequate to conceal a single 'smoke' worth of pipeweed - or a blowgun needle. When the compartment is closed, it is seamless and - can be detected only with a DC 20 Search check. If hit with an instrument - such as a small mallet, it chimes." -}, -{ "Name":"Cloak of Billowing", - "Description":"This black and silver cloak will - always billow dramatically behind the wearer, it has no other effects." -}, -{ "Name":"Cloak of Displacement, Minor", - "Description":"This item appears to be a normal - cloak, but when worn by a character its magical properties distort and - warp reality. When any attack is made against the wearer the cloak has a - 20% chance of falling off, no matter how it is secured." -}, -{ "Name":"Compacting hammer", - "Description":"The force imparted by it is - multiplied, but is spread around the surface of a struck object facing - inward." -}, -{ "Name":"Cymbal of Symbols", - "Description":"This musical instrument enables the - user to comprehend dead languages, but only while they are deafened by - noise." -}, -{ "Name":"Dagger of Told Secrets", - "Description":"A simple-looking dagger. If used to - backstab someone to death, it will whisper your most embarrassing secret - to that person." -}, -{ "Name":"Dagger of Untold Secrets", - "Description":"A simple looking dagger. If used to - backstab someone to death, it will whisper the most embarrassing secret - of that person to you." -}, -{ "Name":"Decanter of Endless Sorrow", - "Description":"A pewter flask that produces - limitless alcohol when held to their lips by someone who is troubled. It - gets them drunk but they never feel any better." -}, -{ "Name":"Diadem of Brothaurity", - "Description":"When wearing this headpiece, you are - as elegant and well-spoken as a famous diplomat or regent, but you can't - stop calling everyone bro." -}, -{ "Name":"Enchanted Book of Collected Stories", - "Description":"Opening this will cause miniature - creatures/people to pour out and preform a chapter from the book much - like a theater." -}, -{ "Name":"Fade to Black Belt", - "Description":"The wearer of this belt will be - unable to remember any sexual encounter begun while they were wearing the - belt." -}, -{ "Name":"Focusing Ring", - "Description":"The digit on which this ring is worn - can be viewed in extremely high definition from a great distance." -}, -{ "Name":"Gloves of Tinkering", - "Description":"Wearing the gloves will make you - able to almost repair any broken item. However, you will always end up - with pieces from the item that don't seem to fit anywhere." -}, -{ "Name":"Greater Staff of Random Summoning", - "Description":"Summons a random creature at a - random place. You could be summoning a giant Ogre on the other side of - the globe for all you know." -}, -{ "Name":"Hoarder's Wand", - "Description":"Does nothing but for some reason you - think it might be important later in your quest." -}, -{ "Name":"Hood of Offensive Facades", - "Description":"This hood will change your identity - in the eyes of others to the appearance of the person they most - personally dislike." -}, -{ "Name":"Hood Of Worrisome Facades", - "Description":"This hood will change your identity - in the eyes of others, however the identity used will be random." -}, -{ "Name":"Indestructible Notebook of Memories", - "Description":"This otherwise normal notepad of - normal notepad size cannot be damaged or destroyed, and anything written - in it cannot be obscured or defaced. It also has unlimited pages despite - its finite size. However, the data it holds only lasts as long as the - writer independently remembers it, and decays in exact proportion to the - relevant memories. Remember who and when, but not where? Then the words - describing the location in that particular entry are the only ones gone." -}, -{ "Name":"Intransigent Rod", - "Description":"When the button on this artifact is - pressed in, the holder's opinions solidify and they become impossible to - convince." -}, -{ "Name":"Lunchbox of Delicious Unfulfillment", - "Description":"This lunchbox will hold whatever - food you desire. However you will never get full and the food will - deliver no nourishment." -}, -{ "Name":"Mattress of Poverty, The", - "Description":"No matter how you fluff this - gorgeous, thick, mattress, you will always sleep on the thin part of it." -}, -{ "Name":"Mug O' Dissatisfaction", - "Description":"A mug that always produces a - steaming hot cup of coffee or tea when tapped on the bottom. It conjures - the opposite of what the tapper prefers, so if you like tea you get - coffee and vice versa. Handing the full mug to another person will make - the drink in it transform to the opposite of that persons preferences." -}, -{ "Name":"Murder Dagger", - "Description":"All damage it would deal is instead - replaced by the target being harassed by crows for that many hours." -}, -{ "Name":"Needle Of Learned Compromise", - "Description":"This needle will create beautiful - tattoos of any design, however they hurt a tiny bit more. When used to - sew it is entirely normal." -}, -{ "Name":"Portable Dark Tavern Corner", - "Description":"Consisting of two wooden boards - connected by a hinge, this artifact draws those nearby into assuming it - is a perfect spot to conduct seedy business." -}, -{ "Name":"Ring of First Impression", - "Description":"Wearing the ring will make you able - to perform a perfect handshake with the hand wearing it." -}, -{ "Name":"Sack of Hive Eggs", - "Description":"Crushing one of the numerous tiny - eggs will cause the thoughts of everybody in the proximity to merge. - Everybody can hear what you think and you can hear everybody." -}, -{ "Name":"Shoes of the Restless Traveler", - "Description":"These shoes allow their user to run - for miles without feeling fatigue, but if they try to do anything else - with it (walk, sit down, jump), they will instantly trip" -}, -{ "Name":"Sword of Parrying", - "Description":"Parries every attack, swinging it - yourself will force it to \"parry\" your opponents weapon/attack - even though he/she/it is defenseless." -}, -{ "Name":"Vorpal Grindstone", - "Description":"It can \"sharpen\" any - object to become vorpal. Any object." -}, -{ "Name":"Water Hat, The", - "Description":"A small red hat, when worn, causes - water to pour from the wearer's fingers at the speed and pressure of a - kitchen faucet at half power." -}, -{ "Name":"Wineskin of the Eternal Primary", - "Description":"This wineskin never runs out of - water, but even the tiniest sip makes you have to go, like, super bad. - Right now." -}, -] \ No newline at end of file From 78f8182a31e59530c1989fd7ca24e6f2b397168f Mon Sep 17 00:00:00 2001 From: appelemac Date: Mon, 28 Mar 2016 15:36:15 +0200 Subject: [PATCH 19/20] remove magicitemsv1, add TLModule to NADekoBot --- NadekoBot/NadekoBot.cs | 2 + NadekoBot/bin/Debug/data/magicitemsv1.json | 248 --------------------- 2 files changed, 2 insertions(+), 248 deletions(-) delete mode 100644 NadekoBot/bin/Debug/data/magicitemsv1.json diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index d3e8df01..d4f60c86 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -14,6 +14,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using NadekoBot.Modules.Translator; namespace NadekoBot { @@ -167,6 +168,7 @@ namespace NadekoBot 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); diff --git a/NadekoBot/bin/Debug/data/magicitemsv1.json b/NadekoBot/bin/Debug/data/magicitemsv1.json deleted file mode 100644 index 0a039a0e..00000000 --- a/NadekoBot/bin/Debug/data/magicitemsv1.json +++ /dev/null @@ -1,248 +0,0 @@ -[{ - "Name": "Ace of Spades", - "Description": "An ace of spades from a standard card deck. No matter where you store it on your body, you will always be able to find it in your right sleeve afterwards." -}, { - "Name": "Arrow of Euarere", - "Description": "A silver arrow, suspended on a string. It always points to the person holding the string." -}, { - "Name": "Amulet of Extra Amulet Slot", - "Description": "This amulet allows you to gain the benefit from two magical amulets rather than one. It cannot be further enchanted." -}, { - "Name": "Amulet of Feather Fall", - "Description": "When worn, this amulet turns into a feather and falls to the ground." -}, { - "Name": "Anti-Matches", - "Description": "A box of matches. Striking one will make it begin to drip water from the tip while the match shrivels away. The amount of water a match releases is about enough to fill a tablespoon." -}, { - "Name": "Artist's Bludgeon, The", - "Description": "Inanimate objects hit with this bludgeon will receive no damage; they will however change color." -}, { - "Name":"Attentive Guardsman's Pike", - "Description":"These ornate and deadly-looking ceremonial pikes are reach weapons and appear to eigh at least 20 lbs, not counting the weight of the fluttering banners that can be unfurled for parade use. Constructed of shadowstuff, they weigh one pound, and inflict only a single point of damage on an attack, being almost entirely for show, although they also have the unique property of remaining in place when set (although unable to support more than 20 lbs), allowing a 'resting his eyes' guardsman to prop it up and leave it standing under its own power, while his hand sags off of it." -}, { - "Name": "Attentive Guardsman's Tabard", - "Description": "A dozen of these tabards were fashioned for palace guardsmen in the Empire of Sard, 250 miles from the nearest enemy. The bearer is placed under a glamour that causes him to appear alert and awake, even if his eyes are closed and he is snoring lightly." -}, { - "Name": "Axe of Big Numbers", - "Description": "This axe shouts \"Big numbers baby, come on!\" whenever it is swung, but always deals 1 damage or less." -}, { - "Name": "Axe of Empathy", - "Description": "Every time you hit something with this +5 greataxe, you get dealt an equal amount of damage. Both you and the thing you hit are then healed the amount of damage dealt by the axe, even if either are dead. The Axe hopes you have learned your lesson." -}, { - "Name": "Axe of Pain", - "Description": "The axe is always moaning and groaning with pain." -}, { - "Name": "Baby Oil", - "Description": "An aphrodisiac made from the finest mashed babies. Strangely unpopular in the upper planes, the judgmental prudes." -}, { - "Name": "Bag of Faerie Gold", - "Description": "This sack appears to be full of gold coins and jewels. When one attempts to spend them, however, the glamour on them soon vanishes, revealing them to be nothing but leaves and pebbles. Obviously, most shopkeepers will not be happy about this, and no amount of 'we didn't know, I swear!' will change their mind." -}, { - "Name": "Bag of Holding", - "Description":"This item functions as a normal - backpack, however when attempting to retrieve an item, a calm female - voice tells them there is a wait time of 4d10 minutes before they can - retrieve their item (actual time is stated time plus 6d6 additional - minutes). During this wait, the bag plays either annoying muzak or advertisements - for the bag's creator's other products/services. Upon attempting to - retrieve an item, there is a chance that the wrong item is retrieved, or - that the intended item is simply missing. Obtaining the original item - requires an additional 4d10+6d6 minutes and has only a 5% chance of - success." -}, { - "Name": "Bag of Holding (Alternate)", - "Description": "This sack needs a hug!" -}, { - "Name": "Bag of Trading", - "Description": "You can take one thing out of the bag for each object you put in the bag. However, you have no control over what you get, and there are no trade-backs. Past research seems to imply there's some sort of correlation to what gets you what, but it's extremely convoluted and far from understood." -}, { - "Name": "Bag of Trick", - "Description": "This bag operates like a Bag of Tricks, except it only works once a week and produces a rat each time itis used." -}, { - "Name": "Bag of Unholding", - "Description": "Quite a large backpack but even the smallest item doesn't fit." -}, { - "Name": "Bagpipe of Stealth", - "Description": "Grants the user invisibility as long as it is being played." -}, { - "Name": "Ball of Eyes", - "Description": "A snow-globe filled with miniature eyeballs. When shaken, it grants the user a blurry, jittery vision of some future event." -}, { - "Name": "Banana Walkie-Talkies", - "Description": "There exist two, and only two, of these items in the world. One of which is possessed by a cranky and lonely half-orc. It appears to be an innocuous wooden banana with a coat of faded yellow paint. When an end (doesn't matter which one) is placed against your ear, you can hear a ringing followed by a *click* and a half-orc yelling at you for waking him up at this ungodly hour. If you drop the banana or \"hang up,\" the call ends. If you stay and listen, the half-orc will yell at you, call o...(line truncated)... -}, { - "Name": "Barrel of Holding", - "Description": "This large wooden barrel measuring √(12/π) feet in diameter and 5 feet in height can hold up to 15 cubic feet of matter." -}, { - "Name": "Beam Sword of Severed Nerves", - "Description": "A beam sword. It cannot cut anything but nerve strings. Will pass through any other material leaving no harm." -}, { - "Name": "Belt of Pants", - "Description": "This belt creates illusory pants on the wearer. The wearer can suppress the illusion at will" -}, { - "Name": "Belt of Tightening", - "Description": "Every time you put this belt on, all of your clothes permanently shrink a fraction of a millimeter. The effect is compound." -}, { - "Name": "Belt of Unbathed Breath", - "Description": "When worn around the waist, allows the user to breathe underwater. Does not function when wet." -}, { - "Name": "Boogie Skeleton", - "Description": "This pile of bones is small, such as one that might be obtained from a bird or a toad, though it can look as though it came from any creature. When a song is sung or played in the vicinity of the skeleton, it begins to dance appropriately. As soon as the music stops, it collapses into the pile of bones again. The skeleton, when dancing, can be no larger than Diminutive." -}, { - "Name": "Book of Canon", - "Description": "A book that automatically transforms into a copy of the sacred text of any religion, translated into the language the user is most familiar with." -}, { - "Name": "Book of Confusion", - "Description": "The letters in this book always appear to be upside down, even if viewed from different directions at the same time. The book is a bad novel about zombies." -}, { - "Name": "Book of Curses", - "Description": "When opened, the book verbally berates anyone in the immediate vicinity, calling into question their combat ability, intellect, personal hygiene, lineage and profession of their mothers, and other delightful insults. Once closed the book continues shouting (although it is muffled) until placed inside a bag or some other similar container for 1d4+1 minutes and ignored. Replying to the book in any other way causes the insults to get louder and more childish the more time you spend replying to...(line truncated)... -}, { - "Name": "Book of Exalted Deeds", - "Description": "Contains a listing of some of the finest houses ever sold and the specifics of the titles to the properties." -}, { - "Name": "Boots of Levitation", - "Description": "These boots levitate a few inches off the ground when not worn." -}, { - "Name": "Boots of Stylishness", - "Description": "Knee high black boots that are always clean and shiny. They never take in water, thus feet are always dry." -}, { - "Name": "Boots of Walking", - "Description": "The wearer of the boots cannot run, nor can he take a double move action, and takes a -5 to Tumble checks. These boots are made for walkin', and that's just what they'll do." -}, { - "Name": "Bottle of Air", - "Description": "It's a bottle. Full of air. Congratulations." -}, { - "Name": "Bottomless Beer Mug", - "Description": "Any liquid poured into this mug treats the bottom as incorporeal, but solid objects don't" -}, { - "Name": "Bowl of Comfortable Warmth", - "Description": "Any liquid in the bowl will feel comfortably warm, so icy cold water will feel like it's a bit over room temperature. Do note, however, that it's still icy cold water, it just feels warmer." -}, { - "Name": "Breastplate of Secret Detection", - "Description": "If the wearer of this breastplate gains a piece of information that is somehow connected to the concealment of a hidden conspiracy or plot, a live and still wet red herring forms on the inside of the armor." -}, { - "Name": "Bullying Gloves", - "Description": "At random intervals, these gloves instil the wearer with a near-irresistible urge to hit themselves." -}, { - "Name": "Bunyan’s Belt", - "Description": "When worn, causes an enormous, bushy black beard to appear on the wearer’s face." -}, { - "Name": "Cape of Resistance", - "Description": "When this item is placed on any living thing it somehow manages to fall off, untie itself, slip past the owner’s neck entirely, or otherwise avoid being worn." -}, { - "Name": "Case of the Litigator", - "Description": "Translates any document placed in the case into legal jargon; non-reversible. Does not confer the ability to understand legal jargon." -}, { - "Name": "Cat of Schrodinger", - "Description": "When this cat is not being observed in any way it is both dead and alive. When something observes it, it suddenly becomes either dead or alive with a 50% chance of either." -}, { - "Name": "Chair of Steadiness", - "Description": "This chair can be moved but cannot be tipped over by anything less than a DC 35 Strength check." -}, { - "Name": "Charles", - "Description": "This small, unremarkable figurine of a gnome refuses to be called anything but Charles. No other name will leave the lips of the speaker. It has no other powers." -}, { - "Name": "Chime of Interruption", - "Description": "This instrument can be struck once every round, which takes a standard action. On any round the chime is activated the user may ready one action without spending an action to do so." -}, { - "Name": "Chime of Opening", - "Description": "Commonly affixed to or near doors, when pressed it emits a sound on the interior of the owner’s home to let them know guests have arrived." -}, { - "Name": "Chime of Opening (Alternate)", - "Description": "When struck against a solid surface, this chime emits a loud click, and opens along its length, to reveal a tiny compartment adequate to conceal a single 'smoke' worth of pipeweed or a blowgun needle. When the compartment is closed, it is seamless and can be detected only with a DC 20 Search check. If hit with an instrument such as a small mallet, it chimes." -}, { - "Name": "Cloak of Billowing", - "Description": "This black and silver cloak will always billow dramatically behind the wearer, it has no other effects." -}, { - "Name": "Cloak of Displacement, Minor", - "Description": "This item appears to be a normal cloak, but when worn by a character its magical properties distort and warp reality. When any attack is made against the wearer the cloak has a 20% chance of falling off, no matter how it is secured." -}, { - "Name": "Compacting hammer", - "Description": "The force imparted by it is multiplied, but is spread around the surface of a struck object facing inward." -}, { - "Name": "Cymbal of Symbols", - "Description": "This musical instrument enables the user to comprehend dead languages, but only while they are deafened by noise." -}, { - "Name": "Dagger of Told Secrets", - "Description": "A simple-looking dagger. If used to backstab someone to death, it will whisper your most embarrassing secret to that person." -}, { - "Name": "Dagger of Untold Secrets", - "Description": "A simple looking dagger. If used to backstab someone to death, it will whisper the most embarrassing secret of that person to you." -}, { - "Name": "Decanter of Endless Sorrow", - "Description": "A pewter flask that produces limitless alcohol when held to their lips by someone who is troubled. It gets them drunk but they never feel any better." -}, { - "Name": "Diadem of Brothaurity", - "Description": "When wearing this headpiece, you are as elegant and well-spoken as a famous diplomat or regent, but you can't stop calling everyone bro." -}, { - "Name": "Enchanted Book of Collected Stories", - "Description": "Opening this will cause miniature creatures/people to pour out and preform a chapter from the book much like a theater." -}, { - "Name": "Fade to Black Belt", - "Description": "The wearer of this belt will be unable to remember any sexual encounter begun while they were wearing the belt." -}, { - "Name": "Focusing Ring", - "Description": "The digit on which this ring is worn can be viewed in extremely high definition from a great distance." -}, { - "Name": "Gloves of Tinkering", - "Description": "Wearing the gloves will make you able to almost repair any broken item. However, you will always end up with pieces from the item that don't seem to fit anywhere." -}, { - "Name": "Greater Staff of Random Summoning", - "Description": "Summons a random creature at a random place. You could be summoning a giant Ogre on the other side of the globe for all you know." -}, { - "Name": "Hoarder's Wand", - "Description": "Does nothing but for some reason you think it might be important later in your quest." -}, { - "Name": "Hood of Offensive Facades", - "Description": "This hood will change your identity in the eyes of others to the appearance of the person they most personally dislike." -}, { - "Name": "Hood Of Worrisome Facades", - "Description": "This hood will change your identity in the eyes of others, however the identity used will be random." -}, { - "Name": "Indestructible Notebook of Memories", - "Description": "This otherwise normal notepad of normal notepad size cannot be damaged or destroyed, and anything written in it cannot be obscured or defaced. It also has unlimited pages despite its finite size. However, the data it holds only lasts as long as the writer independently remembers it, and decays in exact proportion to the relevant memories. Remember who and when, but not where? Then the words describing the location in that particular entry are the only ones gone." -}, { - "Name": "Intransigent Rod", - "Description": "When the button on this artifact is pressed in, the holder's opinions solidify and they become impossible to convince." -}, { - "Name": "Lunchbox of Delicious Unfulfillment", - "Description": "This lunchbox will hold whatever food you desire. However you will never get full and the food will deliver no nourishment." -}, { - "Name": "Mattress of Poverty, The", - "Description": "No matter how you fluff this gorgeous, thick, mattress, you will always sleep on the thin part of it." -}, { - "Name": "Mug O' Dissatisfaction", - "Description": "A mug that always produces a steaming hot cup of coffee or tea when tapped on the bottom. It conjures the opposite of what the tapper prefers, so if you like tea you get coffee and vice versa. Handing the full mug to another person will make the drink in it transform to the opposite of that persons preferences." -}, { - "Name": "Murder Dagger", - "Description": "All damage it would deal is instead replaced by the target being harassed by crows for that many hours." -}, { - "Name": "Needle Of Learned Compromise", - "Description": "This needle will create beautiful tattoos of any design, however they hurt a tiny bit more. When used to sew it is entirely normal." -}, { - "Name": "Portable Dark Tavern Corner", - "Description": "Consisting of two wooden boards connected by a hinge, this artifact draws those nearby into assuming it is a perfect spot to conduct seedy business." -}, { - "Name": "Ring of First Impression", - "Description": "Wearing the ring will make you able to perform a perfect handshake with the hand wearing it." -}, { - "Name": "Sack of Hive Eggs", - "Description": "Crushing one of the numerous tiny eggs will cause the thoughts of everybody in the proximity to merge. Everybody can hear what you think and you can hear everybody." -}, { - "Name": "Shoes of the Restless Traveler", - "Description": "These shoes allow their user to run for miles without feeling fatigue, but if they try to do anything else with it (walk, sit down, jump), they will instantly trip" -}, { - "Name": "Sword of Parrying", - "Description": "Parries every attack, swinging it yourself will force it to \"parry\" your opponents weapon/attack even though he/she/it is defenseless." -}, { - "Name": "Vorpal Grindstone", - "Description": "It can \"sharpen\" any object to become vorpal. Any object." -}, { - "Name": "Water Hat, The", - "Description": "A small red hat, when worn, causes water to pour from the wearer's fingers at the speed and pressure of a kitchen faucet at half power." -}, -{ "Name":"Wineskin of the Eternal Primary", - "Description":"This wineskin never runs out of water, but even the tiniest sip makes you have to go, like, super bad. Right now." -}, -] \ No newline at end of file From b3bad995fda616898e9a30ec54dbd3c7fa6a04a7 Mon Sep 17 00:00:00 2001 From: appelemac Date: Mon, 28 Mar 2016 15:59:22 +0200 Subject: [PATCH 20/20] Cmd list I'm working on the pokemoves~ --- commandlist.md | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/commandlist.md b/commandlist.md index 3fe3a9a1..681c48ba 100644 --- a/commandlist.md +++ b/commandlist.md @@ -2,7 +2,7 @@ ######You can donate on paypal: `nadekodiscordbot@gmail.com` or Bitcoin `17MZz1JAqME39akMLrVT4XBPffQJ2n1EPa` #NadekoBot List Of Commands -Version: `NadekoBot v0.9.5925.41065` +Version: `NadekoBot v0.9.5930.23184` ### Administration Command and aliases | Description | Usage ----------------|--------------|------- @@ -13,9 +13,9 @@ Command and aliases | Description | Usage `.byepm` | Toggles whether the good bye messages will be sent in a PM or in the text channel. `.greetpm` | Toggles whether the greet messages will be sent in a PM or in the text channel. `.spmom` | Toggles whether mentions of other offline users on your server will send a pm to them. -`.logserver` | Toggles logging in this channel. Logs every message sent/deleted/edited on the server. BOT OWNER ONLY. SERVER OWNER ONLY. -`.userpresence` | Starts logging to this channel when someone from the server goes online/offline/idle. BOT OWNER ONLY. SERVER OWNER ONLY. -`.voicepresence` | Toggles logging to this channel whenever someone joins or leaves a voice channel you are in right now. BOT OWNER ONLY. SERVER OWNER ONLY. +`.logserver` | Toggles logging in this channel. Logs every message sent/deleted/edited on the server. **Owner Only!** +`.userpresence` | Starts logging to this channel when someone from the server goes online/offline/idle. **Owner Only!** +`.voicepresence` | Toggles logging to this channel whenever someone joins or leaves a voice channel you are in right now. **Owner Only!** `.repeat` | Repeat a message every X minutes. If no parameters are specified, repeat is disabled. Requires manage messages. `.rotateplaying`, `.ropl` | Toggles rotation of playing status of the dynamic strings you specified earlier. `.addplaying`, `.adpl` | Adds a specified string to the list of playing strings to rotate. Supported placeholders: %servers%, %users%, %playing%, %queued%, %trivia% @@ -77,7 +77,7 @@ Command and aliases | Description | Usage Command and aliases | Description | Usage ----------------|--------------|------- `-h`, `-help`, `@BotName help`, `@BotName h`, `~h` | Either shows a help for a single command, or PMs you help link if no arguments are specified. | '-h !m q' or just '-h' -`-hgit` | OWNER ONLY commandlist.md file generation. +`-hgit` | Generates the commandlist.md file. **Owner Only!** `-readme`, `-guide` | Sends a readme and a guide links to the channel. `-donate`, `~donate` | Instructions for helping the project! `-modules`, `.modules` | List all bot modules. @@ -114,16 +114,19 @@ Command and aliases | Description | Usage `;arm`, `;allrolemodules` | Sets permissions for all modules at the role level. | ;arm [enable/disable] [role_name] `;arc`, `;allrolecommands` | Sets permissions for all commands from a certain module at the role level. | ;arc [module_name] [enable/disable] [role_name] `;ubl` | Blacklists a mentioned user. | ;ubl [user_mention] -`;uubl`, `;unblacklist` | Unblacklists a mentioned user. | ;uubl [user_mention] +`;uubl` | Unblacklists a mentioned user. | ;uubl [user_mention] `;cbl` | Blacklists a mentioned channel (#general for example). | ;ubl [channel_mention] +`;cubl` | Unblacklists a mentioned channel (#general for example). | ;cubl [channel_mention] `;sbl` | Blacklists a server by a name or id (#general for example). **BOT OWNER ONLY** | ;usl [servername/serverid] ### Conversations Command and aliases | Description | Usage ----------------|--------------|------- `e` | You did it. +`comeatmebro` | Come at me bro (ง’̀-‘́)ง | comeatmebro {target} `\o\` | Nadeko replies with /o/ `/o/` | Nadeko replies with \o\ +`moveto` | Suggests moving the conversation. | moveto #spam `..` | Adds a new quote with the specified name (single word) and message (no limit). | .. abc My message `...` | Shows a random quote with a specified name. | .. abc `@BotName copyme`, `@BotName cm` | Nadeko starts copying everything you say. Disable with cs @@ -155,7 +158,7 @@ Command and aliases | Description | Usage `@BotName dump` | Dumps all of the invites it can to dump.txt.** Owner Only.** `@BotName ab` | Try to get 'abalabahaha' `@BotName av`, `@BotName avatar` | Shows a mentioned person's avatar. | ~av @X -`@BotName leet` | Convert your text to leetspeak. Level is a number 1-6. | @BotName leet [level] [Your text here] +`@BotName leet` | ### Gambling Command and aliases | Description | Usage @@ -167,6 +170,7 @@ Command and aliases | Description | Usage `$nroll` | Rolls in a given range. | `$nroll 5` (rolls 0-5) or `$nroll 5-15` `$raffle` | Prints a name and ID of a random user from the online list from the (optional) role. `$$$` | Check how many NadekoFlowers you have. +`$give` | Give someone a certain amount of flowers ### Games Command and aliases | Description | Usage @@ -202,14 +206,14 @@ Command and aliases | Description | Usage `!m max` | Sets the music volume to 100% (real max is actually 150%). `!m half` | Sets the music volume to 50%. `!m sh` | Shuffles the current playlist. -`!m setgame` | Sets the game of the bot to the number of songs playing.**Owner only** +`!m setgame` | Sets the game of the bot to the number of songs playing. **Owner only** `!m pl` | Queues up to 25 songs from a youtube playlist specified by a link, or keywords. -`!m lopl` | Queues up to 50 songs from a directory. +`!m lopl` | Queues up to 50 songs from a directory. **Owner Only!** `!m radio`, `!m ra` | Queues a direct radio stream from a link. -`!m lo` | Queues a local file by specifying a full path. BOT OWNER ONLY. +`!m lo` | Queues a local file by specifying a full path. **Owner Only!** `!m mv` | Moves the bot to your voice channel. (works only if music is already playing) `!m rm` | Remove a song by its # in the queue, or 'all' to remove whole queue. -`!m cleanup` | Cleans up hanging voice connections. BOT OWNER ONLY +`!m cleanup` | Cleans up hanging voice connections. **Owner Only!** ### Searches Command and aliases | Description | Usage @@ -223,6 +227,7 @@ Command and aliases | Description | Usage `~we` | Shows weather data for a specified city and a country BOTH ARE REQUIRED. Weather api is very random if you make a mistake. `~yt` | Searches youtubes and shows the first result `~ani`, `~anime`, `~aq` | Queries anilist for an anime and shows the first result. +`~imdb` | Queries imdb for movies or series, show first result. `~mang`, `~manga`, `~mq` | Queries anilist for a manga and shows the first result. `~randomcat` | Shows a random cat image. `~i` | Pulls the first image found using a search parameter. Use ~ir for different results. | ~i cute kitten @@ -234,6 +239,12 @@ Command and aliases | Description | Usage `~#` | Searches Tagdef.com for a hashtag. | ~# ff `~quote` | Shows a random quote. +### Translator +Command and aliases | Description | Usage +----------------|--------------|------- +`~trans` | Translates from>to text. From the given language to the destiation language. +`~translangs` | List the valid languages for translation. + ### NSFW Command and aliases | Description | Usage ----------------|--------------|-------