Adds implementation for Skill model.
Adds stubbed out implementation of Monster model. all methods throw exceptions.
This commit is contained in:
@@ -7,11 +7,124 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "Ability.h"
|
||||||
|
#import "Action.h"
|
||||||
|
#import "DamageType.h"
|
||||||
|
#import "Language.h"
|
||||||
|
#import "SavingThrow.h"
|
||||||
|
#import "Skill.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@class Skill;
|
||||||
|
|
||||||
@interface Monster : NSObject
|
@interface Monster : NSObject
|
||||||
|
|
||||||
|
@property NSString *name;
|
||||||
|
@property NSString *size;
|
||||||
|
@property NSString *type;
|
||||||
|
@property NSString *tag;
|
||||||
|
@property NSString *alignment;
|
||||||
|
@property NSString *armorName;
|
||||||
|
@property NSString *otherArmorDescription;
|
||||||
|
@property NSString *hpText;
|
||||||
|
@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;
|
||||||
|
@property NSString *darkvisionDistance;
|
||||||
|
@property NSString *tremorsenseDistance;
|
||||||
|
@property NSString *truesightDistance;
|
||||||
|
@property NSString *understandsBut;
|
||||||
|
|
||||||
|
@property int strengthScore;
|
||||||
|
@property int dexterityScore;
|
||||||
|
@property int constitutionScore;
|
||||||
|
@property int intelligenceScore;
|
||||||
|
@property int wisdomScore;
|
||||||
|
@property int charismaScore;
|
||||||
|
@property int shieldBonus;
|
||||||
|
@property int naturalArmorBonus;
|
||||||
|
@property int hitDice;
|
||||||
|
@property int customProficiencyBonus;
|
||||||
|
// Shouldn't this be a BOOL?
|
||||||
|
@property int telepathy;
|
||||||
|
|
||||||
|
@property BOOL customHP;
|
||||||
|
@property BOOL hover;
|
||||||
|
@property BOOL customSpeed;
|
||||||
|
@property BOOL isBlind;
|
||||||
|
|
||||||
|
+(int)abilityModifierForScore: (int)score;
|
||||||
|
+(int)hitDieForSize: (NSString*)size;
|
||||||
|
|
||||||
|
-(id)initWithJSON:(NSString*)jsonData;
|
||||||
|
-(NSString*)meta;
|
||||||
|
-(int)abilityScoreForAbilityScoreName: (NSString*)abilityScoreName;
|
||||||
|
-(int)abilityModifierForAbilityScoreName: (NSString*)abilityScoreName;
|
||||||
|
-(int)strengthModifier;
|
||||||
|
-(int)dexterityModifier;
|
||||||
|
-(int)constitutionModifier;
|
||||||
|
-(int)intelligenceModifier;
|
||||||
|
-(int)wisdomModifier;
|
||||||
|
-(int)charismaModifier;
|
||||||
|
//getArmorClass
|
||||||
|
-(NSString*)armorClassDescription;
|
||||||
|
//getHitPoints
|
||||||
|
-(NSString*)hitPointsDescription;
|
||||||
|
//getSpeedText
|
||||||
|
-(NSString*)speedDescription;
|
||||||
|
-(NSString*)strengthDescription;
|
||||||
|
-(NSString*)dexterityDescription;
|
||||||
|
-(NSString*)constitutionDescription;
|
||||||
|
-(NSString*)intelligenceDescription;
|
||||||
|
-(NSString*)wisdomDescription;
|
||||||
|
-(NSString*)charismaDescription;
|
||||||
|
-(NSSet*)savingThrows;
|
||||||
|
-(void)addSavingThrow: (SavingThrow*)savingThrow;
|
||||||
|
-(void)remvoeSavingThrow: (SavingThrow*)savingThrow;
|
||||||
|
-(void)clearSavingThrows;
|
||||||
|
-(NSString*)savingThrowsDescription;
|
||||||
|
-(int)proficiencyBonus;
|
||||||
|
-(void)addSkill: (Skill*)skill;
|
||||||
|
-(void)removeSkill: (Skill*)skill;
|
||||||
|
-(void)clearSkills;
|
||||||
|
-(NSString*)skillsDescription;
|
||||||
|
-(void)addDamageType: (DamageType*)damageType;
|
||||||
|
-(void)removeDamageType: (DamageType*)damageType;
|
||||||
|
-(void)clearDamageTypes;
|
||||||
|
-(NSString*)damageImmunitiesDescription;
|
||||||
|
-(NSString*)damageResistancesDescription;
|
||||||
|
-(NSString*)damageVulnerabilitiesDescription;
|
||||||
|
-(void)addConditionImmunity: (NSString*)condition;
|
||||||
|
-(void)removeConditionImmunity: (NSString*)condition;
|
||||||
|
-(void)clearConditionImmunities;
|
||||||
|
-(NSString*)conditionImmunitiesDescription;
|
||||||
|
-(NSString*)sensesDescription;
|
||||||
|
-(void)addLanguage: (Language*)language;
|
||||||
|
-(void)removeLanguage: (Language*)language;
|
||||||
|
-(void)clearLanguages;
|
||||||
|
-(NSString*)languagesDescription;
|
||||||
|
-(NSString*)challengeRatingDescription;
|
||||||
|
-(void)addAbility: (Ability*)ability;
|
||||||
|
-(void)removeAbility: (Ability*)ability;
|
||||||
|
-(void)clearAbilities;
|
||||||
|
-(NSArray*)abilityDescriptions;
|
||||||
|
-(void)addAction: (Action*)action;
|
||||||
|
-(void)removeAction: (Action*)action;
|
||||||
|
-(void)clearActions;
|
||||||
|
-(NSArray*)actionDescriptions;
|
||||||
|
-(NSString*)placeholderReplacedText: (NSString*)text;
|
||||||
|
-(int)savingThrowForAbilityScoreName: (NSString*)abilityScoreName;
|
||||||
|
-(int)spellSaveDCForAbilityScoreName: (NSString*)abilityScoreName;
|
||||||
|
-(int)attackBonusForAbilityScoreName: (NSString*)abilityScoreName;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -10,4 +10,255 @@
|
|||||||
|
|
||||||
@implementation Monster
|
@implementation Monster
|
||||||
|
|
||||||
|
+(int)abilityModifierForScore: (int)score {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
+(int)hitDieForSize: (NSString*)size{
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(id)init {
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
// TODO: Actually initialize the class.
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(id)initWithJSON: (NSString*)jsonData {
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
// TODO: Actually initialize the class.
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)meta {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)abilityScoreForAbilityScoreName: (NSString*)abilityScoreName {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)abilityModifierForAbilityScoreName: (NSString*)abilityScoreName {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)strengthModifier {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)dexterityModifier {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)constitutionModifier {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)intelligenceModifier {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)wisdomModifier {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)charismaModifier {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
//getArmorClass
|
||||||
|
-(NSString*)armorClassDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
//getHitPoints
|
||||||
|
-(NSString*)hitPointsDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
//getSpeedText
|
||||||
|
-(NSString*)speedDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)strengthDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)dexterityDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)constitutionDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)intelligenceDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)wisdomDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)charismaDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSSet*)savingThrows {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addSavingThrow: (SavingThrow*)savingThrow {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)remvoeSavingThrow: (SavingThrow*)savingThrow {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearSavingThrows {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)savingThrowsDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)proficiencyBonus {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addSkill: (Skill*)skill {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)removeSkill: (Skill*)skill {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearSkills {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)skillsDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addDamageType: (DamageType*)damageType {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)removeDamageType: (DamageType*)damageType {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearDamageTypes {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)damageImmunitiesDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)damageResistancesDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)damageVulnerabilitiesDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addConditionImmunity: (NSString*)condition {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)removeConditionImmunity: (NSString*)condition {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearConditionImmunities {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)conditionImmunitiesDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)sensesDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addLanguage: (Language*)language {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)removeLanguage: (Language*)language {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearLanguages {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)languagesDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)challengeRatingDescription {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addAbility: (Ability*)ability {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)removeAbility: (Ability*)ability {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearAbilities {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSArray*)abilityDescriptions {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)addAction: (Action*)action {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)removeAction: (Action*)action {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)clearActions {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSArray*)actionDescriptions {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)placeholderReplacedText: (NSString*)text {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)savingThrowForAbilityScoreName: (NSString*)abilityScoreName {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)spellSaveDCForAbilityScoreName: (NSString*)abilityScoreName {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)attackBonusForAbilityScoreName: (NSString*)abilityScoreName {
|
||||||
|
@throw [[NSException alloc] initWithName:@"unimplemented" reason:@"Method not implemented." userInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -7,11 +7,21 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "Monster.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class Monster;
|
||||||
|
|
||||||
@interface Skill : NSObject
|
@interface Skill : NSObject
|
||||||
|
|
||||||
|
@property NSString* name;
|
||||||
|
@property NSString* abilityScoreName;
|
||||||
|
@property NSString* notes;
|
||||||
|
|
||||||
|
-(id)initWithName: (NSString*)name abilityScoreName:(NSString*)abilityScoreName andNotes:(NSString*)notes;
|
||||||
|
-(int)skillBonusForMonster: (Monster*)monster;
|
||||||
|
-(NSString*)textForMonster: (Monster*)monster;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -10,4 +10,30 @@
|
|||||||
|
|
||||||
@implementation Skill
|
@implementation Skill
|
||||||
|
|
||||||
|
-(id)initWithName: (NSString*)name abilityScoreName:(NSString*)abilityScoreName andNotes:(NSString*)notes{
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
self.name = name;
|
||||||
|
self.abilityScoreName = abilityScoreName;
|
||||||
|
self.notes = notes;
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(int)skillBonusForMonster: (Monster*)monster {
|
||||||
|
int bonus = [monster abilityModifierForAbilityScoreName: self.abilityScoreName];
|
||||||
|
if ([@" (ex)" isEqualToString:self.notes]) {
|
||||||
|
bonus += 2 * monster.proficiencyBonus;
|
||||||
|
} else {
|
||||||
|
bonus += monster.proficiencyBonus;
|
||||||
|
}
|
||||||
|
return bonus;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)textForMonster: (Monster*)monster {
|
||||||
|
int bonus = [self skillBonusForMonster:monster];
|
||||||
|
|
||||||
|
return [NSString stringWithFormat:@"%@%@ %d", [self.name substringToIndex:1], [self.name substringFromIndex:1], bonus];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user