mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Allow for preset moves
This commit is contained in:
parent
02cac77853
commit
02183cee84
@ -3629,9 +3629,9 @@ export default class BattleScene extends SceneBase {
|
||||
) as TurnHeldItemTransferModifier;
|
||||
finalBossMBH.setTransferrableFalse();
|
||||
this.addEnemyModifier(finalBossMBH, false, true);
|
||||
pokemon.generateAndPopulateMoveset(1);
|
||||
this.setFieldScale(0.75);
|
||||
this.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
|
||||
pokemon.generateAndPopulateMoveset();
|
||||
this.currentBattle.double = true;
|
||||
const availablePartyMembers = this.getPlayerParty().filter(p => p.isAllowedInBattle());
|
||||
if (availablePartyMembers.length > 1) {
|
||||
|
@ -3481,8 +3481,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
/** Generates a semi-random moveset for a Pokemon */
|
||||
public generateAndPopulateMoveset(): void {
|
||||
this.moveset = [];
|
||||
public generateAndPopulateMoveset(...presetMoves: Moves[]): void {
|
||||
this.moveset = presetMoves.map(m => new PokemonMove(m));
|
||||
if (presetMoves.length === 4) {
|
||||
return; // Return early if all moves are set
|
||||
}
|
||||
let movePool: [Moves, number][] = [];
|
||||
const allLevelMoves = this.getLevelMoves(1, true, true);
|
||||
if (!allLevelMoves) {
|
||||
@ -3669,6 +3672,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
)),
|
||||
]);
|
||||
|
||||
// Filter out preset moves, do it here so they still have an impact on the weight of other moves
|
||||
movePool = movePool.filter(m => !this.moveset.some(
|
||||
pm => pm.moveId === m[0]
|
||||
));
|
||||
|
||||
// Weight damaging moves against the lower stat. This uses a non-linear relationship.
|
||||
// If the higher stat is 1 - 1.09x higher, no change. At higher stat ~1.38x lower stat, off-stat moves have half weight.
|
||||
// One third weight at ~1.58x higher, one quarter weight at ~1.73x higher, one fifth at ~1.87x, and one tenth at ~2.35x higher.
|
||||
@ -3700,7 +3708,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
]);
|
||||
|
||||
// Trainers and bosses always force a stab move
|
||||
if (this.hasTrainer() || this.isBoss()) {
|
||||
if ((this.hasTrainer() || this.isBoss()) && !presetMoves.some(m => this.isOfType(allMoves[m].type))) {
|
||||
const stabMovePool = baseWeights.filter(
|
||||
m =>
|
||||
allMoves[m[0]].category !== MoveCategory.STATUS &&
|
||||
@ -7177,18 +7185,17 @@ export class EnemyPokemon extends Pokemon {
|
||||
}
|
||||
}
|
||||
|
||||
generateAndPopulateMoveset(formIndex?: number): void {
|
||||
switch (true) {
|
||||
case this.species.speciesId === Species.SMEARGLE:
|
||||
generateAndPopulateMoveset(...presetMoves: Moves[]): void {
|
||||
if (this.species.speciesId === Species.SMEARGLE) {
|
||||
this.moveset = [
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
];
|
||||
break;
|
||||
case this.species.speciesId === Species.ETERNATUS:
|
||||
this.moveset = (formIndex !== undefined ? formIndex : this.formIndex)
|
||||
}
|
||||
else if (this.species.speciesId === Species.ETERNATUS) {
|
||||
this.moveset = this.formIndex === 1
|
||||
? [
|
||||
new PokemonMove(Moves.DYNAMAX_CANNON),
|
||||
new PokemonMove(Moves.CROSS_POISON),
|
||||
@ -7204,10 +7211,9 @@ export class EnemyPokemon extends Pokemon {
|
||||
if (globalScene.gameMode.hasChallenge(Challenges.INVERSE_BATTLE)) {
|
||||
this.moveset[2] = new PokemonMove(Moves.THUNDERBOLT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.generateAndPopulateMoveset();
|
||||
break;
|
||||
}
|
||||
else {
|
||||
super.generateAndPopulateMoveset(...presetMoves);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user