This commit is contained in:
Ka0rX 2022-10-16 20:42:53 +02:00
parent 110dad2f5e
commit adbfdb97ef

View File

@ -60,7 +60,7 @@ public class LinkedSkillTree extends SkillTree {
@Override @Override
public void setupNodeState(PlayerData playerData) { public void setupNodeState(PlayerData playerData) {
//Values are labelled as Unlockable //Values are labelled as unlockable
for (SkillTreeNode root : roots) for (SkillTreeNode root : roots)
playerData.setNodeState(root, NodeState.UNLOCKABLE); playerData.setNodeState(root, NodeState.UNLOCKABLE);
@ -86,7 +86,7 @@ public class LinkedSkillTree extends SkillTree {
} }
/** /**
* We recursively label all the locked node who are connected to an unlockable node * We recursively label all the locked nodes who are connected to an unlockable node.
**/ **/
private void labelLockedNodes(PlayerData playerData) { private void labelLockedNodes(PlayerData playerData) {
List<SkillTreeNode> unlockableNodes = nodes.values().stream().filter(node -> playerData.getNodeState(node) == NodeState.UNLOCKABLE).toList(); List<SkillTreeNode> unlockableNodes = nodes.values().stream().filter(node -> playerData.getNodeState(node) == NodeState.UNLOCKABLE).toList();
@ -121,11 +121,11 @@ public class LinkedSkillTree extends SkillTree {
return isUnlockable; return isUnlockable;
} }
//Counts the number of unlocked neighbours of a node for a certain playerData /**
* Counts the number of unlocked neighbours of a node for a certain playerData
**/
private int countUnlockedNeighbours(IntegerCoordinates coor, PlayerData playerData) { private int countUnlockedNeighbours(IntegerCoordinates coor, PlayerData playerData) {
int number = 0; int number = 0;
int x = coor.getX();
int y = coor.getY();
for (IntegerCoordinates coordinates : getCheckCoordinates(coor)) { for (IntegerCoordinates coordinates : getCheckCoordinates(coor)) {
if (isNode(coordinates) && playerData.getNodeLevel(getNode(coordinates)) > 0) if (isNode(coordinates) && playerData.getNodeLevel(getNode(coordinates)) > 0)
number++; number++;