Merge branch 'fix/gamepad_support_disable_focus' of github.com:Greenlamp2/pokerogue into feat/mapping_setting
Conflicts: src/inputs-controller.ts src/system/settings.tspull/685/head
commit
d4e1834e7c
|
@ -103,7 +103,6 @@ export default class BattleScene extends SceneBase {
|
||||||
public expGainsSpeed: integer = 0;
|
public expGainsSpeed: integer = 0;
|
||||||
public hpBarSpeed: integer = 0;
|
public hpBarSpeed: integer = 0;
|
||||||
public fusionPaletteSwaps: boolean = true;
|
public fusionPaletteSwaps: boolean = true;
|
||||||
public gamepadSupport: boolean = true;
|
|
||||||
public enableTouchControls: boolean = false;
|
public enableTouchControls: boolean = false;
|
||||||
public enableVibration: boolean = false;
|
public enableVibration: boolean = false;
|
||||||
public abSwapped: boolean = false;
|
public abSwapped: boolean = false;
|
||||||
|
|
|
@ -5132,7 +5132,6 @@ export function initMoves() {
|
||||||
.attr(RecoilAttr, false, 0.33)
|
.attr(RecoilAttr, false, 0.33)
|
||||||
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE)
|
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE)
|
||||||
.attr(StatusEffectAttr, StatusEffect.BURN)
|
.attr(StatusEffectAttr, StatusEffect.BURN)
|
||||||
.condition(failOnGravityCondition)
|
|
||||||
.recklessMove(),
|
.recklessMove(),
|
||||||
new AttackMove(Moves.FORCE_PALM, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 100, 10, 30, 0, 4)
|
new AttackMove(Moves.FORCE_PALM, Type.FIGHTING, MoveCategory.PHYSICAL, 60, 100, 10, 30, 0, 4)
|
||||||
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
|
.attr(StatusEffectAttr, StatusEffect.PARALYSIS),
|
||||||
|
@ -6669,7 +6668,7 @@ export function initMoves() {
|
||||||
new AttackMove(Moves.FICKLE_BEAM, Type.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9)
|
new AttackMove(Moves.FICKLE_BEAM, Type.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9)
|
||||||
.attr(PreMoveMessageAttr, doublePowerChanceMessageFunc)
|
.attr(PreMoveMessageAttr, doublePowerChanceMessageFunc)
|
||||||
.attr(DoublePowerChanceAttr),
|
.attr(DoublePowerChanceAttr),
|
||||||
new StatusMove(Moves.BURNING_BULWARK, Type.FIRE, -1, 10, 100, 4, 9)
|
new SelfStatusMove(Moves.BURNING_BULWARK, Type.FIRE, -1, 10, 100, 4, 9)
|
||||||
.attr(ProtectAttr, BattlerTagType.BURNING_BULWARK),
|
.attr(ProtectAttr, BattlerTagType.BURNING_BULWARK),
|
||||||
new AttackMove(Moves.THUNDERCLAP, Type.ELECTRIC, MoveCategory.SPECIAL, 70, 100, 5, -1, 1, 9)
|
new AttackMove(Moves.THUNDERCLAP, Type.ELECTRIC, MoveCategory.SPECIAL, 70, 100, 5, -1, 1, 9)
|
||||||
.condition((user, target, move) => user.scene.currentBattle.turnCommands[target.getBattlerIndex()].command === Command.FIGHT && !target.turnData.acted && allMoves[user.scene.currentBattle.turnCommands[target.getBattlerIndex()].move.move].category !== MoveCategory.STATUS),
|
.condition((user, target, move) => user.scene.currentBattle.turnCommands[target.getBattlerIndex()].command === Command.FIGHT && !target.turnData.acted && allMoves[user.scene.currentBattle.turnCommands[target.getBattlerIndex()].move.move].category !== MoveCategory.STATUS),
|
||||||
|
@ -6686,6 +6685,7 @@ export function initMoves() {
|
||||||
.target(MoveTarget.NEAR_ALLY)
|
.target(MoveTarget.NEAR_ALLY)
|
||||||
.partial(),
|
.partial(),
|
||||||
new AttackMove(Moves.ALLURING_VOICE, Type.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 9)
|
new AttackMove(Moves.ALLURING_VOICE, Type.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 9)
|
||||||
|
.soundBased()
|
||||||
.partial(),
|
.partial(),
|
||||||
new AttackMove(Moves.TEMPER_FLARE, Type.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9)
|
new AttackMove(Moves.TEMPER_FLARE, Type.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9)
|
||||||
.attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result == MoveResult.MISS || user.getLastXMoves(2)[1]?.result == MoveResult.FAIL ? 2 : 1),
|
.attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result == MoveResult.MISS || user.getLastXMoves(2)[1]?.result == MoveResult.FAIL ? 2 : 1),
|
||||||
|
|
|
@ -3206,6 +3206,14 @@ export class PokemonMove {
|
||||||
return allMoves[this.moveId];
|
return allMoves[this.moveId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets {@link ppUsed} for this move and ensures the value does not exceed {@link getMovePp}
|
||||||
|
* @param {number} count Amount of PP to use
|
||||||
|
*/
|
||||||
|
usePp(count: number = 1) {
|
||||||
|
this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp());
|
||||||
|
}
|
||||||
|
|
||||||
getMovePp(): integer {
|
getMovePp(): integer {
|
||||||
return this.getMove().pp + this.ppUp * Math.max(Math.floor(this.getMove().pp / 5), 1);
|
return this.getMove().pp + this.ppUp * Math.max(Math.floor(this.getMove().pp / 5), 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ export class InputsController {
|
||||||
private time: Time;
|
private time: Time;
|
||||||
private player: Map<String, GamepadMapping> = new Map();
|
private player: Map<String, GamepadMapping> = new Map();
|
||||||
|
|
||||||
|
private gamepadSupport: boolean = true;
|
||||||
|
|
||||||
public customGamepadMapping = new Map();
|
public customGamepadMapping = new Map();
|
||||||
|
|
||||||
constructor(scene: Phaser.Scene) {
|
constructor(scene: Phaser.Scene) {
|
||||||
|
@ -47,6 +49,7 @@ export class InputsController {
|
||||||
this.interactions[b] = {
|
this.interactions[b] = {
|
||||||
pressTime: false,
|
pressTime: false,
|
||||||
isPressed: false,
|
isPressed: false,
|
||||||
|
source: null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We don't want the menu key to be repeated
|
// We don't want the menu key to be repeated
|
||||||
|
@ -89,16 +92,32 @@ export class InputsController {
|
||||||
this.deactivatePressedKey();
|
this.deactivatePressedKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setGamepadSupport(value: boolean): void {
|
||||||
|
if (value) {
|
||||||
|
this.gamepadSupport = true;
|
||||||
|
} else {
|
||||||
|
this.gamepadSupport = false;
|
||||||
|
this.deactivatePressedKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update(): void {
|
update(): void {
|
||||||
// reversed to let the cancel button have a kinda priority on the action button
|
// reversed to let the cancel button have a kinda priority on the action button
|
||||||
for (const b of Utils.getEnumValues(Button).reverse()) {
|
for (const b of Utils.getEnumValues(Button).reverse()) {
|
||||||
if (!this.interactions.hasOwnProperty(b)) continue;
|
if (
|
||||||
if (this.repeatInputDurationJustPassed(b) && this.interactions[b].isPressed) {
|
this.interactions.hasOwnProperty(b) &&
|
||||||
|
this.repeatInputDurationJustPassed(b) &&
|
||||||
|
this.interactions[b].isPressed
|
||||||
|
) {
|
||||||
|
if (!this.gamepadSupport && this.interactions[b].source === 'gamepad') {
|
||||||
|
this.delLastProcessedMovementTime(b);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.events.emit('input_down', {
|
this.events.emit('input_down', {
|
||||||
controller_type: 'repeated',
|
controller_type: this.interactions[b].source,
|
||||||
button: b,
|
button: b,
|
||||||
});
|
});
|
||||||
this.setLastProcessedMovementTime(b);
|
this.setLastProcessedMovementTime(b, this.interactions[b].source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +164,7 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepadButtonDown(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
gamepadButtonDown(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
||||||
if (!this.scene.gamepadSupport) return;
|
if (!this.gamepadSupport) return;
|
||||||
const actionMapping = this.getActionGamepadMapping();
|
const actionMapping = this.getActionGamepadMapping();
|
||||||
const buttonDown = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
const buttonDown = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
||||||
if (buttonDown !== undefined) {
|
if (buttonDown !== undefined) {
|
||||||
|
@ -153,12 +172,12 @@ export class InputsController {
|
||||||
controller_type: 'gamepad',
|
controller_type: 'gamepad',
|
||||||
button: buttonDown,
|
button: buttonDown,
|
||||||
});
|
});
|
||||||
this.setLastProcessedMovementTime(buttonDown);
|
this.setLastProcessedMovementTime(buttonDown, 'gamepad');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepadButtonUp(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
gamepadButtonUp(pad: Phaser.Input.Gamepad.Gamepad, button: Phaser.Input.Gamepad.Button, value: number): void {
|
||||||
if (!this.scene.gamepadSupport) return;
|
if (!this.gamepadSupport) return;
|
||||||
const actionMapping = this.getActionGamepadMapping();
|
const actionMapping = this.getActionGamepadMapping();
|
||||||
const buttonUp = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
const buttonUp = actionMapping.hasOwnProperty(button.index) && actionMapping[button.index];
|
||||||
if (buttonUp !== undefined) {
|
if (buttonUp !== undefined) {
|
||||||
|
@ -214,7 +233,7 @@ export class InputsController {
|
||||||
controller_type: 'keyboard',
|
controller_type: 'keyboard',
|
||||||
button: index,
|
button: index,
|
||||||
});
|
});
|
||||||
this.setLastProcessedMovementTime(index);
|
this.setLastProcessedMovementTime(index, 'keyboard');
|
||||||
});
|
});
|
||||||
key.on('up', () => {
|
key.on('up', () => {
|
||||||
this.events.emit('input_up', {
|
this.events.emit('input_up', {
|
||||||
|
@ -253,11 +272,12 @@ export class InputsController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setLastProcessedMovementTime(button: Button): void {
|
setLastProcessedMovementTime(button: Button, source: String = 'keyboard'): void {
|
||||||
if (!this.interactions.hasOwnProperty(button)) return;
|
if (!this.interactions.hasOwnProperty(button)) return;
|
||||||
this.setButtonLock(button);
|
this.setButtonLock(button);
|
||||||
this.interactions[button].pressTime = this.time.now;
|
this.interactions[button].pressTime = this.time.now;
|
||||||
this.interactions[button].isPressed = true;
|
this.interactions[button].isPressed = true;
|
||||||
|
this.interactions[button].source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
delLastProcessedMovementTime(button: Button): void {
|
delLastProcessedMovementTime(button: Button): void {
|
||||||
|
@ -265,15 +285,18 @@ export class InputsController {
|
||||||
this.releaseButtonLock(button);
|
this.releaseButtonLock(button);
|
||||||
this.interactions[button].pressTime = null;
|
this.interactions[button].pressTime = null;
|
||||||
this.interactions[button].isPressed = false;
|
this.interactions[button].isPressed = false;
|
||||||
|
this.interactions[button].source = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivatePressedKey(): void {
|
deactivatePressedKey(): void {
|
||||||
this.releaseButtonLock(this.buttonLock);
|
this.releaseButtonLock(this.buttonLock);
|
||||||
this.releaseButtonLock(this.buttonLock2);
|
this.releaseButtonLock(this.buttonLock2);
|
||||||
for (const b of Utils.getEnumValues(Button)) {
|
for (const b of Utils.getEnumValues(Button)) {
|
||||||
if (!this.interactions.hasOwnProperty(b)) return;
|
if (this.interactions.hasOwnProperty(b)) {
|
||||||
this.interactions[b].pressTime = null;
|
this.interactions[b].pressTime = null;
|
||||||
this.interactions[b].isPressed = false;
|
this.interactions[b].isPressed = false;
|
||||||
|
this.interactions[b].source = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ export const menu: SimpleTranslationEntries = {
|
||||||
"confirmPassword": "Confirmer le MDP",
|
"confirmPassword": "Confirmer le MDP",
|
||||||
"registrationAgeWarning": "Vous confirmez en vous inscrivant que vous avez 13 ans ou plus.",
|
"registrationAgeWarning": "Vous confirmez en vous inscrivant que vous avez 13 ans ou plus.",
|
||||||
"backToLogin": "Retour",
|
"backToLogin": "Retour",
|
||||||
"failedToLoadSaveData": "Échec du chargement des données. Veuillez recharger la page.\nSi cela continue, veuillez contacter l’administrateur.",
|
"failedToLoadSaveData": "Échec du chargement des données. Veuillez recharger\nla page. Si cela persiste, contactez l’administrateur.",
|
||||||
"sessionSuccess": "Session chargée avec succès.",
|
"sessionSuccess": "Session chargée avec succès.",
|
||||||
"failedToLoadSession": "Vos données de session n’ont pas pu être chargées.\nElles pourraient être corrompues.",
|
"failedToLoadSession": "Vos données de session n’ont pas pu être chargées.\nElles pourraient être corrompues.",
|
||||||
"boyOrGirl": "Es-tu un garçon ou une fille ?",
|
"boyOrGirl": "Es-tu un garçon ou une fille ?",
|
||||||
|
|
|
@ -955,7 +955,7 @@ export const modifierTypes = {
|
||||||
ENEMY_DAMAGE_BOOSTER: () => new ModifierType('Damage Token', 'Increases damage by 5%', (type, _args) => new Modifiers.EnemyDamageBoosterModifier(type, 5), 'wl_item_drop'),
|
ENEMY_DAMAGE_BOOSTER: () => new ModifierType('Damage Token', 'Increases damage by 5%', (type, _args) => new Modifiers.EnemyDamageBoosterModifier(type, 5), 'wl_item_drop'),
|
||||||
ENEMY_DAMAGE_REDUCTION: () => new ModifierType('Protection Token', 'Reduces incoming damage by 2.5%', (type, _args) => new Modifiers.EnemyDamageReducerModifier(type, 2.5), 'wl_guard_spec'),
|
ENEMY_DAMAGE_REDUCTION: () => new ModifierType('Protection Token', 'Reduces incoming damage by 2.5%', (type, _args) => new Modifiers.EnemyDamageReducerModifier(type, 2.5), 'wl_guard_spec'),
|
||||||
//ENEMY_SUPER_EFFECT_BOOSTER: () => new ModifierType('Type Advantage Token', 'Increases damage of super effective attacks by 30%', (type, _args) => new Modifiers.EnemySuperEffectiveDamageBoosterModifier(type, 30), 'wl_custom_super_effective'),
|
//ENEMY_SUPER_EFFECT_BOOSTER: () => new ModifierType('Type Advantage Token', 'Increases damage of super effective attacks by 30%', (type, _args) => new Modifiers.EnemySuperEffectiveDamageBoosterModifier(type, 30), 'wl_custom_super_effective'),
|
||||||
ENEMY_HEAL: () => new ModifierType('Recovery Token', 'Heals 3% of max HP every turn', (type, _args) => new Modifiers.EnemyTurnHealModifier(type, 3), 'wl_potion'),
|
ENEMY_HEAL: () => new ModifierType('Recovery Token', 'Heals 2% of max HP every turn', (type, _args) => new Modifiers.EnemyTurnHealModifier(type, 2), 'wl_potion'),
|
||||||
ENEMY_ATTACK_POISON_CHANCE: () => new EnemyAttackStatusEffectChanceModifierType('Poison Token', 10, StatusEffect.POISON, 'wl_antidote'),
|
ENEMY_ATTACK_POISON_CHANCE: () => new EnemyAttackStatusEffectChanceModifierType('Poison Token', 10, StatusEffect.POISON, 'wl_antidote'),
|
||||||
ENEMY_ATTACK_PARALYZE_CHANCE: () => new EnemyAttackStatusEffectChanceModifierType('Paralyze Token', 10, StatusEffect.PARALYSIS, 'wl_paralyze_heal'),
|
ENEMY_ATTACK_PARALYZE_CHANCE: () => new EnemyAttackStatusEffectChanceModifierType('Paralyze Token', 10, StatusEffect.PARALYSIS, 'wl_paralyze_heal'),
|
||||||
ENEMY_ATTACK_SLEEP_CHANCE: () => new EnemyAttackStatusEffectChanceModifierType('Sleep Token', 10, StatusEffect.SLEEP, 'wl_awakening'),
|
ENEMY_ATTACK_SLEEP_CHANCE: () => new EnemyAttackStatusEffectChanceModifierType('Sleep Token', 10, StatusEffect.SLEEP, 'wl_awakening'),
|
||||||
|
|
|
@ -2004,7 +2004,7 @@ export class EnemyTurnHealModifier extends EnemyPersistentModifier {
|
||||||
super(type, stackCount);
|
super(type, stackCount);
|
||||||
|
|
||||||
// Hardcode temporarily
|
// Hardcode temporarily
|
||||||
this.healPercent = 3;
|
this.healPercent = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
match(modifier: Modifier): boolean {
|
match(modifier: Modifier): boolean {
|
||||||
|
@ -2033,7 +2033,7 @@ export class EnemyTurnHealModifier extends EnemyPersistentModifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaxStackCount(scene: BattleScene): integer {
|
getMaxStackCount(scene: BattleScene): integer {
|
||||||
return 10;
|
return 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2158,6 +2158,7 @@ export class MovePhase extends BattlePhase {
|
||||||
public targets: BattlerIndex[];
|
public targets: BattlerIndex[];
|
||||||
protected followUp: boolean;
|
protected followUp: boolean;
|
||||||
protected ignorePp: boolean;
|
protected ignorePp: boolean;
|
||||||
|
protected failed: boolean;
|
||||||
protected cancelled: boolean;
|
protected cancelled: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, pokemon: Pokemon, targets: BattlerIndex[], move: PokemonMove, followUp?: boolean, ignorePp?: boolean) {
|
constructor(scene: BattleScene, pokemon: Pokemon, targets: BattlerIndex[], move: PokemonMove, followUp?: boolean, ignorePp?: boolean) {
|
||||||
|
@ -2168,6 +2169,7 @@ export class MovePhase extends BattlePhase {
|
||||||
this.move = move;
|
this.move = move;
|
||||||
this.followUp = !!followUp;
|
this.followUp = !!followUp;
|
||||||
this.ignorePp = !!ignorePp;
|
this.ignorePp = !!ignorePp;
|
||||||
|
this.failed = false;
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2175,6 +2177,12 @@ export class MovePhase extends BattlePhase {
|
||||||
return this.pokemon.isActive(true) && this.move.isUsable(this.pokemon, this.ignorePp) && !!this.targets.length;
|
return this.pokemon.isActive(true) && this.move.isUsable(this.pokemon, this.ignorePp) && !!this.targets.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Signifies the current move should fail but still use PP */
|
||||||
|
fail(): void {
|
||||||
|
this.failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**Signifies the current move should cancel and retain PP */
|
||||||
cancel(): void {
|
cancel(): void {
|
||||||
this.cancelled = true;
|
this.cancelled = true;
|
||||||
}
|
}
|
||||||
|
@ -2214,7 +2222,7 @@ export class MovePhase extends BattlePhase {
|
||||||
this.targets[0] = attacker.getBattlerIndex();
|
this.targets[0] = attacker.getBattlerIndex();
|
||||||
}
|
}
|
||||||
if (this.targets[0] === BattlerIndex.ATTACKER) {
|
if (this.targets[0] === BattlerIndex.ATTACKER) {
|
||||||
this.cancel();
|
this.fail(); // Marks the move as failed for later in doMove
|
||||||
this.showMoveText();
|
this.showMoveText();
|
||||||
this.showFailedText();
|
this.showFailedText();
|
||||||
}
|
}
|
||||||
|
@ -2235,10 +2243,23 @@ export class MovePhase extends BattlePhase {
|
||||||
|
|
||||||
this.pokemon.lapseTags(BattlerTagLapseType.PRE_MOVE);
|
this.pokemon.lapseTags(BattlerTagLapseType.PRE_MOVE);
|
||||||
|
|
||||||
|
let ppUsed = 1;
|
||||||
|
// Filter all opponents to include only those this move is targeting
|
||||||
|
const targetedOpponents = this.pokemon.getOpponents().filter(o => this.targets.includes(o.getBattlerIndex()));
|
||||||
|
for (let opponent of targetedOpponents) {
|
||||||
|
if (this.move.ppUsed + ppUsed >= this.move.getMovePp()) // If we're already at max PP usage, stop checking
|
||||||
|
break;
|
||||||
|
if (opponent.hasAbilityWithAttr(IncreasePpAbAttr)) // Accounting for abilities like Pressure
|
||||||
|
ppUsed++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.followUp && this.canMove() && !this.cancelled) {
|
if (!this.followUp && this.canMove() && !this.cancelled) {
|
||||||
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
|
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
|
||||||
}
|
}
|
||||||
if (this.cancelled) {
|
if (this.cancelled || this.failed) {
|
||||||
|
if (this.failed)
|
||||||
|
this.move.usePp(ppUsed); // Only use PP if the move failed
|
||||||
|
|
||||||
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
@ -2253,23 +2274,12 @@ export class MovePhase extends BattlePhase {
|
||||||
if ((moveQueue.length && moveQueue[0].move === Moves.NONE) || !targets.length) {
|
if ((moveQueue.length && moveQueue[0].move === Moves.NONE) || !targets.length) {
|
||||||
moveQueue.shift();
|
moveQueue.shift();
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
|
||||||
|
|
||||||
if (this.cancelled) {
|
|
||||||
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
||||||
return this.end();
|
return this.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moveQueue.length || !moveQueue.shift().ignorePP) {
|
if (!moveQueue.length || !moveQueue.shift().ignorePP) // using .shift here clears out two turn moves once they've been used
|
||||||
this.move.ppUsed++;
|
this.move.usePp(ppUsed);
|
||||||
const targetedOpponents = this.pokemon.getOpponents().filter(o => this.targets.includes(o.getBattlerIndex()));
|
|
||||||
for (let opponent of targetedOpponents) {
|
|
||||||
if (this.move.ppUsed === this.move.getMove().pp)
|
|
||||||
break;
|
|
||||||
if (opponent.hasAbilityWithAttr(IncreasePpAbAttr))
|
|
||||||
this.move.ppUsed = Math.min(this.move.ppUsed + 1, this.move.getMovePp());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!allMoves[this.move.moveId].getAttrs(CopyMoveAttr).length)
|
if (!allMoves[this.move.moveId].getAttrs(CopyMoveAttr).length)
|
||||||
this.scene.currentBattle.lastMove = this.move.moveId;
|
this.scene.currentBattle.lastMove = this.move.moveId;
|
||||||
|
|
|
@ -587,7 +587,7 @@ export class GameData {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem('sessionData', btoa(JSON.stringify(sessionData)));
|
localStorage.setItem(`sessionData${scene.sessionSlotId ? scene.sessionSlotId : ''}`, btoa(JSON.stringify(sessionData)));
|
||||||
|
|
||||||
console.debug('Session data saved');
|
console.debug('Session data saved');
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,12 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
case Setting.Gamepad_Support:
|
||||||
|
scene.inputController.setGamepadSupport(settingOptions[setting][value] !== 'Disabled');
|
||||||
|
break;
|
||||||
|
case Setting.Swap_A_and_B:
|
||||||
|
scene.abSwapped = settingOptions[setting][value] !== 'Disabled';
|
||||||
|
break;
|
||||||
case Setting.Touch_Controls:
|
case Setting.Touch_Controls:
|
||||||
scene.enableTouchControls = settingOptions[setting][value] !== 'Disabled' && hasTouchscreen();
|
scene.enableTouchControls = settingOptions[setting][value] !== 'Disabled' && hasTouchscreen();
|
||||||
const touchControls = document.getElementById('touchControls');
|
const touchControls = document.getElementById('touchControls');
|
||||||
|
@ -171,19 +177,19 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
||||||
handler: () => changeLocaleHandler('en')
|
handler: () => changeLocaleHandler('en')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Spanish',
|
label: 'Español',
|
||||||
handler: () => changeLocaleHandler('es')
|
handler: () => changeLocaleHandler('es')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Italian',
|
label: 'Italiano',
|
||||||
handler: () => changeLocaleHandler('it')
|
handler: () => changeLocaleHandler('it')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'French',
|
label: 'Français',
|
||||||
handler: () => changeLocaleHandler('fr')
|
handler: () => changeLocaleHandler('fr')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'German',
|
label: 'Deutsch',
|
||||||
handler: () => changeLocaleHandler('de')
|
handler: () => changeLocaleHandler('de')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -414,7 +414,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
this.classicWinIcons = new Array(81).fill(null).map((_, i) => {
|
this.classicWinIcons = new Array(81).fill(null).map((_, i) => {
|
||||||
const x = (i % 9) * 18;
|
const x = (i % 9) * 18;
|
||||||
const y = Math.floor(i / 9) * 18;
|
const y = Math.floor(i / 9) * 18;
|
||||||
const ret = this.scene.add.image(x + 152, y + 16, 'champion_ribbon');
|
const ret = this.scene.add.image(x + 153, y + 21, 'champion_ribbon');
|
||||||
ret.setOrigin(0, 0);
|
ret.setOrigin(0, 0);
|
||||||
ret.setScale(0.5);
|
ret.setScale(0.5);
|
||||||
ret.setVisible(false);
|
ret.setVisible(false);
|
||||||
|
@ -462,7 +462,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
this.pokemonCandyDarknessOverlay.setScale(0.5);
|
this.pokemonCandyDarknessOverlay.setScale(0.5);
|
||||||
this.pokemonCandyDarknessOverlay.setOrigin(0, 0);
|
this.pokemonCandyDarknessOverlay.setOrigin(0, 0);
|
||||||
this.pokemonCandyDarknessOverlay.setTint(0x000000);
|
this.pokemonCandyDarknessOverlay.setTint(0x000000);
|
||||||
this.pokemonCandyDarknessOverlay.setAlpha(0.5);
|
this.pokemonCandyDarknessOverlay.setAlpha(0.50);
|
||||||
this.pokemonCandyDarknessOverlay.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains);
|
this.pokemonCandyDarknessOverlay.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains);
|
||||||
this.starterSelectContainer.add(this.pokemonCandyDarknessOverlay);
|
this.starterSelectContainer.add(this.pokemonCandyDarknessOverlay);
|
||||||
|
|
||||||
|
@ -1332,7 +1332,6 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pokemonCandyDarknessOverlay.setCrop(0,0,16, candyCropY);
|
this.pokemonCandyDarknessOverlay.setCrop(0,0,16, candyCropY);
|
||||||
this.pokemonCandyDarknessOverlay.setCrop(0,0,16, candyCropY);
|
|
||||||
}
|
}
|
||||||
this.iconAnimHandler.addOrUpdate(this.starterSelectGenIconContainers[species.generation - 1].getAt(this.genSpecies[species.generation - 1].indexOf(species)) as Phaser.GameObjects.Sprite, PokemonIconAnimMode.PASSIVE);
|
this.iconAnimHandler.addOrUpdate(this.starterSelectGenIconContainers[species.generation - 1].getAt(this.genSpecies[species.generation - 1].indexOf(species)) as Phaser.GameObjects.Sprite, PokemonIconAnimMode.PASSIVE);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
private candyShadow: Phaser.GameObjects.Sprite;
|
private candyShadow: Phaser.GameObjects.Sprite;
|
||||||
private candyIcon: Phaser.GameObjects.Sprite;
|
private candyIcon: Phaser.GameObjects.Sprite;
|
||||||
private candyOverlay: Phaser.GameObjects.Sprite;
|
private candyOverlay: Phaser.GameObjects.Sprite;
|
||||||
|
private candyCountText: Phaser.GameObjects.Text;
|
||||||
|
private championRibbon: Phaser.GameObjects.Image;
|
||||||
private statusContainer: Phaser.GameObjects.Container;
|
private statusContainer: Phaser.GameObjects.Container;
|
||||||
private status: Phaser.GameObjects.Image;
|
private status: Phaser.GameObjects.Image;
|
||||||
private summaryPageContainer: Phaser.GameObjects.Container;
|
private summaryPageContainer: Phaser.GameObjects.Container;
|
||||||
|
@ -142,12 +144,6 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.pokeball.setOrigin(0, 1);
|
this.pokeball.setOrigin(0, 1);
|
||||||
this.summaryContainer.add(this.pokeball);
|
this.summaryContainer.add(this.pokeball);
|
||||||
|
|
||||||
this.candyShadow = this.scene.add.sprite(13, -140, 'candy');
|
|
||||||
this.candyShadow.setTint(0x141414)
|
|
||||||
this.candyShadow.setScale(0.8);
|
|
||||||
this.candyShadow.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains);
|
|
||||||
this.summaryContainer.add(this.candyShadow);
|
|
||||||
|
|
||||||
this.candyIcon = this.scene.add.sprite(13, -140, 'candy');
|
this.candyIcon = this.scene.add.sprite(13, -140, 'candy');
|
||||||
this.candyIcon.setScale(0.8);
|
this.candyIcon.setScale(0.8);
|
||||||
this.summaryContainer.add(this.candyIcon);
|
this.summaryContainer.add(this.candyIcon);
|
||||||
|
@ -156,6 +152,24 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.candyOverlay.setScale(0.8);
|
this.candyOverlay.setScale(0.8);
|
||||||
this.summaryContainer.add(this.candyOverlay);
|
this.summaryContainer.add(this.candyOverlay);
|
||||||
|
|
||||||
|
this.candyShadow = this.scene.add.sprite(13, -140, 'candy');
|
||||||
|
this.candyShadow.setTint(0x000000);
|
||||||
|
this.candyShadow.setAlpha(0.50);
|
||||||
|
this.candyShadow.setScale(0.8);
|
||||||
|
this.candyShadow.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains);
|
||||||
|
this.summaryContainer.add(this.candyShadow);
|
||||||
|
|
||||||
|
this.candyCountText = addTextObject(this.scene, 20, -146, 'x0', TextStyle.WINDOW_ALT, { fontSize: '76px' });
|
||||||
|
this.candyCountText.setOrigin(0, 0);
|
||||||
|
this.summaryContainer.add(this.candyCountText);
|
||||||
|
|
||||||
|
this.championRibbon = this.scene.add.image(88, -146, 'champion_ribbon');
|
||||||
|
this.championRibbon.setOrigin(0, 0);
|
||||||
|
//this.championRibbon.setScale(0.8);
|
||||||
|
this.championRibbon.setScale(1.25);
|
||||||
|
this.summaryContainer.add(this.championRibbon);
|
||||||
|
this.championRibbon.setVisible(false);
|
||||||
|
|
||||||
this.levelText = addTextObject(this.scene, 36, -17, '', TextStyle.SUMMARY_ALT);
|
this.levelText = addTextObject(this.scene, 36, -17, '', TextStyle.SUMMARY_ALT);
|
||||||
this.levelText.setOrigin(0, 1);
|
this.levelText.setOrigin(0, 1);
|
||||||
this.summaryContainer.add(this.levelText);
|
this.summaryContainer.add(this.levelText);
|
||||||
|
@ -275,6 +289,11 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.splicedIcon.on('pointerout', () => (this.scene as BattleScene).ui.hideTooltip());
|
this.splicedIcon.on('pointerout', () => (this.scene as BattleScene).ui.hideTooltip());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.scene.gameData.starterData[this.pokemon.species.getRootSpeciesId()].classicWinCount > 0 && this.scene.gameData.starterData[this.pokemon.species.getRootSpeciesId(true)].classicWinCount > 0)
|
||||||
|
this.championRibbon.setVisible(true);
|
||||||
|
else
|
||||||
|
this.championRibbon.setVisible(false);
|
||||||
|
|
||||||
var currentFriendship = this.scene.gameData.starterData[this.pokemon.species.getRootSpeciesId()].friendship;
|
var currentFriendship = this.scene.gameData.starterData[this.pokemon.species.getRootSpeciesId()].friendship;
|
||||||
if (!currentFriendship || currentFriendship === undefined)
|
if (!currentFriendship || currentFriendship === undefined)
|
||||||
currentFriendship = 0;
|
currentFriendship = 0;
|
||||||
|
@ -287,8 +306,9 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.candyShadow.on('pointerout', () => (this.scene as BattleScene).ui.hideTooltip());
|
this.candyShadow.on('pointerout', () => (this.scene as BattleScene).ui.hideTooltip());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.candyIcon.setCrop(0,candyCropY,16, 16);
|
this.candyCountText.setText(`x${this.scene.gameData.starterData[this.pokemon.species.getRootSpeciesId()].candyCount}`);
|
||||||
this.candyOverlay.setCrop(0,candyCropY,16, 16);
|
|
||||||
|
this.candyShadow.setCrop(0,0,16, candyCropY);
|
||||||
|
|
||||||
const doubleShiny = isFusion && this.pokemon.shiny && this.pokemon.fusionShiny;
|
const doubleShiny = isFusion && this.pokemon.shiny && this.pokemon.fusionShiny;
|
||||||
const baseVariant = !doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant;
|
const baseVariant = !doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant;
|
||||||
|
|
|
@ -84,7 +84,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||||
|
|
||||||
this.updateTitleStats();
|
this.updateTitleStats();
|
||||||
|
|
||||||
this.titleStatsTimer = setInterval(() => this.updateTitleStats(), 30000);
|
this.titleStatsTimer = setInterval(() => this.updateTitleStats(), 60000);
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [ this.titleContainer, ui.getMessageHandler().bg ],
|
targets: [ this.titleContainer, ui.getMessageHandler().bg ],
|
||||||
|
|
Loading…
Reference in New Issue