mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
Merge branch 'beta' into beta
This commit is contained in:
commit
c75ced6c12
@ -40,7 +40,6 @@ import {
|
|||||||
type TerastallizeModifierType,
|
type TerastallizeModifierType,
|
||||||
type TmModifierType,
|
type TmModifierType,
|
||||||
getModifierType,
|
getModifierType,
|
||||||
ModifierPoolType,
|
|
||||||
ModifierTypeGenerator,
|
ModifierTypeGenerator,
|
||||||
modifierTypes,
|
modifierTypes,
|
||||||
PokemonHeldItemModifierType,
|
PokemonHeldItemModifierType,
|
||||||
@ -3232,8 +3231,7 @@ export abstract class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steals an item from a set of target Pokemon.
|
* Steals an item, chosen randomly, from a set of target Pokemon.
|
||||||
* This prioritizes high-tier held items when selecting the item to steal.
|
|
||||||
* @param pokemon The {@linkcode Pokemon} holding this item
|
* @param pokemon The {@linkcode Pokemon} holding this item
|
||||||
* @param target The {@linkcode Pokemon} to steal from (optional)
|
* @param target The {@linkcode Pokemon} to steal from (optional)
|
||||||
* @param _args N/A
|
* @param _args N/A
|
||||||
@ -3253,30 +3251,15 @@ export abstract class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const poolType = pokemon.isPlayer()
|
|
||||||
? ModifierPoolType.PLAYER
|
|
||||||
: pokemon.hasTrainer()
|
|
||||||
? ModifierPoolType.TRAINER
|
|
||||||
: ModifierPoolType.WILD;
|
|
||||||
|
|
||||||
const transferredModifierTypes: ModifierType[] = [];
|
const transferredModifierTypes: ModifierType[] = [];
|
||||||
const itemModifiers = globalScene.findModifiers(
|
const itemModifiers = globalScene.findModifiers(
|
||||||
m => m instanceof PokemonHeldItemModifier && m.pokemonId === targetPokemon.id && m.isTransferable,
|
m => m instanceof PokemonHeldItemModifier && m.pokemonId === targetPokemon.id && m.isTransferable,
|
||||||
targetPokemon.isPlayer(),
|
targetPokemon.isPlayer(),
|
||||||
) as PokemonHeldItemModifier[];
|
) as PokemonHeldItemModifier[];
|
||||||
let highestItemTier = itemModifiers
|
|
||||||
.map(m => m.type.getOrInferTier(poolType))
|
|
||||||
.reduce((highestTier, tier) => Math.max(tier!, highestTier), 0); // TODO: is this bang correct?
|
|
||||||
let tierItemModifiers = itemModifiers.filter(m => m.type.getOrInferTier(poolType) === highestItemTier);
|
|
||||||
|
|
||||||
for (let i = 0; i < transferredItemCount; i++) {
|
for (let i = 0; i < transferredItemCount; i++) {
|
||||||
if (!tierItemModifiers.length) {
|
if (!itemModifiers.length) {
|
||||||
while (highestItemTier-- && !tierItemModifiers.length) {
|
break;
|
||||||
tierItemModifiers = itemModifiers.filter(m => m.type.tier === highestItemTier);
|
|
||||||
}
|
|
||||||
if (!tierItemModifiers.length) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const randItemIndex = pokemon.randBattleSeedInt(itemModifiers.length);
|
const randItemIndex = pokemon.randBattleSeedInt(itemModifiers.length);
|
||||||
const randItem = itemModifiers[randItemIndex];
|
const randItem = itemModifiers[randItemIndex];
|
||||||
|
@ -78,10 +78,15 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */
|
/**
|
||||||
|
* In case the current pokemon was just switched in, make sure it is counted as participating in the combat.
|
||||||
|
* For EXP_SHARE purposes, if the current pokemon faints as the combat ends and it was the ONLY player pokemon
|
||||||
|
* involved in combat, it needs to be counted as a participant so the other party pokemon can get their EXP,
|
||||||
|
* so the fainted pokemon has been included.
|
||||||
|
*/
|
||||||
for (const pokemon of globalScene.getPlayerField()) {
|
for (const pokemon of globalScene.getPlayerField()) {
|
||||||
if (pokemon?.isActive(true) && pokemon.isPlayer()) {
|
if (pokemon?.isActive() || pokemon?.isFainted()) {
|
||||||
globalScene.currentBattle.addParticipant(pokemon as PlayerPokemon);
|
globalScene.currentBattle.addParticipant(pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,10 +108,12 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
this.reloadSettings = this.settings.filter(s => s?.requireReload);
|
this.reloadSettings = this.settings.filter(s => s?.requireReload);
|
||||||
|
|
||||||
|
let anyReloadRequired = false;
|
||||||
this.settings.forEach((setting, s) => {
|
this.settings.forEach((setting, s) => {
|
||||||
let settingName = setting.label;
|
let settingName = setting.label;
|
||||||
if (setting?.requireReload) {
|
if (setting?.requireReload) {
|
||||||
settingName += ` (${i18next.t("settings:requireReload")})`;
|
settingName += "*";
|
||||||
|
anyReloadRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.settingLabels[s] = addTextObject(8, 28 + s * 16, settingName, TextStyle.SETTINGS_LABEL);
|
this.settingLabels[s] = addTextObject(8, 28 + s * 16, settingName, TextStyle.SETTINGS_LABEL);
|
||||||
@ -187,6 +189,14 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
|||||||
this.settingsContainer.add(iconAction);
|
this.settingsContainer.add(iconAction);
|
||||||
this.settingsContainer.add(iconCancel);
|
this.settingsContainer.add(iconCancel);
|
||||||
this.settingsContainer.add(actionText);
|
this.settingsContainer.add(actionText);
|
||||||
|
// Only add the ReloadRequired text on pages that have settings that require a reload.
|
||||||
|
if (anyReloadRequired) {
|
||||||
|
const reloadRequired = addTextObject(0, 0, `*${i18next.t("settings:requireReload")}`, TextStyle.SETTINGS_LABEL)
|
||||||
|
.setOrigin(0, 0.15)
|
||||||
|
.setPositionRelative(actionsBg, 6, 0)
|
||||||
|
.setY(actionText.y);
|
||||||
|
this.settingsContainer.add(reloadRequired);
|
||||||
|
}
|
||||||
this.settingsContainer.add(cancelText);
|
this.settingsContainer.add(cancelText);
|
||||||
this.settingsContainer.add(this.messageBoxContainer);
|
this.settingsContainer.add(this.messageBoxContainer);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user