I am trying to create an outline of what a character is in a game.
Then I want to create 10 different characters and compare their stats at different levels.
I am creating an interface called Hero
that looks like this,
public interface Hero {
// define methods that must be defined across all character types
public int getLevel();
public String getPrimaryAttribute();
public String getAttackType();
public String getAbility1();
public String getAbility2();
public String getAbility3();
public String getAbility4();
public double getStrength();
public double getStrengthMultiplier();
public double getAgility();
public double getAgilityMultiplier();
public double getIntelligence();
public double getIntelligenceMultiplier();
public int getHealth();
public int getMana();
public int getDamageMin();
public int getDamageMax();
public int getRange();
public double getArmor();
public int getMovement();
}
Then I am creating each character like this,
public class DrowRanger implements Hero {
private int level = 0;
private String primaryAttribute = "Agility";
private String attackType = "Ranged";
private String ability1 = "Frost Arrows";
private String ability2 = "Gust";
private String ability3 = "Precision Aura";
private String ability4 = "Marksmanship";
private double strength = 17;
private double strengthMultiplier = 1.9;
private double agility;
private double agilityMultiplier = 1.9;
private double intelligence = 15;
private double intelligenceMultiplier = 1.4;
private int health = 473;
private int mana = 195;
private int damageMin = 44;
private int damageMax = 55;
private int range = 625;
private double armor = 0.64;
private int movement = 300;
//default constructor
public DrowRanger() {
}
// override as many times as you'd like
public DrowRanger(int level) {
this.level = level;
}
// getters and setters - required to implement ALL from interface
public int getLevel() {
return this.level;
}
public String getPrimaryAttribute() {
return this.primaryAttribute;
}
public String getAttackType() {
return this.attackType;
}
public String getAbility1() {
return this.ability1;
}
public String getAbility2() {
return this.ability2;
}
public String getAbility3() {
return this.ability3;
}
public String getAbility4() {
return this.ability4;
}
public double getStrength() {
return this.strength;
}
public double getStrengthMultiplier() {
return this.strengthMultiplier;
}
public double getAgility() {
return this.agility;
}
public double getAgilityMultiplier() {
return this.agilityMultiplier;
}
public double getIntelligence() {
return this.intelligence;
}
public double getIntelligenceMultiplier() {
return this.intelligenceMultiplier;
}
public int getHealth() {
return this.health;
}
public int getMana() {
return this.mana;
}
public int getDamageMin() {
return this.damageMin;
}
public int getDamageMax() {
return this.damageMax;
}
public int getRange() {
return this.range;
}
public double getArmor() {
return this.armor;
}
public int getMovement() {
return this.movement;
}
// This is where the setters are.
public void setLevel(int level) {
this.level = level;
}
public void setPrimaryAttribute(String primaryAttribute) {
this.primaryAttribute = primaryAttribute;
}
public void setAttackType(String attackType) {
this.attackType = attackType;
}
public void setAbility1(String ability1) {
this.ability1 = ability1;
}
public void setAbility2(String ability2) {
this.ability2 = ability2;
}
public void setAbility3String(String ability3) {
this.ability3 = ability3;
}
public void setAbility4(String ability4) {
this.ability4 = ability4;
}
public void setStrength(double strength) {
this.strength = strength;
}
public void setStrengthMultiplier(double strengthMultiplier) {
this.strengthMultiplier = strengthMultiplier;
}
public void setAgility(double agility) {
this.agility = agility;
}
public void setAgilityMultiplier(double agilityMultiplier) {
this.agilityMultiplier = agilityMultiplier;
}
public void setIntelligence(double intelligence) {
this.intelligence = intelligence;
}
public void setIntelligenceMultiplier(double intelligenceMultiplier) {
this.intelligenceMultiplier = intelligenceMultiplier;
}
public void setHealth(int health) {
this.health = health;
}
public void setMana(int mana) {
this.mana = mana;
}
public void setDamageMin(int damageMin) {
this.damageMin = damageMin;
}
public void setDamageMax(int damageMax) {
this.damageMax = damageMax;
}
public void setRange(int range) {
this.range = range;
}
public void setArmor(double armor) {
this.armor = armor;
}
public void setMovement(int movement) {
this.movement = movement;
}
} // End DrowRanger Class
Am I on the right path here?
n
number of characters with arbitrary attributes based on thatCharacter
template? or are you creating a specific character type with different attributes, likeBarbarian
,Wizard
,Hunter
? I'm a bit confused. If your problem is the first one, then it's easy, just make a Factory for character generation with random values/attributes, but if your problem is the second one, then we have a lot of work to do. :) \$\endgroup\$