mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
Fixed berries, removed some debug messages
This commit is contained in:
parent
d2825bad1e
commit
90bc14c667
@ -72,6 +72,10 @@ export class BerryHeldItem extends ConsumableHeldItem {
|
|||||||
apply(params: BERRY_PARAMS): boolean {
|
apply(params: BERRY_PARAMS): boolean {
|
||||||
const pokemon = params.pokemon;
|
const pokemon = params.pokemon;
|
||||||
|
|
||||||
|
if (!this.shouldApply(pokemon)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const preserve = new BooleanHolder(false);
|
const preserve = new BooleanHolder(false);
|
||||||
globalScene.applyModifiers(PreserveBerryModifier, pokemon.isPlayer(), pokemon, preserve);
|
globalScene.applyModifiers(PreserveBerryModifier, pokemon.isPlayer(), pokemon, preserve);
|
||||||
const consumed = !preserve.value;
|
const consumed = !preserve.value;
|
||||||
|
@ -33,8 +33,7 @@ export class BerryPhase extends FieldPhase {
|
|||||||
*/
|
*/
|
||||||
eatBerries(pokemon: Pokemon): void {
|
eatBerries(pokemon: Pokemon): void {
|
||||||
const hasUsableBerry = pokemon.getHeldItems().some(m => {
|
const hasUsableBerry = pokemon.getHeldItems().some(m => {
|
||||||
//TODO: This is bugged, must fix the .shouldApply() function
|
return isItemInCategory(m, HeldItemCategoryId.BERRY) && allHeldItems[m].shouldApply(pokemon);
|
||||||
isItemInCategory(m, HeldItemCategoryId.BERRY) && allHeldItems[m].shouldApply(pokemon);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!hasUsableBerry) {
|
if (!hasUsableBerry) {
|
||||||
|
@ -475,7 +475,6 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getModifierTypeOptions(modifierCount: number): ModifierTypeOption[] {
|
getModifierTypeOptions(modifierCount: number): ModifierTypeOption[] {
|
||||||
console.log("HERE WE ARE", modifierCount, this.customModifierSettings);
|
|
||||||
return getPlayerModifierTypeOptions(
|
return getPlayerModifierTypeOptions(
|
||||||
modifierCount,
|
modifierCount,
|
||||||
globalScene.getPlayerParty(),
|
globalScene.getPlayerParty(),
|
||||||
|
@ -219,7 +219,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
: [];
|
: [];
|
||||||
const optionsYOffset =
|
const optionsYOffset =
|
||||||
shopTypeOptions.length > SHOP_OPTIONS_ROW_LIMIT ? -SINGLE_SHOP_ROW_YOFFSET : -DOUBLE_SHOP_ROW_YOFFSET;
|
shopTypeOptions.length > SHOP_OPTIONS_ROW_LIMIT ? -SINGLE_SHOP_ROW_YOFFSET : -DOUBLE_SHOP_ROW_YOFFSET;
|
||||||
console.log("ui_shop_options", shopTypeOptions);
|
|
||||||
|
|
||||||
for (let m = 0; m < typeOptions.length; m++) {
|
for (let m = 0; m < typeOptions.length; m++) {
|
||||||
const sliceWidth = globalScene.game.canvas.width / 6 / (typeOptions.length + 2);
|
const sliceWidth = globalScene.game.canvas.width / 6 / (typeOptions.length + 2);
|
||||||
@ -233,7 +232,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
this.modifierContainer.add(option);
|
this.modifierContainer.add(option);
|
||||||
this.options.push(option);
|
this.options.push(option);
|
||||||
}
|
}
|
||||||
console.log("ui_options", this.options);
|
|
||||||
|
|
||||||
// Set "Continue" button height based on number of rows in healing items shop
|
// Set "Continue" button height based on number of rows in healing items shop
|
||||||
const continueButton = this.continueButtonContainer.getAt<Phaser.GameObjects.Text>(0);
|
const continueButton = this.continueButtonContainer.getAt<Phaser.GameObjects.Text>(0);
|
||||||
@ -296,20 +294,14 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("maxUpgradeCount", maxUpgradeCount);
|
|
||||||
|
|
||||||
globalScene.time.delayedCall(1000 + maxUpgradeCount * 2000, () => {
|
globalScene.time.delayedCall(1000 + maxUpgradeCount * 2000, () => {
|
||||||
console.log("delayed1", partyHasHeldItem);
|
|
||||||
for (const shopOption of this.shopOptionsRows.flat()) {
|
for (const shopOption of this.shopOptionsRows.flat()) {
|
||||||
console.log("uishop", shopOption);
|
|
||||||
shopOption.show(0, 0);
|
shopOption.show(0, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
globalScene.time.delayedCall(4000 + maxUpgradeCount * 2000, () => {
|
globalScene.time.delayedCall(4000 + maxUpgradeCount * 2000, () => {
|
||||||
console.log("delayed2", partyHasHeldItem);
|
|
||||||
if (partyHasHeldItem) {
|
if (partyHasHeldItem) {
|
||||||
console.log("uihelditem", partyHasHeldItem);
|
|
||||||
this.transferButtonContainer.setAlpha(0);
|
this.transferButtonContainer.setAlpha(0);
|
||||||
this.transferButtonContainer.setVisible(true);
|
this.transferButtonContainer.setVisible(true);
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
@ -364,8 +356,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("ui_end");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +769,6 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
this.add(this.itemContainer);
|
this.add(this.itemContainer);
|
||||||
|
|
||||||
const getItem = () => {
|
const getItem = () => {
|
||||||
console.log("SHOWING ICON", this.modifierTypeOption.type?.name, this.modifierTypeOption.type?.getIcon());
|
|
||||||
const item = globalScene.add.sprite(0, 0, "items", this.modifierTypeOption.type?.getIcon());
|
const item = globalScene.add.sprite(0, 0, "items", this.modifierTypeOption.type?.getIcon());
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
@ -815,7 +804,6 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show(remainingDuration: number, upgradeCountOffset: number) {
|
show(remainingDuration: number, upgradeCountOffset: number) {
|
||||||
console.log("mo1");
|
|
||||||
if (!this.modifierTypeOption.cost) {
|
if (!this.modifierTypeOption.cost) {
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
targets: this.pb,
|
targets: this.pb,
|
||||||
@ -823,7 +811,6 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
duration: 1250,
|
duration: 1250,
|
||||||
ease: "Bounce.Out",
|
ease: "Bounce.Out",
|
||||||
});
|
});
|
||||||
console.log("mo2");
|
|
||||||
|
|
||||||
let lastValue = 1;
|
let lastValue = 1;
|
||||||
let bounceCount = 0;
|
let bounceCount = 0;
|
||||||
@ -850,7 +837,6 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
lastValue = value;
|
lastValue = value;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log("mo3");
|
|
||||||
|
|
||||||
for (let u = 0; u < this.modifierTypeOption.upgradeCount; u++) {
|
for (let u = 0; u < this.modifierTypeOption.upgradeCount; u++) {
|
||||||
const upgradeIndex = u;
|
const upgradeIndex = u;
|
||||||
@ -888,14 +874,12 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log("mo4");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
globalScene.time.delayedCall(remainingDuration + 2000, () => {
|
globalScene.time.delayedCall(remainingDuration + 2000, () => {
|
||||||
if (!globalScene) {
|
if (!globalScene) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("mo5");
|
|
||||||
|
|
||||||
if (!this.modifierTypeOption.cost) {
|
if (!this.modifierTypeOption.cost) {
|
||||||
this.pb.setTexture("pb", `${this.getPbAtlasKey(0)}_open`);
|
this.pb.setTexture("pb", `${this.getPbAtlasKey(0)}_open`);
|
||||||
@ -910,7 +894,6 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
onComplete: () => this.pb.destroy(),
|
onComplete: () => this.pb.destroy(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log("mo6");
|
|
||||||
|
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
targets: this.itemContainer,
|
targets: this.itemContainer,
|
||||||
@ -945,7 +928,6 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("mo_end");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPbAtlasKey(tierOffset = 0) {
|
getPbAtlasKey(tierOffset = 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user