Add shared movesets for spliced Pokemon

This commit is contained in:
Flashfyre 2023-11-08 22:30:22 -05:00
parent d0a60a7f86
commit 1236cb948d
4 changed files with 35 additions and 11 deletions

View File

@ -3476,10 +3476,10 @@ export function initMoves() {
new AttackMove(Moves.STORED_POWER, "Stored Power (N)", Type.PSYCHIC, MoveCategory.SPECIAL, 20, 100, 10, 41, "Power increases when user's stats have been raised.", -1, 0, 5), new AttackMove(Moves.STORED_POWER, "Stored Power (N)", Type.PSYCHIC, MoveCategory.SPECIAL, 20, 100, 10, 41, "Power increases when user's stats have been raised.", -1, 0, 5),
new SelfStatusMove(Moves.QUICK_GUARD, "Quick Guard (N)", Type.FIGHTING, -1, 15, -1, "Protects the user's team from high-priority moves.", -1, 3, 5) new SelfStatusMove(Moves.QUICK_GUARD, "Quick Guard (N)", Type.FIGHTING, -1, 15, -1, "Protects the user's team from high-priority moves.", -1, 3, 5)
.target(MoveTarget.USER_SIDE), .target(MoveTarget.USER_SIDE),
new StatusMove(Moves.ALLY_SWITCH, "Ally Switch (N)", Type.PSYCHIC, -1, 15, -1, "User switches with opposite teammate.", -1, 0, 5) new StatusMove(Moves.ALLY_SWITCH, "Ally Switch (N)", Type.PSYCHIC, -1, 15, -1, "User switches with opposite teammate.", -1, 2, 5)
.ignoresProtect() .ignoresProtect()
.target(MoveTarget.USER), // TODO .target(MoveTarget.USER), // TODO
new AttackMove(Moves.SCALD, "Scald", Type.WATER, MoveCategory.SPECIAL, 80, 100, 15, -1, "May burn opponent.", 30, 1, 5) new AttackMove(Moves.SCALD, "Scald", Type.WATER, MoveCategory.SPECIAL, 80, 100, 15, -1, "May burn opponent.", 30, 0, 5)
.attr(StatusEffectAttr, StatusEffect.BURN), .attr(StatusEffectAttr, StatusEffect.BURN),
new SelfStatusMove(Moves.SHELL_SMASH, "Shell Smash", Type.NORMAL, -1, 15, -1, "Sharply raises user's Attack, Special Attack and Speed but lowers Defense and Special Defense.", -1, 0, 5) new SelfStatusMove(Moves.SHELL_SMASH, "Shell Smash", Type.NORMAL, -1, 15, -1, "Sharply raises user's Attack, Special Attack and Speed but lowers Defense and Special Defense.", -1, 0, 5)
.attr(StatChangeAttr, [ BattleStat.ATK, BattleStat.SPATK ], 2, true) .attr(StatChangeAttr, [ BattleStat.ATK, BattleStat.SPATK ], 2, true)

View File

@ -77,8 +77,8 @@ export abstract class PokemonSpeciesForm {
getLevelMoves(): LevelMoves { getLevelMoves(): LevelMoves {
if (pokemonSpeciesFormLevelMoves.hasOwnProperty(this.speciesId) && pokemonSpeciesFormLevelMoves[this.speciesId].hasOwnProperty(this.formIndex)) if (pokemonSpeciesFormLevelMoves.hasOwnProperty(this.speciesId) && pokemonSpeciesFormLevelMoves[this.speciesId].hasOwnProperty(this.formIndex))
return pokemonSpeciesFormLevelMoves[this.speciesId][this.formIndex]; return pokemonSpeciesFormLevelMoves[this.speciesId][this.formIndex].slice(0);
return pokemonSpeciesLevelMoves[this.speciesId]; return pokemonSpeciesLevelMoves[this.speciesId].slice(0);
} }
isObtainable() { isObtainable() {

View File

@ -29,7 +29,7 @@ import { Mode } from './ui/ui';
import PartyUiHandler, { PartyOption, PartyUiMode } from './ui/party-ui-handler'; import PartyUiHandler, { PartyOption, PartyUiMode } from './ui/party-ui-handler';
import SoundFade from 'phaser3-rex-plugins/plugins/soundfade'; import SoundFade from 'phaser3-rex-plugins/plugins/soundfade';
import { GameMode } from './game-mode'; import { GameMode } from './game-mode';
import { pokemonFormLevelMoves } from './data/pokemon-level-moves'; import { LevelMoves, pokemonFormLevelMoves } from './data/pokemon-level-moves';
export enum FieldPosition { export enum FieldPosition {
CENTER, CENTER,
@ -539,10 +539,27 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
getLevelMoves(startingLevel?: integer): Moves[] { getLevelMoves(startingLevel?: integer): Moves[] {
const ret: Moves[] = []; const ret: Moves[] = [];
const levelMoves = this.getSpeciesForm().getLevelMoves(); let levelMoves = this.getSpeciesForm().getLevelMoves();
if (levelMoves) {
if (!startingLevel) if (!startingLevel)
startingLevel = this.level; startingLevel = this.level;
if (this.fusionSpecies) {
const fusionLevelMoves = this.getFusionSpeciesForm().getLevelMoves();
const newLevelMoves: LevelMoves = [];
for (let l = startingLevel; l <= this.level; l++) {
while (levelMoves.length && levelMoves[0][0] === l) {
const levelMove = levelMoves.shift();
if (!newLevelMoves.find(lm => lm[1] === levelMove[1]))
newLevelMoves.push(levelMove);
}
while (fusionLevelMoves.length && fusionLevelMoves[0][0] === l) {
const fusionLevelMove = fusionLevelMoves.shift();
if (!newLevelMoves.find(lm => lm[1] === fusionLevelMove[1]))
newLevelMoves.push(fusionLevelMove);
}
}
levelMoves = newLevelMoves;
}
if (levelMoves) {
for (let lm of levelMoves) { for (let lm of levelMoves) {
const level = lm[0]; const level = lm[0];
if (level < startingLevel) if (level < startingLevel)
@ -1160,7 +1177,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
// Failsafe // Failsafe
this.scene.time.delayedCall(Utils.fixedInt(3000), () => { this.scene.time.delayedCall(Utils.fixedInt(3000), () => {
console.log(faintCryTimer)
if (!faintCryTimer || !this.scene) if (!faintCryTimer || !this.scene)
return; return;
if (cry?.isPlaying) if (cry?.isPlaying)
@ -1357,11 +1373,11 @@ export class PlayerPokemon extends Pokemon {
const moveId = parseInt(tm) as Moves; const moveId = parseInt(tm) as Moves;
for (let p of tmSpecies[tm]) { for (let p of tmSpecies[tm]) {
if (Array.isArray(p)) { if (Array.isArray(p)) {
if (p[0] === this.species.speciesId) { if (p[0] === this.species.speciesId || (this.fusionSpecies && p[0] === this.fusionSpecies.speciesId)) {
this.compatibleTms.push(moveId); this.compatibleTms.push(moveId);
break; break;
} }
} else if (p === this.species.speciesId) { } else if (p === this.species.speciesId || (this.fusionSpecies && p === this.fusionSpecies.speciesId)) {
this.compatibleTms.push(moveId); this.compatibleTms.push(moveId);
break; break;
} }
@ -1440,6 +1456,7 @@ export class PlayerPokemon extends Pokemon {
} }
this.calculateStats(); this.calculateStats();
this.generateCompatibleTms();
this.updateInfo(true).then(() => { this.updateInfo(true).then(() => {
const fusedPartyMemberIndex = this.scene.getParty().indexOf(pokemon); const fusedPartyMemberIndex = this.scene.getParty().indexOf(pokemon);
const fusedPartyMemberHeldModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier const fusedPartyMemberHeldModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
@ -1466,6 +1483,7 @@ export class PlayerPokemon extends Pokemon {
this.fusionGender = 0; this.fusionGender = 0;
this.calculateStats(); this.calculateStats();
this.generateCompatibleTms();
this.updateInfo(true).then(() => resolve()); this.updateInfo(true).then(() => resolve());
}); });
} }

View File

@ -566,6 +566,7 @@ export default class PartyUiHandler extends MessageUiHandler {
for (let o = optionStartIndex; o < optionEndIndex; o++) { for (let o = optionStartIndex; o < optionEndIndex; o++) {
const option = this.options[this.options.length - (o + 1)]; const option = this.options[this.options.length - (o + 1)];
let altText = false;
let optionName: string; let optionName: string;
if ((this.partyUiMode !== PartyUiMode.REMEMBER_MOVE_MODIFIER && (this.partyUiMode !== PartyUiMode.MODIFIER_TRANSFER || this.transferMode)) || option === PartyOption.CANCEL) { if ((this.partyUiMode !== PartyUiMode.REMEMBER_MOVE_MODIFIER && (this.partyUiMode !== PartyUiMode.MODIFIER_TRANSFER || this.transferMode)) || option === PartyOption.CANCEL) {
switch (option) { switch (option) {
@ -586,6 +587,7 @@ export default class PartyUiHandler extends MessageUiHandler {
else if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) { else if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) {
const move = learnableLevelMoves[option]; const move = learnableLevelMoves[option];
optionName = allMoves[move].name; optionName = allMoves[move].name;
altText = !!pokemon.getSpeciesForm().getLevelMoves().find(plm => plm[1] === move);
} else { } else {
const itemModifier = itemModifiers[option]; const itemModifier = itemModifiers[option];
optionName = itemModifier.type.name; optionName = itemModifier.type.name;
@ -595,6 +597,10 @@ export default class PartyUiHandler extends MessageUiHandler {
const yCoord = -6 - 16 * o; const yCoord = -6 - 16 * o;
const optionText = addTextObject(this.scene, -79 - (wideOptions ? 50 : 0), yCoord - 16, optionName, TextStyle.WINDOW); const optionText = addTextObject(this.scene, -79 - (wideOptions ? 50 : 0), yCoord - 16, optionName, TextStyle.WINDOW);
if (altText) {
optionText.setColor('#40c8f8');
optionText.setShadowColor('#006090')
}
optionText.setOrigin(0, 0); optionText.setOrigin(0, 0);
this.optionsContainer.add(optionText); this.optionsContainer.add(optionText);