Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUFFED_HP and BUFFED_MP have a different formula in Grey You #791

Merged
merged 7 commits into from
Jun 1, 2022
4 changes: 4 additions & 0 deletions src/net/sourceforge/kolmafia/KoLCharacter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,10 @@ public static final boolean isVampyre() {
return ascensionClass == AscensionClass.VAMPYRE;
}

public static final boolean isGreyGoo() {
return ascensionClass == AscensionClass.GREY_GOO;
}

public static final boolean isMoxieClass() {
return ascensionClass != null && ascensionClass.getPrimeStatIndex() == 2;
}
Expand Down
33 changes: 24 additions & 9 deletions src/net/sourceforge/kolmafia/Modifiers.java
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,10 @@ public int[] predict() {
hpbase = 30;
hp = hpbase + (int) this.get(Modifiers.HP);
buffedHP = hp;
} else if (KoLCharacter.isGreyGoo()) {
hpbase = (int) KoLCharacter.getBaseMaxHP();
hp = hpbase + (int) this.get(Modifiers.HP);
buffedHP = hp;
} else {
hpbase = rv[Modifiers.BUFFED_MUS] + 3;
double C = KoLCharacter.isMuscleClass() ? 1.5 : 1.0;
Expand All @@ -1101,15 +1105,26 @@ public int[] predict() {
}
rv[Modifiers.BUFFED_HP] = buffedHP;

int mpbase = rv[Modifiers.BUFFED_MYS];
if (this.getBoolean(Modifiers.MOXIE_CONTROLS_MP)
|| (this.getBoolean(Modifiers.MOXIE_MAY_CONTROL_MP) && rv[Modifiers.BUFFED_MOX] > mpbase)) {
mpbase = rv[Modifiers.BUFFED_MOX];
}
double C = KoLCharacter.isMysticalityClass() ? 1.5 : 1.0;
double mpPercent = this.get(Modifiers.MP_PCT);
int mp = (int) Math.ceil(mpbase * (C + mpPercent / 100.0)) + (int) this.get(Modifiers.MP);
rv[Modifiers.BUFFED_MP] = Math.max(mp, mys);
int mpbase;
int mp;
int buffedMP;
if (KoLCharacter.isGreyGoo()) {
mpbase = (int) KoLCharacter.getBaseMaxMP();
mp = mpbase + (int) this.get(Modifiers.MP);
buffedMP = mp;
} else {
mpbase = rv[Modifiers.BUFFED_MYS];
if (this.getBoolean(Modifiers.MOXIE_CONTROLS_MP)
|| (this.getBoolean(Modifiers.MOXIE_MAY_CONTROL_MP)
&& rv[Modifiers.BUFFED_MOX] > mpbase)) {
mpbase = rv[Modifiers.BUFFED_MOX];
}
double C = KoLCharacter.isMysticalityClass() ? 1.5 : 1.0;
double mpPercent = this.get(Modifiers.MP_PCT);
mp = (int) Math.ceil(mpbase * (C + mpPercent / 100.0)) + (int) this.get(Modifiers.MP);
buffedMP = Math.max(mp, mys);
}
rv[Modifiers.BUFFED_MP] = buffedMP;

return rv;
}
Expand Down
3 changes: 3 additions & 0 deletions src/net/sourceforge/kolmafia/objectpool/ItemPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ItemPool {
public static final int SPIDER_WEB = 27;
public static final int BIG_ROCK = 30;
public static final int BJORNS_HAMMER = 32;
public static final int VIKING_HELMET = 37;
public static final int CASINO_PASS = 40;
public static final int SCHLITZ = 41;
public static final int HERMIT_PERMIT = 42;
Expand Down Expand Up @@ -667,6 +668,7 @@ public class ItemPool {
public static final int BETTER_THAN_CUDDLING_CAKE = 2332;
public static final int STUFFED_NINJA_SNOWMAN = 2333;
public static final int HOLY_MACGUFFIN = 2334;
public static final int REINFORCED_BEADED_HEADBAND = 2337;
public static final int BLACK_PUDDING = 2338;
public static final int BLACKFLY_CHARDONNAY = 2339;
public static final int FILTHWORM_QUEEN_HEART = 2347;
Expand Down Expand Up @@ -3341,6 +3343,7 @@ public class ItemPool {
public static final int CATHERINE_WHEEL = 10770;
public static final int ROCKET_BOOTS = 10771;
public static final int OVERSIZED_SPARKLER = 10772;
public static final int EXTRA_WIDE_HEAD_CANDLE = 10783;
public static final int BLART = 10790;
public static final int RAINPROOF_BARREL_CAULK = 10794;
public static final int PUMP_GREASE = 10795;
Expand Down
12 changes: 12 additions & 0 deletions test/internal/helpers/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ public static Cleanups setStats(int muscle, int mysticality, int moxie) {
return new Cleanups(() -> setStats(0, 0, 0));
}

public static Cleanups setHP(long current, long maximum, long base) {
KoLCharacter.setHP(current, maximum, base);
KoLCharacter.recalculateAdjustments();
return new Cleanups(() -> setHP(0, 0, 0));
}

public static Cleanups setMP(long current, long maximum, long base) {
KoLCharacter.setMP(current, maximum, base);
KoLCharacter.recalculateAdjustments();
return new Cleanups(() -> setMP(0, 0, 0));
}

public static Cleanups isClass(AscensionClass ascensionClass) {
var old = KoLCharacter.getAscensionClass();
KoLCharacter.setAscensionClass(ascensionClass);
Expand Down