Calculate IVs twice for hatched Pokemon to improve overall IVs

pull/14/head
Flashfyre 2023-12-20 13:05:11 -05:00
parent c3c4446930
commit 5883c2fafd
2 changed files with 23 additions and 9 deletions

View File

@ -402,6 +402,20 @@ export class EggHatchPhase extends BattlePhase {
}
ret.trySetShiny(this.egg.gachaType === GachaType.SHINY ? 1024 : 512);
this.scene.executeWithSeedOffset(() => {
const secondaryId = Utils.randSeedInt(4294967295);
const secondaryIvs = [
Utils.binToDec(Utils.decToBin(secondaryId).substring(0, 5)),
Utils.binToDec(Utils.decToBin(secondaryId).substring(5, 10)),
Utils.binToDec(Utils.decToBin(secondaryId).substring(10, 15)),
Utils.binToDec(Utils.decToBin(secondaryId).substring(15, 20)),
Utils.binToDec(Utils.decToBin(secondaryId).substring(20, 25)),
Utils.binToDec(Utils.decToBin(secondaryId).substring(25, 30))
];
for (let s = 0; s < ret.ivs.length; s++)
ret.ivs[s] = Math.max(ret.ivs[s], secondaryIvs[s]);
}, ret.id, EGG_SEED.toString());
return ret;
}

View File

@ -79,6 +79,15 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
{
(function() {
for (let achv of voucherAchvs) {
const voucherType = achv.score >= 150
? VoucherType.PREMIUM
: achv.score >= 75
? VoucherType.PLUS
: VoucherType.REGULAR;
vouchers[achv.id] = new Voucher(voucherType, achv.description);
}
const bossTrainerTypes = Object.keys(trainerConfigs)
.filter(tt => trainerConfigs[tt].isBoss && trainerConfigs[tt].getDerivedType() !== TrainerType.RIVAL);
@ -90,15 +99,6 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
vouchers[key] = new Voucher(voucherType, `Defeat ${trainerConfigs[trainerType].name}`);
}
for (let achv of voucherAchvs) {
const voucherType = achv.score >= 150
? VoucherType.PREMIUM
: achv.score >= 100
? VoucherType.PLUS
: VoucherType.REGULAR;
vouchers[achv.id] = new Voucher(voucherType, achv.description);
}
const voucherKeys = Object.keys(vouchers);
for (let k of voucherKeys)
vouchers[k].id = k;