diff --git a/MonsterCards/Models/Monster.h b/MonsterCards/Models/Monster.h
index d7884f9..6b36c20 100644
--- a/MonsterCards/Models/Monster.h
+++ b/MonsterCards/Models/Monster.h
@@ -37,7 +37,6 @@ NS_ASSUME_NONNULL_BEGIN
@property NSString *truesightDistance;
@property NSString *understandsBut;
-@property int shieldBonus;
@property int naturalArmorBonus;
@property int hitDice;
@property int customProficiencyBonus;
diff --git a/MonsterCards/Models/Monster.m b/MonsterCards/Models/Monster.m
index 634f197..24becdf 100644
--- a/MonsterCards/Models/Monster.m
+++ b/MonsterCards/Models/Monster.m
@@ -27,7 +27,6 @@
@synthesize hpText;
@synthesize isBlind;
@synthesize naturalArmorBonus;
-@synthesize shieldBonus;
@synthesize speed;
@synthesize swimSpeed;
@synthesize telepathy;
@@ -95,6 +94,10 @@
if (tempNumber != nil && [tempNumber isKindOfClass:[NSNumber class]]) {
self.charismaScore = tempNumber.intValue;
}
+ tempNumber = [jsonRoot objectForKey:@"shieldBonus"];
+ if (tempNumber != nil && [tempNumber isKindOfClass:[NSNumber class]]) {
+ self.shieldBonus = tempNumber.intValue;
+ }
return self;
}
@@ -368,6 +371,7 @@
self.charismaScore = monster.charismaScore;
self.armorName = monster.armorName;
self.otherArmorDescription = monster.otherArmorDescription;
+ self.shieldBonus = monster.shieldBonus;
}
@end
diff --git a/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents b/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents
index 9ae689f..3d90d75 100644
--- a/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents
+++ b/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents
@@ -9,6 +9,7 @@
+
@@ -16,6 +17,6 @@
-
+
\ No newline at end of file
diff --git a/MonsterCardsTests/Models/MonsterTests.m b/MonsterCardsTests/Models/MonsterTests.m
index 3034547..61285fc 100644
--- a/MonsterCardsTests/Models/MonsterTests.m
+++ b/MonsterCardsTests/Models/MonsterTests.m
@@ -25,7 +25,7 @@
- (void)setUp {
_context = nil;
_monster = [[Monster alloc] initWithContext:_context];
- _jsonString = @"{\"name\":\"Acolyte\",\"size\":\"medium\",\"type\":\"humanoid\",\"tag\":\"any race\",\"alignment\":\"any alignment\",\"strPoints\":8,\"dexPoints\":10,\"conPoints\":12,\"intPoints\":14,\"wisPoints\":16,\"chaPoints\":18,\"armorName\":\"none\"}";
+ _jsonString = @"{\"name\":\"Acolyte\",\"size\":\"medium\",\"type\":\"humanoid\",\"tag\":\"any race\",\"alignment\":\"any alignment\",\"strPoints\":8,\"dexPoints\":10,\"conPoints\":12,\"intPoints\":14,\"wisPoints\":16,\"chaPoints\":18,\"armorName\":\"none\",\"otherArmorDesc\":\"10\",\"shieldBonus\":2}";
_jsonData = [_jsonString dataUsingEncoding:NSUTF8StringEncoding];
}
@@ -47,6 +47,8 @@
XCTAssertEqual(0, _monster.wisdomScore);
XCTAssertEqual(0, _monster.charismaScore);
XCTAssertEqualObjects(@"", _monster.armorName);
+ XCTAssertEqualObjects(@"", _monster.otherArmorDescription);
+ XCTAssertEqual(0, _monster.shieldBonus);
}
- (void)testInitWithJSONString {
@@ -65,6 +67,8 @@
XCTAssertEqual(16, _monster.wisdomScore);
XCTAssertEqual(18, _monster.charismaScore);
XCTAssertEqualObjects(@"none", _monster.armorName);
+ XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
+ XCTAssertEqual(2, _monster.shieldBonus);
}
- (void)testInitWithEmptyJSONString {
@@ -83,6 +87,8 @@
XCTAssertEqual(0, _monster.wisdomScore);
XCTAssertEqual(0, _monster.charismaScore);
XCTAssertEqualObjects(@"", _monster.armorName);
+ XCTAssertEqualObjects(@"", _monster.otherArmorDescription);
+ XCTAssertEqual(0, _monster.shieldBonus);
}
- (void)testInitWithJSONData {
_monster = [[Monster alloc] initWithJSONData:_jsonData andContext:_context];
@@ -100,6 +106,8 @@
XCTAssertEqual(16, _monster.wisdomScore);
XCTAssertEqual(18, _monster.charismaScore);
XCTAssertEqualObjects(@"none", _monster.armorName);
+ XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
+ XCTAssertEqual(2, _monster.shieldBonus);
}
- (void)testNameGetterAndSetter {
@@ -148,6 +156,8 @@
XCTAssertEqual(16, _monster.wisdomScore);
XCTAssertEqual(18, _monster.charismaScore);
XCTAssertEqualObjects(@"none", _monster.armorName);
+ XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
+ XCTAssertEqual(2, _monster.shieldBonus);
}
- (void)testMetaWithNoFieldsSet {
@@ -364,7 +374,12 @@
- (void)testGetterAndSetterForArmorName {
_monster.armorName = @"dandelion";
- XCTAssertEqualObjects(_monster.armorName, @"dandelion");
+ XCTAssertEqualObjects(@"dandelion", _monster.armorName);
+}
+
+- (void)testGetterAndSetterForOtherArmorDescription {
+ _monster.otherArmorDescription = @"green";
+ XCTAssertEqualObjects(@"green", _monster.otherArmorDescription);
}
@end