Add Lock Capsule item and update reroll logic
parent
efb6b9dbc9
commit
5bed242002
|
@ -4598,9 +4598,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "4.5.2",
|
"version": "4.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz",
|
||||||
"integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==",
|
"integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.18.10",
|
"esbuild": "^0.18.10",
|
||||||
|
|
11977
public/images/items.json
11977
public/images/items.json
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 46 KiB |
Binary file not shown.
After Width: | Height: | Size: 305 B |
|
@ -149,6 +149,7 @@ export default class BattleScene extends SceneBase {
|
||||||
public arena: Arena;
|
public arena: Arena;
|
||||||
public gameMode: GameMode;
|
public gameMode: GameMode;
|
||||||
public score: integer;
|
public score: integer;
|
||||||
|
public lockModifierTiers: boolean;
|
||||||
public trainer: Phaser.GameObjects.Sprite;
|
public trainer: Phaser.GameObjects.Sprite;
|
||||||
public lastEnemyTrainer: Trainer;
|
public lastEnemyTrainer: Trainer;
|
||||||
public currentBattle: Battle;
|
public currentBattle: Battle;
|
||||||
|
@ -596,6 +597,8 @@ export default class BattleScene extends SceneBase {
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
this.money = 0;
|
this.money = 0;
|
||||||
|
|
||||||
|
this.lockModifierTiers = false;
|
||||||
|
|
||||||
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ]));
|
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ]));
|
||||||
this.pokeballCounts[PokeballType.POKEBALL] += 5;
|
this.pokeballCounts[PokeballType.POKEBALL] += 5;
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ const setPositionRelative = function (guideObject: any, x: number, y: number) {
|
||||||
this.setPosition(x, y);
|
this.setPosition(x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Phaser.GameObjects.Container.prototype.setPositionRelative = setPositionRelative;
|
||||||
Phaser.GameObjects.Sprite.prototype.setPositionRelative = setPositionRelative;
|
Phaser.GameObjects.Sprite.prototype.setPositionRelative = setPositionRelative;
|
||||||
Phaser.GameObjects.Image.prototype.setPositionRelative = setPositionRelative;
|
Phaser.GameObjects.Image.prototype.setPositionRelative = setPositionRelative;
|
||||||
Phaser.GameObjects.NineSlice.prototype.setPositionRelative = setPositionRelative;
|
Phaser.GameObjects.NineSlice.prototype.setPositionRelative = setPositionRelative;
|
||||||
|
|
|
@ -856,6 +856,8 @@ export const modifierTypes = {
|
||||||
GOLDEN_PUNCH: () => new PokemonHeldItemModifierType('Golden Punch', 'Grants 50% of damage inflicted as money', (type, args) => new Modifiers.DamageMoneyRewardModifier(type, (args[0] as Pokemon).id)),
|
GOLDEN_PUNCH: () => new PokemonHeldItemModifierType('Golden Punch', 'Grants 50% of damage inflicted as money', (type, args) => new Modifiers.DamageMoneyRewardModifier(type, (args[0] as Pokemon).id)),
|
||||||
COIN_CASE: () => new ModifierType('Coin Case', 'After every 10th battle, receive 10% of your money in interest', (type, _args) => new Modifiers.MoneyInterestModifier(type)),
|
COIN_CASE: () => new ModifierType('Coin Case', 'After every 10th battle, receive 10% of your money in interest', (type, _args) => new Modifiers.MoneyInterestModifier(type)),
|
||||||
|
|
||||||
|
LOCK_CAPSULE: () => new ModifierType('Lock Capsule', 'Allows you to lock item rarities when rerolling items', (type, _args) => new Modifiers.LockModifierTiersModifier(type), 'lock_capsule'),
|
||||||
|
|
||||||
GRIP_CLAW: () => new ContactHeldItemTransferChanceModifierType('Grip Claw', 10),
|
GRIP_CLAW: () => new ContactHeldItemTransferChanceModifierType('Grip Claw', 10),
|
||||||
|
|
||||||
MULTI_LENS: () => new PokemonMultiHitModifierType('Multi Lens', 'zoom_lens'),
|
MULTI_LENS: () => new PokemonMultiHitModifierType('Multi Lens', 'zoom_lens'),
|
||||||
|
@ -1032,6 +1034,7 @@ const modifierPool: ModifierPool = {
|
||||||
new WeightedModifierType(modifierTypes.ABILITY_CHARM, 6),
|
new WeightedModifierType(modifierTypes.ABILITY_CHARM, 6),
|
||||||
new WeightedModifierType(modifierTypes.FOCUS_BAND, 5),
|
new WeightedModifierType(modifierTypes.FOCUS_BAND, 5),
|
||||||
new WeightedModifierType(modifierTypes.KINGS_ROCK, 3),
|
new WeightedModifierType(modifierTypes.KINGS_ROCK, 3),
|
||||||
|
new WeightedModifierType(modifierTypes.LOCK_CAPSULE, 3),
|
||||||
new WeightedModifierType(modifierTypes.SUPER_EXP_CHARM, 10),
|
new WeightedModifierType(modifierTypes.SUPER_EXP_CHARM, 10),
|
||||||
new WeightedModifierType(modifierTypes.FORM_CHANGE_ITEM, 18),
|
new WeightedModifierType(modifierTypes.FORM_CHANGE_ITEM, 18),
|
||||||
new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 8, 32),
|
new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 8, 32),
|
||||||
|
|
|
@ -1681,6 +1681,28 @@ export class ShinyRateBoosterModifier extends PersistentModifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class LockModifierTiersModifier extends PersistentModifier {
|
||||||
|
constructor(type: ModifierType, stackCount?: integer) {
|
||||||
|
super(type, stackCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
match(modifier: Modifier): boolean {
|
||||||
|
return modifier instanceof LockModifierTiersModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(args: any[]): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
clone(): LockModifierTiersModifier {
|
||||||
|
return new LockModifierTiersModifier(this.type, this.stackCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMaxStackCount(scene: BattleScene): integer {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class SwitchEffectTransferModifier extends PokemonHeldItemModifier {
|
export class SwitchEffectTransferModifier extends PokemonHeldItemModifier {
|
||||||
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
|
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
|
||||||
super(type, pokemonId, stackCount);
|
super(type, pokemonId, stackCount);
|
||||||
|
|
|
@ -3923,7 +3923,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
this.scene.ui.revertMode();
|
this.scene.ui.revertMode();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
super.end();
|
super.end();
|
||||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions)));
|
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)));
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3932,7 +3932,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
switch (rowCursor) {
|
switch (rowCursor) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!cursor) {
|
if (!cursor) {
|
||||||
const rerollCost = this.getRerollCost(typeOptions);
|
const rerollCost = this.getRerollCost(typeOptions, this.scene.lockModifierTiers);
|
||||||
if (this.scene.money < rerollCost) {
|
if (this.scene.money < rerollCost) {
|
||||||
this.scene.ui.playError();
|
this.scene.ui.playError();
|
||||||
return false;
|
return false;
|
||||||
|
@ -3944,18 +3944,25 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
this.scene.updateMoneyText();
|
this.scene.updateMoneyText();
|
||||||
this.scene.playSound('buy');
|
this.scene.playSound('buy');
|
||||||
}
|
}
|
||||||
} else {
|
} else if (cursor === 1) {
|
||||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => {
|
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => {
|
||||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions)).then(() => {
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)).then(() => {
|
||||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||||
const itemModifier = itemModifiers[itemIndex];
|
const itemModifier = itemModifiers[itemIndex];
|
||||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, true);
|
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, true);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||||
}, PartyUiHandler.FilterItemMaxStacks);
|
}, PartyUiHandler.FilterItemMaxStacks);
|
||||||
|
} else {
|
||||||
|
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
||||||
|
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
||||||
|
uiHandler.setRerollCost(this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||||
|
uiHandler.updateLockRaritiesText();
|
||||||
|
uiHandler.updateRerollCostText();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -3997,7 +4004,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
applyModifier(modifier, true);
|
applyModifier(modifier, true);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||||
}, modifierType.selectFilter);
|
}, modifierType.selectFilter);
|
||||||
} else {
|
} else {
|
||||||
const pokemonModifierType = modifierType as PokemonModifierType;
|
const pokemonModifierType = modifierType as PokemonModifierType;
|
||||||
|
@ -4022,7 +4029,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
applyModifier(modifier, true);
|
applyModifier(modifier, true);
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId);
|
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -4030,7 +4037,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
|
|
||||||
return !cost;
|
return !cost;
|
||||||
};
|
};
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions));
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSeed(): void {
|
updateSeed(): void {
|
||||||
|
@ -4041,11 +4048,14 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRerollCost(typeOptions: ModifierTypeOption[]): integer {
|
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer {
|
||||||
let baseValue = 0;
|
let baseValue = 0;
|
||||||
const tierValues = [ 50, 125, 300, 750, 2000 ];
|
if (lockRarities) {
|
||||||
for (let opt of typeOptions)
|
const tierValues = [ 50, 125, 300, 750, 2000 ];
|
||||||
baseValue += tierValues[opt.type.tier];
|
for (let opt of typeOptions)
|
||||||
|
baseValue += tierValues[opt.type.tier];
|
||||||
|
} else
|
||||||
|
baseValue = 250;
|
||||||
return Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount);
|
return Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4054,7 +4064,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
}
|
}
|
||||||
|
|
||||||
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
||||||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.modifierTiers);
|
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
addModifier(modifier: Modifier): Promise<void> {
|
addModifier(modifier: Modifier): Promise<void> {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { getPokeballAtlasKey, PokeballType } from "../data/pokeball";
|
||||||
import { addTextObject, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
|
import { addTextObject, getModifierTierTextTint, getTextColor, TextStyle } from "./text";
|
||||||
import AwaitableUiHandler from "./awaitable-ui-handler";
|
import AwaitableUiHandler from "./awaitable-ui-handler";
|
||||||
import { Mode } from "./ui";
|
import { Mode } from "./ui";
|
||||||
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier";
|
||||||
import { handleTutorial, Tutorial } from "../tutorial";
|
import { handleTutorial, Tutorial } from "../tutorial";
|
||||||
|
|
||||||
export const SHOP_OPTIONS_ROW_LIMIT = 6;
|
export const SHOP_OPTIONS_ROW_LIMIT = 6;
|
||||||
|
@ -12,8 +12,10 @@ export const SHOP_OPTIONS_ROW_LIMIT = 6;
|
||||||
export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
private modifierContainer: Phaser.GameObjects.Container;
|
private modifierContainer: Phaser.GameObjects.Container;
|
||||||
private rerollButtonContainer: Phaser.GameObjects.Container;
|
private rerollButtonContainer: Phaser.GameObjects.Container;
|
||||||
|
private lockRarityButtonContainer: Phaser.GameObjects.Container;
|
||||||
private transferButtonContainer: Phaser.GameObjects.Container;
|
private transferButtonContainer: Phaser.GameObjects.Container;
|
||||||
private rerollCostText: Phaser.GameObjects.Text;
|
private rerollCostText: Phaser.GameObjects.Text;
|
||||||
|
private lockRarityButtonText: Phaser.GameObjects.Text;
|
||||||
|
|
||||||
private rowCursor: integer = 0;
|
private rowCursor: integer = 0;
|
||||||
private player: boolean;
|
private player: boolean;
|
||||||
|
@ -57,6 +59,14 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
this.rerollCostText.setOrigin(0, 0);
|
this.rerollCostText.setOrigin(0, 0);
|
||||||
this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1);
|
this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1);
|
||||||
this.rerollButtonContainer.add(this.rerollCostText);
|
this.rerollButtonContainer.add(this.rerollCostText);
|
||||||
|
|
||||||
|
this.lockRarityButtonContainer = this.scene.add.container(16, -64);
|
||||||
|
this.lockRarityButtonContainer.setVisible(false);
|
||||||
|
ui.add(this.lockRarityButtonContainer);
|
||||||
|
|
||||||
|
this.lockRarityButtonText = addTextObject(this.scene, -4, -2, 'Lock Rarities', TextStyle.PARTY);
|
||||||
|
this.lockRarityButtonText.setOrigin(0, 0);
|
||||||
|
this.lockRarityButtonContainer.add(this.lockRarityButtonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
show(args: any[]): boolean {
|
show(args: any[]): boolean {
|
||||||
|
@ -78,6 +88,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
this.player = args[0];
|
this.player = args[0];
|
||||||
|
|
||||||
const partyHasHeldItem = this.player && !!this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).getTransferrable(true)).length;
|
const partyHasHeldItem = this.player && !!this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).getTransferrable(true)).length;
|
||||||
|
const canLockRarities = !!this.scene.findModifier(m => m instanceof LockModifierTiersModifier);
|
||||||
|
|
||||||
this.transferButtonContainer.setVisible(false);
|
this.transferButtonContainer.setVisible(false);
|
||||||
this.transferButtonContainer.setAlpha(0);
|
this.transferButtonContainer.setAlpha(0);
|
||||||
|
@ -85,6 +96,11 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
this.rerollButtonContainer.setVisible(false);
|
this.rerollButtonContainer.setVisible(false);
|
||||||
this.rerollButtonContainer.setAlpha(0);
|
this.rerollButtonContainer.setAlpha(0);
|
||||||
|
|
||||||
|
this.lockRarityButtonContainer.setVisible(false);
|
||||||
|
this.lockRarityButtonContainer.setAlpha(0);
|
||||||
|
|
||||||
|
this.rerollButtonContainer.setPositionRelative(this.lockRarityButtonContainer, 0, canLockRarities ? -12 : 0);
|
||||||
|
|
||||||
this.rerollCost = args[3] as integer;
|
this.rerollCost = args[3] as integer;
|
||||||
|
|
||||||
this.updateRerollCostText();
|
this.updateRerollCostText();
|
||||||
|
@ -155,15 +171,16 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.scene.currentBattle.waveIndex % 10) {
|
this.rerollButtonContainer.setAlpha(0);
|
||||||
this.rerollButtonContainer.setAlpha(0);
|
this.lockRarityButtonContainer.setAlpha(0);
|
||||||
this.rerollButtonContainer.setVisible(true);
|
this.rerollButtonContainer.setVisible(true);
|
||||||
this.scene.tweens.add({
|
this.lockRarityButtonContainer.setVisible(canLockRarities);
|
||||||
targets: this.rerollButtonContainer,
|
|
||||||
alpha: 1,
|
this.scene.tweens.add({
|
||||||
duration: 250
|
targets: [ this.rerollButtonContainer, this.lockRarityButtonContainer ],
|
||||||
});
|
alpha: 1,
|
||||||
}
|
duration: 250
|
||||||
|
});
|
||||||
|
|
||||||
this.setCursor(0);
|
this.setCursor(0);
|
||||||
this.setRowCursor(1);
|
this.setRowCursor(1);
|
||||||
|
@ -210,24 +227,28 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
} else {
|
} else {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case Button.UP:
|
case Button.UP:
|
||||||
if (this.rowCursor < this.shopOptionsRows.length + 1)
|
if (!this.rowCursor && this.cursor === 2)
|
||||||
|
success = this.setCursor(0);
|
||||||
|
else if (this.rowCursor < this.shopOptionsRows.length + 1)
|
||||||
success = this.setRowCursor(this.rowCursor + 1);
|
success = this.setRowCursor(this.rowCursor + 1);
|
||||||
break;
|
break;
|
||||||
case Button.DOWN:
|
case Button.DOWN:
|
||||||
if (this.rowCursor)
|
if (this.rowCursor)
|
||||||
success = this.setRowCursor(this.rowCursor - 1);
|
success = this.setRowCursor(this.rowCursor - 1);
|
||||||
|
else if (this.lockRarityButtonContainer.visible && !this.cursor)
|
||||||
|
success = this.setCursor(2);
|
||||||
break;
|
break;
|
||||||
case Button.LEFT:
|
case Button.LEFT:
|
||||||
if (!this.rowCursor)
|
if (!this.rowCursor) {
|
||||||
success = this.rerollButtonContainer.visible && this.setCursor(0);
|
success = this.cursor === 1 && this.rerollButtonContainer.visible && this.setCursor(0);
|
||||||
else if (this.cursor)
|
} else if (this.cursor)
|
||||||
success = this.setCursor(this.cursor - 1);
|
success = this.setCursor(this.cursor - 1);
|
||||||
else if (this.rowCursor === 1 && this.rerollButtonContainer.visible)
|
else if (this.rowCursor === 1 && this.rerollButtonContainer.visible)
|
||||||
success = this.setRowCursor(0);
|
success = this.setRowCursor(0);
|
||||||
break;
|
break;
|
||||||
case Button.RIGHT:
|
case Button.RIGHT:
|
||||||
if (!this.rowCursor)
|
if (!this.rowCursor)
|
||||||
success = this.transferButtonContainer.visible && this.setCursor(1);
|
success = this.cursor !== 1 && this.transferButtonContainer.visible && this.setCursor(1);
|
||||||
else if (this.cursor < this.getRowItems(this.rowCursor) - 1)
|
else if (this.cursor < this.getRowItems(this.rowCursor) - 1)
|
||||||
success = this.setCursor(this.cursor + 1);
|
success = this.setCursor(this.cursor + 1);
|
||||||
else if (this.rowCursor === 1 && this.transferButtonContainer.visible)
|
else if (this.rowCursor === 1 && this.transferButtonContainer.visible)
|
||||||
|
@ -263,11 +284,14 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
this.cursorObj.setPosition(sliceWidth * (cursor + 1) + (sliceWidth * 0.5) - 16, (-this.scene.game.canvas.height / 12 - this.scene.game.canvas.height / 32) - (-16 + 28 * (this.rowCursor - (this.shopOptionsRows.length - 1))));
|
this.cursorObj.setPosition(sliceWidth * (cursor + 1) + (sliceWidth * 0.5) - 16, (-this.scene.game.canvas.height / 12 - this.scene.game.canvas.height / 32) - (-16 + 28 * (this.rowCursor - (this.shopOptionsRows.length - 1))));
|
||||||
ui.showText(options[this.cursor].modifierTypeOption.type.getDescription(this.scene));
|
ui.showText(options[this.cursor].modifierTypeOption.type.getDescription(this.scene));
|
||||||
} else if (!cursor) {
|
} else if (!cursor) {
|
||||||
this.cursorObj.setPosition(6, -60);
|
this.cursorObj.setPosition(6, this.lockRarityButtonContainer.visible ? -72 : -60);
|
||||||
ui.showText('Spend money to reroll your item options');
|
ui.showText('Spend money to reroll your item options');
|
||||||
} else {
|
} else if (cursor === 1) {
|
||||||
this.cursorObj.setPosition((this.scene.game.canvas.width / 6) - 50, -60);
|
this.cursorObj.setPosition((this.scene.game.canvas.width / 6) - 50, -60);
|
||||||
ui.showText('Transfer a held item from one Pokémon to another');
|
ui.showText('Transfer a held item from one Pokémon to another');
|
||||||
|
} else {
|
||||||
|
this.cursorObj.setPosition(6, -60);
|
||||||
|
ui.showText('Lock item rarities on reroll (affects reroll cost)');
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -304,6 +328,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setRerollCost(rerollCost: integer): void {
|
||||||
|
this.rerollCost = rerollCost;
|
||||||
|
}
|
||||||
|
|
||||||
updateCostText(): void {
|
updateCostText(): void {
|
||||||
const shopOptions = this.shopOptionsRows.flat();
|
const shopOptions = this.shopOptionsRows.flat();
|
||||||
for (let shopOption of shopOptions)
|
for (let shopOption of shopOptions)
|
||||||
|
@ -320,6 +348,12 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
this.rerollCostText.setShadowColor(this.getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED, true));
|
this.rerollCostText.setShadowColor(this.getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateLockRaritiesText(): void {
|
||||||
|
const textStyle = this.scene.lockModifierTiers ? TextStyle.SUMMARY_BLUE : TextStyle.PARTY;
|
||||||
|
this.lockRarityButtonText.setColor(this.getTextColor(textStyle));
|
||||||
|
this.lockRarityButtonText.setShadowColor(this.getTextColor(textStyle, true));
|
||||||
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
super.clear();
|
super.clear();
|
||||||
|
|
||||||
|
@ -342,7 +376,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||||
onComplete: () => options.forEach(o => o.destroy())
|
onComplete: () => options.forEach(o => o.destroy())
|
||||||
});
|
});
|
||||||
|
|
||||||
[ this.rerollButtonContainer, this.transferButtonContainer ].forEach(container => {
|
[ this.rerollButtonContainer, this.transferButtonContainer, this.lockRarityButtonContainer ].forEach(container => {
|
||||||
if (container.visible) {
|
if (container.visible) {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: container,
|
targets: container,
|
||||||
|
|
Loading…
Reference in New Issue