Renames armorName to armorType.

Sets default values for core data fields.
Moves hit dice and hp related fields into the basic info section of the editor.
This commit is contained in:
2020-09-26 17:12:35 -07:00
parent ec7f827123
commit 57bf1f2e3a
5 changed files with 107 additions and 85 deletions

View File

@@ -333,8 +333,8 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E22F837D2511E8350072105C /* Helpers */, E22F837D2511E8350072105C /* Helpers */,
E2592B8B250D6B6000906A40 /* Views */,
E2FD91E225047C1D00D5E935 /* Models */, E2FD91E225047C1D00D5E935 /* Models */,
E2592B8B250D6B6000906A40 /* Views */,
E2F7249525005E8A007D87ED /* MonsterCardsTests.m */, E2F7249525005E8A007D87ED /* MonsterCardsTests.m */,
E2F7249725005E8A007D87ED /* Info.plist */, E2F7249725005E8A007D87ED /* Info.plist */,
); );

View File

@@ -112,7 +112,7 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan";
self.hpText = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"hpText" withDefaultValue:@""]; self.hpText = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"hpText" withDefaultValue:@""];
self.alignment = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"alignment" withDefaultValue:@""]; self.alignment = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"alignment" withDefaultValue:@""];
self.armorName = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"armorName" withDefaultValue:@""]; self.armorType = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"armorName" withDefaultValue:@""];
self.otherArmorDescription = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"otherArmorDesc" withDefaultValue:@""]; self.otherArmorDescription = [JSONHelper readStringFromDictionary:jsonRoot forKey:@"otherArmorDesc" withDefaultValue:@""];
self.strengthScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"strPoints" withDefaultValue:0]; self.strengthScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"strPoints" withDefaultValue:0];
self.dexterityScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"dexPoints" withDefaultValue:0]; self.dexterityScore = [JSONHelper readIntFromDictionary:jsonRoot forKey:@"dexPoints" withDefaultValue:0];
@@ -195,69 +195,69 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan";
//getArmorClass //getArmorClass
-(NSString*)armorClassDescription { -(NSString*)armorClassDescription {
BOOL hasShield = [self shieldBonus] != 0; BOOL hasShield = [self shieldBonus] != 0;
NSString *armorName = [self armorName]; NSString *armorType = [self armorType];
if ([StringHelper isStringNilOrEmpty:armorName] || [kArmorNameNone isEqualToString:armorName]) { if ([StringHelper isStringNilOrEmpty:armorType] || [kArmorNameNone isEqualToString:armorType]) {
// 10 + dexMod + 2 for shieldBonus "15" or "17 (shield)" // 10 + dexMod + 2 for shieldBonus "15" or "17 (shield)"
int armorClass = kArmorClassUnarmored + self.dexterityModifier + self.shieldBonus; int armorClass = kArmorClassUnarmored + self.dexterityModifier + self.shieldBonus;
return [NSString stringWithFormat:@"%d%@", armorClass, (hasShield ? @" (shield)" : @"")]; return [NSString stringWithFormat:@"%d%@", armorClass, (hasShield ? @" (shield)" : @"")];
} else if ([kArmorNameNaturalArmor isEqualToString:armorName]) { } else if ([kArmorNameNaturalArmor isEqualToString:armorType]) {
// 10 + dexMod + naturalArmorBonus + 2 for shieldBonus "16 (natural armor)" or "18 (natural armor, shield)" // 10 + dexMod + naturalArmorBonus + 2 for shieldBonus "16 (natural armor)" or "18 (natural armor, shield)"
int armorClass = kArmorClassUnarmored + self.dexterityModifier + self.naturalArmorBonus + self.shieldBonus; int armorClass = kArmorClassUnarmored + self.dexterityModifier + self.naturalArmorBonus + self.shieldBonus;
return [NSString stringWithFormat:@"%d (natural armor%@)", armorClass, (hasShield ? @" (shield)" : @"")]; return [NSString stringWithFormat:@"%d (natural armor%@)", armorClass, (hasShield ? @" (shield)" : @"")];
} else if ([kArmorNameMageArmor isEqualToString:armorName]) { } else if ([kArmorNameMageArmor isEqualToString:armorType]) {
// 10 + dexMod + 2 for shield + 3 for mage armor "15 (18 with mage armor)" or 17 (shield, 20 with mage armor) // 10 + dexMod + 2 for shield + 3 for mage armor "15 (18 with mage armor)" or 17 (shield, 20 with mage armor)
int armorClass = kArmorClassUnarmored + self.dexterityModifier + self.shieldBonus; int armorClass = kArmorClassUnarmored + self.dexterityModifier + self.shieldBonus;
int armorClassWithMageArmor = kArmorClassMageArmor + self.dexterityModifier + self.shieldBonus; int armorClassWithMageArmor = kArmorClassMageArmor + self.dexterityModifier + self.shieldBonus;
return [NSString stringWithFormat:@"%d (%@%d with mage armor)", armorClass, (hasShield ? @"shield, " : @""), armorClassWithMageArmor]; return [NSString stringWithFormat:@"%d (%@%d with mage armor)", armorClass, (hasShield ? @"shield, " : @""), armorClassWithMageArmor];
} else if ([kArmorNamePadded isEqualToString:armorName]) { } else if ([kArmorNamePadded isEqualToString:armorType]) {
// 11 + dexMod + 2 for shield "18 (padded armor, shield)" // 11 + dexMod + 2 for shield "18 (padded armor, shield)"
int armorClass = kArmorClassPadded + self.dexterityModifier + self.shieldBonus; int armorClass = kArmorClassPadded + self.dexterityModifier + self.shieldBonus;
return [NSString stringWithFormat:@"%d (padded%@)", armorClass, (hasShield ? @"shield, " : @"")]; return [NSString stringWithFormat:@"%d (padded%@)", armorClass, (hasShield ? @"shield, " : @"")];
} else if ([kArmorNameLeather isEqualToString:armorName]) { } else if ([kArmorNameLeather isEqualToString:armorType]) {
// 11 + dexMod + 2 for shield "18 (leather, shield)" // 11 + dexMod + 2 for shield "18 (leather, shield)"
int armorClass = kArmorClassLeather + self.dexterityModifier + self.shieldBonus; int armorClass = kArmorClassLeather + self.dexterityModifier + self.shieldBonus;
return [NSString stringWithFormat:@"%d (leather%@)", armorClass, (hasShield ? @"shield, " : @"")]; return [NSString stringWithFormat:@"%d (leather%@)", armorClass, (hasShield ? @"shield, " : @"")];
} else if ([kArmorNameStuddedLeather isEqualToString:armorName]) { } else if ([kArmorNameStuddedLeather isEqualToString:armorType]) {
// 12 + dexMod +2 for shield "17 (studded leather)" // 12 + dexMod +2 for shield "17 (studded leather)"
int armorClass = kArmorClassStudded + self.dexterityModifier + self.shieldBonus; int armorClass = kArmorClassStudded + self.dexterityModifier + self.shieldBonus;
return [NSString stringWithFormat:@"%d (studded leather%@)", armorClass, (hasShield ? @"shield, " : @"")]; return [NSString stringWithFormat:@"%d (studded leather%@)", armorClass, (hasShield ? @"shield, " : @"")];
} else if ([kArmorNameHide isEqualToString:armorName]) { } else if ([kArmorNameHide isEqualToString:armorType]) {
// 12 + Min(2, dexMod) + 2 for shield "12 (hide armor)" // 12 + Min(2, dexMod) + 2 for shield "12 (hide armor)"
int armorClass = kArmorClassHide + MIN(2, self.dexterityModifier) + self.shieldBonus; int armorClass = kArmorClassHide + MIN(2, self.dexterityModifier) + self.shieldBonus;
return [NSString stringWithFormat:@"%d (hide%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (hide%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameChainShirt isEqualToString:armorName]) { } else if ([kArmorNameChainShirt isEqualToString:armorType]) {
// 13 + Min(2, dexMod) + 2 for shield "12 (chain shirt)" // 13 + Min(2, dexMod) + 2 for shield "12 (chain shirt)"
int armorClass = kArmorClassChainShirt + MIN(2, self.dexterityModifier) + self.shieldBonus; int armorClass = kArmorClassChainShirt + MIN(2, self.dexterityModifier) + self.shieldBonus;
return [NSString stringWithFormat:@"%d (chain shirt%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (chain shirt%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameScaleMail isEqualToString:armorName]) { } else if ([kArmorNameScaleMail isEqualToString:armorType]) {
// 14 + Min(2, dexMod) + 2 for shield "14 (scale mail)" // 14 + Min(2, dexMod) + 2 for shield "14 (scale mail)"
int armorClass = kArmorClassScaleMail + MIN(2, self.dexterityModifier) + self.shieldBonus; int armorClass = kArmorClassScaleMail + MIN(2, self.dexterityModifier) + self.shieldBonus;
return [NSString stringWithFormat:@"%d (scale mail%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (scale mail%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameBreastplate isEqualToString:armorName]) { } else if ([kArmorNameBreastplate isEqualToString:armorType]) {
// 14 + Min(2, dexMod) + 2 for shield "16 (breastplate)" // 14 + Min(2, dexMod) + 2 for shield "16 (breastplate)"
int armorClass = kArmorClassBreastplate + MIN(2, self.dexterityModifier) + self.shieldBonus; int armorClass = kArmorClassBreastplate + MIN(2, self.dexterityModifier) + self.shieldBonus;
return [NSString stringWithFormat:@"%d (breastplate%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (breastplate%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameHalfPlate isEqualToString:armorName]) { } else if ([kArmorNameHalfPlate isEqualToString:armorType]) {
// 15 + Min(2, dexMod) + 2 for shield "17 (half plate)" // 15 + Min(2, dexMod) + 2 for shield "17 (half plate)"
int armorClass = kArmorClassHalfPlate + MIN(2, self.dexterityModifier) + self.shieldBonus; int armorClass = kArmorClassHalfPlate + MIN(2, self.dexterityModifier) + self.shieldBonus;
return [NSString stringWithFormat:@"%d (half plate%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (half plate%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameRingMail isEqualToString:armorName]) { } else if ([kArmorNameRingMail isEqualToString:armorType]) {
// 14 + 2 for shield "14 (ring mail) // 14 + 2 for shield "14 (ring mail)
int armorClass = kArmorClassRingMail + self.shieldBonus; int armorClass = kArmorClassRingMail + self.shieldBonus;
return [NSString stringWithFormat:@"%d (ring mail%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (ring mail%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameChainMail isEqualToString:armorName]) { } else if ([kArmorNameChainMail isEqualToString:armorType]) {
// 16 + 2 for shield "16 (chain mail)" // 16 + 2 for shield "16 (chain mail)"
int armorClass = kArmorClassChainMail + self.shieldBonus; int armorClass = kArmorClassChainMail + self.shieldBonus;
return [NSString stringWithFormat:@"%d (chain mail%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (chain mail%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameSplintMail isEqualToString:armorName]) { } else if ([kArmorNameSplintMail isEqualToString:armorType]) {
// 17 + 2 for shield "17 (splint)" // 17 + 2 for shield "17 (splint)"
int armorClass = kArmorClassSplintMail + self.shieldBonus; int armorClass = kArmorClassSplintMail + self.shieldBonus;
return [NSString stringWithFormat:@"%d (splint%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (splint%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNamePlateMail isEqualToString:armorName]) { } else if ([kArmorNamePlateMail isEqualToString:armorType]) {
// 18 + 2 for shield "18 (plate)" // 18 + 2 for shield "18 (plate)"
int armorClass = kArmorClassPlate + self.shieldBonus; int armorClass = kArmorClassPlate + self.shieldBonus;
return [NSString stringWithFormat:@"%d (plate%@)", armorClass, (hasShield ? @", shield" : @"")]; return [NSString stringWithFormat:@"%d (plate%@)", armorClass, (hasShield ? @", shield" : @"")];
} else if ([kArmorNameOther isEqualToString:armorName]) { } else if ([kArmorNameOther isEqualToString:armorType]) {
// pure string value shield check does nothing just copies the string from otherArmorDesc // pure string value shield check does nothing just copies the string from otherArmorDesc
return self.otherArmorDescription; return self.otherArmorDescription;
} else { } else {
@@ -490,7 +490,7 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan";
self.intelligenceScore = monster.intelligenceScore; self.intelligenceScore = monster.intelligenceScore;
self.wisdomScore = monster.wisdomScore; self.wisdomScore = monster.wisdomScore;
self.charismaScore = monster.charismaScore; self.charismaScore = monster.charismaScore;
self.armorName = monster.armorName; self.armorType = monster.armorType;
self.otherArmorDescription = monster.otherArmorDescription; self.otherArmorDescription = monster.otherArmorDescription;
self.shieldBonus = monster.shieldBonus; self.shieldBonus = monster.shieldBonus;
self.customHP = monster.customHP; self.customHP = monster.customHP;

View File

@@ -1,33 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17192" systemVersion="19G2021" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" usedWithCloudKit="YES" userDefinedModelVersionIdentifier=""> <model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17192" systemVersion="19H2" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
<entity name="Monster" representedClassName="Monster" syncable="YES" codeGenerationType="category"> <entity name="Monster" representedClassName="Monster" syncable="YES" codeGenerationType="category">
<attribute name="alignment" attributeType="String" defaultValueString=""/> <attribute name="alignment" attributeType="String" defaultValueString=""/>
<attribute name="armorName" optional="YES" attributeType="String" defaultValueString=""/> <attribute name="armorType" attributeType="String" defaultValueString=""/>
<attribute name="baseSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="baseSpeed" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="burrowSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="burrowSpeed" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="canHover" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="canHover" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="charismaScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="charismaScore" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="climbSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="climbSpeed" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="constitutionScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="constitutionScore" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="customHP" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="customArmor" attributeType="String" defaultValueString=""/>
<attribute name="customSpeed" optional="YES" attributeType="String"/> <attribute name="customHP" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="dexterityScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="customSpeed" attributeType="String" defaultValueString=""/>
<attribute name="flySpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="dexterityScore" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="hasCustomSpeed" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="flySpeed" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="hitDice" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="hasCustomSpeed" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="hpText" optional="YES" attributeType="String" defaultValueString=""/> <attribute name="hasShield" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="intelligenceScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="hitDice" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="hpText" attributeType="String" defaultValueString=""/>
<attribute name="intelligenceScore" 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="natrualArmorBonus" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="shieldBonus" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="otherArmorDescription" attributeType="String" defaultValueString=""/>
<attribute name="shieldBonus" 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" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="subtype" attributeType="String" defaultValueString=""/> <attribute name="subtype" attributeType="String" defaultValueString=""/>
<attribute name="swimSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="swimSpeed" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="type" attributeType="String" defaultValueString=""/> <attribute name="type" attributeType="String" defaultValueString=""/>
<attribute name="wisdomScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="wisdomScore" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
</entity> </entity>
<elements> <elements>
<element name="Monster" positionX="-63" positionY="-18" width="128" height="418"/> <element name="Monster" positionX="-63" positionY="-18" width="128" height="463"/>
</elements> </elements>
</model> </model>

View File

@@ -28,10 +28,14 @@ const int kBasicInfoSectionRowIndexSize = 1;
const int kBasicInfoSectionRowIndexType = 2; const int kBasicInfoSectionRowIndexType = 2;
const int kBasicInfoSectionRowIndexSubtype = 3; const int kBasicInfoSectionRowIndexSubtype = 3;
const int kBasicInfoSectionRowIndexAlignment = 4; const int kBasicInfoSectionRowIndexAlignment = 4;
const int kBasicInfoSectionRowIndexHitDice = 5;
const int kBasicInfoSectionRowIndexCustomHP = 6;
const int kBasicInfoSectionRowIndexCustomHPText = 7;
const int kArmorSectionRowIndexHitDice = 0; const int kArmorSectionRowIndexArmorType = 0;
const int kArmorSectionRowIndexCustomHP = 1; const int kArmorSectionRowIndexHasShield = 1;
const int kArmorSectionRowIndexCustomHPText = 2; const int kArmorSectionRowIndexNaturalArmorBonus = 2;
const int kArmorSectionRowIndexCustomArmor = 3;
const int kSpeedSectionRowIndexBaseSpeed = 0; const int kSpeedSectionRowIndexBaseSpeed = 0;
const int kSpeedSectionRowIndexBurrowSpeed = 1; const int kSpeedSectionRowIndexBurrowSpeed = 1;
@@ -154,9 +158,9 @@ const int kAbilityScoreSectionRowIndexCharisma = 5;
// * Type // * Type
// * Subtype // * Subtype
// * Alignment // * Alignment
return 5; return 8;
case kSectionIndexArmor: case kSectionIndexArmor:
return 3; return 0;
case kSectionIndexSpeed: case kSectionIndexSpeed:
return 8; return 8;
case kSectionIndexAbilityScores: case kSectionIndexAbilityScores:
@@ -224,105 +228,120 @@ titleForHeaderInSection:(NSInteger)section {
label: NSLocalizedString(@"Alignment", @"Placeholder text for the alignment of a monster or NPC.") label: NSLocalizedString(@"Alignment", @"Placeholder text for the alignment of a monster or NPC.")
andInitialValue:self.editingMonster.alignment]; andInitialValue:self.editingMonster.alignment];
break; break;
case kBasicInfoSectionRowIndexHitDice:
newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.hitDice"
label:NSLocalizedString(@"Hit Dice", @"")
andInitialValue:self.editingMonster.hitDice];
break;
case kBasicInfoSectionRowIndexCustomHP:
newCell = [self makeBooleanCellFromTableView:self.monsterTableView
withIdentifier:@"monster.customHP"
label:NSLocalizedString(@"Custom HP", @"")
andInitialValue:self.editingMonster.customHP];
break;
case kBasicInfoSectionRowIndexCustomHPText:
newCell = [self makeShortStringCellFromTableView:self.monsterTableView
withIdentifier:@"monster.customHPText"
label:NSLocalizedString(@"Custom HP Text", @"")
andInitialValue:self.editingMonster.hpText];
break;
} }
break; break;
case kSectionIndexArmor: case kSectionIndexArmor:
switch (indexPath.row) { switch (indexPath.row) {
case kArmorSectionRowIndexHitDice:
return [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.hitDice"
label:NSLocalizedString(@"Hit Dice", @"")
andInitialValue:self.editingMonster.hitDice];
case kArmorSectionRowIndexCustomHP:
return [self makeBooleanCellFromTableView:self.monsterTableView
withIdentifier:@"monster.customHP"
label:NSLocalizedString(@"Custom HP", @"")
andInitialValue:self.editingMonster.customHP];
return nil;
case kArmorSectionRowIndexCustomHPText:
return [self makeShortStringCellFromTableView:self.monsterTableView
withIdentifier:@"monster.customHPText"
label:NSLocalizedString(@"Custom HP Text", @"")
andInitialValue:self.editingMonster.hpText];
} }
break; break;
case kSectionIndexSpeed: case kSectionIndexSpeed:
switch (indexPath.row) { switch (indexPath.row) {
case kSpeedSectionRowIndexBaseSpeed: case kSpeedSectionRowIndexBaseSpeed:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.baseSpeed" withIdentifier:@"monster.baseSpeed"
label:NSLocalizedString(@"Base", @"") label:NSLocalizedString(@"Base", @"")
andInitialValue:self.editingMonster.baseSpeed]; andInitialValue:self.editingMonster.baseSpeed];
break;
case kSpeedSectionRowIndexBurrowSpeed: case kSpeedSectionRowIndexBurrowSpeed:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.burrowSpeed" withIdentifier:@"monster.burrowSpeed"
label:NSLocalizedString(@"Burrow", @"") label:NSLocalizedString(@"Burrow", @"")
andInitialValue:self.editingMonster.burrowSpeed]; andInitialValue:self.editingMonster.burrowSpeed];
break;
case kSpeedSectionRowIndexClimbSpeed: case kSpeedSectionRowIndexClimbSpeed:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.climbSpeed" withIdentifier:@"monster.climbSpeed"
label:NSLocalizedString(@"Climb", @"") label:NSLocalizedString(@"Climb", @"")
andInitialValue:self.editingMonster.climbSpeed]; andInitialValue:self.editingMonster.climbSpeed];
break;
case kSpeedSectionRowIndexFlySpeed: case kSpeedSectionRowIndexFlySpeed:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.flySpeed" withIdentifier:@"monster.flySpeed"
label:NSLocalizedString(@"Fly", @"") label:NSLocalizedString(@"Fly", @"")
andInitialValue:self.editingMonster.flySpeed]; andInitialValue:self.editingMonster.flySpeed];
break;
case kSpeedSectionRowIndexCanHover: case kSpeedSectionRowIndexCanHover:
return [self makeBooleanCellFromTableView:self.monsterTableView newCell = [self makeBooleanCellFromTableView:self.monsterTableView
withIdentifier:@"monster.canHover" withIdentifier:@"monster.canHover"
label:NSLocalizedString(@"Hover", @"") label:NSLocalizedString(@"Hover", @"")
andInitialValue:self.editingMonster.canHover]; andInitialValue:self.editingMonster.canHover];
break;
case kSpeedSectionRowIndexSwimSpeed: case kSpeedSectionRowIndexSwimSpeed:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.swimSpeed" withIdentifier:@"monster.swimSpeed"
label:NSLocalizedString(@"Swim", @"") label:NSLocalizedString(@"Swim", @"")
andInitialValue:self.editingMonster.swimSpeed]; andInitialValue:self.editingMonster.swimSpeed];
break;
case kSpeedSectionRowIndexHasCustomSpeed: case kSpeedSectionRowIndexHasCustomSpeed:
return [self makeBooleanCellFromTableView:self.monsterTableView newCell = [self makeBooleanCellFromTableView:self.monsterTableView
withIdentifier:@"monster.hasCustomSpeed" withIdentifier:@"monster.hasCustomSpeed"
label:NSLocalizedString(@"Custom Speed", @"") label:NSLocalizedString(@"Custom Speed", @"")
andInitialValue:self.editingMonster.hasCustomSpeed]; andInitialValue:self.editingMonster.hasCustomSpeed];
break;
case kSpeedSectionRowIndexCustomSpeed: case kSpeedSectionRowIndexCustomSpeed:
return [self makeShortStringCellFromTableView:self.monsterTableView newCell = [self makeShortStringCellFromTableView:self.monsterTableView
withIdentifier:@"monster.customSpeed" withIdentifier:@"monster.customSpeed"
label:NSLocalizedString(@"Custom Speed", @"") label:NSLocalizedString(@"Custom Speed", @"")
andInitialValue:self.editingMonster.customSpeed]; andInitialValue:self.editingMonster.customSpeed];
break;
} }
break; break;
case kSectionIndexAbilityScores: case kSectionIndexAbilityScores:
switch (indexPath.row) { switch (indexPath.row) {
case kAbilityScoreSectionRowIndexStrength: case kAbilityScoreSectionRowIndexStrength:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.strengthScore" withIdentifier:@"monster.strengthScore"
label:NSLocalizedString(@"STR", @"Placeholder abbreviation for the strength score of a monster or NPC.") label:NSLocalizedString(@"STR", @"Placeholder abbreviation for the strength score of a monster or NPC.")
andInitialValue:self.editingMonster.strengthScore]; andInitialValue:self.editingMonster.strengthScore];
break;
case kAbilityScoreSectionRowIndexDexterity: case kAbilityScoreSectionRowIndexDexterity:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.dexterityScore" withIdentifier:@"monster.dexterityScore"
label:NSLocalizedString(@"DEX", @"Placeholder abbreviation for the dexterity score of a monster or NPC.") label:NSLocalizedString(@"DEX", @"Placeholder abbreviation for the dexterity score of a monster or NPC.")
andInitialValue:self.editingMonster.dexterityScore]; andInitialValue:self.editingMonster.dexterityScore];
break;
case kAbilityScoreSectionRowIndexConstitution: case kAbilityScoreSectionRowIndexConstitution:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.constitutionScore" withIdentifier:@"monster.constitutionScore"
label:NSLocalizedString(@"CON", @"Placeholder abbreviation for the constitution score of a monster or NPC.") label:NSLocalizedString(@"CON", @"Placeholder abbreviation for the constitution score of a monster or NPC.")
andInitialValue:self.editingMonster.constitutionScore]; andInitialValue:self.editingMonster.constitutionScore];
break;
case kAbilityScoreSectionRowIndexIntelligence: case kAbilityScoreSectionRowIndexIntelligence:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.intelligenceScore" withIdentifier:@"monster.intelligenceScore"
label:NSLocalizedString(@"INT", @"Placeholder abbreviation for the intelligence score of a monster or NPC.") label:NSLocalizedString(@"INT", @"Placeholder abbreviation for the intelligence score of a monster or NPC.")
andInitialValue:self.editingMonster.intelligenceScore]; andInitialValue:self.editingMonster.intelligenceScore];
break;
case kAbilityScoreSectionRowIndexWisdom: case kAbilityScoreSectionRowIndexWisdom:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.wisdomScore" withIdentifier:@"monster.wisdomScore"
label:NSLocalizedString(@"WIS", @"Placeholder abbreviation for the wisdom score of a monster or NPC.") label:NSLocalizedString(@"WIS", @"Placeholder abbreviation for the wisdom score of a monster or NPC.")
andInitialValue:self.editingMonster.wisdomScore]; andInitialValue:self.editingMonster.wisdomScore];
break;
case kAbilityScoreSectionRowIndexCharisma: case kAbilityScoreSectionRowIndexCharisma:
return [self makeIntegerCellFromTableView:self.monsterTableView newCell = [self makeIntegerCellFromTableView:self.monsterTableView
withIdentifier:@"monster.charismaScore" withIdentifier:@"monster.charismaScore"
label:NSLocalizedString(@"CHA", @"Placeholder abbreviation for the charisma score of a monster or NPC.") label:NSLocalizedString(@"CHA", @"Placeholder abbreviation for the charisma score of a monster or NPC.")
andInitialValue:self.editingMonster.charismaScore]; andInitialValue:self.editingMonster.charismaScore];
break;
} }
break; break;

