extend ability system to support dynamic slot counts, add skill tree validation, new prerequisites API, and extended mod commands

This commit is contained in:
2026-05-25 12:43:13 +02:00
parent 77fbada438
commit 7f5830d409
8 changed files with 56 additions and 22 deletions
@@ -33,7 +33,7 @@ public class SkillLogic {
int totalCost = 0;
for (SkillNode plannedNode : plan) {
totalCost += plannedNode.getCost();
totalCost += Math.max(0, plannedNode.getCost());
}
if (data.getSkillPoints() < totalCost) {
return Optional.empty();
@@ -33,6 +33,9 @@ public final class SkillTreeValidator {
if (!isPngTexture(node.getIcons())) {
issues.add(node.getId() + " has invalid icon path " + node.getIcons() + " (expected a .png texture)");
}
if (node.getCost() < 0) {
issues.add(node.getId() + " has negative cost " + node.getCost());
}
for (ResourceLocation parent : node.getLinks()) {
if (SkillNodeRegistry.get(parent) == null) {
issues.add(node.getId() + " links to missing skill node " + parent);
@@ -83,6 +86,9 @@ public final class SkillTreeValidator {
if (!isPngTexture(ability.getIcon())) {
issues.add(ability.getId() + " has invalid icon path " + ability.getIcon() + " (expected a .png texture)");
}
if (ability.getCooldown() < 0) {
issues.add(ability.getId() + " has negative cooldown " + ability.getCooldown());
}
for (ResourceLocation parent : ability.getLinks()) {
if (SkillNodeRegistry.get(parent) == null && AbilityNodeRegistry.get(parent) == null) {
issues.add(ability.getId() + " links to missing node or ability " + parent);