Fix abilities

This commit is contained in:
RedstonewolfX 2024-07-14 19:50:40 -04:00
parent 54ddc63a14
commit 06e7e24aa7
4 changed files with 39 additions and 4 deletions

View File

@ -2645,6 +2645,8 @@ function getAnticipationCondition(): AbAttrCondition {
return (pokemon: Pokemon) => { return (pokemon: Pokemon) => {
for (const opponent of pokemon.getOpponents()) { for (const opponent of pokemon.getOpponents()) {
for (const move of opponent.moveset) { for (const move of opponent.moveset) {
if (move == undefined)
continue;
// move is super effective // move is super effective
if (move.getMove() instanceof AttackMove && pokemon.getAttackTypeEffectiveness(move.getMove().type, opponent, true) >= 2) { if (move.getMove() instanceof AttackMove && pokemon.getAttackTypeEffectiveness(move.getMove().type, opponent, true) >= 2) {
return true; return true;

View File

@ -2406,6 +2406,27 @@ export class CheckSwitchPhase extends BattlePhase {
pk.getBattleInfo().flyoutMenu.flyoutText[2].setColor("#e8e8a8") pk.getBattleInfo().flyoutMenu.flyoutText[2].setColor("#e8e8a8")
} }
} }
if (false) {
this.scene.pokemonInfoContainer.show(this.scene.getEnemyField()[0], false, 1, true);
if (this.scene.getEnemyField()[1] != undefined) {
this.scene.tweens.add({
targets: this.scene.pokemonInfoContainer,
alpha: 1,
duration: 5000,
onComplete: () => {
this.scene.pokemonInfoContainer.hide(1.3)
this.scene.tweens.add({
targets: this.scene.pokemonInfoContainer,
alpha: 1,
duration: 1000,
onComplete: () => {
this.scene.pokemonInfoContainer.show(this.scene.getEnemyField()[1], false, 1, true);
}
})
}
})
}
}
this.scene.ui.showText(i18next.t("battle:switchQuestion", { pokemonName: this.useName ? pokemon.name : i18next.t("battle:pokemon") }), null, () => { this.scene.ui.showText(i18next.t("battle:switchQuestion", { pokemonName: this.useName ? pokemon.name : i18next.t("battle:pokemon") }), null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.CONFIRM, () => {
@ -2421,6 +2442,7 @@ export class CheckSwitchPhase extends BattlePhase {
this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[3].text = "???" this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[3].text = "???"
this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[2].setColor("#f8f8f8") this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[2].setColor("#f8f8f8")
} }
//this.scene.pokemonInfoContainer.hide()
this.end(); this.end();
}, () => { }, () => {
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
@ -2432,6 +2454,7 @@ export class CheckSwitchPhase extends BattlePhase {
this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[3].text = "???" this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[3].text = "???"
this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[2].setColor("#f8f8f8") this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[2].setColor("#f8f8f8")
} }
//this.scene.pokemonInfoContainer.hide()
this.end(); this.end();
}); });
}); });

View File

@ -207,7 +207,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
this.setVisible(false); this.setVisible(false);
} }
show(pokemon: Pokemon, showMoves: boolean = false, speedMultiplier: number = 1): Promise<void> { show(pokemon: Pokemon, showMoves: boolean = false, speedMultiplier: number = 1, lessInfo: boolean = false): Promise<void> {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
const caughtAttr = BigInt(pokemon.scene.gameData.dexData[pokemon.species.speciesId].caughtAttr); const caughtAttr = BigInt(pokemon.scene.gameData.dexData[pokemon.species.speciesId].caughtAttr);
if (pokemon.gender > Gender.GENDERLESS) { if (pokemon.gender > Gender.GENDERLESS) {
@ -290,6 +290,11 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
this.pokemonNatureLabelText.setColor(getTextColor(TextStyle.WINDOW, false, this.scene.uiTheme)); this.pokemonNatureLabelText.setColor(getTextColor(TextStyle.WINDOW, false, this.scene.uiTheme));
this.pokemonNatureLabelText.setShadowColor(getTextColor(TextStyle.WINDOW, true, this.scene.uiTheme)); this.pokemonNatureLabelText.setShadowColor(getTextColor(TextStyle.WINDOW, true, this.scene.uiTheme));
} }
this.pokemonAbilityText.setVisible(!lessInfo)
this.pokemonAbilityLabelText.setVisible(!lessInfo)
this.pokemonNatureText.setVisible(!lessInfo)
this.pokemonNatureLabelText.setVisible(!lessInfo)
const isFusion = pokemon.isFusion(); const isFusion = pokemon.isFusion();
const doubleShiny = isFusion && pokemon.shiny && pokemon.fusionShiny; const doubleShiny = isFusion && pokemon.shiny && pokemon.fusionShiny;
@ -328,7 +333,11 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
? this.scene.gameData.dexData[starterSpeciesId].ivs ? this.scene.gameData.dexData[starterSpeciesId].ivs
: null; : null;
this.statsContainer.updateIvs(pokemon.ivs, originalIvs); if (lessInfo) {
this.statsContainer.updateIvs(pokemon.species.baseStats, undefined, 255);
} else {
this.statsContainer.updateIvs(pokemon.ivs, originalIvs);
}
this.scene.tweens.add({ this.scene.tweens.add({
targets: this, targets: this,

View File

@ -65,9 +65,10 @@ export class StatsContainer extends Phaser.GameObjects.Container {
}); });
} }
updateIvs(ivs: integer[], originalIvs?: integer[]): void { updateIvs(ivs: integer[], originalIvs?: integer[], max?: integer): void {
if (ivs) { if (ivs) {
const ivChartData = new Array(6).fill(null).map((_, i) => [ (ivs[ivChartStatIndexes[i]] / 31) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][0], (ivs[ivChartStatIndexes[i]] / 31) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][1] ] ).flat(); var maxIV = max || 31
const ivChartData = new Array(6).fill(null).map((_, i) => [ (ivs[ivChartStatIndexes[i]] / maxIV) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][0], (ivs[ivChartStatIndexes[i]] / maxIV) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][1] ] ).flat();
const lastIvChartData = this.statsIvsCache || defaultIvChartData; const lastIvChartData = this.statsIvsCache || defaultIvChartData;
const perfectIVColor: string = getTextColor(TextStyle.SUMMARY_GOLD, false, (this.scene as BattleScene).uiTheme); const perfectIVColor: string = getTextColor(TextStyle.SUMMARY_GOLD, false, (this.scene as BattleScene).uiTheme);
this.statsIvsCache = ivChartData.slice(0); this.statsIvsCache = ivChartData.slice(0);