Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ability] Implement ability illusion #2217

Closed
wants to merge 202 commits into from
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
77d5baa
get name for illusion
PyGaVS Jun 10, 2024
dc2bf95
Illusion working but without AI
PyGaVS Jun 11, 2024
068c935
illusion working entirely
PyGaVS Jun 14, 2024
7ed5395
merge up-to-date
PyGaVS Jun 14, 2024
56de1e2
add illusion
PyGaVS Jun 14, 2024
8927758
add comments in AbAttr classes
PyGaVS Jun 14, 2024
f79174e
add comments for the property pokemon.illusion
PyGaVS Jun 14, 2024
88ecabe
update generateIllusion method
PyGaVS Jun 14, 2024
ee5d689
feat: Add Google and Discord login functionality
f-fsantos Jun 1, 2024
dbb1fc1
refactor: Add missing properties to initLoggedInUser function
f-fsantos Jun 19, 2024
ef5847d
Update src/locales/de/menu-ui-handler.ts
f-fsantos Jun 23, 2024
0dff7b4
shiny illusion working
PyGaVS Jun 26, 2024
045b754
Zoroark uses the actual form of the target as illusion
PyGaVS Jun 27, 2024
782718c
make i18n debugging an optional env setting
flx-sta Jun 28, 2024
e929538
set development default also to "0"
flx-sta Jun 28, 2024
1094d55
illusion update
PyGaVS Jul 2, 2024
7947d27
merge up to date
PyGaVS Jul 3, 2024
973098f
Illusion not available under neutralizing gas
PyGaVS Jul 4, 2024
b21922b
Merge branch 'main' into updates
PyGaVS Jul 4, 2024
e6d078b
resolve party ui handler conflict
PyGaVS Jul 5, 2024
d197186
resolve party ui conflicts
PyGaVS Jul 5, 2024
34e5ba4
remove overrides changes
PyGaVS Jul 5, 2024
c936261
resolve conflicts on pokemon.ts getAttackTypeEffectiveness()
PyGaVS Jul 5, 2024
4190246
optimization
PyGaVS Jul 6, 2024
ef64037
overrides reset
PyGaVS Jul 6, 2024
3323b64
remove comments
PyGaVS Jul 6, 2024
0e114e8
add french localization
PyGaVS Jul 8, 2024
7f4c373
resolve merge conflicts
PyGaVS Jul 8, 2024
3136734
missed one localization
PyGaVS Jul 8, 2024
db200b8
Update src/locales/de/ability-trigger.ts
PyGaVS Jul 8, 2024
759870e
Update src/locales/pt_BR/ability-trigger.ts
PyGaVS Jul 8, 2024
6ea4faa
Update src/locales/zh_CN/ability-trigger.ts
PyGaVS Jul 8, 2024
15c843f
Update src/locales/zh_TW/ability-trigger.ts
PyGaVS Jul 8, 2024
d4eea94
Update src/locales/fr/ability-trigger.ts
PyGaVS Jul 8, 2024
6f19e50
Update src/locales/ko/ability-trigger.ts
PyGaVS Jul 9, 2024
a74f450
locale key changed
PyGaVS Jul 9, 2024
2e127ec
change locale key
PyGaVS Jul 9, 2024
d5ebdce
Update ability-trigger.ts (Illusion IT)
NicusPulcis Jul 9, 2024
ef2cfd4
Merge pull request #1 from NicusPulcis/patch-53
PyGaVS Jul 9, 2024
ac450a7
Update src/locales/es/ability-trigger.ts
PyGaVS Jul 10, 2024
fc1a1ed
[Bug] add move effectiveness text color check to ignore ability (#2042)
torranx Jun 10, 2024
a996fba
[Bug] Fix inputs being annoying in the corner of the screen again (#2…
SquillWall Jun 10, 2024
ff1fa15
fix inaccurate docs for TypeImmunityAbAttr (#2957)
torranx Jul 10, 2024
c44b38c
chore: Add beta branch to GitHub Actions tests workflow
f-fsantos Jul 10, 2024
4dbed9c
chore: Add beta branch to GitHub Actions linter and gh-pages workflow
f-fsantos Jul 10, 2024
f506a70
Merge branch 'beta' into discord-oauth
f-fsantos Jul 10, 2024
ea4e56b
Update src/locales/ko/menu-ui-handler.ts
f-fsantos Jul 10, 2024
cf1e457
Update src/locales/ko/menu.ts
f-fsantos Jul 10, 2024
84e03be
Localization(pt): translated bgm-name.ts (#2955)
josericardo-fo Jul 10, 2024
db38963
Merge remote-tracking branch 'upstream/beta' into feature/i18n-debugging
flx-sta Jul 10, 2024
fab5992
update VITE_I18N_DEBUG in .env files
flx-sta Jul 10, 2024
cbf9bdb
chore: Update environment variables for beta and production environments
f-fsantos Jul 10, 2024
3674325
Merge pull request #1693 from f-fsantos/discord-oauth
f-fsantos Jul 10, 2024
3c09eef
Merge remote-tracking branch 'upstream/beta' into feature/i18n-debugging
flx-sta Jul 10, 2024
616b448
chore: Add beta branch to GitHub Actions deploy workflow
f-fsantos Jul 10, 2024
85a89b9
Merge branch 'beta' of github.com:pagefaultgames/pokerogue into beta
f-fsantos Jul 10, 2024
4797878
Hardcoded Pokemon should have proper names (#2941)
Tempo-anon Jul 10, 2024
fc4b97d
Merge pull request #2692 from flx-sta/feature/i18n-debugging
Tempo-anon Jul 10, 2024
fc2e75f
delete party as useless parameter in applyPresummonAbAttr() + optimiz…
PyGaVS Jul 10, 2024
5742f08
Refactor challenges and add fresh start (#2963)
Xavion3 Jul 10, 2024
01f6ec2
[Balance] Update many TM learnsets (#2879)
Fontbane Jul 10, 2024
991051f
Refactor challenges and add fresh start (#2964)
Xavion3 Jul 11, 2024
6bc191c
[Bug] Fix off-by-one error in damage calc (#2970)
DayKev Jul 11, 2024
55f2a32
[Bug] Grounded on Terrain fixes (#2969)
chaosgrimmon Jul 11, 2024
d69bedd
Update game-stats-ui-handler.ts (italian) (#2965)
NicusPulcis Jul 11, 2024
e9b13be
[Bugfix] Fix a bug during bgm-bar initialization (#2822)
Dakurei Jul 11, 2024
caf541b
[Mirror][Localization] Translate game victory sentences #2254 (#2906)
EnochG1 Jul 11, 2024
74941bd
[Mirror][Localization] Translate summary #2336 (#2907)
EnochG1 Jul 11, 2024
2f550ea
[Localization] Localization arena flyout (Active Battle Effects) (#2932)
EnochG1 Jul 11, 2024
516a100
This should prevent gym leaders appear as doubles (marnie & piers) wh…
CodeTappert Jul 11, 2024
dd361c5
The stat messages can now be plural (#2600)
CodeTappert Jul 11, 2024
e879b3c
[Enhancement][QoL] Add option to adjust shop overlay opacity (#2622)
torranx Jul 11, 2024
50d7ed3
[Bug] Fix battler tags lapsing at incorrect times (#2944)
innerthunder Jul 11, 2024
4b3984c
Update French pokemon-summary.ts (#2976)
Adri1 Jul 11, 2024
2f81bd5
[Test] Prevent tests from running if overrides are different from the…
OrangeRed Jul 11, 2024
aa90a9f
[QoL] Highlight targets of multitarget moves instead of immediate exe…
torranx Jul 11, 2024
b6360a2
refactor illusion parameter on Pokemon methods + corrections
PyGaVS Jul 11, 2024
41e9073
deleted Promise type on a return func that don't use Promise
PyGaVS Jul 11, 2024
e2290e4
[Refactor] rewrite applyAbAttrsInternal to use an iterator. (#1832)
OrangeRed Jul 11, 2024
ee5a523
Merge branch 'beta' into updates
PyGaVS Jul 11, 2024
d576e7b
[Move] Implement Core Enforcer (#2024)
zacharied Jun 11, 2024
c3438de
merge changes on beta branch
PyGaVS Jul 11, 2024
b5de9de
merge changes on beta branch
PyGaVS Jul 11, 2024
0c23d8f
delete Promise in ApplyPreSummonAbAttr()
PyGaVS Jul 11, 2024
045fd57
Update typescript and typedoc (#2988)
OrangeRed Jul 11, 2024
c5577d6
update workflow (#2989)
OrangeRed Jul 11, 2024
5aee958
[Qol/Balance] Dynamax cannon tweak (#2540)
AsdarDevelops Jul 11, 2024
d57a7c9
[Test] Fix/Extend Unit Test for Hard Press (#2992)
xsn34kzx Jul 12, 2024
1965f2b
[Test] Update tests to enable no-crits override (#2971)
DayKev Jul 12, 2024
39bdfea
[Localization]Localized move-trigger text (#2913)
mercurius-00 Jul 12, 2024
3a1d41a
[Bug] Fix description of rare candy to have proper amount of level (#…
hayuna Jul 12, 2024
21d36bf
move status effect enum into separate file (#2998)
OrangeRed Jul 12, 2024
683c337
add .env.test (#2997)
flx-sta Jul 12, 2024
2314d34
[QoL] Create default overrides class and export that with custom over…
OrangeRed Jul 12, 2024
4dc1af9
[Feature][FUN] add breedersInSpace splash message (#2631)
flx-sta Jul 12, 2024
9df3bdd
[Enhancement] Pokemon generation number tooltip (#2642)
EmberCM Jul 12, 2024
8e44ddf
[Beta] Updating the manage data->unlock all option to work with all a…
Opaque02 Jul 13, 2024
5898012
[Bug] vite port (for development) (#3003)
flx-sta Jul 13, 2024
a3177c6
feat: Update isBeta check in utils.ts to use import.meta.env.MODE
f-fsantos Jul 13, 2024
b2ced62
Merge branch 'beta' of github.com:pagefaultgames/pokerogue into beta
f-fsantos Jul 13, 2024
7709ff5
refactor: Update trainerId and secretId in game data
f-fsantos Jul 13, 2024
a1a906e
Adds bg glow behind starters with unlocked passives (#2497)
Fontbane Jul 13, 2024
985c24e
[Localization] Localize missed things in battlers-tag.ts (#3004)
EnochG1 Jul 13, 2024
0aa5e0d
[Feature] Fully implement Octolock (#2985)
mcmontag Jul 13, 2024
f7b53fa
[Bug] Fix import of overrides in a test (#3009)
mcmontag Jul 13, 2024
cbc6005
[BUG] Fixes Sketch copying the first move used by the opponent instea…
schmidtc1 Jul 13, 2024
0c0de41
[Bug] Making FormChangeItems Untransferrable (#2695)
Arxalc Jul 13, 2024
4a39946
[Bug] Fix Clear terrains upon Trainer Battle (#2027)
Arxalc Jul 13, 2024
2eb317c
Fix item reward overrides going out of bounds (#3012)
OrangeRed Jul 13, 2024
5852cae
[Localization] Localize Berry Heal message (#2996)
EnochG1 Jul 13, 2024
35bbbcb
Adds a check to the bgm-bar display to prevent it from being displaye…
Dakurei Jul 13, 2024
3e8c9d5
[Sprite] Improves Corviknight Palette usage (#3020)
chaosgrimmon Jul 14, 2024
a4f3829
[Beta][Localization] Update French battler-tags.ts and battle.ts (#3015)
Adri1 Jul 14, 2024
1be11d2
[Bug] Fix Lock-On and Mind Reader not working on the first turn (#3001)
schmidtc1 Jul 14, 2024
eedabbf
[Bug] Struggle Recoil should ignore Magic Guard (#3017)
frutescens Jul 14, 2024
8d5bfa5
[Enhancement] Decouple move power calculation from Pokemon.apply(), F…
torranx Jul 14, 2024
416079d
[QoL] Offset the status indicator to keep pokeball in view (#2966)
EmberCM Jul 14, 2024
984b188
[Bug] Fix to epic shiny Yungoos icon (#2991) (#3016)
ArielStevens Jul 14, 2024
2efde67
[Localization(ko)] Change line-break position of ghost type curse add…
EnochG1 Jul 14, 2024
76b42c4
Revert "[Localization]Localized move-trigger text (#2913)" (#3026)
CodeTappert Jul 14, 2024
a9a071b
[Localization(ko)] Fixed typo in Bertha's dialogue (#3025)
sodaMelon Jul 14, 2024
b1e7ae4
[Bug] Prevent fixed-damage and OHKO moves from being modified by dama…
Corrade Jul 14, 2024
4bf5031
[Localization] Brought german localization up to date (#3010)
CodeTappert Jul 15, 2024
21f2e69
[Bug] Remove redundant damage number popups (#3024)
DayKev Jul 15, 2024
d396207
create simple unit tests
PyGaVS Jul 15, 2024
62fb047
merge beta up to date
PyGaVS Jul 15, 2024
ce98794
AI test and bug fix
PyGaVS Jul 15, 2024
b215de1
[Move] Implements Conversion 2 (#2943)
schmidtc1 Jul 15, 2024
4261ab3
[BUG] Fixes bug with Metronome freezing the game (#2819)
schmidtc1 Jul 15, 2024
66481c0
Add missing passive background graphic for legacy UI
Madmadness65 Jul 16, 2024
7d0437d
[Localization] Localize ability messages in ability.ts (trigger, appl…
EnochG1 Jul 16, 2024
e6639ec
Update egg.ts (italian) (#3038)
NicusPulcis Jul 16, 2024
d96b553
[Sprite] Revert Larvesta, fixing stray pixels (#3042)
chaosgrimmon Jul 17, 2024
514c6a1
[Bug] Fix level 100 moves being skipped if leveled past 100 (#3040)
mcmontag Jul 17, 2024
fcbe5e9
[Bug][Fix][Surf][Muddy Water][Sludge Wave][Animation] Added image to …
pom-eranian Jul 17, 2024
4353ccc
[Sprite] Fix Cofagrigus sprite (#3045)
Fontbane Jul 17, 2024
672c9aa
merge beta up-to-date
PyGaVS Jul 17, 2024
bde9b84
Fix FR typo (#3051)
Dakurei Jul 17, 2024
f372c3f
merge beta up-to-date
PyGaVS Jul 17, 2024
93290c6
add unit tests
PyGaVS Jul 17, 2024
7e8f7c1
add corrections + unit tests
PyGaVS Jul 17, 2024
c4e146b
[Beta][Localization] Update Portuguese battler-tags.ts and battle.ts …
josericardo-fo Jul 17, 2024
27b03af
[Music/BGM] Fix bgm file & loop for battle_rival (#3053)
Dakurei Jul 17, 2024
dd693ae
stop loading pride-update banner (#3057)
flx-sta Jul 18, 2024
99f4a9d
[Item] Add Scope Lens and Leek (#2666)
xsn34kzx Jul 18, 2024
719764e
[Music/BGM] New music added for the "Slum" biome, composed by Andr06 …
Dakurei Jul 18, 2024
eb4604d
[Bug] implemented multi target damage penalty (#2329)
bucket1582 Jul 18, 2024
37526c8
[BUG] Uturn faint switch bug fix (#2980)
DustinLin Jul 18, 2024
36cf0ea
[Sprite] Remove extra Oinkologne sprites (#3067)
chaosgrimmon Jul 19, 2024
6735dd7
[Sprite] Mega Mewtwo sprite fixes (#3065)
chaosgrimmon Jul 19, 2024
be1f938
[Music/BGM] New music added for the "Sea" biome, composed by Andr06 (…
Dakurei Jul 19, 2024
6cb2967
merge beta up-to-date
PyGaVS Jul 19, 2024
94b032a
[Balance] Add 12 new TMs and remove 3 (#2733)
Fontbane Jul 20, 2024
a2edc21
[Refactor/Test] Update Dynamax Cannon Unit Tests (#3074)
xsn34kzx Jul 20, 2024
8d1a066
fix: update SameSite attribute in setCookie function to None
f-fsantos Jul 21, 2024
22cd54c
fix: update SameSite attribute in setCookie function to Strict
f-fsantos Jul 21, 2024
4c65569
feat: Add prompt=none to Discord OAuth authorization URL
f-fsantos Jul 21, 2024
93bcf8a
fix: Remove unnecessary cookie setting in LoginPhase and MenuUiHandler
f-fsantos Jul 21, 2024
cf95031
feat: Improve cookie handling in getCookie function
f-fsantos Jul 21, 2024
5abf9ec
feat: Delete duplicate cookies with the same name in getCookie function
f-fsantos Jul 21, 2024
cda7448
[Localization] Add minor Korean translations to ability-trigger file …
smee6 Jul 22, 2024
50cf1c0
Fix broken `multi_target` tests and remove RNG-based failures (#3095)
DayKev Jul 22, 2024
cc6b424
Prevent RNG from breaking the Quick Draw tests (#3096)
DayKev Jul 22, 2024
ecbf757
Make EXP boosting items stack additively and not multiplicatively (#3…
DayKev Jul 22, 2024
21f5595
[Bug] Fixes Encore bug with multi-target moves missing (#3060)
schmidtc1 Jul 22, 2024
4ad5302
Add remaining relearn moves (#2894)
Fontbane Jul 22, 2024
f298ec3
[Enhancement] Decouple move accuracy and accuracy multiplier calculat…
torranx Jul 22, 2024
1041372
[Sprite] Fix a number of sprite issues including the Zubat line, Gold…
Fontbane Jul 22, 2024
b6266c6
[Move] Finish implementation of Glaive Rush (#2720)
DayKev Jul 22, 2024
21940e6
[Bug] fix not changing moveset after add to starter #1932 (#2396)
gjeodnd12165 Jul 22, 2024
fc722be
[Bug] Enemies can properly use stuff cheeks (#3090)
schmidtc1 Jul 22, 2024
01de9b9
[Feature] Added pokemon nicknames/renaming (#2570)
sirzento Jul 22, 2024
de0aacf
[Sprite] Show Partner Eevee variants (#3097)
chaosgrimmon Jul 22, 2024
d0cbe19
Allow Necrozma forms to play their special music (#3054)
Madmadness65 Jul 22, 2024
ccb38ca
[BUG] fixing multi-hit and move messages on faint (#2981)
DustinLin Jul 22, 2024
5006d04
[Bug] Sheer Force/Serene Grace Flyout Bugfix (#2496)
okimin Jul 22, 2024
3d2c2a1
[Visual] Achievement icons (#2617)
frutescens Jul 22, 2024
aba7132
Re-add changes accidentally deleted by #2617
Madmadness65 Jul 22, 2024
04819b8
Fix some broken images in item atlas & achievement
Madmadness65 Jul 22, 2024
348a449
merge up-to-date + implement illusion on nickname
PyGaVS Jul 22, 2024
200fa5b
update illusion test
PyGaVS Jul 22, 2024
b42fa55
fix: Remove unnecessary cookie setting in removeCookie function
f-fsantos Jul 22, 2024
e2829f5
fix: Update removeCookie function to use Max-Age=-1 instead of Expire…
f-fsantos Jul 22, 2024
32d1b6b
[QoL] Starter UI selection update to allow removing specific pokemon …
Opaque02 Jul 22, 2024
86ebd0c
[Bug] Ability changing on evolution fix (#2995)
DayKev Jul 22, 2024
d3c9392
Localization(pt): Updated move.ts (#3078)
josericardo-fo Jul 23, 2024
e846498
[Bug] Enemy pokemon's Harvest creates berry icons on the player's sid…
schmidtc1 Jul 23, 2024
799458c
[Bug] Fix hustle not applying attack boost (#3101)
torranx Jul 23, 2024
630deb9
[Sprite] Mega Latis using opposite's eye colour (#3102)
chaosgrimmon Jul 23, 2024
1d39f8d
[Bug] Fix Thousand Arrows not hitting targets under the effects of Ma…
innerthunder Jul 23, 2024
11c5c0a
[Move] Aeroblast is a wind move (#3109)
Tempo-anon Jul 23, 2024
a0502fb
[Refactor] Replaces the single and double battles overrides with a si…
DayKev Jul 23, 2024
5cb1125
fix `Overrides` capitalization (#3111)
flx-sta Jul 23, 2024
4a04ef5
[Balance] More TM fixes (#3081)
Fontbane Jul 23, 2024
adf5d63
merge up-to-date
PyGaVS Jul 23, 2024
5764211
merge up-to-date
PyGaVS Jul 31, 2024
280f4e0
resolve unexpected merge conflicts
PyGaVS Jul 31, 2024
8d54ab4
remove unexpected changes
PyGaVS Jul 31, 2024
955ceb8
remove unexpected changes
PyGaVS Jul 31, 2024
4acf2b8
remove unexpected changes
PyGaVS Jul 31, 2024
8b46fc4
Merge branch 'beta' into updates
PyGaVS Jul 31, 2024
c78d9f0
update unexpected changes
PyGaVS Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/battle-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ export default class BattleScene extends SceneBase {

container.add(icon);

if (pokemon.isFusion()) {
if (pokemon.isFusion(true)) {
const fusionIcon = this.add.sprite(0, 0, pokemon.getFusionIconAtlasKey(ignoreOverride));
fusionIcon.setName("sprite-fusion-icon");
fusionIcon.setOrigin(0.5, 0);
Expand Down
129 changes: 122 additions & 7 deletions src/data/ability.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,12 @@ export class PostSummonRemoveArenaTagAbAttr extends PostSummonAbAttr {
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: why remove this new line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not intentional

export class PreSummonAbAttr extends AbAttr {
applyPreSummon(pokemon: Pokemon, passive: boolean, party: Pokemon[], args: any[]): boolean {
return false;
}
}

export class PostSummonMessageAbAttr extends PostSummonAbAttr {
private messageFunc: (pokemon: Pokemon) => string;

Expand All @@ -1845,6 +1851,11 @@ export class PostSummonMessageAbAttr extends PostSummonAbAttr {
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
pokemon.scene.queueMessage(this.messageFunc(pokemon));

pokemon.scene.getField(true).map(pokemon => {
if (pokemon.breakIllusion()) {
pokemon.scene.queueMessage(i18next.t("abilityTriggers:illusionBreak", { pokemonName: getPokemonNameWithAffix(pokemon) }));
}
});
return true;
}
}
Expand Down Expand Up @@ -2166,6 +2177,10 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
target = targets[0];
}

if (target.illusion.active) {
return false;
}

pokemon.summonData.speciesForm = target.getSpeciesForm();
pokemon.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
pokemon.summonData.ability = target.getAbility().id;
Expand Down Expand Up @@ -3387,11 +3402,11 @@ export class MaxMultiHitAbAttr extends AbAttr {
}

export class PostBattleAbAttr extends AbAttr {
constructor() {
super(true);
constructor(showAbility: boolean = true) {
super(showAbility);
}

applyPostBattle(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
applyPostBattle(pokemon: Pokemon, passive: boolean, party: Pokemon[], args: any[]): boolean {
return false;
}
}
Expand Down Expand Up @@ -3874,6 +3889,93 @@ export class IceFaceBlockPhysicalAbAttr extends ReceivedMoveDamageMultiplierAbAt
}
}

export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
/**
* Apply a new illusion when summoning Zoroark if the illusion is available
*
* @param {Pokemon} pokemon - The Pokémon with the Illusion ability.
* @param {boolean} passive - N/A
* @param {Pokemon[]} party - The party of the trainer's pokemon.
* @param {...any} args - N/A
* @returns {boolean} - Whether the illusion was applied.
*/
applyPreSummon(pokemon: Pokemon, passive: boolean, party: Pokemon[], args: any[]): boolean {

let suppressed = false;
pokemon.scene.getField(true).filter(p => p !== pokemon).map(p => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does p => p !== pokemon work in this case? I guess because they are references it does, right?

if (p.getAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility()) {
suppressed = true;
}
if (p.getPassiveAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility(true)) {
suppressed = true;
}
});

if (pokemon.illusion.available && !suppressed) {
return pokemon.generateIllusion(party);
} else {
return false;
}
}
}

export class IllusionBreakAbAttr extends PostDefendAbAttr {
/**
* Destroy illusion if attack move deals damage to zoroark
*
* @param {Pokemon} pokemon - The Pokémon with the Illusion ability.
* @param {boolean} passive - N/A
* @param {Pokemon} attacker - The attacking Pokémon.
* @param {PokemonMove} move - The move being used.
* @param {PokemonMove} hitResult - The type of hitResult the pokemon got
* @param {...any} args - N/A
* @returns {boolean} - Whether the illusion was destroyed.
*/
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean | Promise<boolean> {

//[HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO]
if (hitResult > 4) {
PyGaVS marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You ignored @Tempo-anon s improvement request here

return false;
}
pokemon.breakIllusion();
pokemon.scene.queueMessage(i18next.t("abilityTriggers:illusionBreak", { pokemonName: getPokemonNameWithAffix(pokemon) }));
return true;
}
}

export class IllusionAfterBattle extends PostBattleAbAttr {
PyGaVS marked this conversation as resolved.
Show resolved Hide resolved
/**
* Illusion will be available again after a battle and apply the illusion of the pokemon is already on field
*
* @param {Pokemon} pokemon - The Pokémon with the Illusion ability.
* @param {boolean} passive - N/A
* @param {Pokemon[]} party - The party of the trainer's pokemon.
* @param {...any} args - N/A
* @returns {boolean} - Whether the illusion was applied.
*/
applyPostBattle(pokemon: Pokemon, passive: boolean, party: Pokemon[], args: any[]): boolean {
pokemon.breakIllusion();
pokemon.illusion.available = true;
return true;
}
}

export class IllusionDisableAbAttr extends PostSummonAbAttr {
/**
* Illusion will be disabled if the pokemon is summoned with an illusion.
* So the pokemon can use 1 illusion per battle.
PyGaVS marked this conversation as resolved.
Show resolved Hide resolved
*
* @param {Pokemon} pokemon - The Pokémon with the Illusion ability.
* @param {boolean} passive - N/A
* @param {...any} args - N/A
* @returns {boolean}
*/
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
pokemon.illusion.available = false;
return true;
}
PyGaVS marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* If a Pokémon with this Ability selects a damaging move, it has a 30% chance of going first in its priority bracket. If the Ability activates, this is announced at the start of the turn (after move selection).
*
Expand Down Expand Up @@ -4070,6 +4172,11 @@ export function applyPostSummonAbAttrs(attrType: Constructor<PostSummonAbAttr>,
return applyAbAttrsInternal<PostSummonAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostSummon(pokemon, passive, args), args);
}

export function applyPreSummonAbAttrs(attrType: Constructor<PreSummonAbAttr>,
pokemon: Pokemon, party: Pokemon[], ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PreSummonAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreSummon(pokemon, passive, party, args), args);
}

PyGaVS marked this conversation as resolved.
Show resolved Hide resolved
export function applyPreSwitchOutAbAttrs(attrType: Constructor<PreSwitchOutAbAttr>,
pokemon: Pokemon, ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PreSwitchOutAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreSwitchOut(pokemon, passive, args), args, false, true);
Expand Down Expand Up @@ -4126,9 +4233,9 @@ export function applyCheckTrappedAbAttrs(attrType: Constructor<CheckTrappedAbAtt
return applyAbAttrsInternal<CheckTrappedAbAttr>(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, passive, trapped, otherPokemon, args), args, true);
}

export function applyPostBattleAbAttrs(attrType: Constructor<PostBattleAbAttr>,
pokemon: Pokemon, ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PostBattleAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostBattle(pokemon, passive, args), args);
export function applyPostBattleAbAttrs(attrType: { new(...args: any[]): PostBattleAbAttr },
pokemon: Pokemon, party: Pokemon[], ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PostBattleAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostBattle(pokemon, passive, party, args), args);
}

export function applyPostFaintAbAttrs(attrType: Constructor<PostFaintAbAttr>,
Expand Down Expand Up @@ -4617,7 +4724,15 @@ export function initAbilities() {
new Ability(Abilities.ILLUSION, 5)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.unimplemented(),
//The pokemon genrate an illusion if it's available
.conditionalAttr((pokemon) => pokemon.illusion.available, IllusionPreSummonAbAttr, false)
//Illusion is not available after summon
.attr(IllusionDisableAbAttr, false)
//The pokemon loses his illusion when he is damaged by a move
.conditionalAttr((pokemon) => pokemon.illusion.active, IllusionBreakAbAttr, true)
//Illusion is available again after a battle
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionAfterBattle, false)
.bypassFaint(),
PyGaVS marked this conversation as resolved.
Show resolved Hide resolved
new Ability(Abilities.IMPOSTER, 5)
.attr(PostSummonTransformAbAttr)
.attr(UncopiableAbilityAbAttr),
Expand Down
7 changes: 5 additions & 2 deletions src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5225,7 +5225,9 @@ export class AbilityChangeAttr extends MoveEffectAttr {
}

(this.selfTarget ? user : target).summonData.ability = this.ability;

if ((this.selfTarget ? user : target).breakIllusion()) {
(this.selfTarget ? user : target).scene.queueMessage(i18next.t("abilityTriggers:illusionBreak", { pokemonName: getPokemonNameWithAffix((this.selfTarget ? user : target)) }));
}
user.scene.queueMessage("The " + getPokemonMessage((this.selfTarget ? user : target), ` acquired\n${allAbilities[this.ability].name}!`));
PyGaVS marked this conversation as resolved.
Show resolved Hide resolved

return true;
Expand Down Expand Up @@ -5379,7 +5381,8 @@ export class SuppressAbilitiesIfActedAttr extends MoveEffectAttr {
export class TransformAttr extends MoveEffectAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
return new Promise(resolve => {
if (!super.apply(user, target, move, args)) {
if (!super.apply(user, target, move, args) || target.illusion.active || user.illusion.active) {
user.scene.queueMessage(i18next.t("battle:attackFailed"));
return resolve(false);
}

Expand Down
Loading