Adds speed properties to Core Data and monster editor.
This commit is contained in:
@@ -60,13 +60,7 @@ extern NSString* const kArmorNameOther;
|
|||||||
|
|
||||||
@interface Monster : NSManagedObject
|
@interface Monster : NSManagedObject
|
||||||
|
|
||||||
@property NSString *speed;
|
|
||||||
@property NSString *burrowSpeed;
|
|
||||||
@property NSString *climbSpeed;
|
|
||||||
@property NSString *flySpeed;
|
|
||||||
@property NSString *swimSpeed;
|
|
||||||
// speedDescription
|
// speedDescription
|
||||||
@property NSString *customSpeedDescription;
|
|
||||||
@property NSString *challengeRating;
|
@property NSString *challengeRating;
|
||||||
@property NSString *customChallengeRating;
|
@property NSString *customChallengeRating;
|
||||||
@property NSString *blindsightDistance;
|
@property NSString *blindsightDistance;
|
||||||
@@ -80,8 +74,6 @@ extern NSString* const kArmorNameOther;
|
|||||||
// Shouldn't this be a BOOL?
|
// Shouldn't this be a BOOL?
|
||||||
@property int telepathy;
|
@property int telepathy;
|
||||||
|
|
||||||
@property BOOL hover;
|
|
||||||
@property BOOL customSpeed;
|
|
||||||
@property BOOL isBlind;
|
@property BOOL isBlind;
|
||||||
|
|
||||||
+(int)abilityModifierForScore: (int)score;
|
+(int)abilityModifierForScore: (int)score;
|
||||||
|
|||||||
@@ -13,20 +13,12 @@
|
|||||||
@implementation Monster
|
@implementation Monster
|
||||||
|
|
||||||
@synthesize blindsightDistance;
|
@synthesize blindsightDistance;
|
||||||
@synthesize burrowSpeed;
|
|
||||||
@synthesize challengeRating;
|
@synthesize challengeRating;
|
||||||
@synthesize climbSpeed;
|
|
||||||
@synthesize customChallengeRating;
|
@synthesize customChallengeRating;
|
||||||
@synthesize customProficiencyBonus;
|
@synthesize customProficiencyBonus;
|
||||||
@synthesize customSpeed;
|
|
||||||
@synthesize customSpeedDescription;
|
|
||||||
@synthesize darkvisionDistance;
|
@synthesize darkvisionDistance;
|
||||||
@synthesize flySpeed;
|
|
||||||
@synthesize hover;
|
|
||||||
@synthesize isBlind;
|
@synthesize isBlind;
|
||||||
@synthesize naturalArmorBonus;
|
@synthesize naturalArmorBonus;
|
||||||
@synthesize speed;
|
|
||||||
@synthesize swimSpeed;
|
|
||||||
@synthesize telepathy;
|
@synthesize telepathy;
|
||||||
@synthesize tremorsenseDistance;
|
@synthesize tremorsenseDistance;
|
||||||
@synthesize truesightDistance;
|
@synthesize truesightDistance;
|
||||||
@@ -485,6 +477,14 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan";
|
|||||||
self.customHP = monster.customHP;
|
self.customHP = monster.customHP;
|
||||||
self.hitDice = monster.hitDice;
|
self.hitDice = monster.hitDice;
|
||||||
self.hpText = monster.hpText;
|
self.hpText = monster.hpText;
|
||||||
|
self.baseSpeed = monster.baseSpeed;
|
||||||
|
self.burrowSpeed = monster.burrowSpeed;
|
||||||
|
self.climbSpeed = monster.climbSpeed;
|
||||||
|
self.flySpeed = monster.flySpeed;
|
||||||
|
self.canHover = monster.canHover;
|
||||||
|
self.swimSpeed = monster.swimSpeed;
|
||||||
|
self.hasCustomSpeed = monster.hasCustomSpeed;
|
||||||
|
self.customSpeed = monster.customSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -3,10 +3,17 @@
|
|||||||
<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="armorName" optional="YES" attributeType="String" defaultValueString=""/>
|
||||||
|
<attribute name="baseSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="burrowSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="canHover" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||||
<attribute name="charismaScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="charismaScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="climbSpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="constitutionScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="constitutionScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="customHP" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
<attribute name="customHP" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="customSpeed" optional="YES" attributeType="String"/>
|
||||||
<attribute name="dexterityScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="dexterityScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="flySpeed" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="hasCustomSpeed" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||||
<attribute name="hitDice" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="hitDice" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="hpText" optional="YES" attributeType="String" defaultValueString=""/>
|
<attribute name="hpText" optional="YES" attributeType="String" defaultValueString=""/>
|
||||||
<attribute name="intelligenceScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="intelligenceScore" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
@@ -16,10 +23,11 @@
|
|||||||
<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=""/>
|
||||||
|
<attribute name="swimSpeed" optional="YES" 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" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Monster" positionX="-63" positionY="-18" width="128" height="298"/>
|
<element name="Monster" positionX="-63" positionY="-18" width="128" height="418"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
||||||
@@ -20,7 +20,8 @@
|
|||||||
|
|
||||||
const int kSectionIndexBasicInfo = 0;
|
const int kSectionIndexBasicInfo = 0;
|
||||||
const int kSectionIndexArmor = 1;
|
const int kSectionIndexArmor = 1;
|
||||||
const int kSectionIndexAbilityScores = 2;
|
const int kSectionIndexSpeed = 2;
|
||||||
|
const int kSectionIndexAbilityScores = 3;
|
||||||
|
|
||||||
const int kBasicInfoSectionRowIndexName = 0;
|
const int kBasicInfoSectionRowIndexName = 0;
|
||||||
const int kBasicInfoSectionRowIndexSize = 1;
|
const int kBasicInfoSectionRowIndexSize = 1;
|
||||||
@@ -32,6 +33,15 @@ const int kArmorSectionRowIndexHitDice = 0;
|
|||||||
const int kArmorSectionRowIndexCustomHP = 1;
|
const int kArmorSectionRowIndexCustomHP = 1;
|
||||||
const int kArmorSectionRowIndexCustomHPText = 2;
|
const int kArmorSectionRowIndexCustomHPText = 2;
|
||||||
|
|
||||||
|
const int kSpeedSectionRowIndexBaseSpeed = 0;
|
||||||
|
const int kSpeedSectionRowIndexBurrowSpeed = 1;
|
||||||
|
const int kSpeedSectionRowIndexClimbSpeed = 2;
|
||||||
|
const int kSpeedSectionRowIndexFlySpeed = 3;
|
||||||
|
const int kSpeedSectionRowIndexCanHover = 4;
|
||||||
|
const int kSpeedSectionRowIndexSwimSpeed = 5;
|
||||||
|
const int kSpeedSectionRowIndexHasCustomSpeed = 6;
|
||||||
|
const int kSpeedSectionRowIndexCustomSpeed = 7;
|
||||||
|
|
||||||
const int kAbilityScoreSectionRowIndexStrength = 0;
|
const int kAbilityScoreSectionRowIndexStrength = 0;
|
||||||
const int kAbilityScoreSectionRowIndexDexterity = 1;
|
const int kAbilityScoreSectionRowIndexDexterity = 1;
|
||||||
const int kAbilityScoreSectionRowIndexConstitution = 2;
|
const int kAbilityScoreSectionRowIndexConstitution = 2;
|
||||||
@@ -147,6 +157,8 @@ const int kAbilityScoreSectionRowIndexCharisma = 5;
|
|||||||
return 5;
|
return 5;
|
||||||
case kSectionIndexArmor:
|
case kSectionIndexArmor:
|
||||||
return 3;
|
return 3;
|
||||||
|
case kSectionIndexSpeed:
|
||||||
|
return 8;
|
||||||
case kSectionIndexAbilityScores:
|
case kSectionIndexAbilityScores:
|
||||||
return 6;
|
return 6;
|
||||||
default:
|
default:
|
||||||
@@ -165,7 +177,9 @@ titleForHeaderInSection:(NSInteger)section {
|
|||||||
case kSectionIndexBasicInfo:
|
case kSectionIndexBasicInfo:
|
||||||
return NSLocalizedString(@"Basic Info", @"Section title");
|
return NSLocalizedString(@"Basic Info", @"Section title");
|
||||||
case kSectionIndexArmor:
|
case kSectionIndexArmor:
|
||||||
return NSLocalizedString(@"Armor, HP, and Speed", @"Section title");
|
return NSLocalizedString(@"Armor and HP", @"Section title");
|
||||||
|
case kSectionIndexSpeed:
|
||||||
|
return NSLocalizedString(@"Speed", @"Section title");
|
||||||
case kSectionIndexAbilityScores:
|
case kSectionIndexAbilityScores:
|
||||||
return NSLocalizedString(@"Ability Scores", @"Section title");
|
return NSLocalizedString(@"Ability Scores", @"Section title");
|
||||||
default:
|
default:
|
||||||
@@ -215,13 +229,66 @@ titleForHeaderInSection:(NSInteger)section {
|
|||||||
case kSectionIndexArmor:
|
case kSectionIndexArmor:
|
||||||
switch (indexPath.row) {
|
switch (indexPath.row) {
|
||||||
case kArmorSectionRowIndexHitDice:
|
case kArmorSectionRowIndexHitDice:
|
||||||
return [self makeIntegerCellFromTableView:self.monsterTableView withIdentifier:@"monster.hitDice" label:NSLocalizedString(@"Hit Dice", @"") andInitialValue:self.editingMonster.hitDice];
|
return [self makeIntegerCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.hitDice"
|
||||||
|
label:NSLocalizedString(@"Hit Dice", @"")
|
||||||
|
andInitialValue:self.editingMonster.hitDice];
|
||||||
case kArmorSectionRowIndexCustomHP:
|
case kArmorSectionRowIndexCustomHP:
|
||||||
return [self makeBooleanCellFromTableView:self.monsterTableView
|
return [self makeBooleanCellFromTableView:self.monsterTableView
|
||||||
withIdentifier:@"monster.customHP" label:NSLocalizedString(@"Custom HP", @"") andInitialValue:self.editingMonster.customHP];
|
withIdentifier:@"monster.customHP"
|
||||||
|
label:NSLocalizedString(@"Custom HP", @"")
|
||||||
|
andInitialValue:self.editingMonster.customHP];
|
||||||
return nil;
|
return nil;
|
||||||
case kArmorSectionRowIndexCustomHPText:
|
case kArmorSectionRowIndexCustomHPText:
|
||||||
return [self makeShortStringCellFromTableView:self.monsterTableView withIdentifier:@"monster.customHPText" label:NSLocalizedString(@"Custom HP Text", @"") andInitialValue:self.editingMonster.hpText];
|
return [self makeShortStringCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.customHPText"
|
||||||
|
label:NSLocalizedString(@"Custom HP Text", @"")
|
||||||
|
andInitialValue:self.editingMonster.hpText];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kSectionIndexSpeed:
|
||||||
|
switch (indexPath.row) {
|
||||||
|
case kSpeedSectionRowIndexBaseSpeed:
|
||||||
|
return [self makeIntegerCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.baseSpeed"
|
||||||
|
label:NSLocalizedString(@"Base", @"")
|
||||||
|
andInitialValue:self.editingMonster.baseSpeed];
|
||||||
|
case kSpeedSectionRowIndexBurrowSpeed:
|
||||||
|
return [self makeIntegerCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.burrowSpeed"
|
||||||
|
label:NSLocalizedString(@"Burrow", @"")
|
||||||
|
andInitialValue:self.editingMonster.burrowSpeed];
|
||||||
|
case kSpeedSectionRowIndexClimbSpeed:
|
||||||
|
return [self makeIntegerCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.climbSpeed"
|
||||||
|
label:NSLocalizedString(@"Climb", @"")
|
||||||
|
andInitialValue:self.editingMonster.climbSpeed];
|
||||||
|
case kSpeedSectionRowIndexFlySpeed:
|
||||||
|
return [self makeIntegerCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.flySpeed"
|
||||||
|
label:NSLocalizedString(@"Fly", @"")
|
||||||
|
andInitialValue:self.editingMonster.flySpeed];
|
||||||
|
case kSpeedSectionRowIndexCanHover:
|
||||||
|
return [self makeBooleanCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.canHover"
|
||||||
|
label:NSLocalizedString(@"Hover", @"")
|
||||||
|
andInitialValue:self.editingMonster.canHover];
|
||||||
|
case kSpeedSectionRowIndexSwimSpeed:
|
||||||
|
return [self makeIntegerCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.swimSpeed"
|
||||||
|
label:NSLocalizedString(@"Swim", @"")
|
||||||
|
andInitialValue:self.editingMonster.swimSpeed];
|
||||||
|
case kSpeedSectionRowIndexHasCustomSpeed:
|
||||||
|
return [self makeBooleanCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.hasCustomSpeed"
|
||||||
|
label:NSLocalizedString(@"Custom Speed", @"")
|
||||||
|
andInitialValue:self.editingMonster.hasCustomSpeed];
|
||||||
|
case kSpeedSectionRowIndexCustomSpeed:
|
||||||
|
return [self makeShortStringCellFromTableView:self.monsterTableView
|
||||||
|
withIdentifier:@"monster.customSpeed"
|
||||||
|
label:NSLocalizedString(@"Custom Speed", @"")
|
||||||
|
andInitialValue:self.editingMonster.customSpeed];
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kSectionIndexAbilityScores:
|
case kSectionIndexAbilityScores:
|
||||||
@@ -285,6 +352,8 @@ titleForHeaderInSection:(NSInteger)section {
|
|||||||
self.editingMonster.alignment = (NSString*)value;
|
self.editingMonster.alignment = (NSString*)value;
|
||||||
} else if ([@"monster.customHPText" isEqualToString:identifier]) {
|
} else if ([@"monster.customHPText" isEqualToString:identifier]) {
|
||||||
self.editingMonster.hpText = (NSString*)value;
|
self.editingMonster.hpText = (NSString*)value;
|
||||||
|
} else if ([@"monster.customSpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.customSpeed = (NSString*)value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ([kMCFieldValueTypeInteger isEqualToString:type]) {
|
if ([kMCFieldValueTypeInteger isEqualToString:type]) {
|
||||||
@@ -302,11 +371,25 @@ titleForHeaderInSection:(NSInteger)section {
|
|||||||
self.editingMonster.charismaScore = [(NSNumber*)value intValue];
|
self.editingMonster.charismaScore = [(NSNumber*)value intValue];
|
||||||
} else if ([@"monster.hitDice" isEqualToString:identifier]) {
|
} else if ([@"monster.hitDice" isEqualToString:identifier]) {
|
||||||
self.editingMonster.hitDice = [(NSNumber*)value intValue];
|
self.editingMonster.hitDice = [(NSNumber*)value intValue];
|
||||||
|
} else if ([@"monster.baseSpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.baseSpeed = [(NSNumber*)value intValue];
|
||||||
|
} else if ([@"monster.burrowSpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.burrowSpeed = [(NSNumber*)value intValue];
|
||||||
|
} else if ([@"monster.climbSpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.climbSpeed = [(NSNumber*)value intValue];
|
||||||
|
} else if ([@"monster.flySpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.flySpeed = [(NSNumber*)value intValue];
|
||||||
|
} else if ([@"monster.swimSpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.swimSpeed = [(NSNumber*)value intValue];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ([kMCFieldValueTypeBoolean isEqualToString:type]) {
|
if ([kMCFieldValueTypeBoolean isEqualToString:type]) {
|
||||||
if ([@"monster.customHP" isEqualToString:identifier]) {
|
if ([@"monster.customHP" isEqualToString:identifier]) {
|
||||||
self.editingMonster.customHP = [(NSNumber*)value boolValue];
|
self.editingMonster.customHP = [(NSNumber*)value boolValue];
|
||||||
|
} else if ([@"monster.canHover" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.canHover = [(NSNumber*)value boolValue];
|
||||||
|
} else if ([@"monster.hasCustomSpeed" isEqualToString:identifier]) {
|
||||||
|
self.editingMonster.hasCustomSpeed = [(NSNumber*)value boolValue];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user