Fix issues with item transfer and add scrolling
parent
66bd547d6c
commit
fdc1bc5b61
Binary file not shown.
Before Width: | Height: | Size: 198 B |
Binary file not shown.
Before Width: | Height: | Size: 148 B |
Binary file not shown.
Before Width: | Height: | Size: 200 B |
Binary file not shown.
Before Width: | Height: | Size: 204 B |
Binary file not shown.
Before Width: | Height: | Size: 154 B |
Binary file not shown.
Before Width: | Height: | Size: 208 B |
|
@ -216,12 +216,6 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.loadImage('party_message_large', 'ui');
|
||||
this.loadImage('party_message_options', 'ui');
|
||||
this.loadImage('party_message_options_wide', 'ui');
|
||||
this.loadImage('party_options_top', 'ui');
|
||||
this.loadImage('party_options_center', 'ui');
|
||||
this.loadImage('party_options_bottom', 'ui');
|
||||
this.loadImage('party_options_wide_top', 'ui');
|
||||
this.loadImage('party_options_wide_center', 'ui');
|
||||
this.loadImage('party_options_wide_bottom', 'ui');
|
||||
this.loadAtlas('party_cancel', 'ui');
|
||||
|
||||
this.loadImage('summary_bg', 'ui');
|
||||
|
|
|
@ -703,7 +703,7 @@ export const modifierTypes = {
|
|||
|
||||
ENEMY_DAMAGE_BOOSTER: () => new ModifierType('Damage Token', 'Increases damage by 20%', (type, _args) => new Modifiers.EnemyDamageBoosterModifier(type, 20), 'wl_item_drop'),
|
||||
ENEMY_DAMAGE_REDUCTION: () => new ModifierType('Protection Token', 'Reduces incoming damage by 10%', (type, _args) => new Modifiers.EnemyDamageReducerModifier(type, 10), '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_super_potion'),
|
||||
//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 5% of max HP every turn', (type, _args) => new Modifiers.EnemyTurnHealModifier(type, 10), 'wl_potion'),
|
||||
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'),
|
||||
|
@ -964,7 +964,7 @@ export function getPlayerModifierTypeOptionsForWave(waveIndex: integer, count: i
|
|||
|
||||
export function getEnemyBuffModifierForWave(tier: ModifierTier, enemyModifiers: Modifiers.PersistentModifier[]): Modifiers.EnemyPersistentModifier {
|
||||
const tierStackCount = tier === ModifierTier.ULTRA ? 10 : tier === ModifierTier.GREAT ? 5 : 1;
|
||||
const retryCount = 35;
|
||||
const retryCount = 50;
|
||||
let candidate = getNewModifierTypeOption(null, ModifierPoolType.ENEMY_BUFF, tier);
|
||||
let r = 0;
|
||||
let matchingModifier: Modifiers.PersistentModifier;
|
||||
|
@ -990,7 +990,7 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType,
|
|||
if (tier === undefined) {
|
||||
const tierValue = Utils.randSeedInt(256);
|
||||
if (player && tierValue) {
|
||||
const partyShinyCount = party.filter(p => p.shiny).length;
|
||||
const partyShinyCount = party.filter(p => p.isShiny()).length;
|
||||
const upgradeOdds = Math.floor(32 / Math.max((partyShinyCount * 2), 1));
|
||||
upgrade = !Utils.randSeedInt(upgradeOdds);
|
||||
} else
|
||||
|
|
|
@ -35,7 +35,9 @@ export enum PartyOption {
|
|||
SPLICE,
|
||||
SUMMARY,
|
||||
RELEASE,
|
||||
MOVE_1,
|
||||
SCROLL_UP = 1000,
|
||||
SCROLL_DOWN = 1001,
|
||||
MOVE_1 = 2000,
|
||||
MOVE_2,
|
||||
MOVE_3,
|
||||
MOVE_4
|
||||
|
@ -60,7 +62,10 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
private partyMessageBox: Phaser.GameObjects.Image;
|
||||
|
||||
private optionsMode: boolean;
|
||||
private optionsCursor: integer;
|
||||
private optionsScroll: boolean;
|
||||
private optionsCursor: integer = 0;
|
||||
private optionsScrollCursor: integer = 0;
|
||||
private optionsScrollTotal: integer = 0;
|
||||
private optionsContainer: Phaser.GameObjects.Container;
|
||||
private optionsCursorObj: Phaser.GameObjects.Image;
|
||||
private options: integer[];
|
||||
|
@ -208,8 +213,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
if (option === PartyOption.TRANSFER && filterResult === null && this.partyUiMode === PartyUiMode.MOVE_MODIFIER)
|
||||
filterResult = this.moveSelectFilter(pokemon.moveset[this.optionsCursor]);
|
||||
} else {
|
||||
const transferPokemon = this.scene.getParty()[this.transferCursor];
|
||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === pokemon.id) as PokemonHeldItemModifier[];
|
||||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === transferPokemon.id) as PokemonHeldItemModifier[];
|
||||
filterResult = (this.selectFilter as PokemonModifierTransferSelectFilter)(pokemon, itemModifiers[this.transferOptionCursor]);
|
||||
}
|
||||
if (filterResult === null) {
|
||||
|
@ -353,7 +359,32 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
|
||||
if (this.optionsMode) {
|
||||
changed = this.optionsCursor !== cursor;
|
||||
this.optionsCursor = cursor;
|
||||
let isScroll = false;
|
||||
if (changed && this.optionsScroll) {
|
||||
if (Math.abs(cursor - this.optionsCursor) === this.options.length - 1) {
|
||||
this.optionsScrollCursor = cursor ? this.optionsScrollTotal - 8 : 0;
|
||||
this.updateOptions();
|
||||
} else {
|
||||
const isDown = cursor && cursor > this.optionsCursor;
|
||||
if (isDown) {
|
||||
if (this.options[cursor] === PartyOption.SCROLL_DOWN) {
|
||||
isScroll = true;
|
||||
this.optionsScrollCursor++;
|
||||
}
|
||||
} else {
|
||||
if (!cursor && this.optionsScrollCursor) {
|
||||
isScroll = true;
|
||||
this.optionsScrollCursor--;
|
||||
}
|
||||
}
|
||||
if (isScroll && this.optionsScrollCursor === 1)
|
||||
this.optionsScrollCursor += isDown ? 1 : -1;
|
||||
}
|
||||
}
|
||||
if (isScroll) {
|
||||
this.updateOptions();
|
||||
} else
|
||||
this.optionsCursor = cursor;
|
||||
if (!this.optionsCursorObj) {
|
||||
this.optionsCursorObj = this.scene.add.image(0, 0, 'cursor');
|
||||
this.optionsCursorObj.setOrigin(0, 0);
|
||||
|
@ -423,9 +454,13 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
|
||||
this.showText(optionsMessage, 0);
|
||||
|
||||
const optionsBottom = this.scene.add.image(0, 0, `party_options${wideOptions ? '_wide' : ''}_bottom`);
|
||||
optionsBottom.setOrigin(1, 1);
|
||||
this.optionsContainer.add(optionsBottom);
|
||||
this.updateOptions();
|
||||
|
||||
this.setCursor(0);
|
||||
}
|
||||
|
||||
updateOptions(): void {
|
||||
const wideOptions = this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER;
|
||||
|
||||
const pokemon = this.scene.getParty()[this.cursor];
|
||||
|
||||
|
@ -434,6 +469,12 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
&& (m as PokemonHeldItemModifier).getTransferrable(true) && (m as PokemonHeldItemModifier).pokemonId === pokemon.id) as PokemonHeldItemModifier[]
|
||||
: null;
|
||||
|
||||
if (this.options.length) {
|
||||
this.options.splice(0, this.options.length);
|
||||
this.optionsContainer.removeAll(true);
|
||||
this.eraseOptionsCursor();
|
||||
}
|
||||
|
||||
if (this.partyUiMode !== PartyUiMode.MOVE_MODIFIER && (this.transferMode || this.partyUiMode !== PartyUiMode.MODIFIER_TRANSFER)) {
|
||||
switch (this.partyUiMode) {
|
||||
case PartyUiMode.SWITCH:
|
||||
|
@ -480,9 +521,32 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
this.options.push(im);
|
||||
}
|
||||
|
||||
this.optionsScrollTotal = this.options.length;
|
||||
let optionStartIndex = this.optionsScrollCursor;
|
||||
let optionEndIndex = Math.min(this.optionsScrollTotal, optionStartIndex + (!optionStartIndex || this.optionsScrollCursor + 8 >= this.optionsScrollTotal ? 8 : 7));
|
||||
|
||||
this.optionsScroll = this.optionsScrollTotal > 9;
|
||||
|
||||
if (this.optionsScroll) {
|
||||
this.options.splice(optionEndIndex, this.optionsScrollTotal);
|
||||
this.options.splice(0, optionStartIndex);
|
||||
if (optionStartIndex)
|
||||
this.options.unshift(PartyOption.SCROLL_UP);
|
||||
if (optionEndIndex < this.optionsScrollTotal)
|
||||
this.options.push(PartyOption.SCROLL_DOWN);
|
||||
}
|
||||
|
||||
this.options.push(PartyOption.CANCEL);
|
||||
|
||||
for (let o = 0; o < this.options.length; o++) {
|
||||
const optionBg = this.scene.add.nineslice(0, 0, 'window', null, wideOptions ? 144 : 94, 16 * this.options.length + 13, 6, 6, 6, 6);
|
||||
optionBg.setOrigin(1, 1);
|
||||
|
||||
this.optionsContainer.add(optionBg);
|
||||
|
||||
optionStartIndex = 0;
|
||||
optionEndIndex = this.options.length;
|
||||
|
||||
for (let o = optionStartIndex; o < optionEndIndex; o++) {
|
||||
const option = this.options[this.options.length - (o + 1)];
|
||||
let optionName: string;
|
||||
if (this.partyUiMode !== PartyUiMode.MODIFIER_TRANSFER || this.transferMode || option === PartyOption.CANCEL) {
|
||||
|
@ -497,7 +561,11 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
optionName = Utils.toReadableString(PartyOption[option]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
} else if (option === PartyOption.SCROLL_UP)
|
||||
optionName = '↑';
|
||||
else if (option === PartyOption.SCROLL_DOWN)
|
||||
optionName = '↓';
|
||||
else {
|
||||
const itemModifier = itemModifiers[option];
|
||||
optionName = itemModifier.type.name;
|
||||
if (itemModifier.stackCount > 1)
|
||||
|
@ -505,27 +573,17 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
}
|
||||
|
||||
const yCoord = -6 - 16 * o;
|
||||
const optionBg = this.scene.add.image(0, yCoord, `party_options${wideOptions ? '_wide' : ''}_center`);
|
||||
const optionText = addTextObject(this.scene, -79 - (wideOptions ? 50 : 0), yCoord - 16, optionName, TextStyle.WINDOW);
|
||||
|
||||
optionBg.setOrigin(1, 1);
|
||||
optionText.setOrigin(0, 0);
|
||||
|
||||
this.optionsContainer.add(optionBg);
|
||||
this.optionsContainer.add(optionText);
|
||||
}
|
||||
|
||||
const optionsTop = this.scene.add.image(0, -6 - 16 * this.options.length, `party_options${wideOptions ? '_wide' : ''}_top`);
|
||||
optionsTop.setOrigin(1, 1);
|
||||
this.optionsContainer.add(optionsTop);
|
||||
|
||||
this.setCursor(0);
|
||||
}
|
||||
|
||||
startTransfer(): void {
|
||||
this.transferMode = true;
|
||||
this.transferCursor = this.cursor;
|
||||
this.transferOptionCursor = this.optionsCursor;
|
||||
this.transferOptionCursor = this.optionsCursor + this.optionsScrollCursor + (this.options[0] === PartyOption.SCROLL_UP ? -1 : 0);
|
||||
|
||||
this.partySlots[this.transferCursor].setTransfer(true);
|
||||
}
|
||||
|
@ -579,6 +637,9 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||
|
||||
clearOptions() {
|
||||
this.optionsMode = false;
|
||||
this.optionsScroll = false;
|
||||
this.optionsScrollCursor = 0;
|
||||
this.optionsScrollTotal = 0;
|
||||
this.options.splice(0, this.options.length);
|
||||
this.optionsContainer.removeAll(true);
|
||||
this.eraseOptionsCursor();
|
||||
|
|
Loading…
Reference in New Issue