From 930cac6acad1d2fd1b8280ea959b424383aa5b98 Mon Sep 17 00:00:00 2001 From: PhallenTree <168426989+PhallenTree@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:46:56 +0100 Subject: [PATCH] Fix Instruct bypassing AtkCanceler, Entry Hazards targeting wrong side of the field if opponent fainted (#5262) * Fix Instruct bypassing AtkCanceler + interaction with firstTurnOnly moves * Fix Entry Hazards targeting the wrong side of the field if opponent fainted * Remove unused BattleScript_AuroraVeilEnds and STRINGID_AURORAVEILENDS * Alternative fix + Fix gBattlerTarget initially set to 2 * Fix Instruct animation * Alternative anim fix --- data/battle_scripts_1.s | 2 + include/battle_scripts.h | 1 - include/constants/battle_string_ids.h | 539 +++++++++++++------------- src/battle_message.c | 2 - src/battle_script_commands.c | 10 +- src/battle_util.c | 8 +- test/battle/move_effect/instruct.c | 218 +++++++++++ test/battle/move_effect/sticky_web.c | 33 ++ 8 files changed, 532 insertions(+), 281 deletions(-) create mode 100644 test/battle/move_effect/instruct.c diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5bd91f8df5bb..9d0bc6fc1f04 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1757,6 +1757,8 @@ BattleScript_EffectInstruct:: tryinstruct BattleScript_ButItFailed attackanimation waitanimation + copybyte gBattlerAttacker, gBattlerTarget + copybyte gBattlerTarget, gEffectBattler printstring STRINGID_USEDINSTRUCTEDMOVE waitmessage B_WAIT_TIME_LONG setbyte sB_ANIM_TURN, 0 diff --git a/include/battle_scripts.h b/include/battle_scripts.h index e8c71d32c27f..fb1e72af247f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -263,7 +263,6 @@ extern const u8 BattleScript_EmbargoEndTurn[]; extern const u8 BattleScript_TelekinesisEndTurn[]; extern const u8 BattleScript_BufferEndTurn[]; extern const u8 BattleScript_AquaRingHeal[]; -extern const u8 BattleScript_AuroraVeilEnds[]; extern const u8 BattleScript_LuckyChantEnds[]; extern const u8 BattleScript_TailwindEnds[]; extern const u8 BattleScript_TrickRoomEnds[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 9529e026c11b..9fbb70a22397 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -444,277 +444,276 @@ #define STRINGID_WATERSPORTENDS 442 #define STRINGID_GRAVITYENDS 443 #define STRINGID_AQUARINGHEAL 444 -#define STRINGID_AURORAVEILENDS 445 -#define STRINGID_ELECTRICTERRAINENDS 446 -#define STRINGID_MISTYTERRAINENDS 447 -#define STRINGID_PSYCHICTERRAINENDS 448 -#define STRINGID_GRASSYTERRAINENDS 449 -#define STRINGID_TARGETABILITYSTATRAISE 450 -#define STRINGID_TARGETSSTATWASMAXEDOUT 451 -#define STRINGID_ATTACKERABILITYSTATRAISE 452 -#define STRINGID_POISONHEALHPUP 453 -#define STRINGID_BADDREAMSDMG 454 -#define STRINGID_MOLDBREAKERENTERS 455 -#define STRINGID_TERAVOLTENTERS 456 -#define STRINGID_TURBOBLAZEENTERS 457 -#define STRINGID_SLOWSTARTENTERS 458 -#define STRINGID_SLOWSTARTEND 459 -#define STRINGID_SOLARPOWERHPDROP 460 -#define STRINGID_AFTERMATHDMG 461 -#define STRINGID_ANTICIPATIONACTIVATES 462 -#define STRINGID_FOREWARNACTIVATES 463 -#define STRINGID_ICEBODYHPGAIN 464 -#define STRINGID_SNOWWARNINGHAIL 465 -#define STRINGID_FRISKACTIVATES 466 -#define STRINGID_UNNERVEENTERS 467 -#define STRINGID_HARVESTBERRY 468 -#define STRINGID_LASTABILITYRAISEDSTAT 469 -#define STRINGID_MAGICBOUNCEACTIVATES 470 -#define STRINGID_PROTEANTYPECHANGE 471 -#define STRINGID_SYMBIOSISITEMPASS 472 -#define STRINGID_STEALTHROCKDMG 473 -#define STRINGID_TOXICSPIKESABSORBED 474 -#define STRINGID_TOXICSPIKESPOISONED 475 -#define STRINGID_STICKYWEBSWITCHIN 476 -#define STRINGID_HEALINGWISHCAMETRUE 477 -#define STRINGID_HEALINGWISHHEALED 478 -#define STRINGID_LUNARDANCECAMETRUE 479 -#define STRINGID_CUSEDBODYDISABLED 480 -#define STRINGID_ATTACKERACQUIREDABILITY 481 -#define STRINGID_TARGETABILITYSTATLOWER 482 -#define STRINGID_TARGETSTATWONTGOHIGHER 483 -#define STRINGID_PKMNMOVEBOUNCEDABILITY 484 -#define STRINGID_IMPOSTERTRANSFORM 485 -#define STRINGID_ASSAULTVESTDOESNTALLOW 486 -#define STRINGID_GRAVITYPREVENTSUSAGE 487 -#define STRINGID_HEALBLOCKPREVENTSUSAGE 488 -#define STRINGID_NOTDONEYET 489 -#define STRINGID_STICKYWEBUSED 490 -#define STRINGID_QUASHSUCCESS 491 -#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492 -#define STRINGID_PKMNBLEWAWAYSTICKYWEB 493 -#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494 -#define STRINGID_IONDELUGEON 495 -#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496 -#define STRINGID_TERRAINBECOMESMISTY 497 -#define STRINGID_TERRAINBECOMESGRASSY 498 -#define STRINGID_TERRAINBECOMESELECTRIC 499 -#define STRINGID_TERRAINBECOMESPSYCHIC 500 -#define STRINGID_TARGETELECTRIFIED 501 -#define STRINGID_MEGAEVOREACTING 502 -#define STRINGID_MEGAEVOEVOLVED 503 -#define STRINGID_DRASTICALLY 504 -#define STRINGID_SEVERELY 505 -#define STRINGID_INFESTATION 506 -#define STRINGID_NOEFFECTONTARGET 507 -#define STRINGID_BURSTINGFLAMESHIT 508 -#define STRINGID_BESTOWITEMGIVING 509 -#define STRINGID_THIRDTYPEADDED 510 -#define STRINGID_FELLFORFEINT 511 -#define STRINGID_POKEMONCANNOTUSEMOVE 512 -#define STRINGID_COVEREDINPOWDER 513 -#define STRINGID_POWDEREXPLODES 514 -#define STRINGID_BELCHCANTSELECT 515 -#define STRINGID_SPECTRALTHIEFSTEAL 516 -#define STRINGID_GRAVITYGROUNDING 517 -#define STRINGID_MISTYTERRAINPREVENTS 518 -#define STRINGID_GRASSYTERRAINHEALS 519 -#define STRINGID_ELECTRICTERRAINPREVENTS 520 -#define STRINGID_PSYCHICTERRAINPREVENTS 521 -#define STRINGID_SAFETYGOGGLESPROTECTED 522 -#define STRINGID_FLOWERVEILPROTECTED 523 -#define STRINGID_SWEETVEILPROTECTED 524 -#define STRINGID_AROMAVEILPROTECTED 525 -#define STRINGID_CELEBRATEMESSAGE 526 -#define STRINGID_USEDINSTRUCTEDMOVE 527 -#define STRINGID_THROATCHOPENDS 528 -#define STRINGID_PKMNCANTUSEMOVETHROATCHOP 529 -#define STRINGID_LASERFOCUS 530 -#define STRINGID_GEMACTIVATES 531 -#define STRINGID_BERRYDMGREDUCES 532 -#define STRINGID_TARGETATEITEM 533 -#define STRINGID_AIRBALLOONFLOAT 534 -#define STRINGID_AIRBALLOONPOP 535 -#define STRINGID_INCINERATEBURN 536 -#define STRINGID_BUGBITE 537 -#define STRINGID_ILLUSIONWOREOFF 538 -#define STRINGID_ATTACKERCUREDTARGETSTATUS 539 -#define STRINGID_ATTACKERLOSTFIRETYPE 540 -#define STRINGID_HEALERCURE 541 -#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 -#define STRINGID_RECEIVERABILITYTAKEOVER 543 -#define STRINGID_PKNMABSORBINGPOWER 544 -#define STRINGID_NOONEWILLBEABLETORUNAWAY 545 -#define STRINGID_DESTINYKNOTACTIVATES 546 -#define STRINGID_CLOAKEDINAFREEZINGLIGHT 547 -#define STRINGID_CLEARAMULETWONTLOWERSTATS 548 -#define STRINGID_FERVENTWISHREACHED 549 -#define STRINGID_AIRLOCKACTIVATES 550 -#define STRINGID_PRESSUREENTERS 551 -#define STRINGID_DARKAURAENTERS 552 -#define STRINGID_FAIRYAURAENTERS 553 -#define STRINGID_AURABREAKENTERS 554 -#define STRINGID_COMATOSEENTERS 555 -#define STRINGID_SCREENCLEANERENTERS 556 -#define STRINGID_FETCHEDPOKEBALL 557 -#define STRINGID_BATTLERABILITYRAISEDSTAT 558 -#define STRINGID_ASANDSTORMKICKEDUP 559 -#define STRINGID_PKMNSWILLPERISHIN3TURNS 560 -#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561 -#define STRINGID_AURAFLAREDTOLIFE 562 -#define STRINGID_ASONEENTERS 563 -#define STRINGID_CURIOUSMEDICINEENTERS 564 -#define STRINGID_CANACTFASTERTHANKSTO 565 -#define STRINGID_MICLEBERRYACTIVATES 566 -#define STRINGID_PKMNSHOOKOFFTHETAUNT 567 -#define STRINGID_PKMNGOTOVERITSINFATUATION 568 -#define STRINGID_ITEMCANNOTBEREMOVED 569 -#define STRINGID_STICKYBARBTRANSFER 570 -#define STRINGID_PKMNBURNHEALED 571 -#define STRINGID_REDCARDACTIVATE 572 -#define STRINGID_EJECTBUTTONACTIVATE 573 -#define STRINGID_ATKGOTOVERINFATUATION 574 -#define STRINGID_TORMENTEDNOMORE 575 -#define STRINGID_HEALBLOCKEDNOMORE 576 -#define STRINGID_ATTACKERBECAMEFULLYCHARGED 577 -#define STRINGID_ATTACKERBECAMEASHSPECIES 578 -#define STRINGID_EXTREMELYHARSHSUNLIGHT 579 -#define STRINGID_EXTREMESUNLIGHTFADED 580 -#define STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT 581 -#define STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED 582 -#define STRINGID_HEAVYRAIN 583 -#define STRINGID_HEAVYRAINLIFTED 584 -#define STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN 585 -#define STRINGID_NORELIEFROMHEAVYRAIN 586 -#define STRINGID_MYSTERIOUSAIRCURRENT 587 -#define STRINGID_STRONGWINDSDISSIPATED 588 -#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 589 -#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 590 -#define STRINGID_STUFFCHEEKSCANTSELECT 591 -#define STRINGID_PKMNREVERTEDTOPRIMAL 592 -#define STRINGID_BUTPOKEMONCANTUSETHEMOVE 593 -#define STRINGID_BUTHOOPACANTUSEIT 594 -#define STRINGID_BROKETHROUGHPROTECTION 595 -#define STRINGID_ABILITYALLOWSONLYMOVE 596 -#define STRINGID_SWAPPEDABILITIES 597 -#define STRINGID_PASTELVEILPROTECTED 598 -#define STRINGID_PASTELVEILENTERS 599 -#define STRINGID_BATTLERTYPECHANGEDTO 600 -#define STRINGID_BOTHCANNOLONGERESCAPE 601 -#define STRINGID_CANTESCAPEDUETOUSEDMOVE 602 -#define STRINGID_PKMNBECAMEWEAKERTOFIRE 603 -#define STRINGID_ABOUTTOUSEPOLTERGEIST 604 -#define STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE 605 -#define STRINGID_NEUTRALIZINGGASENTERS 606 -#define STRINGID_NEUTRALIZINGGASOVER 607 -#define STRINGID_TARGETTOOHEAVY 608 -#define STRINGID_PKMNTOOKTARGETHIGH 609 -#define STRINGID_PKMNINSNAPTRAP 610 -#define STRINGID_METEORBEAMCHARGING 611 -#define STRINGID_HEATUPBEAK 612 -#define STRINGID_COURTCHANGE 613 -#define STRINGID_PLAYERLOSTTOENEMYTRAINER 614 -#define STRINGID_PLAYERPAIDPRIZEMONEY 615 -#define STRINGID_ZPOWERSURROUNDS 616 -#define STRINGID_ZMOVEUNLEASHED 617 -#define STRINGID_ZMOVERESETSSTATS 618 -#define STRINGID_ZMOVEALLSTATSUP 619 -#define STRINGID_ZMOVEZBOOSTCRIT 620 -#define STRINGID_ZMOVERESTOREHP 621 -#define STRINGID_ZMOVESTATUP 622 -#define STRINGID_ZMOVEHPTRAP 623 -#define STRINGID_ATTACKEREXPELLEDTHEPOISON 624 -#define STRINGID_ATTACKERSHOOKITSELFAWAKE 625 -#define STRINGID_ATTACKERBROKETHROUGHPARALYSIS 626 -#define STRINGID_ATTACKERHEALEDITSBURN 627 -#define STRINGID_ATTACKERMELTEDTHEICE 628 -#define STRINGID_TARGETTOUGHEDITOUT 629 -#define STRINGID_ATTACKERLOSTELECTRICTYPE 630 -#define STRINGID_ATTACKERSWITCHEDSTATWITHTARGET 631 -#define STRINGID_BEINGHITCHARGEDPKMNWITHPOWER 632 -#define STRINGID_SUNLIGHTACTIVATEDABILITY 633 -#define STRINGID_STATWASHEIGHTENED 634 -#define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 635 -#define STRINGID_ABILITYWEAKENEDSURROUNDINGMONSSTAT 636 -#define STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN 637 -#define STRINGID_PKMNSABILITYPREVENTSABILITY 638 -#define STRINGID_PREPARESHELLTRAP 639 -#define STRINGID_SHELLTRAPDIDNTWORK 640 -#define STRINGID_SPIKESDISAPPEAREDFROMTEAM 641 -#define STRINGID_TOXICSPIKESDISAPPEAREDFROMTEAM 642 -#define STRINGID_STICKYWEBDISAPPEAREDFROMTEAM 643 -#define STRINGID_STEALTHROCKDISAPPEAREDFROMTEAM 644 -#define STRINGID_COULDNTFULLYPROTECT 645 -#define STRINGID_STOCKPILEDEFFECTWOREOFF 646 -#define STRINGID_PKMNREVIVEDREADYTOFIGHT 647 -#define STRINGID_ITEMRESTOREDSPECIESHEALTH 648 -#define STRINGID_ITEMCUREDSPECIESSTATUS 649 -#define STRINGID_ITEMRESTOREDSPECIESPP 650 -#define STRINGID_THUNDERCAGETRAPPED 651 -#define STRINGID_PKMNHURTBYFROSTBITE 652 -#define STRINGID_PKMNGOTFROSTBITE 653 -#define STRINGID_PKMNSITEMHEALEDFROSTBITE 654 -#define STRINGID_ATTACKERHEALEDITSFROSTBITE 655 -#define STRINGID_PKMNFROSTBITEHEALED 656 -#define STRINGID_PKMNFROSTBITEHEALED2 657 -#define STRINGID_PKMNFROSTBITEHEALEDBY 658 -#define STRINGID_MIRRORHERBCOPIED 659 -#define STRINGID_STARTEDSNOW 660 -#define STRINGID_SNOWCONTINUES 661 -#define STRINGID_SNOWSTOPPED 662 -#define STRINGID_SNOWWARNINGSNOW 663 -#define STRINGID_PKMNITEMMELTED 664 -#define STRINGID_ULTRABURSTREACTING 665 -#define STRINGID_ULTRABURSTCOMPLETED 666 -#define STRINGID_TEAMGAINEDEXP 667 -#define STRINGID_CURRENTMOVECANTSELECT 668 -#define STRINGID_TARGETISBEINGSALTCURED 669 -#define STRINGID_TARGETISHURTBYSALTCURE 670 -#define STRINGID_TARGETCOVEREDINSTICKYCANDYSYRUP 671 -#define STRINGID_SHARPSTEELFLOATS 672 -#define STRINGID_SHARPSTEELDMG 673 -#define STRINGID_PKMNBLEWAWAYSHARPSTEEL 674 -#define STRINGID_SHARPSTEELDISAPPEAREDFROMTEAM 675 -#define STRINGID_TEAMTRAPPEDWITHVINES 676 -#define STRINGID_PKMNHURTBYVINES 677 -#define STRINGID_TEAMCAUGHTINVORTEX 678 -#define STRINGID_PKMNHURTBYVORTEX 679 -#define STRINGID_TEAMSURROUNDEDBYFIRE 680 -#define STRINGID_PKMNBURNINGUP 681 -#define STRINGID_TEAMSURROUNDEDBYROCKS 682 -#define STRINGID_PKMNHURTBYROCKSTHROWN 683 -#define STRINGID_MOVEBLOCKEDBYDYNAMAX 684 -#define STRINGID_ZEROTOHEROTRANSFORMATION 685 -#define STRINGID_THETWOMOVESBECOMEONE 686 -#define STRINGID_ARAINBOWAPPEAREDONSIDE 687 -#define STRINGID_THERAINBOWDISAPPEARED 688 -#define STRINGID_WAITINGFORPARTNERSMOVE 689 -#define STRINGID_SEAOFFIREENVELOPEDSIDE 690 -#define STRINGID_HURTBYTHESEAOFFIRE 691 -#define STRINGID_THESEAOFFIREDISAPPEARED 692 -#define STRINGID_SWAMPENVELOPEDSIDE 693 -#define STRINGID_THESWAMPDISAPPEARED 694 -#define STRINGID_PKMNTELLCHILLINGRECEPTIONJOKE 695 -#define STRINGID_HOSPITALITYRESTORATION 696 -#define STRINGID_ELECTROSHOTCHARGING 697 -#define STRINGID_ITEMWASUSEDUP 698 -#define STRINGID_ATTACKERLOSTITSTYPE 699 -#define STRINGID_SHEDITSTAIL 700 -#define STRINGID_CLOAKEDINAHARSHLIGHT 701 -#define STRINGID_SUPERSWEETAROMAWAFTS 702 -#define STRINGID_DIMENSIONSWERETWISTED 703 -#define STRINGID_BIZARREARENACREATED 704 -#define STRINGID_BIZARREAREACREATED 705 -#define STRINGID_TIDYINGUPCOMPLETE 706 -#define STRINGID_PKMNTERASTALLIZEDINTO 707 -#define STRINGID_BOOSTERENERGYACTIVATES 708 -#define STRINGID_FOGCREPTUP 709 -#define STRINGID_FOGISDEEP 710 -#define STRINGID_FOGLIFTED 711 -#define STRINGID_PKMNMADESHELLGLEAM 712 -#define STRINGID_FICKLEBEAMDOUBLED 713 +#define STRINGID_ELECTRICTERRAINENDS 445 +#define STRINGID_MISTYTERRAINENDS 446 +#define STRINGID_PSYCHICTERRAINENDS 447 +#define STRINGID_GRASSYTERRAINENDS 448 +#define STRINGID_TARGETABILITYSTATRAISE 449 +#define STRINGID_TARGETSSTATWASMAXEDOUT 450 +#define STRINGID_ATTACKERABILITYSTATRAISE 451 +#define STRINGID_POISONHEALHPUP 452 +#define STRINGID_BADDREAMSDMG 453 +#define STRINGID_MOLDBREAKERENTERS 454 +#define STRINGID_TERAVOLTENTERS 455 +#define STRINGID_TURBOBLAZEENTERS 456 +#define STRINGID_SLOWSTARTENTERS 457 +#define STRINGID_SLOWSTARTEND 458 +#define STRINGID_SOLARPOWERHPDROP 459 +#define STRINGID_AFTERMATHDMG 460 +#define STRINGID_ANTICIPATIONACTIVATES 461 +#define STRINGID_FOREWARNACTIVATES 462 +#define STRINGID_ICEBODYHPGAIN 463 +#define STRINGID_SNOWWARNINGHAIL 464 +#define STRINGID_FRISKACTIVATES 465 +#define STRINGID_UNNERVEENTERS 466 +#define STRINGID_HARVESTBERRY 467 +#define STRINGID_LASTABILITYRAISEDSTAT 468 +#define STRINGID_MAGICBOUNCEACTIVATES 469 +#define STRINGID_PROTEANTYPECHANGE 470 +#define STRINGID_SYMBIOSISITEMPASS 471 +#define STRINGID_STEALTHROCKDMG 472 +#define STRINGID_TOXICSPIKESABSORBED 473 +#define STRINGID_TOXICSPIKESPOISONED 474 +#define STRINGID_STICKYWEBSWITCHIN 475 +#define STRINGID_HEALINGWISHCAMETRUE 476 +#define STRINGID_HEALINGWISHHEALED 477 +#define STRINGID_LUNARDANCECAMETRUE 478 +#define STRINGID_CUSEDBODYDISABLED 479 +#define STRINGID_ATTACKERACQUIREDABILITY 480 +#define STRINGID_TARGETABILITYSTATLOWER 481 +#define STRINGID_TARGETSTATWONTGOHIGHER 482 +#define STRINGID_PKMNMOVEBOUNCEDABILITY 483 +#define STRINGID_IMPOSTERTRANSFORM 484 +#define STRINGID_ASSAULTVESTDOESNTALLOW 485 +#define STRINGID_GRAVITYPREVENTSUSAGE 486 +#define STRINGID_HEALBLOCKPREVENTSUSAGE 487 +#define STRINGID_NOTDONEYET 488 +#define STRINGID_STICKYWEBUSED 489 +#define STRINGID_QUASHSUCCESS 490 +#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 491 +#define STRINGID_PKMNBLEWAWAYSTICKYWEB 492 +#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 493 +#define STRINGID_IONDELUGEON 494 +#define STRINGID_TOPSYTURVYSWITCHEDSTATS 495 +#define STRINGID_TERRAINBECOMESMISTY 496 +#define STRINGID_TERRAINBECOMESGRASSY 497 +#define STRINGID_TERRAINBECOMESELECTRIC 498 +#define STRINGID_TERRAINBECOMESPSYCHIC 499 +#define STRINGID_TARGETELECTRIFIED 500 +#define STRINGID_MEGAEVOREACTING 501 +#define STRINGID_MEGAEVOEVOLVED 502 +#define STRINGID_DRASTICALLY 503 +#define STRINGID_SEVERELY 504 +#define STRINGID_INFESTATION 505 +#define STRINGID_NOEFFECTONTARGET 506 +#define STRINGID_BURSTINGFLAMESHIT 507 +#define STRINGID_BESTOWITEMGIVING 508 +#define STRINGID_THIRDTYPEADDED 509 +#define STRINGID_FELLFORFEINT 510 +#define STRINGID_POKEMONCANNOTUSEMOVE 511 +#define STRINGID_COVEREDINPOWDER 512 +#define STRINGID_POWDEREXPLODES 513 +#define STRINGID_BELCHCANTSELECT 514 +#define STRINGID_SPECTRALTHIEFSTEAL 515 +#define STRINGID_GRAVITYGROUNDING 516 +#define STRINGID_MISTYTERRAINPREVENTS 517 +#define STRINGID_GRASSYTERRAINHEALS 518 +#define STRINGID_ELECTRICTERRAINPREVENTS 519 +#define STRINGID_PSYCHICTERRAINPREVENTS 520 +#define STRINGID_SAFETYGOGGLESPROTECTED 521 +#define STRINGID_FLOWERVEILPROTECTED 522 +#define STRINGID_SWEETVEILPROTECTED 523 +#define STRINGID_AROMAVEILPROTECTED 524 +#define STRINGID_CELEBRATEMESSAGE 525 +#define STRINGID_USEDINSTRUCTEDMOVE 526 +#define STRINGID_THROATCHOPENDS 527 +#define STRINGID_PKMNCANTUSEMOVETHROATCHOP 528 +#define STRINGID_LASERFOCUS 529 +#define STRINGID_GEMACTIVATES 530 +#define STRINGID_BERRYDMGREDUCES 531 +#define STRINGID_TARGETATEITEM 532 +#define STRINGID_AIRBALLOONFLOAT 533 +#define STRINGID_AIRBALLOONPOP 534 +#define STRINGID_INCINERATEBURN 535 +#define STRINGID_BUGBITE 536 +#define STRINGID_ILLUSIONWOREOFF 537 +#define STRINGID_ATTACKERCUREDTARGETSTATUS 538 +#define STRINGID_ATTACKERLOSTFIRETYPE 539 +#define STRINGID_HEALERCURE 540 +#define STRINGID_SCRIPTINGABILITYSTATRAISE 541 +#define STRINGID_RECEIVERABILITYTAKEOVER 542 +#define STRINGID_PKNMABSORBINGPOWER 543 +#define STRINGID_NOONEWILLBEABLETORUNAWAY 544 +#define STRINGID_DESTINYKNOTACTIVATES 545 +#define STRINGID_CLOAKEDINAFREEZINGLIGHT 546 +#define STRINGID_CLEARAMULETWONTLOWERSTATS 547 +#define STRINGID_FERVENTWISHREACHED 548 +#define STRINGID_AIRLOCKACTIVATES 549 +#define STRINGID_PRESSUREENTERS 550 +#define STRINGID_DARKAURAENTERS 551 +#define STRINGID_FAIRYAURAENTERS 552 +#define STRINGID_AURABREAKENTERS 553 +#define STRINGID_COMATOSEENTERS 554 +#define STRINGID_SCREENCLEANERENTERS 555 +#define STRINGID_FETCHEDPOKEBALL 556 +#define STRINGID_BATTLERABILITYRAISEDSTAT 557 +#define STRINGID_ASANDSTORMKICKEDUP 558 +#define STRINGID_PKMNSWILLPERISHIN3TURNS 559 +#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 560 +#define STRINGID_AURAFLAREDTOLIFE 561 +#define STRINGID_ASONEENTERS 562 +#define STRINGID_CURIOUSMEDICINEENTERS 563 +#define STRINGID_CANACTFASTERTHANKSTO 564 +#define STRINGID_MICLEBERRYACTIVATES 565 +#define STRINGID_PKMNSHOOKOFFTHETAUNT 566 +#define STRINGID_PKMNGOTOVERITSINFATUATION 567 +#define STRINGID_ITEMCANNOTBEREMOVED 568 +#define STRINGID_STICKYBARBTRANSFER 569 +#define STRINGID_PKMNBURNHEALED 570 +#define STRINGID_REDCARDACTIVATE 571 +#define STRINGID_EJECTBUTTONACTIVATE 572 +#define STRINGID_ATKGOTOVERINFATUATION 573 +#define STRINGID_TORMENTEDNOMORE 574 +#define STRINGID_HEALBLOCKEDNOMORE 575 +#define STRINGID_ATTACKERBECAMEFULLYCHARGED 576 +#define STRINGID_ATTACKERBECAMEASHSPECIES 577 +#define STRINGID_EXTREMELYHARSHSUNLIGHT 578 +#define STRINGID_EXTREMESUNLIGHTFADED 579 +#define STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT 580 +#define STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED 581 +#define STRINGID_HEAVYRAIN 582 +#define STRINGID_HEAVYRAINLIFTED 583 +#define STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN 584 +#define STRINGID_NORELIEFROMHEAVYRAIN 585 +#define STRINGID_MYSTERIOUSAIRCURRENT 586 +#define STRINGID_STRONGWINDSDISSIPATED 587 +#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 588 +#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 589 +#define STRINGID_STUFFCHEEKSCANTSELECT 590 +#define STRINGID_PKMNREVERTEDTOPRIMAL 591 +#define STRINGID_BUTPOKEMONCANTUSETHEMOVE 592 +#define STRINGID_BUTHOOPACANTUSEIT 593 +#define STRINGID_BROKETHROUGHPROTECTION 594 +#define STRINGID_ABILITYALLOWSONLYMOVE 595 +#define STRINGID_SWAPPEDABILITIES 596 +#define STRINGID_PASTELVEILPROTECTED 597 +#define STRINGID_PASTELVEILENTERS 598 +#define STRINGID_BATTLERTYPECHANGEDTO 599 +#define STRINGID_BOTHCANNOLONGERESCAPE 600 +#define STRINGID_CANTESCAPEDUETOUSEDMOVE 601 +#define STRINGID_PKMNBECAMEWEAKERTOFIRE 602 +#define STRINGID_ABOUTTOUSEPOLTERGEIST 603 +#define STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE 604 +#define STRINGID_NEUTRALIZINGGASENTERS 605 +#define STRINGID_NEUTRALIZINGGASOVER 606 +#define STRINGID_TARGETTOOHEAVY 607 +#define STRINGID_PKMNTOOKTARGETHIGH 608 +#define STRINGID_PKMNINSNAPTRAP 609 +#define STRINGID_METEORBEAMCHARGING 610 +#define STRINGID_HEATUPBEAK 611 +#define STRINGID_COURTCHANGE 612 +#define STRINGID_PLAYERLOSTTOENEMYTRAINER 613 +#define STRINGID_PLAYERPAIDPRIZEMONEY 614 +#define STRINGID_ZPOWERSURROUNDS 615 +#define STRINGID_ZMOVEUNLEASHED 616 +#define STRINGID_ZMOVERESETSSTATS 617 +#define STRINGID_ZMOVEALLSTATSUP 618 +#define STRINGID_ZMOVEZBOOSTCRIT 619 +#define STRINGID_ZMOVERESTOREHP 620 +#define STRINGID_ZMOVESTATUP 621 +#define STRINGID_ZMOVEHPTRAP 622 +#define STRINGID_ATTACKEREXPELLEDTHEPOISON 623 +#define STRINGID_ATTACKERSHOOKITSELFAWAKE 624 +#define STRINGID_ATTACKERBROKETHROUGHPARALYSIS 625 +#define STRINGID_ATTACKERHEALEDITSBURN 626 +#define STRINGID_ATTACKERMELTEDTHEICE 627 +#define STRINGID_TARGETTOUGHEDITOUT 628 +#define STRINGID_ATTACKERLOSTELECTRICTYPE 629 +#define STRINGID_ATTACKERSWITCHEDSTATWITHTARGET 630 +#define STRINGID_BEINGHITCHARGEDPKMNWITHPOWER 631 +#define STRINGID_SUNLIGHTACTIVATEDABILITY 632 +#define STRINGID_STATWASHEIGHTENED 633 +#define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 634 +#define STRINGID_ABILITYWEAKENEDSURROUNDINGMONSSTAT 635 +#define STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN 636 +#define STRINGID_PKMNSABILITYPREVENTSABILITY 637 +#define STRINGID_PREPARESHELLTRAP 638 +#define STRINGID_SHELLTRAPDIDNTWORK 639 +#define STRINGID_SPIKESDISAPPEAREDFROMTEAM 640 +#define STRINGID_TOXICSPIKESDISAPPEAREDFROMTEAM 641 +#define STRINGID_STICKYWEBDISAPPEAREDFROMTEAM 642 +#define STRINGID_STEALTHROCKDISAPPEAREDFROMTEAM 643 +#define STRINGID_COULDNTFULLYPROTECT 644 +#define STRINGID_STOCKPILEDEFFECTWOREOFF 645 +#define STRINGID_PKMNREVIVEDREADYTOFIGHT 646 +#define STRINGID_ITEMRESTOREDSPECIESHEALTH 647 +#define STRINGID_ITEMCUREDSPECIESSTATUS 648 +#define STRINGID_ITEMRESTOREDSPECIESPP 649 +#define STRINGID_THUNDERCAGETRAPPED 650 +#define STRINGID_PKMNHURTBYFROSTBITE 651 +#define STRINGID_PKMNGOTFROSTBITE 652 +#define STRINGID_PKMNSITEMHEALEDFROSTBITE 653 +#define STRINGID_ATTACKERHEALEDITSFROSTBITE 654 +#define STRINGID_PKMNFROSTBITEHEALED 655 +#define STRINGID_PKMNFROSTBITEHEALED2 656 +#define STRINGID_PKMNFROSTBITEHEALEDBY 657 +#define STRINGID_MIRRORHERBCOPIED 658 +#define STRINGID_STARTEDSNOW 659 +#define STRINGID_SNOWCONTINUES 660 +#define STRINGID_SNOWSTOPPED 661 +#define STRINGID_SNOWWARNINGSNOW 662 +#define STRINGID_PKMNITEMMELTED 663 +#define STRINGID_ULTRABURSTREACTING 664 +#define STRINGID_ULTRABURSTCOMPLETED 665 +#define STRINGID_TEAMGAINEDEXP 666 +#define STRINGID_CURRENTMOVECANTSELECT 667 +#define STRINGID_TARGETISBEINGSALTCURED 668 +#define STRINGID_TARGETISHURTBYSALTCURE 669 +#define STRINGID_TARGETCOVEREDINSTICKYCANDYSYRUP 670 +#define STRINGID_SHARPSTEELFLOATS 671 +#define STRINGID_SHARPSTEELDMG 672 +#define STRINGID_PKMNBLEWAWAYSHARPSTEEL 673 +#define STRINGID_SHARPSTEELDISAPPEAREDFROMTEAM 674 +#define STRINGID_TEAMTRAPPEDWITHVINES 675 +#define STRINGID_PKMNHURTBYVINES 676 +#define STRINGID_TEAMCAUGHTINVORTEX 677 +#define STRINGID_PKMNHURTBYVORTEX 678 +#define STRINGID_TEAMSURROUNDEDBYFIRE 679 +#define STRINGID_PKMNBURNINGUP 680 +#define STRINGID_TEAMSURROUNDEDBYROCKS 681 +#define STRINGID_PKMNHURTBYROCKSTHROWN 682 +#define STRINGID_MOVEBLOCKEDBYDYNAMAX 683 +#define STRINGID_ZEROTOHEROTRANSFORMATION 684 +#define STRINGID_THETWOMOVESBECOMEONE 685 +#define STRINGID_ARAINBOWAPPEAREDONSIDE 686 +#define STRINGID_THERAINBOWDISAPPEARED 687 +#define STRINGID_WAITINGFORPARTNERSMOVE 688 +#define STRINGID_SEAOFFIREENVELOPEDSIDE 689 +#define STRINGID_HURTBYTHESEAOFFIRE 690 +#define STRINGID_THESEAOFFIREDISAPPEARED 691 +#define STRINGID_SWAMPENVELOPEDSIDE 692 +#define STRINGID_THESWAMPDISAPPEARED 693 +#define STRINGID_PKMNTELLCHILLINGRECEPTIONJOKE 694 +#define STRINGID_HOSPITALITYRESTORATION 695 +#define STRINGID_ELECTROSHOTCHARGING 696 +#define STRINGID_ITEMWASUSEDUP 697 +#define STRINGID_ATTACKERLOSTITSTYPE 698 +#define STRINGID_SHEDITSTAIL 699 +#define STRINGID_CLOAKEDINAHARSHLIGHT 700 +#define STRINGID_SUPERSWEETAROMAWAFTS 701 +#define STRINGID_DIMENSIONSWERETWISTED 702 +#define STRINGID_BIZARREARENACREATED 703 +#define STRINGID_BIZARREAREACREATED 704 +#define STRINGID_TIDYINGUPCOMPLETE 705 +#define STRINGID_PKMNTERASTALLIZEDINTO 706 +#define STRINGID_BOOSTERENERGYACTIVATES 707 +#define STRINGID_FOGCREPTUP 708 +#define STRINGID_FOGISDEEP 709 +#define STRINGID_FOGLIFTED 710 +#define STRINGID_PKMNMADESHELLGLEAM 711 +#define STRINGID_FICKLEBEAMDOUBLED 712 -#define BATTLESTRINGS_COUNT 714 +#define BATTLESTRINGS_COUNT 713 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_message.c b/src/battle_message.c index 58eda8aed7e5..ecb2932124a3 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -606,7 +606,6 @@ static const u8 sText_TargetAbilityRaisedStat[] = _("{B_DEF_NAME_WITH_PREFIX}'s static const u8 sText_TargetAbilityLoweredStat[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nlowered its {B_BUFF1}!"); static const u8 sText_AttackerAbilityRaisedStat[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nraised its {B_BUFF1}!"); static const u8 sText_ScriptingAbilityRaisedStat[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its {B_BUFF1}!"); -static const u8 sText_AuroraVeilEnds[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nwore off!"); static const u8 sText_ElectricTerrainEnds[] = _("The electricity disappeared\nfrom the battlefield."); static const u8 sText_MistyTerrainEnds[] = _("The mist disappeared\nfrom the battlefield."); static const u8 sText_PsychicTerrainEnds[] = _("The weirdness disappeared\nfrom the battlefield."); @@ -1442,7 +1441,6 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_WATERSPORTENDS - BATTLESTRINGS_TABLE_START] = sText_WaterSportEnds, [STRINGID_GRAVITYENDS - BATTLESTRINGS_TABLE_START] = sText_GravityEnds, [STRINGID_AQUARINGHEAL - BATTLESTRINGS_TABLE_START] = sText_AquaRingHeal, - [STRINGID_AURORAVEILENDS - BATTLESTRINGS_TABLE_START] = sText_AuroraVeilEnds, [STRINGID_ELECTRICTERRAINENDS - BATTLESTRINGS_TABLE_START] = sText_ElectricTerrainEnds, [STRINGID_MISTYTERRAINENDS - BATTLESTRINGS_TABLE_START] = sText_MistyTerrainEnds, [STRINGID_PSYCHICTERRAINENDS - BATTLESTRINGS_TABLE_START] = sText_PsychicTerrainEnds, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index cd5fd182683d..c4f589a8185e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9957,23 +9957,23 @@ static void Cmd_various(void) else { gSpecialStatuses[gBattlerTarget].instructedChosenTarget = *(gBattleStruct->moveTarget + gBattlerTarget) | 0x4; - gBattlerAttacker = gBattlerTarget; gCalledMove = move; for (i = 0; i < MAX_MON_MOVES; i++) { - if (gBattleMons[gBattlerAttacker].moves[i] == gCalledMove) + if (gBattleMons[gBattlerTarget].moves[i] == gCalledMove) { gCurrMovePos = i; i = 4; break; } } - if (i != 4 || gBattleMons[gBattlerAttacker].pp[gCurrMovePos] == 0) + if (i != 4 || gBattleMons[gBattlerTarget].pp[gCurrMovePos] == 0) gBattlescriptCurrInstr = cmd->failInstr; else { - gBattlerTarget = gBattleStruct->lastMoveTarget[gBattlerAttacker]; + gEffectBattler = gBattleStruct->lastMoveTarget[gBattlerTarget]; gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED; + gBattleStruct->atkCancellerTracker = 0; PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, battler, gBattlerPartyIndexes[battler]); gBattlescriptCurrInstr = cmd->nextInstr; } @@ -11408,7 +11408,7 @@ static void Cmd_jumpifnotfirstturn(void) const u8 *jumpInstr = cmd->jumpInstr; - if (gDisableStructs[gBattlerAttacker].isFirstTurn) + if (gDisableStructs[gBattlerAttacker].isFirstTurn && !(gSpecialStatuses[gBattlerAttacker].instructedChosenTarget)) gBattlescriptCurrInstr = cmd->nextInstr; else gBattlescriptCurrInstr = jumpInstr; diff --git a/src/battle_util.c b/src/battle_util.c index b7c61862fc89..6170ad0e487a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -352,7 +352,7 @@ void HandleAction_UseMove(void) else { gBattlerTarget = *(gBattleStruct->moveTarget + gBattlerAttacker); - if (!IsBattlerAlive(gBattlerTarget)) + if (!IsBattlerAlive(gBattlerTarget) && moveTarget != MOVE_TARGET_OPPONENTS_FIELD) { if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) { @@ -3233,7 +3233,7 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType) case CANCELLER_FLAGS: // flags clear gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_DESTINY_BOND; gStatuses3[gBattlerAttacker] &= ~STATUS3_GRUDGE; - gStatuses4[gBattlerAttacker] &= ~ STATUS4_GLAIVE_RUSH; + gStatuses4[gBattlerAttacker] &= ~STATUS4_GLAIVE_RUSH; gBattleStruct->atkCancellerTracker++; break; case CANCELLER_SKY_DROP: @@ -8302,11 +8302,13 @@ u32 GetMoveTarget(u16 move, u8 setTarget) case MOVE_TARGET_DEPENDS: case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: - case MOVE_TARGET_OPPONENTS_FIELD: targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker))); if (!IsBattlerAlive(targetBattler)) targetBattler ^= BIT_FLANK; break; + case MOVE_TARGET_OPPONENTS_FIELD: + targetBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker))); + break; case MOVE_TARGET_RANDOM: side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker)); if (IsAffectedByFollowMe(gBattlerAttacker, side, move)) diff --git a/test/battle/move_effect/instruct.c b/test/battle/move_effect/instruct.c new file mode 100644 index 000000000000..4521969920bb --- /dev/null +++ b/test/battle/move_effect/instruct.c @@ -0,0 +1,218 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gMovesInfo[MOVE_INSTRUCT].effect == EFFECT_INSTRUCT); +} + +DOUBLE_BATTLE_TEST("Instruct fails if target hasn't made a move") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_CELEBRATE); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); } + } SCENE { + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + } +} + +DOUBLE_BATTLE_TEST("Instruct fails if move is banned by Instruct") +{ + ASSUME(gMovesInfo[MOVE_BIDE].instructBanned == TRUE); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_BIDE); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_BIDE); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BIDE, playerRight); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + } +} + +DOUBLE_BATTLE_TEST("Instruct-called move targets the target of the move picked on its last use") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_FAKE_OUT); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + HP_BAR(opponentLeft); + NOT HP_BAR(opponentRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + HP_BAR(opponentLeft); + NOT HP_BAR(opponentRight); + } +} + +DOUBLE_BATTLE_TEST("Instruct doesn't bypass sleep") +{ + ASSUME(gMovesInfo[MOVE_SPORE].effect == EFFECT_SLEEP); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_GROWL); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); MOVE(opponentLeft, MOVE_SPORE, target: playerRight); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + MESSAGE("Wobbuffet is fast asleep."); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + } +} + +DOUBLE_BATTLE_TEST("Instruct fails if target doesn't know the last move it used") +{ + ASSUME(gMovesInfo[MOVE_DRAGON_DANCE].danceMove == TRUE); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_ORICORIO) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_CELEBRATE); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponentLeft, MOVE_DRAGON_DANCE); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_DANCE, opponentLeft); + ABILITY_POPUP(playerRight, ABILITY_DANCER); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_DANCE, playerRight); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_DANCE, playerRight); + } + } +} + +DOUBLE_BATTLE_TEST("Instruct-called move fails if it can only be used on the first turn but consumes PP") +{ + ASSUME(gMovesInfo[MOVE_FAKE_OUT].effect == EFFECT_FIRST_TURN_ONLY); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_FAKE_OUT); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_FAKE_OUT, target: opponentLeft); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FAKE_OUT, playerRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_FAKE_OUT, playerRight); + } THEN { + EXPECT_EQ(playerRight->pp[3], gMovesInfo[MOVE_FAKE_OUT].pp - 2); + } +} + +DOUBLE_BATTLE_TEST("Instruct-called move doesn't fail if tormented") +{ + ASSUME(gMovesInfo[MOVE_TORMENT].effect == EFFECT_TORMENT); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_FAKE_OUT); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponentLeft, MOVE_TORMENT, target: playerRight); MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TORMENT, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + } +} + +DOUBLE_BATTLE_TEST("Instruct-called status moves don't fail if holding Assault Vest") +{ + ASSUME(gItemsInfo[ITEM_ASSAULT_VEST].holdEffect == HOLD_EFFECT_ASSAULT_VEST); + ASSUME(gMovesInfo[MOVE_TRICK].effect == EFFECT_TRICK); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_TRICK); } + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ASSAULT_VEST); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_TRICK, target: opponentLeft); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK, playerRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK, playerRight); + } +} + +DOUBLE_BATTLE_TEST("Instruct-called status move fails if taunted") +{ + ASSUME(gMovesInfo[MOVE_TAUNT].effect == EFFECT_TAUNT); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_GROWL); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_GROWL); MOVE(opponentLeft, MOVE_TAUNT, target: playerRight); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_GROWL, playerRight); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TAUNT, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_GROWL, playerRight); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); + } + } THEN { + EXPECT_EQ(playerRight->pp[3], gMovesInfo[MOVE_GROWL].pp - 1); + } +} + +DOUBLE_BATTLE_TEST("Instruct-called moves fail if disabled") +{ + ASSUME(gMovesInfo[MOVE_DISABLE].effect == EFFECT_DISABLE); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_GROWL); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_TACKLE, target: opponentLeft); MOVE(opponentLeft, MOVE_DISABLE, target: playerRight); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DISABLE, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerRight); + } THEN { + EXPECT_EQ(playerRight->pp[0], gMovesInfo[MOVE_TACKLE].pp - 1); + } +} + +DOUBLE_BATTLE_TEST("Instruct-called moves keep their priority") +{ + ASSUME(gMovesInfo[MOVE_QUICK_ATTACK].priority == 1); + ASSUME(gMovesInfo[MOVE_PSYCHIC_TERRAIN].effect == EFFECT_PSYCHIC_TERRAIN); + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_TACKLE, MOVE_POUND, MOVE_SCRATCH, MOVE_QUICK_ATTACK); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerRight, MOVE_QUICK_ATTACK, target: opponentLeft); MOVE(opponentLeft, MOVE_PSYCHIC_TERRAIN, target: playerRight); MOVE(playerLeft, MOVE_INSTRUCT, target: playerRight); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, playerRight); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC_TERRAIN, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerLeft); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, playerRight); + } +} diff --git a/test/battle/move_effect/sticky_web.c b/test/battle/move_effect/sticky_web.c index 035568dd75d1..d6960f88d18d 100644 --- a/test/battle/move_effect/sticky_web.c +++ b/test/battle/move_effect/sticky_web.c @@ -238,3 +238,36 @@ DOUBLE_BATTLE_TEST("Sticky Web has correct interactions with Mirror Armor - no o EXPECT_EQ(opponentRight->statStages[STAT_SPEED], DEFAULT_STAT_STAGE); } } +SINGLE_BATTLE_TEST("Sticky Web is placed on the correct side after Explosion") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_EXPLOSION); MOVE(opponent, MOVE_STICKY_WEB); SEND_OUT(player, 1);} + } SCENE { + HP_BAR(player, hp: 0); + ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, player); + MESSAGE("Wobbuffet fainted!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, opponent); + MESSAGE("A sticky web spreads out on the ground around your team!"); + } +} + +SINGLE_BATTLE_TEST("Sticky Web is placed on the correct side after Memento") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_MEMENTO); MOVE(opponent, MOVE_STICKY_WEB); SEND_OUT(player, 1); } + } SCENE { + HP_BAR(player, hp: 0); + ANIMATION(ANIM_TYPE_MOVE, MOVE_MEMENTO, player); + MESSAGE("Wobbuffet fainted!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_STICKY_WEB, opponent); + MESSAGE("A sticky web spreads out on the ground around your team!"); + } +}