summaryrefslogtreecommitdiff
path: root/DiscoBot
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2017-08-22 23:20:23 +0200
committerTrueDoctor <d-kobert@web.de>2017-08-22 23:20:23 +0200
commit5861eccde04faa9c1584c6705a69040182296f93 (patch)
tree504e390724c26a0a044bc73189cfd8fdd118e546 /DiscoBot
parentd59a67e552628b464f079bccae20349d649bdd61 (diff)
added support for more charackters
automated char selection attack parade ranged combat
Diffstat (limited to 'DiscoBot')
-rw-r--r--DiscoBot/Char.cs42
-rw-r--r--DiscoBot/Commands.cs55
-rw-r--r--DiscoBot/Program.cs4
3 files changed, 85 insertions, 16 deletions
diff --git a/DiscoBot/Char.cs b/DiscoBot/Char.cs
index 28ed7b9..d64f434 100644
--- a/DiscoBot/Char.cs
+++ b/DiscoBot/Char.cs
@@ -10,7 +10,7 @@ namespace DiscoBot
public class Char
{
- string name;
+ public string name;
public Dictionary<string, int> eigenschaften = new Dictionary<string, int>();
public List<Talent> talente = new List<Talent>();
public List<Kampf> kampftalente = new List<Kampf>();
@@ -18,7 +18,7 @@ namespace DiscoBot
public Dictionary<string, string> Proptable = new Dictionary<string, string>();
- public Char(String path = "Felis.xml")
+ public Char(String path )
{
Load(path);
@@ -73,19 +73,43 @@ namespace DiscoBot
{
var output = new StringBuilder();
var ttalent = talente.Find(v => v.name.Equals(talent));
- var props =ttalent.Test();
+ var props = ttalent.Test();
int tap = ttalent.value;
for (int i = 0; i <= 2; i++)
{
int temp = dice.Rolld20();
int eigenschaft = eigenschaften[Proptable[props[i]]];
if (eigenschaft < temp)
- tap -= temp - eigenschaft ;
- output.Append(temp+" ");
+ tap -= temp - eigenschaft;
+ output.Append(temp + " ");
}
- output.Append("tap: "+ tap);
+ output.Append("tap: " + tap);
return output.ToString();
}
+ public string Angriff(string talent)
+ {
+ var attack = kampftalente.Find(x => x.name.Equals(talent));
+ int tap = attack.at/*+eigenschaften["at"]*/;
+ int temp = dice.Rolld20();
+ tap -= temp;
+ return temp + " " + tap;
+ }
+ public string Parade(string talent)
+ {
+ var attack = kampftalente.Find(x => x.name.Equals(talent));
+ int tap = attack.pa /*+ eigenschaften["pa"]*/;
+ int temp = dice.Rolld20();
+ tap -= temp;
+ return temp + " " + tap;
+ }
+ public string Fernkampf(string talent,int erschwernis=0)
+ {
+ var attack = talente.Find(v => v.name.Equals(talent));
+ int tap = attack.value + eigenschaften["fk"]-erschwernis;
+ int temp = dice.Rolld20();
+ tap -= -temp;
+ return temp + " " + tap;
+ }
}
public class Talent
@@ -104,8 +128,8 @@ namespace DiscoBot
}
public class Kampf
{
- string name;
- private int at, pa;
+ public string name;
+ public int at, pa;
public Kampf(string name, int at, int pa) { this.name = name; this.at = at; this.pa = pa; }
void Test() { }
}
@@ -114,7 +138,7 @@ namespace DiscoBot
static System.Random rnd = new System.Random();
public static int Rolld20()
{
- return rnd.Next(1,21) ;
+ return rnd.Next(1, 21);
}
}
}
diff --git a/DiscoBot/Commands.cs b/DiscoBot/Commands.cs
index 6984761..8e85daf 100644
--- a/DiscoBot/Commands.cs
+++ b/DiscoBot/Commands.cs
@@ -10,8 +10,18 @@ using Discord.WebSocket;
namespace DiscoBot
{
- class Commands
+ public static class DSA
{
+ public static Dictionary<string, string> relation = new Dictionary<string, string>();
+ public static List<Char> chars = new List<Char>();
+ public static void Startup()
+ {
+ relation.Add("The Doctor", "Felis Exodus Schattenwald");
+ relation.Add("Tardis", "Numeri Illuminus");
+ chars.Add(new Char(@"helden\Felis.xml"));
+ chars.Add(new Char(@"helden\Numeri.xml"));
+
+ }
}
public class Info : ModuleBase
{
@@ -19,7 +29,7 @@ namespace DiscoBot
[Command("say"), Summary("Echos a message.")]
public async Task Say([Remainder, Summary("The text to echo")] string echo)
{
-
+ var a = Context.User.Username;
// ReplyAsync is a method on ModuleBase
await ReplyAsync(echo);
@@ -27,16 +37,51 @@ namespace DiscoBot
}
}
- public class Abfrage : ModuleBase
+ public class TestTalent : ModuleBase
{
- Char test = new Char();
// ~say hello -> hello
[Command("t"), Summary("tests a talent.")]
public async Task Say([Remainder, Summary("The text to echo")] string talent)
{
// ReplyAsync is a method on ModuleBase
- await ReplyAsync("```xl\n" + test.TestTalent(talent) + "\n```");
+ await ReplyAsync("```xl\n" + DSA.chars.Find(x=>x.name.Equals(DSA.relation[Context.User.Username])).TestTalent(talent) + "\n```");
+
+ }
+ }
+ public class Angriff : ModuleBase
+ {
+ // ~say hello -> hello
+ [Command("a"), Summary("tests a attack.")]
+ public async Task Say([Remainder, Summary("The text to echo")] string talent)
+ {
+ // ReplyAsync is a method on ModuleBase
+
+ await ReplyAsync("```xl\n" + DSA.chars.Find(x => x.name.Equals(DSA.relation[Context.User.Username])).Angriff(talent) + "\n```");
+
+ }
+ }
+ public class Parade : ModuleBase
+ {
+ // ~say hello -> hello
+ [Command("p"), Summary("tests a parade.")]
+ public async Task Say([Remainder, Summary("The text to echo")] string talent)
+ {
+ // ReplyAsync is a method on ModuleBase
+
+ await ReplyAsync("```xl\n" + DSA.chars.Find(x => x.name.Equals(DSA.relation[Context.User.Username])).Parade(talent) + "\n```");
+
+ }
+ }
+ public class Fernkampf : ModuleBase
+ {
+ // ~say hello -> hello
+ [Command("f"), Summary("tests a shot.")]
+ public async Task Say([Remainder, Summary("The text to echo")] string talent)
+ {
+ // ReplyAsync is a method on ModuleBase
+
+ await ReplyAsync("```xl\n" + DSA.chars.Find(x => x.name.Equals(DSA.relation[Context.User.Username])).Fernkampf(talent) + "\n```");
}
}
diff --git a/DiscoBot/Program.cs b/DiscoBot/Program.cs
index 962e416..1e97fc2 100644
--- a/DiscoBot/Program.cs
+++ b/DiscoBot/Program.cs
@@ -17,14 +17,14 @@ namespace DiscoBot
private CommandService commands;
private DiscordSocketClient client;
private IServiceProvider services;
-
- public Char a = new Char();
+
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
public async Task Start()
{
+ DSA.Startup();
client = new DiscordSocketClient();
commands = new CommandService();