mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-29 18:26:09 +00:00
Add TM learnability indicator when learning TM
This commit is contained in:
parent
46b32976ff
commit
106d3298a2
@ -16,7 +16,7 @@ import { EvolutionPhase } from "./evolution-phase";
|
|||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
|
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat";
|
||||||
import { Biome, biomeLinks } from "./data/biome";
|
import { Biome, biomeLinks } from "./data/biome";
|
||||||
import { ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, getPlayerModifierTypeOptionsForWave, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
import { ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, TmModifierType, getPlayerModifierTypeOptionsForWave, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
||||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||||
import { BattlerTagLapseType, BattlerTagType, HideSpriteTag as HiddenTag, TrappedTag } from "./data/battler-tag";
|
import { BattlerTagLapseType, BattlerTagType, HideSpriteTag as HiddenTag, TrappedTag } from "./data/battler-tag";
|
||||||
import { getPokemonMessage } from "./messages";
|
import { getPokemonMessage } from "./messages";
|
||||||
@ -2484,7 +2484,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
if (modifierType instanceof PokemonModifierType) {
|
if (modifierType instanceof PokemonModifierType) {
|
||||||
const pokemonModifierType = modifierType as PokemonModifierType;
|
const pokemonModifierType = modifierType as PokemonModifierType;
|
||||||
const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
|
const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, !isMoveModifier ? PartyUiMode.MODIFIER : PartyUiMode.MOVE_MODIFIER, -1, (slotIndex: integer, option: PartyOption) => {
|
const isTmModifier = modifierType instanceof TmModifierType;
|
||||||
|
const partyUiMode = isMoveModifier ? PartyUiMode.MOVE_MODIFIER
|
||||||
|
: isTmModifier ? PartyUiMode.TM_MODIFIER : PartyUiMode.MODIFIER;
|
||||||
|
const tmMoveId = isTmModifier
|
||||||
|
? (modifierType as TmModifierType).moveId
|
||||||
|
: undefined;
|
||||||
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: integer, option: PartyOption) => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT).then(() => {
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT).then(() => {
|
||||||
const modifierType = typeOptions[cursor].type;
|
const modifierType = typeOptions[cursor].type;
|
||||||
@ -2497,7 +2503,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
|
||||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined);
|
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId);
|
||||||
} else {
|
} else {
|
||||||
this.scene.addModifier(typeOptions[cursor].type.newModifier(), true).then(() => super.end());
|
this.scene.addModifier(typeOptions[cursor].type.newModifier(), true).then(() => super.end());
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
|
@ -144,7 +144,7 @@ export function initAutoPlay() {
|
|||||||
nextPartyMemberIndex = getBestPartyMemberIndex();
|
nextPartyMemberIndex = getBestPartyMemberIndex();
|
||||||
partyUiHandler.setCursor(nextPartyMemberIndex);
|
partyUiHandler.setCursor(nextPartyMemberIndex);
|
||||||
nextPartyMemberIndex = -1;
|
nextPartyMemberIndex = -1;
|
||||||
if (partyUiHandler.partyUiMode === PartyUiMode.MODIFIER || partyUiHandler.getCursor()) {
|
if ((partyUiHandler.partyUiMode === PartyUiMode.MODIFIER || partyUiHandler.partyUiMode === PartyUiMode.TM_MODIFIER) || partyUiHandler.getCursor()) {
|
||||||
this.processInput(Button.ACTION);
|
this.processInput(Button.ACTION);
|
||||||
thisArg.time.delayedCall(250, () => this.processInput(Button.ACTION));
|
thisArg.time.delayedCall(250, () => this.processInput(Button.ACTION));
|
||||||
} else
|
} else
|
||||||
|
@ -7,6 +7,7 @@ import MessageUiHandler from "./message-ui-handler";
|
|||||||
import { Mode } from "./ui";
|
import { Mode } from "./ui";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
|
import { PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
|
||||||
|
import { Moves } from "../data/move";
|
||||||
|
|
||||||
const defaultMessage = 'Choose a Pokémon.';
|
const defaultMessage = 'Choose a Pokémon.';
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ export enum PartyUiMode {
|
|||||||
POST_BATTLE_SWITCH,
|
POST_BATTLE_SWITCH,
|
||||||
MODIFIER,
|
MODIFIER,
|
||||||
MOVE_MODIFIER,
|
MOVE_MODIFIER,
|
||||||
|
TM_MODIFIER,
|
||||||
MODIFIER_TRANSFER,
|
MODIFIER_TRANSFER,
|
||||||
RELEASE
|
RELEASE
|
||||||
}
|
}
|
||||||
@ -25,6 +27,7 @@ export enum PartyOption {
|
|||||||
SEND_OUT,
|
SEND_OUT,
|
||||||
PASS_BATON,
|
PASS_BATON,
|
||||||
APPLY,
|
APPLY,
|
||||||
|
TEACH,
|
||||||
TRANSFER,
|
TRANSFER,
|
||||||
SUMMARY,
|
SUMMARY,
|
||||||
RELEASE,
|
RELEASE,
|
||||||
@ -65,6 +68,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
private selectCallback: PartySelectCallback | PartyModifierTransferSelectCallback;
|
private selectCallback: PartySelectCallback | PartyModifierTransferSelectCallback;
|
||||||
private selectFilter: PokemonSelectFilter | PokemonModifierTransferSelectFilter;
|
private selectFilter: PokemonSelectFilter | PokemonModifierTransferSelectFilter;
|
||||||
private moveSelectFilter: PokemonMoveSelectFilter;
|
private moveSelectFilter: PokemonMoveSelectFilter;
|
||||||
|
private tmMoveId: Moves;
|
||||||
|
|
||||||
private static FilterAll = (_pokemon: PlayerPokemon) => null;
|
private static FilterAll = (_pokemon: PlayerPokemon) => null;
|
||||||
|
|
||||||
@ -147,11 +151,6 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
this.fieldIndex = args.length > 1 ? args[1] as integer : -1;
|
this.fieldIndex = args.length > 1 ? args[1] as integer : -1;
|
||||||
|
|
||||||
this.partyContainer.setVisible(true);
|
|
||||||
this.partyBg.setTexture(`party_bg${this.scene.currentBattle.double ? '_double' : ''}`);
|
|
||||||
this.populatePartySlots();
|
|
||||||
this.setCursor(this.cursor < 6 ? this.cursor : 0);
|
|
||||||
|
|
||||||
if (args.length > 2 && args[2] instanceof Function)
|
if (args.length > 2 && args[2] instanceof Function)
|
||||||
this.selectCallback = args[2];
|
this.selectCallback = args[2];
|
||||||
this.selectFilter = args.length > 3 && args[3] instanceof Function
|
this.selectFilter = args.length > 3 && args[3] instanceof Function
|
||||||
@ -160,6 +159,12 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
this.moveSelectFilter = args.length > 4 && args[4] instanceof Function
|
this.moveSelectFilter = args.length > 4 && args[4] instanceof Function
|
||||||
? args[4] as PokemonMoveSelectFilter
|
? args[4] as PokemonMoveSelectFilter
|
||||||
: PartyUiHandler.FilterAllMoves;
|
: PartyUiHandler.FilterAllMoves;
|
||||||
|
this.tmMoveId = args.length > 5 && args[5] ? args[5] : Moves.NONE;
|
||||||
|
|
||||||
|
this.partyContainer.setVisible(true);
|
||||||
|
this.partyBg.setTexture(`party_bg${this.scene.currentBattle.double ? '_double' : ''}`);
|
||||||
|
this.populatePartySlots();
|
||||||
|
this.setCursor(this.cursor < 6 ? this.cursor : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
processInput(button: Button) {
|
processInput(button: Button) {
|
||||||
@ -218,7 +223,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
} else if (this.cursor)
|
} else if (this.cursor)
|
||||||
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor, option === PartyOption.PASS_BATON);
|
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, this.cursor, option === PartyOption.PASS_BATON);
|
||||||
if (this.partyUiMode !== PartyUiMode.MODIFIER && this.partyUiMode !== PartyUiMode.MOVE_MODIFIER)
|
if (this.partyUiMode !== PartyUiMode.MODIFIER && this.partyUiMode !== PartyUiMode.TM_MODIFIER && this.partyUiMode !== PartyUiMode.MOVE_MODIFIER)
|
||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -322,7 +327,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
for (let p in party) {
|
for (let p in party) {
|
||||||
const slotIndex = parseInt(p);
|
const slotIndex = parseInt(p);
|
||||||
const partySlot = new PartySlot(this.scene, slotIndex, party[p]);
|
const partySlot = new PartySlot(this.scene, slotIndex, party[p], this.partyUiMode, this.tmMoveId);
|
||||||
this.scene.add.existing(partySlot);
|
this.scene.add.existing(partySlot);
|
||||||
this.partySlotsContainer.add(partySlot);
|
this.partySlotsContainer.add(partySlot);
|
||||||
this.partySlots.push(partySlot);
|
this.partySlots.push(partySlot);
|
||||||
@ -429,6 +434,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
case PartyUiMode.MODIFIER:
|
case PartyUiMode.MODIFIER:
|
||||||
this.options.push(PartyOption.APPLY);
|
this.options.push(PartyOption.APPLY);
|
||||||
break;
|
break;
|
||||||
|
case PartyUiMode.TM_MODIFIER:
|
||||||
|
this.options.push(PartyOption.TEACH);
|
||||||
|
break;
|
||||||
case PartyUiMode.MODIFIER_TRANSFER:
|
case PartyUiMode.MODIFIER_TRANSFER:
|
||||||
this.options.push(PartyOption.TRANSFER);
|
this.options.push(PartyOption.TRANSFER);
|
||||||
break;
|
break;
|
||||||
@ -584,8 +592,9 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
private slotPb: Phaser.GameObjects.Sprite;
|
private slotPb: Phaser.GameObjects.Sprite;
|
||||||
private slotPokemonIcon: Phaser.GameObjects.Sprite;
|
private slotPokemonIcon: Phaser.GameObjects.Sprite;
|
||||||
private slotHpOverlay: Phaser.GameObjects.Sprite;
|
private slotHpOverlay: Phaser.GameObjects.Sprite;
|
||||||
|
private slotTmLabel: Phaser.GameObjects.Text;
|
||||||
|
|
||||||
constructor(scene: BattleScene, slotIndex: integer, pokemon: PlayerPokemon) {
|
constructor(scene: BattleScene, slotIndex: integer, pokemon: PlayerPokemon, partyUiMode: PartyUiMode, tmMoveId: Moves) {
|
||||||
super(scene, slotIndex >= scene.currentBattle.getBattlerCount() ? 230.5 : 64,
|
super(scene, slotIndex >= scene.currentBattle.getBattlerCount() ? 230.5 : 64,
|
||||||
slotIndex >= scene.currentBattle.getBattlerCount() ? -184 + (scene.currentBattle.double ? -38 : 0)
|
slotIndex >= scene.currentBattle.getBattlerCount() ? -184 + (scene.currentBattle.double ? -38 : 0)
|
||||||
+ (28 + (scene.currentBattle.double ? 6 : 0)) * slotIndex : -124 + (scene.currentBattle.double ? -8 : 0) + slotIndex * 64);
|
+ (28 + (scene.currentBattle.double ? 6 : 0)) * slotIndex : -124 + (scene.currentBattle.double ? -8 : 0) + slotIndex * 64);
|
||||||
@ -593,10 +602,10 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
this.slotIndex = slotIndex;
|
this.slotIndex = slotIndex;
|
||||||
this.pokemon = pokemon;
|
this.pokemon = pokemon;
|
||||||
|
|
||||||
this.setup();
|
this.setup(partyUiMode, tmMoveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
setup() {
|
setup(partyUiMode: PartyUiMode, tmMoveId: Moves) {
|
||||||
const battlerCount = (this.scene as BattleScene).currentBattle.getBattlerCount();
|
const battlerCount = (this.scene as BattleScene).currentBattle.getBattlerCount();
|
||||||
|
|
||||||
const slotKey = `party_slot${this.slotIndex >= battlerCount ? '' : '_main'}`;
|
const slotKey = `party_slot${this.slotIndex >= battlerCount ? '' : '_main'}`;
|
||||||
@ -632,6 +641,9 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
slotLevelText.setPositionRelative(slotLevelLabel, 9, 0);
|
slotLevelText.setPositionRelative(slotLevelLabel, 9, 0);
|
||||||
slotLevelText.setOrigin(0, 0.25);
|
slotLevelText.setOrigin(0, 0.25);
|
||||||
|
|
||||||
|
slotInfoContainer.add([ slotName, slotLevelLabel, slotLevelText ]);
|
||||||
|
|
||||||
|
if (partyUiMode !== PartyUiMode.TM_MODIFIER) {
|
||||||
const slotHpBar = this.scene.add.image(0, 0, 'party_slot_hp_bar');
|
const slotHpBar = this.scene.add.image(0, 0, 'party_slot_hp_bar');
|
||||||
slotHpBar.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 72 : 8, this.slotIndex >= battlerCount ? 7 : 31);
|
slotHpBar.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 72 : 8, this.slotIndex >= battlerCount ? 7 : 31);
|
||||||
slotHpBar.setOrigin(0, 0);
|
slotHpBar.setOrigin(0, 0);
|
||||||
@ -647,9 +659,28 @@ class PartySlot extends Phaser.GameObjects.Container {
|
|||||||
slotHpText.setPositionRelative(slotHpBar, slotHpBar.width - 3, slotHpBar.height - 2);
|
slotHpText.setPositionRelative(slotHpBar, slotHpBar.width - 3, slotHpBar.height - 2);
|
||||||
slotHpText.setOrigin(1, 0);
|
slotHpText.setOrigin(1, 0);
|
||||||
|
|
||||||
slotInfoContainer.add([ slotName, slotLevelLabel, slotLevelText, slotHpBar, slotHpOverlay, slotHpText ]);
|
slotInfoContainer.add([ slotHpBar, slotHpOverlay, slotHpText ]);
|
||||||
|
|
||||||
this.slotHpOverlay = slotHpOverlay;
|
this.slotHpOverlay = slotHpOverlay;
|
||||||
|
} else {
|
||||||
|
let slotTmText: string;
|
||||||
|
switch (true) {
|
||||||
|
case (this.pokemon.compatibleTms.indexOf(tmMoveId) === -1):
|
||||||
|
slotTmText = 'NOT ABLE';
|
||||||
|
break;
|
||||||
|
case (this.pokemon.getMoveset().filter(m => m?.moveId === tmMoveId).length > 0):
|
||||||
|
slotTmText = 'LEARNED';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
slotTmText = 'ABLE';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.slotTmLabel = addTextObject(this.scene, 0, 0, slotTmText, TextStyle.MESSAGE);
|
||||||
|
this.slotTmLabel.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 82 : 32, this.slotIndex >= battlerCount ? 16 : 46);
|
||||||
|
this.slotTmLabel.setOrigin(0, 1);
|
||||||
|
|
||||||
|
slotInfoContainer.add(this.slotTmLabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select(): void {
|
select(): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user