Skip to content

Commit

Permalink
Fix relics always doing min roll after first roll (#14)
Browse files Browse the repository at this point in the history
* Fix relics always doing min roll after first roll

* Adjust implementation to remove stepNum
  • Loading branch information
AFNGP authored Dec 2, 2023
1 parent dd1ee72 commit a49f245
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/emu/lunarcore/game/inventory/GameItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ private void addNewSubAffix() {

private void upgradeRandomSubAffix() {
ItemSubAffix subAffix = Utils.randomElement(this.subAffixes);
subAffix.incrementCount();
var subAffixExcel = GameData.getRelicSubAffixExcel(this.getExcel().getRelicExcel().getSubAffixGroup(), subAffix.getId());
subAffix.incrementCount(subAffixExcel.getStepNum());
}

/**
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/emu/lunarcore/game/inventory/ItemSubAffix.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.morphia.annotations.Entity;
import emu.lunarcore.data.excel.RelicSubAffixExcel;
import emu.lunarcore.data.GameData;
import emu.lunarcore.proto.RelicAffixOuterClass.RelicAffix;
import emu.lunarcore.util.Utils;
import lombok.Getter;
Expand All @@ -12,7 +13,7 @@ public class ItemSubAffix {
private int id; // Affix id
private int count;
private int step;

@Deprecated
public ItemSubAffix() {
// Morphia only!
Expand All @@ -25,11 +26,12 @@ public ItemSubAffix(RelicSubAffixExcel subAffix) {
public ItemSubAffix(RelicSubAffixExcel subAffix, int count) {
this.id = subAffix.getAffixID();
this.count = count;
this.step = Utils.randomRange(0, subAffix.getStepNum());
this.step = Utils.randomRange(0, 2 * subAffix.getStepNum());
}

public void incrementCount() {
public void incrementCount(int stepNum) {
this.count += 1;
this.step += Utils.randomRange(0, stepNum);
}

public RelicAffix toProto() {
Expand All @@ -40,4 +42,4 @@ public RelicAffix toProto() {

return proto;
}
}
}

0 comments on commit a49f245

Please sign in to comment.