Cleans up code that generates HTML labels.

Adds Label for speed.
Makes the Monster Card refresh the monster from CoreData when the view is shown.
This commit is contained in:
2020-09-26 15:09:46 -07:00
parent d041105e1e
commit caa1be50cf
5 changed files with 77 additions and 18 deletions

View File

@@ -278,9 +278,28 @@ NSString* const kMonsterSizeGargantuan = @"gargantuan";
}
}
//getSpeedText
-(NSString*)speedDescription {
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
if (self.hasCustomSpeed) {
return self.customSpeed;
} else {
NSMutableArray* parts = [[NSMutableArray alloc] init];
if (self.baseSpeed > 0) {
[parts addObject:[NSString stringWithFormat:@"%d ft.", self.baseSpeed]];
}
if (self.burrowSpeed > 0) {
[parts addObject:[NSString stringWithFormat:@"burrow %d ft.", self.burrowSpeed]];
}
if (self.climbSpeed > 0) {
[parts addObject:[NSString stringWithFormat:@"climb %d ft.", self.climbSpeed]];
}
if (self.flySpeed > 0) {
[parts addObject:[NSString stringWithFormat:@"fly %d ft.%@", self.flySpeed, self.canHover ? @" (hover)" : @""]];
}
if (self.swimSpeed > 0) {
[parts addObject:[NSString stringWithFormat:@"swim %d ft.", self.swimSpeed]];
}
return [parts componentsJoinedByString:@" "];
}
}
-(NSString*)strengthDescription {