summaryrefslogtreecommitdiff
path: root/dsa/DSALib/Characters/Critter.cs
diff options
context:
space:
mode:
authoruzvkl <dennis.kobert@student.kit.edu>2019-06-11 23:05:52 +0200
committeruzvkl <dennis.kobert@student.kit.edu>2019-06-11 23:05:52 +0200
commite6181c24124d97f2fbc932b8a68311e625463156 (patch)
treec1f097c344ca266b7941c9668590b0fd35c7870a /dsa/DSALib/Characters/Critter.cs
parent2490ad5d31fe2ac778ff9303776f0e91f47a2862 (diff)
Move dsa related stuff to subfolder
Diffstat (limited to 'dsa/DSALib/Characters/Critter.cs')
-rw-r--r--dsa/DSALib/Characters/Critter.cs88
1 files changed, 88 insertions, 0 deletions
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