Refactor avatar skilldepot and constellation/talent changing

Ensures Traveler retains talent levels and constellations on inactive elements when switching elements.
Relevant for any other skillDepot-changing activities like Windtrace too, though keeping those in the db might not be as useful.

Refactor avatar talent upgrade and access
Refactor skillExtraCharges
This commit is contained in:
AnimeGitB
2022-08-17 19:48:41 +09:30
parent 78b7fb70ac
commit fb1bacb0f8
14 changed files with 399 additions and 476 deletions

View File

@@ -244,32 +244,11 @@ public final class GiveCommand implements CommandHandler {
}
private static Avatar makeAvatar(AvatarData avatarData, int level, int promoteLevel, int constellation) {
// Calculate ascension level.
Avatar avatar = new Avatar(avatarData);
avatar.setLevel(level);
avatar.setPromoteLevel(promoteLevel);
// Add constellations.
int talentBase = switch (avatar.getAvatarId()) {
case 10000005 -> 70;
case 10000006 -> 40;
default -> (avatar.getAvatarId() - 10000000) * 10;
};
for (int i = 1; i <= constellation; i++) {
avatar.getTalentIdList().add(talentBase + i);
}
// Main character needs skill depot manually added.
if (avatar.getAvatarId() == GameConstants.MAIN_CHARACTER_MALE) {
avatar.setSkillDepotData(GameData.getAvatarSkillDepotDataMap().get(504));
}
else if (avatar.getAvatarId() == GameConstants.MAIN_CHARACTER_FEMALE) {
avatar.setSkillDepotData(GameData.getAvatarSkillDepotDataMap().get(704));
}
avatar.forceConstellationLevel(constellation);
avatar.recalcStats();
return avatar;
}