Adds shieldBonus to Monster entity.
Adds tests for shieldBonus.
This commit is contained in:
@@ -37,7 +37,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property NSString *truesightDistance;
|
@property NSString *truesightDistance;
|
||||||
@property NSString *understandsBut;
|
@property NSString *understandsBut;
|
||||||
|
|
||||||
@property int shieldBonus;
|
|
||||||
@property int naturalArmorBonus;
|
@property int naturalArmorBonus;
|
||||||
@property int hitDice;
|
@property int hitDice;
|
||||||
@property int customProficiencyBonus;
|
@property int customProficiencyBonus;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
@synthesize hpText;
|
@synthesize hpText;
|
||||||
@synthesize isBlind;
|
@synthesize isBlind;
|
||||||
@synthesize naturalArmorBonus;
|
@synthesize naturalArmorBonus;
|
||||||
@synthesize shieldBonus;
|
|
||||||
@synthesize speed;
|
@synthesize speed;
|
||||||
@synthesize swimSpeed;
|
@synthesize swimSpeed;
|
||||||
@synthesize telepathy;
|
@synthesize telepathy;
|
||||||
@@ -95,6 +94,10 @@
|
|||||||
if (tempNumber != nil && [tempNumber isKindOfClass:[NSNumber class]]) {
|
if (tempNumber != nil && [tempNumber isKindOfClass:[NSNumber class]]) {
|
||||||
self.charismaScore = tempNumber.intValue;
|
self.charismaScore = tempNumber.intValue;
|
||||||
}
|
}
|
||||||
|
tempNumber = [jsonRoot objectForKey:@"shieldBonus"];
|
||||||
|
if (tempNumber != nil && [tempNumber isKindOfClass:[NSNumber class]]) {
|
||||||
|
self.shieldBonus = tempNumber.intValue;
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -368,6 +371,7 @@
|
|||||||
self.charismaScore = monster.charismaScore;
|
self.charismaScore = monster.charismaScore;
|
||||||
self.armorName = monster.armorName;
|
self.armorName = monster.armorName;
|
||||||
self.otherArmorDescription = monster.otherArmorDescription;
|
self.otherArmorDescription = monster.otherArmorDescription;
|
||||||
|
self.shieldBonus = monster.shieldBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<attribute name="intelligenceScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="intelligenceScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="name" attributeType="String" defaultValueString=""/>
|
<attribute name="name" attributeType="String" defaultValueString=""/>
|
||||||
<attribute name="otherArmorDescription" optional="YES" attributeType="String" defaultValueString=""/>
|
<attribute name="otherArmorDescription" optional="YES" attributeType="String" defaultValueString=""/>
|
||||||
|
<attribute name="shieldBonus" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="size" attributeType="String" defaultValueString=""/>
|
<attribute name="size" attributeType="String" defaultValueString=""/>
|
||||||
<attribute name="strengthScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="strengthScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="subtype" attributeType="String" defaultValueString=""/>
|
<attribute name="subtype" attributeType="String" defaultValueString=""/>
|
||||||
@@ -16,6 +17,6 @@
|
|||||||
<attribute name="wisdomScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="wisdomScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Monster" positionX="-63" positionY="-18" width="128" height="238"/>
|
<element name="Monster" positionX="-63" positionY="-18" width="128" height="253"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
- (void)setUp {
|
- (void)setUp {
|
||||||
_context = nil;
|
_context = nil;
|
||||||
_monster = [[Monster alloc] initWithContext:_context];
|
_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];
|
_jsonData = [_jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +47,8 @@
|
|||||||
XCTAssertEqual(0, _monster.wisdomScore);
|
XCTAssertEqual(0, _monster.wisdomScore);
|
||||||
XCTAssertEqual(0, _monster.charismaScore);
|
XCTAssertEqual(0, _monster.charismaScore);
|
||||||
XCTAssertEqualObjects(@"", _monster.armorName);
|
XCTAssertEqualObjects(@"", _monster.armorName);
|
||||||
|
XCTAssertEqualObjects(@"", _monster.otherArmorDescription);
|
||||||
|
XCTAssertEqual(0, _monster.shieldBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testInitWithJSONString {
|
- (void)testInitWithJSONString {
|
||||||
@@ -65,6 +67,8 @@
|
|||||||
XCTAssertEqual(16, _monster.wisdomScore);
|
XCTAssertEqual(16, _monster.wisdomScore);
|
||||||
XCTAssertEqual(18, _monster.charismaScore);
|
XCTAssertEqual(18, _monster.charismaScore);
|
||||||
XCTAssertEqualObjects(@"none", _monster.armorName);
|
XCTAssertEqualObjects(@"none", _monster.armorName);
|
||||||
|
XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
|
||||||
|
XCTAssertEqual(2, _monster.shieldBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testInitWithEmptyJSONString {
|
- (void)testInitWithEmptyJSONString {
|
||||||
@@ -83,6 +87,8 @@
|
|||||||
XCTAssertEqual(0, _monster.wisdomScore);
|
XCTAssertEqual(0, _monster.wisdomScore);
|
||||||
XCTAssertEqual(0, _monster.charismaScore);
|
XCTAssertEqual(0, _monster.charismaScore);
|
||||||
XCTAssertEqualObjects(@"", _monster.armorName);
|
XCTAssertEqualObjects(@"", _monster.armorName);
|
||||||
|
XCTAssertEqualObjects(@"", _monster.otherArmorDescription);
|
||||||
|
XCTAssertEqual(0, _monster.shieldBonus);
|
||||||
}
|
}
|
||||||
- (void)testInitWithJSONData {
|
- (void)testInitWithJSONData {
|
||||||
_monster = [[Monster alloc] initWithJSONData:_jsonData andContext:_context];
|
_monster = [[Monster alloc] initWithJSONData:_jsonData andContext:_context];
|
||||||
@@ -100,6 +106,8 @@
|
|||||||
XCTAssertEqual(16, _monster.wisdomScore);
|
XCTAssertEqual(16, _monster.wisdomScore);
|
||||||
XCTAssertEqual(18, _monster.charismaScore);
|
XCTAssertEqual(18, _monster.charismaScore);
|
||||||
XCTAssertEqualObjects(@"none", _monster.armorName);
|
XCTAssertEqualObjects(@"none", _monster.armorName);
|
||||||
|
XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
|
||||||
|
XCTAssertEqual(2, _monster.shieldBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testNameGetterAndSetter {
|
- (void)testNameGetterAndSetter {
|
||||||
@@ -148,6 +156,8 @@
|
|||||||
XCTAssertEqual(16, _monster.wisdomScore);
|
XCTAssertEqual(16, _monster.wisdomScore);
|
||||||
XCTAssertEqual(18, _monster.charismaScore);
|
XCTAssertEqual(18, _monster.charismaScore);
|
||||||
XCTAssertEqualObjects(@"none", _monster.armorName);
|
XCTAssertEqualObjects(@"none", _monster.armorName);
|
||||||
|
XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
|
||||||
|
XCTAssertEqual(2, _monster.shieldBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testMetaWithNoFieldsSet {
|
- (void)testMetaWithNoFieldsSet {
|
||||||
@@ -364,7 +374,12 @@
|
|||||||
|
|
||||||
- (void)testGetterAndSetterForArmorName {
|
- (void)testGetterAndSetterForArmorName {
|
||||||
_monster.armorName = @"dandelion";
|
_monster.armorName = @"dandelion";
|
||||||
XCTAssertEqualObjects(_monster.armorName, @"dandelion");
|
XCTAssertEqualObjects(@"dandelion", _monster.armorName);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testGetterAndSetterForOtherArmorDescription {
|
||||||
|
_monster.otherArmorDescription = @"green";
|
||||||
|
XCTAssertEqualObjects(@"green", _monster.otherArmorDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user