Give crescendo/talent material if we are adding duplicate discs/characters

This commit is contained in:
Melledy
2025-12-07 23:01:46 -08:00
parent 209ce83fc9
commit fa08bcebae
2 changed files with 41 additions and 9 deletions

View File

@@ -58,10 +58,15 @@ public class CharacterStorage extends PlayerManager {
return null; return null;
} }
return this.addCharacter(GameData.getCharacterDataTable().get(charId)); // Get data
var data = GameData.getCharacterDataTable().get(charId);
if (data == null) return null;
// Add character
return this.addCharacter(data);
} }
private GameCharacter addCharacter(CharacterDef data) { public GameCharacter addCharacter(CharacterDef data) {
// Sanity check to make sure we dont have this character already // Sanity check to make sure we dont have this character already
if (this.hasCharacter(data.getId())) { if (this.hasCharacter(data.getId())) {
return null; return null;
@@ -132,10 +137,15 @@ public class CharacterStorage extends PlayerManager {
return null; return null;
} }
return this.addDisc(GameData.getDiscDataTable().get(discId)); // Get data
var data = GameData.getDiscDataTable().get(discId);
if (data == null) return null;
// Add disc
return this.addDisc(data);
} }
private GameDisc addDisc(DiscDef data) { public GameDisc addDisc(DiscDef data) {
// Sanity check to make sure we dont have this disc already // Sanity check to make sure we dont have this disc already
if (this.hasDisc(data.getId())) { if (this.hasDisc(data.getId())) {
return null; return null;

View File

@@ -377,12 +377,23 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
} }
} }
case Disc -> { case Disc -> {
if (amount <= 0) { // Cannot remove discs
if (amount <= 0) break;
// Get disc data
var discData = GameData.getDiscDataTable().get(id);
if (discData == null) break;
// Add transform item instead if we already have this disc
if (getPlayer().getCharacters().hasDisc(id)) {
this.addItem(discData.getTransformItemId(), amount, change);
break; break;
} }
var disc = getPlayer().getCharacters().addDisc(id); // Add disc
var disc = getPlayer().getCharacters().addDisc(discData);
// Add to change info
if (disc != null) { if (disc != null) {
change.add(disc.toProto()); change.add(disc.toProto());
} else { } else {
@@ -390,12 +401,23 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
} }
} }
case Char -> { case Char -> {
if (amount <= 0) { // Cannot remove characters
if (amount <= 0) break;
// Get character data
var charData = GameData.getCharacterDataTable().get(id);
if (charData == null) break;
// Add transform item instead if we already have this character
if (getPlayer().getCharacters().hasCharacter(id)) {
this.addItem(charData.getFragmentsId(), charData.getTransformQty(), change);
break; break;
} }
var character = getPlayer().getCharacters().addCharacter(id); // Add character
var character = getPlayer().getCharacters().addCharacter(charData);
// Add to change info
if (character != null) { if (character != null) {
change.add(character.toProto()); change.add(character.toProto());
} else { } else {