diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-06-11 23:38:13 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-06-11 23:38:13 +0200 |
commit | 2fa4a0e50ebfc97059c8b84dbd17e79f9afc8a8d (patch) | |
tree | c3b34ccb2737e347a73768536895cbbaab13cc01 /dsa/DSALib/Characters | |
parent | ec991104f56e90d7bb2878da2fe6ed4e585dfc46 (diff) | |
parent | af74efccf8d21e6151022b71f3cacd3fa83024ee (diff) |
Merge branch 'rework-backend'
Diffstat (limited to 'dsa/DSALib/Characters')
-rw-r--r-- | dsa/DSALib/Characters/Being.cs | 17 | ||||
-rw-r--r-- | dsa/DSALib/Characters/Critter.cs | 88 | ||||
-rw-r--r-- | dsa/DSALib/Characters/Entity.cs | 12 | ||||
-rw-r--r-- | dsa/DSALib/Characters/ICharacter.cs | 15 | ||||
-rw-r--r-- | dsa/DSALib/Characters/ICombatant.cs | 20 |
5 files changed, 152 insertions, 0 deletions
diff --git a/dsa/DSALib/Characters/Being.cs b/dsa/DSALib/Characters/Being.cs new file mode 100644 index 0000000..27879a1 --- /dev/null +++ b/dsa/DSALib/Characters/Being.cs @@ -0,0 +1,17 @@ +namespace DSALib.Characters +{ + public class Being : Entity + { + public int Lebenspunkte_Basis { get; set; } = 30; + + public int Lebenspunkte_Aktuell { get; set; } = 30; + + public int Ausdauer_Basis { get; set; } = 30; + + public int Ausdauer_Aktuell { get; set; } = 30; + + public int Astralpunkte_Basis { get; set; } = 0; + + public int Astralpunkte_Aktuell { get; set; } = 0; + } +}
\ No newline at end of file diff --git a/dsa/DSALib/Characters/Critter.cs b/dsa/DSALib/Characters/Critter.cs new file mode 100644 index 0000000..dcedccb --- /dev/null +++ b/dsa/DSALib/Characters/Critter.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.IO; +using DiscoBot.DSA_Game.Characters; +using DSALib.Models.Dsa; +using Newtonsoft.Json; + +namespace DSALib.Characters +{ + public class Critter : Being, ICombatant + { + public CritterAttack lastAttack; + + public Critter(int gw, int gs, int rs, int mr, int ko, int pa, string ini, List<CritterAttack> critterAttacks) + { + Gw = gw; + Gs = gs; + Rs = rs; + Mr = mr; + Ko = ko; + Pa = pa; + Ini = ini; + CritterAttacks = critterAttacks; + lastAttack = CritterAttacks[new Random().Next(critterAttacks.Count)]; + } + + public Critter() + { + } + + public int Rs { get; set; } + + public int Mr { get; set; } + + public int Ko { get; set; } + + public int Pa { get; set; } + + public int Gs { get; set; } + + public int Gw { get; set; } + + public string Ini { get; set; } + + public string Comment { get; set; } + + public List<CritterAttack> CritterAttacks { get; set; } + + public string Angriff(string talent, int erschwernis = 0) + { + throw new NotImplementedException(); + } + + public string Parade(string talent, int erschwernis = 0) + { + throw new NotImplementedException(); + } + + public static Critter Load(string path) + { + try + { + return + JsonConvert.DeserializeObject<Critter>( + File.ReadAllText(path)); // Deserialize Data and create Session Object + } + catch (Exception e) + { + Console.WriteLine($"Laden von Save-File {path} fehlgeschlagen." + e); + return null; + } + } + + public void Save(string path = @"..\..\Critters\") + { + try + { + File.WriteAllText(path + Name + ".json", + JsonConvert.SerializeObject(this, + Formatting.Indented)); // Deserialize Data and create CommandInfo Struct + } + catch (Exception e) + { + Console.WriteLine($"Speichern von Save-File {path} fehlgeschlagen." + e); + } + } + } +}
\ No newline at end of file diff --git a/dsa/DSALib/Characters/Entity.cs b/dsa/DSALib/Characters/Entity.cs new file mode 100644 index 0000000..a8a5e81 --- /dev/null +++ b/dsa/DSALib/Characters/Entity.cs @@ -0,0 +1,12 @@ +namespace DSALib.Characters +{ + public class Entity + { + public string Name { get; set; } + + public override string ToString() + { + return Name; + } + } +}
\ No newline at end of file diff --git a/dsa/DSALib/Characters/ICharacter.cs b/dsa/DSALib/Characters/ICharacter.cs new file mode 100644 index 0000000..256fecd --- /dev/null +++ b/dsa/DSALib/Characters/ICharacter.cs @@ -0,0 +1,15 @@ +using DiscoBot.DSA_Game.Characters; + +namespace DSALib.Characters +{ + public interface ICharacter : ICombatant + { + string TestTalent(string talent, int erschwernis = 0); + + string TestEigenschaft(string eigenschaft, int erschwernis = 0); + + string Fernkampf(string talent, int erschwernis = 0); + + string TestZauber(string waffe, int erschwernis); + } +}
\ No newline at end of file diff --git a/dsa/DSALib/Characters/ICombatant.cs b/dsa/DSALib/Characters/ICombatant.cs new file mode 100644 index 0000000..a4ce601 --- /dev/null +++ b/dsa/DSALib/Characters/ICombatant.cs @@ -0,0 +1,20 @@ +namespace DiscoBot.DSA_Game.Characters +{ + public interface ICombatant + { + string Name { get; set; } + + int Lebenspunkte_Basis { get; set; } + int Lebenspunkte_Aktuell { get; set; } + + int Ausdauer_Basis { get; set; } + int Ausdauer_Aktuell { get; set; } + + int Astralpunkte_Basis { get; set; } + int Astralpunkte_Aktuell { get; set; } + + string Angriff(string talent, int erschwernis = 0); + + string Parade(string talent, int erschwernis = 0); + } +}
\ No newline at end of file |