Standardizing the 6 stats classes
This commit is contained in:
@@ -6,22 +6,57 @@ public class CharacterStats {
|
||||
|
||||
public CharacterStats() {
|
||||
|
||||
stats = new Stats[]{};
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement constructor, validates all proposed ability scores and creates new objects containing corresponding values.
|
||||
public CharacterStats(int str, int dex, int con, int intel, int wis, int cha) {
|
||||
|
||||
this.stats = new Stats[]{
|
||||
|
||||
new Strength(str),
|
||||
new Dexterity(dex),
|
||||
new Constitution(con),
|
||||
new Intelligence(intel),
|
||||
new Wisdom(wis),
|
||||
new Charisma(cha)
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// FIXME: Need to implement constructor, validates all proposed ability scores and creates new objects containing corresponding values.
|
||||
public CharacterStats(Strength str, Dexterity dex, Constitution con, Intelligence intel, Wisdom wis, Charisma cha) {
|
||||
|
||||
this.stats = new Stats[]{str, dex, con, intel, wis, cha};
|
||||
|
||||
}
|
||||
|
||||
// FIXME: Need to implement ability score validation.
|
||||
// TODO: Need to implement ability score validation.
|
||||
public boolean validateAbilityScore(int abilityScore) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public Stats[] getStats() {
|
||||
|
||||
return stats;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Allows for access to a particular stat.
|
||||
*
|
||||
* @param int stat
|
||||
* @return a specific stat
|
||||
*
|
||||
*/
|
||||
public Stats getStats(int stat) {
|
||||
|
||||
return stats[stat];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,28 +2,47 @@ package com.builder;
|
||||
|
||||
public class Charisma extends Stats {
|
||||
|
||||
@Override
|
||||
int getScore() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
private int abilityScore;
|
||||
private int abilityScoreModifier;
|
||||
|
||||
public Charisma(int abilityScore) {
|
||||
|
||||
this.abilityScore = abilityScore;
|
||||
this.abilityScoreModifier = calcSavingThrow(abilityScore);
|
||||
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
|
||||
return abilityScore;
|
||||
|
||||
}
|
||||
|
||||
public int getModifier() {
|
||||
|
||||
return abilityScoreModifier;
|
||||
|
||||
}
|
||||
|
||||
public int getSavingThrow() {
|
||||
|
||||
return getModifier();
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need description.
|
||||
public String getDescription() {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
int getModifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
public String toString() {
|
||||
|
||||
@Override
|
||||
String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
return "Ability Score: " + abilityScore + " | Modifier: " + abilityScoreModifier + " | Description: "
|
||||
+ getDescription();
|
||||
|
||||
@Override
|
||||
int getSavingThrow() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,28 +2,47 @@ package com.builder;
|
||||
|
||||
public class Constitution extends Stats {
|
||||
|
||||
@Override
|
||||
int getScore() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
private int abilityScore;
|
||||
private int abilityScoreModifier;
|
||||
|
||||
public Constitution(int abilityScore) {
|
||||
|
||||
this.abilityScore = abilityScore;
|
||||
this.abilityScoreModifier = calcSavingThrow(abilityScore);
|
||||
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
|
||||
return abilityScore;
|
||||
|
||||
}
|
||||
|
||||
public int getModifier() {
|
||||
|
||||
return abilityScoreModifier;
|
||||
|
||||
}
|
||||
|
||||
public int getSavingThrow() {
|
||||
|
||||
return getModifier();
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need description.
|
||||
public String getDescription() {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
int getModifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
public String toString() {
|
||||
|
||||
@Override
|
||||
String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
return "Ability Score: " + abilityScore + " | Modifier: " + abilityScoreModifier + " | Description: "
|
||||
+ getDescription();
|
||||
|
||||
@Override
|
||||
int getSavingThrow() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Dexterity extends Stats {
|
||||
|
||||
}
|
||||
|
||||
// FIXME: Need to implement.
|
||||
// TODO: Need description.
|
||||
public String getDescription() {
|
||||
|
||||
return "";
|
||||
|
||||
@@ -2,28 +2,47 @@ package com.builder;
|
||||
|
||||
public class Intelligence extends Stats{
|
||||
|
||||
@Override
|
||||
int getScore() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
private int abilityScore;
|
||||
private int abilityScoreModifier;
|
||||
|
||||
public Intelligence(int abilityScore) {
|
||||
|
||||
this.abilityScore = abilityScore;
|
||||
this.abilityScoreModifier = calcSavingThrow(abilityScore);
|
||||
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
|
||||
return abilityScore;
|
||||
|
||||
}
|
||||
|
||||
public int getModifier() {
|
||||
|
||||
return abilityScoreModifier;
|
||||
|
||||
}
|
||||
|
||||
public int getSavingThrow() {
|
||||
|
||||
return getModifier();
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need description.
|
||||
public String getDescription() {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
int getModifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
public String toString() {
|
||||
|
||||
@Override
|
||||
String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
return "Ability Score: " + abilityScore + " | Modifier: " + abilityScoreModifier + " | Description: "
|
||||
+ getDescription();
|
||||
|
||||
@Override
|
||||
int getSavingThrow() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* Object stores information about a character's skills arrays. Firstly, the name of each skill, and secondly the value of each skill. When constructed, a private method is called
|
||||
* which adds any proficiency bonus to each skill and then adds the ability score modifier to each skill.
|
||||
*
|
||||
*/
|
||||
public class Skills {
|
||||
|
||||
// TODO: Need to verify skills are in correct order.
|
||||
private String[] allSkillsText = {"Acrobatics", "Animal Handling", "Arcana", "Athletics", "Deception", "History", "Insight", "Intimidation", "Investigation", "Medicine", "Nature", "Perception", "Performance", "Persuasion", "Religion", "Sleight of Hand", "Stealth", "Survival"};
|
||||
|
||||
// TODO: Need to verify these are the correct ability scores for each skill.
|
||||
private int[] skillsAbilities = {1, 4, 3, 0, 5, 3, 4, 5, 3, 4, 3, 4, 5, 5, 3, 1, 4};
|
||||
|
||||
private final int profBonus = 5;
|
||||
|
||||
private Stats[] stats;
|
||||
@@ -17,8 +20,7 @@ public class Skills {
|
||||
|
||||
/**
|
||||
*
|
||||
* Default constructor for the Skills class. Should be constructed AFTER the user has generated their stats and chosen the skills they are
|
||||
* proficient in.
|
||||
* Default constructor for the Skills class. Should be constructed AFTER the user has generated their stats and chosen the skills they are proficient in.
|
||||
*
|
||||
* @param int[] skills
|
||||
* @param Stats[] stats
|
||||
@@ -41,6 +43,9 @@ public class Skills {
|
||||
*/
|
||||
private void setSkills() {
|
||||
|
||||
// TODO: Need to verify these are the correct ability scores for each skill.
|
||||
int[] skillsAbilities = { 1, 4, 3, 0, 5, 3, 4, 5, 3, 4, 3, 4, 5, 5, 3, 1, 4 };
|
||||
|
||||
for(int i = 0; i < allSkillsText.length; i++) {
|
||||
|
||||
if(skills[i] == 1) {
|
||||
|
||||
@@ -5,7 +5,6 @@ public class Strength extends Stats {
|
||||
private int abilityScore;
|
||||
private int abilityScoreModifier;
|
||||
|
||||
// FIXME: Need to implement standard constructor.
|
||||
public Strength(int abilityScore) {
|
||||
|
||||
this.abilityScore = abilityScore;
|
||||
@@ -13,6 +12,13 @@ public class Strength extends Stats {
|
||||
|
||||
}
|
||||
|
||||
public Strength(Strength str) {
|
||||
|
||||
this.abilityScore = str.getScore();
|
||||
this.abilityScoreModifier = str.getModifier();
|
||||
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
|
||||
return abilityScore;
|
||||
|
||||
@@ -2,28 +2,47 @@ package com.builder;
|
||||
|
||||
public class Wisdom extends Stats {
|
||||
|
||||
@Override
|
||||
int getScore() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
private int abilityScore;
|
||||
private int abilityScoreModifier;
|
||||
|
||||
public Wisdom(int abilityScore) {
|
||||
|
||||
this.abilityScore = abilityScore;
|
||||
this.abilityScoreModifier = calcSavingThrow(abilityScore);
|
||||
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
|
||||
return abilityScore;
|
||||
|
||||
}
|
||||
|
||||
public int getModifier() {
|
||||
|
||||
return abilityScoreModifier;
|
||||
|
||||
}
|
||||
|
||||
public int getSavingThrow() {
|
||||
|
||||
return getModifier();
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need description.
|
||||
public String getDescription() {
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
int getModifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
public String toString() {
|
||||
|
||||
@Override
|
||||
String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
return "Ability Score: " + abilityScore + " | Modifier: " + abilityScoreModifier + " | Description: "
|
||||
+ getDescription();
|
||||
|
||||
@Override
|
||||
int getSavingThrow() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user