diff --git a/src/Parser.cs b/src/Parser.cs index cda8da3..cc63d68 100644 --- a/src/Parser.cs +++ b/src/Parser.cs @@ -26,10 +26,17 @@ namespace WorldOfPeacecraft public const string ValueY = "y"; public const string ValueCol = "col"; public const string ValueRow = "row"; - public const string EValueDragon = "DRAGON"; - public const string EValueStagunt = "STAGHUNT"; - public const string EValueSkirmish = "SKIRMISH"; + public const string EValueFight = "FIGHT"; + public const string EValueRest = "REST"; + public const string EValueStag = "STAG"; + public const string EValueBunny = "BUNNY"; + public const string EValueSword = "SWORD"; + public const string EValueMagic = "MAGIC"; + public const string EValueAlchemy = "ALCHEMY"; public const string EValueWalkable = "WALKABLE"; + public const string EValueSkirmish = "SKIRMISH"; + public const string EValueStaghunt = "STAGHUNT"; + public const string EValueDragon = "DRAGON"; public const string EValueWall = "WALL"; public const string EValueForest = "FOREST"; public const string EValueWater = "WATER"; @@ -239,7 +246,7 @@ namespace WorldOfPeacecraft Result r = new Result(round, running, delay); } - private void ProcessOpponent(Block oppBlock) + private void ProcessOpponent (Block oppBlock) { int id = oppBlock.GetIntValue (ValueId); int points = oppBlock.GetIntValue (ValuePoints); @@ -247,14 +254,31 @@ namespace WorldOfPeacecraft LinkedList unnamedValue = oppBlock.GetUnnamedValues (); string stringValue = unnamedValue.First.Value; Decision d; - if (stringValue == EValueDragon) - d = Decision.DRAGON; - else if (stringValue == EValueStagunt) - d = Decision.STAGHUNT; - else if (stringValue == EValueSkirmish) - d = Decision.SKIRMISH; - else + switch (stringValue) { + case EValueAlchemy: + d = Decision.ALCHEMY; + break; + case EValueBunny: + d = Decision.BUNNY; + break; + case EValueFight: + d = Decision.FIGHT; + break; + case EValueMagic: + d = Decision.MAGIC; + break; + case EValueRest: + d = Decision.REST; + break; + case EValueStag: + d = Decision.STAG; + break; + case EValueSword: + d = Decision.SWORD; + break; + default: throw new ParsingException("Wrong param"); // TODO Better message + } Opponent o = new Opponent (id, points, total, d); } @@ -275,7 +299,7 @@ namespace WorldOfPeacecraft case EValueDragon: type = "Dragon"; break; - case EValueStagunt: + case EValueStaghunt: type = "Staghunt"; break; case EValueSkirmish: