From d63ffc58db0f032cf7573b2a8a7720de2d5050ab Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Sun, 3 Jun 2018 23:16:17 +0200 Subject: -General restructuring -seperated talents and spells --- DiscoBot/DSA_Game/Characters/NPC.cs | 115 ++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 DiscoBot/DSA_Game/Characters/NPC.cs (limited to 'DiscoBot/DSA_Game/Characters/NPC.cs') diff --git a/DiscoBot/DSA_Game/Characters/NPC.cs b/DiscoBot/DSA_Game/Characters/NPC.cs new file mode 100644 index 0000000..dce4381 --- /dev/null +++ b/DiscoBot/DSA_Game/Characters/NPC.cs @@ -0,0 +1,115 @@ +namespace DiscoBot.Characters +{ + using System; + + using DiscoBot.Auxiliary; + using DiscoBot.DSA_Game.Characters; + + public class Npc : ICharacter + { + private readonly int mean, stDv; + + public Npc(string name, int mean, int stDv) + { + this.mean = mean; + this.stDv = stDv; + this.Name = name; + } + + public string Name { get; set; } + + public int Lebenspunkte { get; set; } + + public string TestTalent(string talent, int tap = 3) + { + for (int i = 0; i <= 2; i++) + { + // foreach property, dice and tap + int temp = Dice.Roll(); + int eigenschaft = (int)Math.Round(RandomMisc.Random(this.stDv, this.mean)); + + if (eigenschaft < temp) + { + tap -= temp - eigenschaft; + } + } + + if (tap >= 0) + { + return $"{this.Name} vollführt {talent} erfolgreich"; + } + + + return $"{this.Name} scheitert an {talent}"; + } + + public string TestEigenschaft(string eigenschaft, int erschwernis = 0) + { + int temp = Dice.Roll(); + int prop = (int)Math.Round(RandomMisc.Random(this.stDv, this.stDv)); + + if (temp + erschwernis < prop) + { + return $"{this.Name} vollführt {eigenschaft} erfolgreich"; + } + + return $"{this.Name} scheitert an {eigenschaft}"; + } + + public string Angriff(string waffe, int erschwernis = 0) + { + int temp = Dice.Roll(); + + if (temp == 1) + { + return $"{this.Name} greift kritisch mit {waffe} an"; + } + + if (temp < erschwernis) + { + return $"{this.Name} greift mit {waffe} an"; + } + + return $"{this.Name} haut mit {waffe} daneben"; + } + + public string Parade(string waffe, int erschwernis = 0) + { + int temp = Dice.Roll(); + + if (temp == 1) + { + return $"{this.Name} pariert mit {waffe} meisterlich"; + } + + if (temp < erschwernis) + { + return $"{this.Name} pariert mit {waffe} an"; + } + + return $"{this.Name} schafft es nicht mit {waffe} zu parieren"; + } + + public string Fernkampf(string waffe, int erschwernis = 0) + { + int temp = Dice.Roll(); + + if (temp == 1) + { + return $"{this.Name} trifft kritisch mit {waffe}"; + } + + if (temp < erschwernis) + { + return $"{this.Name} greift mit {waffe} an"; + } + + return $"{this.Name} schießt mit {waffe} daneben"; + } + + public string TestZauber(string zauber, int erschwernis) + { + return TestTalent(zauber, erschwernis); + } + } +} -- cgit v1.2.3-54-g00ecf From 7f55f6f289b5ab5b7fd4ac42b472b51a9a0e679e Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Mon, 4 Jun 2018 22:56:44 +0200 Subject: implemented Astralpunkte + some cleanup --- DiscoBot/Commands/FileHandler.cs | 3 +-- DiscoBot/Commands/Gm.cs | 1 - DiscoBot/Commands/ProbenTest.cs | 2 +- DiscoBot/DSA_Game/Characters/Character.cs | 10 +++++++--- DiscoBot/DSA_Game/Characters/ICharacter.cs | 2 +- DiscoBot/DSA_Game/Characters/NPC.cs | 2 ++ 6 files changed, 12 insertions(+), 8 deletions(-) (limited to 'DiscoBot/DSA_Game/Characters/NPC.cs') diff --git a/DiscoBot/Commands/FileHandler.cs b/DiscoBot/Commands/FileHandler.cs index 1a82a9c..7885aa9 100644 --- a/DiscoBot/Commands/FileHandler.cs +++ b/DiscoBot/Commands/FileHandler.cs @@ -3,8 +3,7 @@ using System; using System.Linq; using System.Net; - - using DiscoBot.Auxiliary; + using DiscoBot.DSA_Game; using DiscoBot.DSA_Game.Characters; diff --git a/DiscoBot/Commands/Gm.cs b/DiscoBot/Commands/Gm.cs index b92b5b8..2698926 100644 --- a/DiscoBot/Commands/Gm.cs +++ b/DiscoBot/Commands/Gm.cs @@ -7,7 +7,6 @@ using DiscoBot.DSA_Game; using Discord.Commands; - using Discord.WebSocket; public class Gm : ModuleBase { diff --git a/DiscoBot/Commands/ProbenTest.cs b/DiscoBot/Commands/ProbenTest.cs index ae98ec2..1d8f8b0 100644 --- a/DiscoBot/Commands/ProbenTest.cs +++ b/DiscoBot/Commands/ProbenTest.cs @@ -9,7 +9,7 @@ public class ProbenTest : ModuleBase { [Command("t"), Summary("Würfelt ein Talent-/Zauberprobe")] - [Alias("T", "Talent", "talent", "zauber", "z", "versuche")] + [Alias("T", "Talent", "talent", "versuche")] public Task TalentAsync([Summary("Talent oder Zaubername")] string talent, int erschwernis = 0) { string res; diff --git a/DiscoBot/DSA_Game/Characters/Character.cs b/DiscoBot/DSA_Game/Characters/Character.cs index 01b7eeb..2f994f0 100644 --- a/DiscoBot/DSA_Game/Characters/Character.cs +++ b/DiscoBot/DSA_Game/Characters/Character.cs @@ -65,6 +65,8 @@ public int Lebenspunkte { get; set; } + public int Astralpunkte { get; set; } + public Dictionary Eigenschaften { get; set; } = new Dictionary(); // char properties public List Talente { get; set; } = new List(); // list of talent objects (talents) @@ -176,11 +178,13 @@ private void Post_process() { - var LE_Wert = this.Eigenschaften.First(s => s.Key.Contains("Leben")).Value; - var KK_Wert = this.Eigenschaften.First(s => s.Key.Contains("Körper")).Value; - var KO__Wert = this.Eigenschaften.First(s => s.Key.Contains("Konst")).Value; + var LE_Wert = this.Eigenschaften["Lebensenergie"]; + var KK_Wert = this.Eigenschaften["Körperkraft"]; + var KO__Wert = this.Eigenschaften["Konstitution"]; this.Lebenspunkte = LE_Wert + (int)(KO__Wert + (KK_Wert/2.0) + 0.5); + + // ToDo: Astralpunkte berrechnen } diff --git a/DiscoBot/DSA_Game/Characters/ICharacter.cs b/DiscoBot/DSA_Game/Characters/ICharacter.cs index 91eee2d..1dae15d 100644 --- a/DiscoBot/DSA_Game/Characters/ICharacter.cs +++ b/DiscoBot/DSA_Game/Characters/ICharacter.cs @@ -8,7 +8,7 @@ //int Ausdauer { get; set; } - //int Astralpunkte { get; set; } + int Astralpunkte { get; set; } //int Karmapunkte { get; set; } diff --git a/DiscoBot/DSA_Game/Characters/NPC.cs b/DiscoBot/DSA_Game/Characters/NPC.cs index dce4381..45ff6b0 100644 --- a/DiscoBot/DSA_Game/Characters/NPC.cs +++ b/DiscoBot/DSA_Game/Characters/NPC.cs @@ -20,6 +20,8 @@ public int Lebenspunkte { get; set; } + public int Astralpunkte { get; set; } + public string TestTalent(string talent, int tap = 3) { for (int i = 0; i <= 2; i++) -- cgit v1.2.3-54-g00ecf