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;
|
) as TurnHeldItemTransferModifier;
|
||||||
finalBossMBH.setTransferrableFalse();
|
finalBossMBH.setTransferrableFalse();
|
||||||
this.addEnemyModifier(finalBossMBH, false, true);
|
this.addEnemyModifier(finalBossMBH, false, true);
|
||||||
pokemon.generateAndPopulateMoveset(1);
|
|
||||||
this.setFieldScale(0.75);
|
this.setFieldScale(0.75);
|
||||||
this.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
|
this.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
|
||||||
|
pokemon.generateAndPopulateMoveset();
|
||||||
this.currentBattle.double = true;
|
this.currentBattle.double = true;
|
||||||
const availablePartyMembers = this.getPlayerParty().filter(p => p.isAllowedInBattle());
|
const availablePartyMembers = this.getPlayerParty().filter(p => p.isAllowedInBattle());
|
||||||
if (availablePartyMembers.length > 1) {
|
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 */
|
/** Generates a semi-random moveset for a Pokemon */
|
||||||
public generateAndPopulateMoveset(): void {
|
public generateAndPopulateMoveset(...presetMoves: Moves[]): void {
|
||||||
this.moveset = [];
|
this.moveset = presetMoves.map(m => new PokemonMove(m));
|
||||||
|
if (presetMoves.length === 4) {
|
||||||
|
return; // Return early if all moves are set
|
||||||
|
}
|
||||||
let movePool: [Moves, number][] = [];
|
let movePool: [Moves, number][] = [];
|
||||||
const allLevelMoves = this.getLevelMoves(1, true, true);
|
const allLevelMoves = this.getLevelMoves(1, true, true);
|
||||||
if (!allLevelMoves) {
|
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.
|
// 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.
|
// 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.
|
// 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
|
// 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(
|
const stabMovePool = baseWeights.filter(
|
||||||
m =>
|
m =>
|
||||||
allMoves[m[0]].category !== MoveCategory.STATUS &&
|
allMoves[m[0]].category !== MoveCategory.STATUS &&
|
||||||
@ -7177,18 +7185,17 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generateAndPopulateMoveset(formIndex?: number): void {
|
generateAndPopulateMoveset(...presetMoves: Moves[]): void {
|
||||||
switch (true) {
|
if (this.species.speciesId === Species.SMEARGLE) {
|
||||||
case this.species.speciesId === Species.SMEARGLE:
|
|
||||||
this.moveset = [
|
this.moveset = [
|
||||||
new PokemonMove(Moves.SKETCH),
|
new PokemonMove(Moves.SKETCH),
|
||||||
new PokemonMove(Moves.SKETCH),
|
new PokemonMove(Moves.SKETCH),
|
||||||
new PokemonMove(Moves.SKETCH),
|
new PokemonMove(Moves.SKETCH),
|
||||||
new PokemonMove(Moves.SKETCH),
|
new PokemonMove(Moves.SKETCH),
|
||||||
];
|
];
|
||||||
break;
|
}
|
||||||
case this.species.speciesId === Species.ETERNATUS:
|
else if (this.species.speciesId === Species.ETERNATUS) {
|
||||||
this.moveset = (formIndex !== undefined ? formIndex : this.formIndex)
|
this.moveset = this.formIndex === 1
|
||||||
? [
|
? [
|
||||||
new PokemonMove(Moves.DYNAMAX_CANNON),
|
new PokemonMove(Moves.DYNAMAX_CANNON),
|
||||||
new PokemonMove(Moves.CROSS_POISON),
|
new PokemonMove(Moves.CROSS_POISON),
|
||||||
@ -7204,10 +7211,9 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
if (globalScene.gameMode.hasChallenge(Challenges.INVERSE_BATTLE)) {
|
if (globalScene.gameMode.hasChallenge(Challenges.INVERSE_BATTLE)) {
|
||||||
this.moveset[2] = new PokemonMove(Moves.THUNDERBOLT);
|
this.moveset[2] = new PokemonMove(Moves.THUNDERBOLT);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
else {
|
||||||
super.generateAndPopulateMoveset();
|
super.generateAndPopulateMoveset(...presetMoves);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user