Adds alignment to monsters.

Adds tests for editing alignment on monsters.
Adds tests for monster meta text when alignment is set.
This commit is contained in:
2020-09-12 17:39:07 -07:00
parent 0c1deecb5b
commit 513e2c3511
4 changed files with 115 additions and 12 deletions

View File

@@ -75,6 +75,7 @@
self.size = [jsonRoot objectForKey:@"size"] ?: @"";
self.type = [jsonRoot objectForKey:@"type"] ?: @"";
self.subtype = [jsonRoot objectForKey:@"tag"] ?: @"";
self.alignment = [jsonRoot objectForKey:@"alignment"] ?: @"";
return self;
}
@@ -338,6 +339,7 @@
self.size = monster.size;
self.type = monster.type;
self.subtype = monster.subtype;
self.alignment = monster.alignment;
}
@end

View File

@@ -59,7 +59,7 @@
// * Subtype
// * Alignment
return 4;
return 5;
}
- (EditableShortStringTableViewCell*) makeShortStringCellFromCell:(UITableViewCell*)cell {
@@ -109,6 +109,13 @@
shortStringCell.textField.text = self.editingMonster.subtype;
shortStringCell.textField.placeholder = NSLocalizedString(@"Subtype", @"Placeholder text for the subtype of a monster or NPC.");
return shortStringCell;
case 4:
shortStringCell = [self makeShortStringCellFromCell: [self.monsterTableView dequeueReusableCellWithIdentifier:@"EditableShortString"]];
shortStringCell.delegate = self;
shortStringCell.identifier = @"monster.alignment";
shortStringCell.textField.text = self.editingMonster.alignment;
shortStringCell.textField.placeholder = NSLocalizedString(@"Alignment", @"Placeholder text for the alignment of a monster or NPC.");
return shortStringCell;
}
break;
}
@@ -128,6 +135,8 @@
self.editingMonster.type = (NSString*)value;
} else if ([@"monster.subtype" isEqualToString:identifier]) {
self.editingMonster.subtype = (NSString*)value;
} else if ([@"monster.alignment" isEqualToString:identifier]) {
self.editingMonster.alignment = (NSString*)value;
}
}
}