mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 16:56:11 +00:00
Rerolls lock rarity tiers and price accordingly
This commit is contained in:
parent
35cc37deb6
commit
de77db70d7
@ -695,7 +695,7 @@ export class EnemyInstantReviveChanceModifierType extends ModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ModifierTypeFunc = () => ModifierType;
|
export type ModifierTypeFunc = () => ModifierType;
|
||||||
type WeightedModifierTypeWeightFunc = (party: Pokemon[]) => integer;
|
type WeightedModifierTypeWeightFunc = (party: Pokemon[], rerollCount?: integer) => integer;
|
||||||
|
|
||||||
class WeightedModifierType {
|
class WeightedModifierType {
|
||||||
public modifierType: ModifierType;
|
public modifierType: ModifierType;
|
||||||
@ -1019,7 +1019,7 @@ const modifierPool: ModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.EXP_SHARE, 12),
|
new WeightedModifierType(modifierTypes.EXP_SHARE, 12),
|
||||||
new WeightedModifierType(modifierTypes.EXP_BALANCE, 4),
|
new WeightedModifierType(modifierTypes.EXP_BALANCE, 4),
|
||||||
new WeightedModifierType(modifierTypes.TERA_ORB, (party: Pokemon[]) => Math.min(Math.max(Math.floor(party[0].scene.currentBattle.waveIndex / 50) * 2, 1), 4), 4),
|
new WeightedModifierType(modifierTypes.TERA_ORB, (party: Pokemon[]) => Math.min(Math.max(Math.floor(party[0].scene.currentBattle.waveIndex / 50) * 2, 1), 4), 4),
|
||||||
new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[]) => !party[0].scene.gameMode.isDaily ? 3 : 0, 3),
|
new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(3 - rerollCount, 0) : 0, 3),
|
||||||
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
|
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
|
||||||
[ModifierTier.ROGUE]: [
|
[ModifierTier.ROGUE]: [
|
||||||
new WeightedModifierType(modifierTypes.ROGUE_BALL, 24),
|
new WeightedModifierType(modifierTypes.ROGUE_BALL, 24),
|
||||||
@ -1040,10 +1040,10 @@ const modifierPool: ModifierPool = {
|
|||||||
].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
|
].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
|
||||||
[ModifierTier.MASTER]: [
|
[ModifierTier.MASTER]: [
|
||||||
new WeightedModifierType(modifierTypes.MASTER_BALL, 32),
|
new WeightedModifierType(modifierTypes.MASTER_BALL, 32),
|
||||||
new WeightedModifierType(modifierTypes.SHINY_CHARM, 18),
|
new WeightedModifierType(modifierTypes.SHINY_CHARM, 14),
|
||||||
new WeightedModifierType(modifierTypes.HEALING_CHARM, 18),
|
new WeightedModifierType(modifierTypes.HEALING_CHARM, 18),
|
||||||
new WeightedModifierType(modifierTypes.MULTI_LENS, 24),
|
new WeightedModifierType(modifierTypes.MULTI_LENS, 18),
|
||||||
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (party: Pokemon[]) => !party[0].scene.gameMode.isDaily ? 8 : 0, 8),
|
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily ? Math.max(9 - rerollCount * 3, 0) : 0, 9),
|
||||||
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
|
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
|
||||||
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 1 : 0, 1),
|
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 1 : 0, 1),
|
||||||
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
|
].map(m => { m.setTier(ModifierTier.MASTER); return m; })
|
||||||
@ -1175,7 +1175,7 @@ let enemyBuffIgnoredPoolIndexes = {};
|
|||||||
|
|
||||||
const tierWeights = [ 769 / 1024, 192 / 1024, 48 / 1024, 12 / 1024, 1 / 1024 ];
|
const tierWeights = [ 769 / 1024, 192 / 1024, 48 / 1024, 12 / 1024, 1 / 1024 ];
|
||||||
|
|
||||||
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType) {
|
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType, rerollCount: integer = 0) {
|
||||||
let pool: ModifierPool;
|
let pool: ModifierPool;
|
||||||
switch (poolType) {
|
switch (poolType) {
|
||||||
case ModifierPoolType.PLAYER:
|
case ModifierPoolType.PLAYER:
|
||||||
@ -1213,7 +1213,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
|
|||||||
|| itemModifierType instanceof FormChangeItemModifierType
|
|| itemModifierType instanceof FormChangeItemModifierType
|
||||||
|| existingModifiers.find(m => m.stackCount < m.getMaxStackCount(party[0].scene, true))
|
|| existingModifiers.find(m => m.stackCount < m.getMaxStackCount(party[0].scene, true))
|
||||||
? weightedModifierType.weight instanceof Function
|
? weightedModifierType.weight instanceof Function
|
||||||
? (weightedModifierType.weight as Function)(party)
|
? (weightedModifierType.weight as Function)(party, rerollCount)
|
||||||
: weightedModifierType.weight as integer
|
: weightedModifierType.weight as integer
|
||||||
: 0;
|
: 0;
|
||||||
if (weightedModifierType.maxWeight) {
|
if (weightedModifierType.maxWeight) {
|
||||||
@ -1267,11 +1267,11 @@ export function getModifierTypeFuncById(id: string): ModifierTypeFunc {
|
|||||||
return modifierTypes[id];
|
return modifierTypes[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemon[]): ModifierTypeOption[] {
|
export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemon[], modifierTiers?: ModifierTier[]): ModifierTypeOption[] {
|
||||||
const options: ModifierTypeOption[] = [];
|
const options: ModifierTypeOption[] = [];
|
||||||
const retryCount = Math.min(count * 5, 50);
|
const retryCount = Math.min(count * 5, 50);
|
||||||
new Array(count).fill(0).map(() => {
|
new Array(count).fill(0).map((_, i) => {
|
||||||
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER);
|
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, modifierTiers?.length > i ? modifierTiers[i] : undefined);
|
||||||
let r = 0;
|
let r = 0;
|
||||||
while (options.length && ++r < retryCount && options.filter(o => o.type.name === candidate.type.name || o.type.group === candidate.type.group).length)
|
while (options.length && ++r < retryCount && options.filter(o => o.type.name === candidate.type.name || o.type.group === candidate.type.group).length)
|
||||||
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate.type.tier, candidate.upgradeCount);
|
candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate.type.tier, candidate.upgradeCount);
|
||||||
@ -1393,6 +1393,7 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType,
|
|||||||
} while (upgraded);
|
} while (upgraded);
|
||||||
}
|
}
|
||||||
tier = tierValue > 255 ? ModifierTier.COMMON : tierValue > 60 ? ModifierTier.GREAT : tierValue > 12 ? ModifierTier.ULTRA : tierValue ? ModifierTier.ROGUE : ModifierTier.MASTER;
|
tier = tierValue > 255 ? ModifierTier.COMMON : tierValue > 60 ? ModifierTier.GREAT : tierValue > 12 ? ModifierTier.ULTRA : tierValue ? ModifierTier.ROGUE : ModifierTier.MASTER;
|
||||||
|
// Does this actually do anything?
|
||||||
if (!upgradeCount)
|
if (!upgradeCount)
|
||||||
upgradeCount = Math.min(upgradeCount, ModifierTier.MASTER - tier);
|
upgradeCount = Math.min(upgradeCount, ModifierTier.MASTER - tier);
|
||||||
tier += upgradeCount;
|
tier += upgradeCount;
|
||||||
@ -1401,6 +1402,19 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType,
|
|||||||
if (upgradeCount)
|
if (upgradeCount)
|
||||||
upgradeCount--;
|
upgradeCount--;
|
||||||
}
|
}
|
||||||
|
} else if (upgradeCount === undefined && player) {
|
||||||
|
upgradeCount = 0;
|
||||||
|
if (tier < ModifierTier.MASTER) {
|
||||||
|
const partyShinyCount = 6;//party.filter(p => p.isShiny() && !p.isFainted()).length;
|
||||||
|
const upgradeOdds = Math.floor(32 / ((partyShinyCount + 2) / 2));
|
||||||
|
while (modifierPool.hasOwnProperty(tier + upgradeCount + 1) && modifierPool[tier + upgradeCount + 1].length) {
|
||||||
|
if (!Utils.randSeedInt(upgradeOdds))
|
||||||
|
upgradeCount++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tier += upgradeCount;
|
||||||
|
}
|
||||||
} else if (retryCount === 10 && tier) {
|
} else if (retryCount === 10 && tier) {
|
||||||
retryCount = 0;
|
retryCount = 0;
|
||||||
tier--;
|
tier--;
|
||||||
|
@ -3878,11 +3878,13 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
|
|
||||||
export class SelectModifierPhase extends BattlePhase {
|
export class SelectModifierPhase extends BattlePhase {
|
||||||
private rerollCount: integer;
|
private rerollCount: integer;
|
||||||
|
private modifierTiers: ModifierTier[];
|
||||||
|
|
||||||
constructor(scene: BattleScene, rerollCount: integer = 0) {
|
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[]) {
|
||||||
super(scene);
|
super(scene);
|
||||||
|
|
||||||
this.rerollCount = rerollCount;
|
this.rerollCount = rerollCount;
|
||||||
|
this.modifierTiers = modifierTiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@ -3892,7 +3894,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
this.updateSeed();
|
this.updateSeed();
|
||||||
|
|
||||||
const party = this.scene.getParty();
|
const party = this.scene.getParty();
|
||||||
regenerateModifierPoolThresholds(party, this.getPoolType());
|
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||||
const modifierCount = new Utils.IntegerHolder(3);
|
const modifierCount = new Utils.IntegerHolder(3);
|
||||||
if (this.isPlayer())
|
if (this.isPlayer())
|
||||||
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
||||||
@ -3905,7 +3907,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
this.scene.ui.revertMode();
|
this.scene.ui.revertMode();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
super.end();
|
super.end();
|
||||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()));
|
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions)));
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3914,12 +3916,12 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
switch (rowCursor) {
|
switch (rowCursor) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!cursor) {
|
if (!cursor) {
|
||||||
const rerollCost = this.getRerollCost();
|
const rerollCost = this.getRerollCost(typeOptions);
|
||||||
if (this.scene.money < rerollCost) {
|
if (this.scene.money < rerollCost) {
|
||||||
this.scene.ui.playError();
|
this.scene.ui.playError();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1));
|
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type.tier)));
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||||
this.scene.money -= rerollCost;
|
this.scene.money -= rerollCost;
|
||||||
@ -3929,14 +3931,14 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
} else {
|
} else {
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => {
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => {
|
||||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost()).then(() => {
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions)).then(() => {
|
||||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||||
const itemModifier = itemModifiers[itemIndex];
|
const itemModifier = itemModifiers[itemIndex];
|
||||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, true);
|
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, true);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost());
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
||||||
}, PartyUiHandler.FilterItemMaxStacks);
|
}, PartyUiHandler.FilterItemMaxStacks);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -3979,7 +3981,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
applyModifier(modifier, true);
|
applyModifier(modifier, true);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost());
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
||||||
}, modifierType.selectFilter);
|
}, modifierType.selectFilter);
|
||||||
} else {
|
} else {
|
||||||
const pokemonModifierType = modifierType as PokemonModifierType;
|
const pokemonModifierType = modifierType as PokemonModifierType;
|
||||||
@ -4004,7 +4006,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
applyModifier(modifier, true);
|
applyModifier(modifier, true);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost());
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
||||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId);
|
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -4012,7 +4014,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
|
|
||||||
return !cost;
|
return !cost;
|
||||||
};
|
};
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost());
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSeed(): void {
|
updateSeed(): void {
|
||||||
@ -4023,8 +4025,12 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRerollCost(): integer {
|
getRerollCost(typeOptions: ModifierTypeOption[]): integer {
|
||||||
return Math.ceil(this.scene.currentBattle.waveIndex / 10) * 250 * Math.pow(2, this.rerollCount);
|
let baseValue = 0;
|
||||||
|
const tierValues = [ 50, 125, 300, 750, 2000 ];
|
||||||
|
for (let opt of typeOptions)
|
||||||
|
baseValue += tierValues[opt.type.tier];
|
||||||
|
return Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPoolType(): ModifierPoolType {
|
getPoolType(): ModifierPoolType {
|
||||||
@ -4032,7 +4038,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
||||||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty());
|
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.modifierTiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
addModifier(modifier: Modifier): Promise<void> {
|
addModifier(modifier: Modifier): Promise<void> {
|
||||||
|
Loading…
Reference in New Issue
Block a user