I have 2 classes, a 'unit' class, and a 'skill' class.
protected ArrayList<Skill> skills;
protected double skillHaste;
}```
```public class Skill {
protected final double baseCooldown;
protected double cooldown;
protected double getCooldown() {
return this.baseCooldown / (1 + skillHaste); //Error as skillHaste is unknown
}
}```
My problem is the 'Skill' class does not have access to the 'Unit' class. How can I resolve this problem where I need the skill haste information from the 'Unit' class in the 'Skill' class?
I thought about using 'Unit' class a field in the 'Skill' class, but I've read that it's anti-pattern. Is there a better solution?