public class Composition {
private ArrayList<Tank> tanks;
private ArrayList<DamageDealer> damageDealers;
private ArrayList<Healer> healers;
private ArrayList<Bruiser> bruisers;
private boolean doubleSupport;
private boolean doubleWarrior;
private boolean heavyDamage;
private boolean lockdownProtection;
private int mobility;
private int waveclear;
private int nuMelee;
private int nuRange;
private int lockdown;
private int burstMitigation;
private int sustainedMitigation;
private int damage;
private int burstDamageRating;
private int sustainedDamageRating;
private int frontlineRating;
private int defensiveRating;
private int offensiveRating;
public Composition() {
this.tanks = new ArrayList<Tank>();
this.damageDealers = new ArrayList<DamageDealer>();
this.healers = new ArrayList<Healer>();
this.bruisers = new ArrayList<Bruiser>();
}
private void addMutualContribution(Role r) {
this.mobility += r.getMobility();
this.defensiveRating += r.getPeeling();
this.waveclear += r.getWaveclear();
this.burstMitigation += r.getBurstMitigaion();
this.sustainedMitigation += r.getSustainedMitigation();
}
public void addBruiserContribution(Bruiser b) {
addMutualContribution(b);
this.offensiveRating += b.getPressure();
this.damage += b.getDamage();
this.frontlineRating += b.getFrontlineRating();
addBruiser(b);
}
public void addDDContribution(DamageDealer d) {
addMutualContribution(d);
this.burstDamageRating += d.getBurstDamageRating();
this.sustainedDamageRating += d.getSustainedDamageRating();
this.damage += d.getDamageOutput();
this.offensiveRating += d.getAggression();
addDamageDealer(d);
}
public void addTankContribution(Tank t) {
addMutualContribution(t);
this.defensiveRating += t.getAntiMeleeEffectiveness();
this.offensiveRating += t.getEngage();
this.frontlineRating += t.getFrontlineRating();
addTank(t);
}
public void addHealerContribution(Healer h) {
addMutualContribution(h);
this.burstMitigation += h.getBurstHealing();
this.sustainedMitigation += h.getSustainedHealing();
if (h.hasLockdownProtection()) {
this.lockdownProtection = true;
}
addHealer(h);
}
private void addTank(Tank t) {
tanks.add(t);
if (tanks.size() + bruisers.size() > 1) {
setDoubleWarrior(true);
}
}
private void addHealer(Healer h) {
healers.add(h);
if (healers.size() == 2) {
setDoubleSupport(true);
}
}
private void addDamageDealer(DamageDealer d) {
damageDealers.add(d);
if (damageDealers.size() + bruisers.size() > 2) {
setHeavyDamage(true);
}
}
private void addBruiser(Bruiser b) {
bruisers.add(b);
if(bruisers.size() + damageDealers.size() > 2) {
setHeavyDamage(true);
}
}
private void setDoubleWarrior(boolean b) {
doubleWarrior = b;
}
private void setDoubleSupport(boolean b) {
doubleSupport = b;
}
private void setHeavyDamage(boolean b) {
heavyDamage = b;
}
}
Fleshed out code to include everything relevant to the abstract and subclasses in question
David Tamrazov
- 167
- 1
- 1
- 7