View File

@@ -46,7 +46,7 @@
XCTAssertEqual(0, _monster.intelligenceScore); XCTAssertEqual(0, _monster.intelligenceScore);
XCTAssertEqual(0, _monster.wisdomScore); XCTAssertEqual(0, _monster.wisdomScore);
XCTAssertEqual(0, _monster.charismaScore); XCTAssertEqual(0, _monster.charismaScore);
XCTAssertEqualObjects(@"", _monster.armorName); XCTAssertEqualObjects(@"", _monster.armorType);
XCTAssertEqualObjects(@"", _monster.otherArmorDescription); XCTAssertEqualObjects(@"", _monster.otherArmorDescription);
XCTAssertEqual(0, _monster.shieldBonus); XCTAssertEqual(0, _monster.shieldBonus);
XCTAssertEqual(NO, _monster.customHP); XCTAssertEqual(NO, _monster.customHP);
@@ -68,7 +68,7 @@
XCTAssertEqual(14, _monster.intelligenceScore); XCTAssertEqual(14, _monster.intelligenceScore);
XCTAssertEqual(16, _monster.wisdomScore); XCTAssertEqual(16, _monster.wisdomScore);
XCTAssertEqual(18, _monster.charismaScore); XCTAssertEqual(18, _monster.charismaScore);
XCTAssertEqualObjects(@"none", _monster.armorName); XCTAssertEqualObjects(@"none", _monster.armorType);
XCTAssertEqualObjects(@"10", _monster.otherArmorDescription); XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
XCTAssertEqual(2, _monster.shieldBonus); XCTAssertEqual(2, _monster.shieldBonus);
XCTAssertEqual(YES, _monster.customHP); XCTAssertEqual(YES, _monster.customHP);
@@ -91,7 +91,7 @@
XCTAssertEqual(0, _monster.intelligenceScore); XCTAssertEqual(0, _monster.intelligenceScore);
XCTAssertEqual(0, _monster.wisdomScore); XCTAssertEqual(0, _monster.wisdomScore);
XCTAssertEqual(0, _monster.charismaScore); XCTAssertEqual(0, _monster.charismaScore);
XCTAssertEqualObjects(@"", _monster.armorName); XCTAssertEqualObjects(@"", _monster.armorType);
XCTAssertEqualObjects(@"", _monster.otherArmorDescription); XCTAssertEqualObjects(@"", _monster.otherArmorDescription);
XCTAssertEqual(0, _monster.shieldBonus); XCTAssertEqual(0, _monster.shieldBonus);
XCTAssertEqual(NO, _monster.customHP); XCTAssertEqual(NO, _monster.customHP);
@@ -114,7 +114,7 @@
XCTAssertEqual(14, _monster.intelligenceScore); XCTAssertEqual(14, _monster.intelligenceScore);
XCTAssertEqual(16, _monster.wisdomScore); XCTAssertEqual(16, _monster.wisdomScore);
XCTAssertEqual(18, _monster.charismaScore); XCTAssertEqual(18, _monster.charismaScore);
XCTAssertEqualObjects(@"none", _monster.armorName); XCTAssertEqualObjects(@"none", _monster.armorType);
XCTAssertEqualObjects(@"10", _monster.otherArmorDescription); XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
XCTAssertEqual(2, _monster.shieldBonus); XCTAssertEqual(2, _monster.shieldBonus);
XCTAssertEqual(YES, _monster.customHP); XCTAssertEqual(YES, _monster.customHP);
@@ -167,7 +167,7 @@
XCTAssertEqual(14, _monster.intelligenceScore); XCTAssertEqual(14, _monster.intelligenceScore);
XCTAssertEqual(16, _monster.wisdomScore); XCTAssertEqual(16, _monster.wisdomScore);
XCTAssertEqual(18, _monster.charismaScore); XCTAssertEqual(18, _monster.charismaScore);
XCTAssertEqualObjects(@"none", _monster.armorName); XCTAssertEqualObjects(@"none", _monster.armorType);
XCTAssertEqualObjects(@"10", _monster.otherArmorDescription); XCTAssertEqualObjects(@"10", _monster.otherArmorDescription);
XCTAssertEqual(2, _monster.shieldBonus); XCTAssertEqual(2, _monster.shieldBonus);
} }
@@ -385,8 +385,8 @@
} }
- (void)testGetterAndSetterForArmorName { - (void)testGetterAndSetterForArmorName {
_monster.armorName = @"dandelion"; _monster.armorType = @"dandelion";
XCTAssertEqualObjects(@"dandelion", _monster.armorName); XCTAssertEqualObjects(@"dandelion", _monster.armorType);
} }
- (void)testGetterAndSetterForOtherArmorDescription { - (void)testGetterAndSetterForOtherArmorDescription {