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

Detect 'NOT x; NOT y;' #3459

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Conversation

mrgriffin
Copy link
Collaborator

NOT x; NOT y; does not behave how you would expect, so this PR detects uses of that and tells the developer to write NONE_OF { x; y; } instead.

Purifying Salt's can't-be-frozen test was erroneously passing because of this, so that has been fixed too.

Fix Purifying Salt to be immune to statuses from secondary effects.
@mrgriffin
Copy link
Collaborator Author

When merging to upcoming we also need this change:

diff --git a/test/battle/move_effect/syrup_bomb.c b/test/battle/move_effect/syrup_bomb.c
index ae689b3629..18b032f5cb 100644
--- a/test/battle/move_effect/syrup_bomb.c
+++ b/test/battle/move_effect/syrup_bomb.c
@@ -33,8 +33,10 @@ SINGLE_BATTLE_TEST("Syrup Bomb is prevented by Bulletproof")
     } SCENE {
         ABILITY_POPUP(opponent, ABILITY_BULLETPROOF);
         MESSAGE("Foe Chespin's Bulletproof blocks Syrup Bomb!");
-        NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
-        NOT HP_BAR(opponent);
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
+            HP_BAR(opponent);
+        }
     }
 }
 
@@ -75,8 +77,10 @@ SINGLE_BATTLE_TEST("Clear Body, White Smoke and Full Metal Body prevent Sticky S
             ABILITY_POPUP(opponent, ABILITY_FULL_METAL_BODY);
             MESSAGE("Foe Solgaleo's Full Metal Body prevents stat loss!");
         }
-        NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
-        NOT MESSAGE("Foe Beldum's Speed fell!");
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
+            MESSAGE("Foe Beldum's Speed fell!");
+        }
     }
 }
 
@@ -92,7 +96,9 @@ SINGLE_BATTLE_TEST("Clear Amulet prevents Sticky Syrup speed reduction")
         HP_BAR(opponent);
         MESSAGE("Foe Wobbuffet got covered in sticky syrup!");
         MESSAGE("Foe Wobbuffet's Speed was not lowered!");
-        NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
-        NOT MESSAGE("Foe Wobbuffet's Speed fell!");
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
+            MESSAGE("Foe Wobbuffet's Speed fell!");
+        }
     }
 }

@AlexOn1ine
Copy link
Collaborator

When merging to upcoming we also need this change:

diff --git a/test/battle/move_effect/syrup_bomb.c b/test/battle/move_effect/syrup_bomb.c
index ae689b3629..18b032f5cb 100644
--- a/test/battle/move_effect/syrup_bomb.c
+++ b/test/battle/move_effect/syrup_bomb.c
@@ -33,8 +33,10 @@ SINGLE_BATTLE_TEST("Syrup Bomb is prevented by Bulletproof")
     } SCENE {
         ABILITY_POPUP(opponent, ABILITY_BULLETPROOF);
         MESSAGE("Foe Chespin's Bulletproof blocks Syrup Bomb!");
-        NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
-        NOT HP_BAR(opponent);
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
+            HP_BAR(opponent);
+        }
     }
 }
 
@@ -75,8 +77,10 @@ SINGLE_BATTLE_TEST("Clear Body, White Smoke and Full Metal Body prevent Sticky S
             ABILITY_POPUP(opponent, ABILITY_FULL_METAL_BODY);
             MESSAGE("Foe Solgaleo's Full Metal Body prevents stat loss!");
         }
-        NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
-        NOT MESSAGE("Foe Beldum's Speed fell!");
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
+            MESSAGE("Foe Beldum's Speed fell!");
+        }
     }
 }
 
@@ -92,7 +96,9 @@ SINGLE_BATTLE_TEST("Clear Amulet prevents Sticky Syrup speed reduction")
         HP_BAR(opponent);
         MESSAGE("Foe Wobbuffet got covered in sticky syrup!");
         MESSAGE("Foe Wobbuffet's Speed was not lowered!");
-        NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
-        NOT MESSAGE("Foe Wobbuffet's Speed fell!");
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
+            MESSAGE("Foe Wobbuffet's Speed fell!");
+        }
     }
 }

Should an issue be opened as a reminder?

Copy link
Collaborator

@AlexOn1ine AlexOn1ine left a comment

Choose a reason for hiding this comment

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

Looks good!

I liked to do those, sorry 😅

@AlexOn1ine AlexOn1ine merged commit 5fe564f into rh-hideout:master Oct 24, 2023
1 check passed
@mrgriffin
Copy link
Collaborator Author

I liked to those, sorry 😅

Me too 😂 I think the vast majority of the fixes were to code I wrote 😅

@mrgriffin mrgriffin mentioned this pull request Oct 24, 2023
@AlexOn1ine
Copy link
Collaborator

When merging to upcoming we also need this change:

diff --git a/test/battle/move_effect/syrup_bomb.c b/test/battle/move_effect/syrup_bomb.c
index ae689b3629..18b032f5cb 100644
--- a/test/battle/move_effect/syrup_bomb.c
+++ b/test/battle/move_effect/syrup_bomb.c
@@ -33,8 +33,10 @@ SINGLE_BATTLE_TEST("Syrup Bomb is prevented by Bulletproof")
     } SCENE {
         ABILITY_POPUP(opponent, ABILITY_BULLETPROOF);
         MESSAGE("Foe Chespin's Bulletproof blocks Syrup Bomb!");
-        NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
-        NOT HP_BAR(opponent);
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_MOVE, MOVE_SYRUP_BOMB, player);
+            HP_BAR(opponent);
+        }
     }
 }
 
@@ -75,8 +77,10 @@ SINGLE_BATTLE_TEST("Clear Body, White Smoke and Full Metal Body prevent Sticky S
             ABILITY_POPUP(opponent, ABILITY_FULL_METAL_BODY);
             MESSAGE("Foe Solgaleo's Full Metal Body prevents stat loss!");
         }
-        NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
-        NOT MESSAGE("Foe Beldum's Speed fell!");
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
+            MESSAGE("Foe Beldum's Speed fell!");
+        }
     }
 }
 
@@ -92,7 +96,9 @@ SINGLE_BATTLE_TEST("Clear Amulet prevents Sticky Syrup speed reduction")
         HP_BAR(opponent);
         MESSAGE("Foe Wobbuffet got covered in sticky syrup!");
         MESSAGE("Foe Wobbuffet's Speed was not lowered!");
-        NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
-        NOT MESSAGE("Foe Wobbuffet's Speed fell!");
+        NONE_OF {
+            ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
+            MESSAGE("Foe Wobbuffet's Speed fell!");
+        }
     }
 }

Should an issue be opened as a reminder?

Fixed in #3437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants