mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Revised logic in tryTransferHeldItemModifier
This commit is contained in:
parent
b8f9bb0d8f
commit
3e94a3aa65
@ -2584,12 +2584,18 @@ export default class BattleScene extends SceneBase {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const source = itemModifier.pokemonId ? itemModifier.getPokemon(target.scene) : null;
|
const source = itemModifier.pokemonId ? itemModifier.getPokemon(target.scene) : null;
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new Utils.BooleanHolder(false);
|
||||||
Utils.executeIf(!!source && source.isPlayer() !== target.isPlayer(), () => applyAbAttrs(BlockItemTheftAbAttr, source! /* checked in condition*/, cancelled)).then(() => {
|
if (source && source.isPlayer() !== target.isPlayer()) {
|
||||||
// Prevents transfer of Mini Black Hole from opponent to player / player to opponent
|
//Check for abilities like Sticky Hold that prevent item transfer between player and opponent
|
||||||
cancelled.value = itemModifier instanceof TurnHeldItemTransferModifier ? true : false;
|
applyAbAttrs(BlockItemTheftAbAttr, source, cancelled).then(() => {
|
||||||
|
// Check to prevent player-to-opponent/opponent-to-player MBH transfer
|
||||||
|
if (!cancelled.value) {
|
||||||
|
cancelled.value = itemModifier instanceof TurnHeldItemTransferModifier;
|
||||||
|
}
|
||||||
if (cancelled.value) {
|
if (cancelled.value) {
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
const newItemModifier = itemModifier.clone() as PokemonHeldItemModifier;
|
const newItemModifier = itemModifier.clone() as PokemonHeldItemModifier;
|
||||||
newItemModifier.pokemonId = target.id;
|
newItemModifier.pokemonId = target.id;
|
||||||
const matchingModifier = target.scene.findModifier(m => m instanceof PokemonHeldItemModifier
|
const matchingModifier = target.scene.findModifier(m => m instanceof PokemonHeldItemModifier
|
||||||
@ -2641,7 +2647,6 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
resolve(false);
|
resolve(false);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removePartyMemberModifiers(partyMemberIndex: integer): Promise<void> {
|
removePartyMemberModifiers(partyMemberIndex: integer): Promise<void> {
|
||||||
|
Loading…
Reference in New Issue
Block a user