diff --git a/iOS/MonsterCards/Models/Monster.h b/iOS/MonsterCards/Models/Monster.h index e659fd3..66ef24f 100644 --- a/iOS/MonsterCards/Models/Monster.h +++ b/iOS/MonsterCards/Models/Monster.h @@ -60,13 +60,7 @@ extern NSString* const kArmorNameOther; @interface Monster : NSManagedObject -@property NSString *speed; -@property NSString *burrowSpeed; -@property NSString *climbSpeed; -@property NSString *flySpeed; -@property NSString *swimSpeed; // speedDescription -@property NSString *customSpeedDescription; @property NSString *challengeRating; @property NSString *customChallengeRating; @property NSString *blindsightDistance; @@ -80,8 +74,6 @@ extern NSString* const kArmorNameOther; // Shouldn't this be a BOOL? @property int telepathy; -@property BOOL hover; -@property BOOL customSpeed; @property BOOL isBlind; +(int)abilityModifierForScore: (int)score; diff --git a/iOS/MonsterCards/Models/Monster.m b/iOS/MonsterCards/Models/Monster.m index 21897d1..d74245f 100644 --- a/iOS/MonsterCards/Models/Monster.m +++ b/iOS/MonsterCards/Models/Monster.m @@ -13,20 +13,12 @@ @implementation Monster @synthesize blindsightDistance; -@synthesize burrowSpeed; @synthesize challengeRating; -@synthesize climbSpeed; @synthesize customChallengeRating; @synthesize customProficiencyBonus; -@synthesize customSpeed; -@synthesize customSpeedDescription; @synthesize darkvisionDistance; -@synthesize flySpeed; -@synthesize hover; @synthesize isBlind; @synthesize naturalArmorBonus; -@synthesize speed; -@synthesize swimSpeed; @synthesize telepathy; @synthesize tremorsenseDistance; @synthesize truesightDistance; @@ -485,6 +477,14 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan"; self.customHP = monster.customHP; self.hitDice = monster.hitDice; 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 diff --git a/iOS/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents b/iOS/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents index a5c0a26..baf8099 100644 --- a/iOS/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents +++ b/iOS/MonsterCards/MonsterCards.xcdatamodeld/MonsterCards.xcdatamodel/contents @@ -3,10 +3,17 @@ + + + + + + + @@ -16,10 +23,11 @@ + - + \ No newline at end of file diff --git a/iOS/MonsterCards/Views/EditMonsterViewController.m b/iOS/MonsterCards/Views/EditMonsterViewController.m index 4959ff0..d7f99af 100644 --- a/iOS/MonsterCards/Views/EditMonsterViewController.m +++ b/iOS/MonsterCards/Views/EditMonsterViewController.m @@ -20,7 +20,8 @@ const int kSectionIndexBasicInfo = 0; const int kSectionIndexArmor = 1; -const int kSectionIndexAbilityScores = 2; +const int kSectionIndexSpeed = 2; +const int kSectionIndexAbilityScores = 3; const int kBasicInfoSectionRowIndexName = 0; const int kBasicInfoSectionRowIndexSize = 1; @@ -32,6 +33,15 @@ const int kArmorSectionRowIndexHitDice = 0; const int kArmorSectionRowIndexCustomHP = 1; 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 kAbilityScoreSectionRowIndexDexterity = 1; const int kAbilityScoreSectionRowIndexConstitution = 2; @@ -147,6 +157,8 @@ const int kAbilityScoreSectionRowIndexCharisma = 5; return 5; case kSectionIndexArmor: return 3; + case kSectionIndexSpeed: + return 8; case kSectionIndexAbilityScores: return 6; default: @@ -165,7 +177,9 @@ titleForHeaderInSection:(NSInteger)section { case kSectionIndexBasicInfo: return NSLocalizedString(@"Basic Info", @"Section title"); 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: return NSLocalizedString(@"Ability Scores", @"Section title"); default: @@ -215,13 +229,66 @@ titleForHeaderInSection:(NSInteger)section { case kSectionIndexArmor: switch (indexPath.row) { 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: 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; 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; case kSectionIndexAbilityScores: @@ -283,8 +350,10 @@ titleForHeaderInSection:(NSInteger)section { self.editingMonster.subtype = (NSString*)value; } else if ([@"monster.alignment" isEqualToString:identifier]) { self.editingMonster.alignment = (NSString*)value; - } else if ([@"monster.customHPText" isEqualToString:identifier]){ + } else if ([@"monster.customHPText" isEqualToString:identifier]) { self.editingMonster.hpText = (NSString*)value; + } else if ([@"monster.customSpeed" isEqualToString:identifier]) { + self.editingMonster.customSpeed = (NSString*)value; } } if ([kMCFieldValueTypeInteger isEqualToString:type]) { @@ -300,13 +369,27 @@ titleForHeaderInSection:(NSInteger)section { self.editingMonster.wisdomScore = [(NSNumber*)value intValue]; } else if ([@"monster.charismaScore" isEqualToString:identifier]) { self.editingMonster.charismaScore = [(NSNumber*)value intValue]; - } else if ([@"monster.hitDice" isEqualToString:identifier]){ + } else if ([@"monster.hitDice" isEqualToString:identifier]) { 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 ([@"monster.customHP" isEqualToString:identifier]) { 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]; } } }