Skip to content

Commit

Permalink
some work toward mattacks
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT committed Nov 30, 2019
1 parent a21d142 commit 0049099
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
17 changes: 17 additions & 0 deletions custom_json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,21 @@ protected override JsonProperty CreateProperty(MemberInfo member, MemberSerializ
return jsonProperty;
}
}

public class MonsterAttackConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
MonsterAttack attack = value as MonsterAttack;
throw new NotImplementedException();
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
throw new NotImplementedException();
}
public override bool CanConvert(Type objectType)
{
return typeof(MonsterAttack).IsAssignableFrom(objectType);
}
}
}
12 changes: 6 additions & 6 deletions json/hardcoded_mattack.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"NONE":
"EAT_CROP":
"EAT_FOOD":
"ANTQUEEN":
"CHECK_UP":
"ASSIST":
"NONE": "no attack chosen",
"EAT_CROP": "eats a furniture with the PLANT flag",
"EAT_FOOD": "eats a food item",
"ANTQUEEN": "lays ant eggs and feeds them to have them grow into an adult",
"CHECK_UP": "robot nurse checkup special",
"ASSIST": "self-aware special",
"OPERATE":
"PAID_BOT":
"SHRIEK":
Expand Down
8 changes: 7 additions & 1 deletion mtype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using Newtonsoft.Json;

namespace cdda_item_creator
{
[JsonConverter(typeof(MonsterAttackConverter))]
class MonsterAttack
{

}
class Translation
{
[DefaultValue("")]
Expand Down Expand Up @@ -54,7 +60,7 @@ public void Add(DamageUnit du_add)
// intended to be able to be written to JSON easily
class Mtype
{
public const string Type = "MONSTER";
public string Type { get; } = "MONSTER";

[DefaultValue("")]
public string Id { get; set; } = "";
Expand Down
2 changes: 1 addition & 1 deletion spell_type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public class spell_type
public spell_type() { }

public string Id { get; set; } = "";
public const string Type = "SPELL";
public string Type { get; } = "SPELL";
public string Name { get; set; } = "";
public string Description { get; set; } = "";

Expand Down

0 comments on commit 0049099

Please sign in to comment.