-
Notifications
You must be signed in to change notification settings - Fork 883
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
86e59a4
fb46ce8
a1b78cf
5919a1d
ad80ccb
7e6d6ff
bbc9d48
d45740c
5245103
1799153
8ab9fd7
4261ce6
ab08814
30bef57
bd7955e
d61fd3d
0832f1a
31e6367
cc46dd5
866f474
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6025,7 +6025,9 @@ public final int getTotalDamageDoneBy() { | |
|
|
||
| // this is the amount of damage a creature needs to receive before it dies | ||
| public final int getLethal() { | ||
| if (hasKeyword("Lethal damage dealt to CARDNAME is determined by its power rather than its toughness.")) { | ||
| boolean lethalByPower = hasKeyword("Lethal damage dealt to CARDNAME is determined by its power rather than its toughness.") || StaticAbilityLethalDamageByPower.isLethalDamageByPower(this); | ||
|
||
|
|
||
| if (lethalByPower) { | ||
| return getNetPower(); | ||
| } | ||
| return getNetToughness(); | ||
|
|
||
| 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; | ||
| } | ||
| } |
| 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; | ||
| } | ||
| } |
| 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 StaticAbilityLethalDamageByPower { | ||
|
|
||
| public static boolean isLethalDamageByPower(Card card) { | ||
| for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) { | ||
| for (final StaticAbility stAb : ca.getStaticAbilities()) { | ||
| if (!stAb.checkConditions(StaticAbilityMode.LethalDamageByPower)) { | ||
| continue; | ||
| } | ||
| if (applyLethalDamageByPowerAbility(stAb, card)) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public static boolean applyLethalDamageByPowerAbility(StaticAbility stAb, Card card) { | ||
| if (!stAb.matchesValidParam("ValidCard", card)) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| } |
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