-
Notifications
You must be signed in to change notification settings - Fork 845
Refactor: Hidden keywords to StaticAbilityMode (Issue #3307) #9703
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
Open
calaespi
wants to merge
20
commits into
Card-Forge:master
Choose a base branch
from
calaespi:refactor/hidden-keywords
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+764
−16
Open
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
86e59a4
Refactor: Hidden keywords to StaticAbilityMode (Issue #3307)
calaespi fb46ce8
test(forge-game): add unit test verifying ForgetOnMoved triggers (Cha…
calaespi a1b78cf
test(harness): run Upkeep step and execute queued TestAction precondi…
calaespi 5919a1d
Refactor Lure to use StaticAbilityMustBeBlockedByAll
calaespi ad80ccb
Fix Outpost Siege interaction and update Card lethal logic
calaespi 7e6d6ff
Merge pull request #2 from calaespi/pr-2-harness-outpost-siege
calaespi bbc9d48
test(forge-game): add unit test verifying ForgetOnMoved triggers (Cha…
calaespi d45740c
Merge pull request #1 from calaespi/pr-0-forgetonmoved-unit-test
calaespi 5245103
Merge branch 'master' into refactor/hidden-keywords
calaespi 1799153
Refactor hidden keywords to use StaticAbility pattern
calaespi 8ab9fd7
Refactor LethalDamageByPower to use Card field instead of iterating s…
calaespi 4261ce6
Merge branch 'master' into refactor/hidden-keywords
calaespi ab08814
Refactor: Address PR review comments (Revert MustBeBlocked/CountersRe…
calaespi 30bef57
Merge branch 'master' into refactor/hidden-keywords
calaespi bd7955e
Resolve conflict in AbilityActivated.java by keeping isDetained check
calaespi d61fd3d
Merge branch 'master' into refactor/hidden-keywords
calaespi 0832f1a
Fix PR: restore StaticAbilityCountersRemain, remove enum duplicate, c…
calaespi 31e6367
Merge branch 'master' into refactor/hidden-keywords
calaespi cc46dd5
Remove unused script compile-and-test-pr.sh
calaespi 866f474
Merge branch 'master' into refactor/hidden-keywords
calaespi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
forge-game/src/main/java/forge/game/staticability/StaticAbilityBounceAtUntap.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package forge.game.staticability; | ||
|
|
||
| import forge.game.card.Card; | ||
| import forge.game.zone.ZoneType; | ||
|
|
||
| public class StaticAbilityBounceAtUntap { | ||
|
|
||
| public static boolean shouldBounceAtUntap(Card card) { | ||
| for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) { | ||
| for (final StaticAbility stAb : ca.getStaticAbilities()) { | ||
| if (!stAb.checkConditions(StaticAbilityMode.BounceAtUntap)) { | ||
| continue; | ||
| } | ||
| if (applyBounceAtUntapAbility(stAb, card)) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public static boolean applyBounceAtUntapAbility(StaticAbility stAb, Card card) { | ||
| if (!stAb.matchesValidParam("ValidCard", card)) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
forge-game/src/main/java/forge/game/staticability/StaticAbilityCantGainControl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package forge.game.staticability; | ||
|
|
||
| import forge.game.card.Card; | ||
| import forge.game.zone.ZoneType; | ||
|
|
||
| public class StaticAbilityCantGainControl { | ||
|
|
||
| public static boolean cantGainControl(Card card) { | ||
| for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) { | ||
| for (final StaticAbility stAb : ca.getStaticAbilities()) { | ||
| if (!stAb.checkConditions(StaticAbilityMode.CantGainControl)) { | ||
| continue; | ||
| } | ||
| if (applyCantGainControlAbility(stAb, card)) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public static boolean applyCantGainControlAbility(StaticAbility stAb, Card card) { | ||
| if (!stAb.matchesValidParam("ValidCard", card)) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems fine
but there is another place with the KW
remove checking for it from both