mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-24 22:37:33 -04:00
[Bug] Prevent lures from stacking different tiers (#2550)
* Prevent lures from stacking different tiers
* Fix existing stacks of lures only applying once
* Revert "Fix existing stacks of lures only applying once"
This reverts commit c954a56b41
.
* Document lure modifier code
This commit is contained in:
parent
9e3fe2d53a
commit
2ca86dd901
1 changed files with 9 additions and 2 deletions
|
@ -328,7 +328,8 @@ export class DoubleBattleChanceBoosterModifier extends LapsingPersistentModifier
|
||||||
|
|
||||||
match(modifier: Modifier): boolean {
|
match(modifier: Modifier): boolean {
|
||||||
if (modifier instanceof DoubleBattleChanceBoosterModifier) {
|
if (modifier instanceof DoubleBattleChanceBoosterModifier) {
|
||||||
return (modifier as DoubleBattleChanceBoosterModifier).battlesLeft === this.battlesLeft;
|
// Check type id to not match different tiers of lures
|
||||||
|
return modifier.type.id === this.type.id && modifier.battlesLeft === this.battlesLeft;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -340,9 +341,15 @@ export class DoubleBattleChanceBoosterModifier extends LapsingPersistentModifier
|
||||||
getArgs(): any[] {
|
getArgs(): any[] {
|
||||||
return [ this.battlesLeft ];
|
return [ this.battlesLeft ];
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Modifies the chance of a double battle occurring
|
||||||
|
* @param args A single element array containing the double battle chance as a NumberHolder
|
||||||
|
* @returns {boolean} Returns true if the modifier was applied
|
||||||
|
*/
|
||||||
apply(args: any[]): boolean {
|
apply(args: any[]): boolean {
|
||||||
const doubleBattleChance = args[0] as Utils.NumberHolder;
|
const doubleBattleChance = args[0] as Utils.NumberHolder;
|
||||||
|
// This is divided because the chance is generated as a number from 0 to doubleBattleChance.value using Utils.randSeedInt
|
||||||
|
// A double battle will initiate if the generated number is 0
|
||||||
doubleBattleChance.value = Math.ceil(doubleBattleChance.value / 2);
|
doubleBattleChance.value = Math.ceil(doubleBattleChance.value / 2);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue