properly add ascension-locked talents

This commit is contained in:
SpikeHD 2022-04-19 02:06:58 -07:00
parent cc9beed961
commit ed448a9f84
2 changed files with 22 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GenshinData;
import emu.grasscutter.data.def.ItemData;
import emu.grasscutter.data.def.AvatarData;
import emu.grasscutter.data.def.AvatarSkillDepotData;
import emu.grasscutter.data.def.MonsterData;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.World;
@ -254,6 +255,9 @@ public final class PlayerCommands {
GenshinAvatar avatar = new GenshinAvatar(avatarID);
avatar.setLevel(level);
avatar.setPromoteLevel(ascension);
// This will handle stats and talents
avatar.recalcStats();
targetPlayer.addAvatar(avatar);
}
@ -291,6 +295,9 @@ public final class PlayerCommands {
GenshinAvatar avatar = new GenshinAvatar(avatarID);
avatar.setLevel(level);
avatar.setPromoteLevel(ascension);
// This will handle stats and talents
avatar.recalcStats();
targetPlayer.addAvatar(avatar);
} catch (NumberFormatException ignored) {

View File

@ -510,6 +510,21 @@ public class GenshinAvatar {
}
}
// Add proud skills and unlock them if needed
AvatarSkillDepotData skillDepot = GenshinData.getAvatarSkillDepotDataMap().get(this.getSkillDepotId());
this.getProudSkillList().clear();
for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) {
if (openData.getProudSkillGroupId() == 0) {
continue;
}
if (openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()) {
int proudSkillId = (openData.getProudSkillGroupId() * 100) + 1;
if (GenshinData.getProudSkillDataMap().containsKey(proudSkillId)) {
this.getProudSkillList().add(proudSkillId);
}
}
}
// Proud skills
for (int proudSkillId : this.getProudSkillList()) {
ProudSkillData proudSkillData = GenshinData.getProudSkillDataMap().get(proudSkillId);