-
Notifications
You must be signed in to change notification settings - Fork 883
Player Hidden Keywords related to SearchLibrary #10219
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 all commits
98f3002
6200bd6
d318e09
4de14fc
f7b33c7
021f048
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 |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package forge.game.staticability; | ||
|
|
||
| import forge.game.player.Player; | ||
| import forge.game.zone.ZoneType; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import static forge.game.staticability.StaticAbilityMode.CantSearchLibrary; | ||
| import static forge.game.staticability.StaticAbilityMode.LimitSearchLibrary; | ||
|
|
||
|
|
||
| public class StaticAbilitySearchLibrary { | ||
|
|
||
| /** | ||
| * @return maximum number of cards which can be fetched from a library considering its size and search limit or null if there is no limit | ||
| */ | ||
| public static Integer limitSearchLibraryConsideringSize(Player player) { | ||
| Integer limit = limitSearchLibrary(player); | ||
| if (limit != null) { | ||
| return Math.min(player.getCardsIn(ZoneType.Library).size(), limit); | ||
| } else { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @return maximum number of cards which can be revealed from a library or null if there is no limit | ||
| */ | ||
| public static Integer limitSearchLibrary(Player player) { | ||
| return findStaticAbilityForValidPlayer(player, LimitSearchLibrary) | ||
| .map(stAb -> Integer.valueOf(stAb.getParam("LimitNum"))) | ||
| .orElse(null); | ||
| } | ||
|
|
||
| public static boolean cantSearchLibrary(Player player) { | ||
| return findStaticAbilityForValidPlayer(player, CantSearchLibrary) | ||
| .filter(stAb -> !stAb.getIgnoreEffectPlayers().contains(player)) | ||
| .isPresent(); | ||
| } | ||
|
|
||
| private static Optional<StaticAbility> findStaticAbilityForValidPlayer(final Player player, final StaticAbilityMode mode) { | ||
| return player.getGame() | ||
| .getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES) | ||
| .stream() | ||
| .flatMap(card -> card.getStaticAbilities().stream()) | ||
| .filter(stAb -> stAb.checkConditions(mode) && stAb.matchesValidParam("ValidPlayer", player)) | ||
| .findAny(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ Name:Ashiok, Dream Render | |
| ManaCost:1 UB UB | ||
| Types:Legendary Planeswalker Ashiok | ||
| Loyalty:5 | ||
| S:Mode$ Continuous | Affected$ Opponent | AddKeyword$ Spells and abilities you control can't cause you to search your library. | Description$ Spells and abilities your opponents control can't cause their controller to search their library. | ||
| S:Mode$ CantSearchLibrary | ValidPlayer$ Opponent | Description$ Spells and abilities your opponents control can't cause their controller to search their library. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to add ValidCause to check for Spells and Abilities and check if they are controlled by the same player as the one that gets their library searched |
||
| A:AB$ Mill | Cost$ SubCounter<1/LOYALTY> | Planeswalker$ True | NumCards$ 4 | ValidTgts$ Player | SubAbility$ DBExileGrave | SpellDescription$ Target player mills four cards. Then exile each opponent's graveyard. | ||
| SVar:DBExileGrave:DB$ ChangeZoneAll | Origin$ Graveyard | Destination$ Exile | Defined$ Opponent | ChangeType$ Card | ||
| Oracle:Spells and abilities your opponents control can't cause their controller to search their library.\n[-1]: Target player mills four cards. Then exile each opponent's graveyard. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,5 @@ Types:Creature Bird Wizard | |
| PT:2/1 | ||
| K:Flash | ||
| K:Flying | ||
| S:Mode$ Continuous | Affected$ Player.Opponent | AddKeyword$ LimitSearchLibrary | Description$ If an opponent would search a library, that player searches the top four cards of that library instead. | ||
| S:Mode$ LimitSearchLibrary | ValidPlayer$ Player.Opponent | LimitNum$ 4 | Description$ If an opponent would search a library, that player searches the top four cards of that library instead. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically this is a replacement effect
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it should look like |
||
| Oracle:Flash\nFlying\nIf an opponent would search a library, that player searches the top four cards of that library instead. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| Name:Mindlock Orb | ||
| ManaCost:3 U | ||
| Types:Artifact | ||
| S:Mode$ Continuous | Affected$ Player | AddKeyword$ CantSearchLibrary | Description$ Players can't search libraries. | ||
| S:Mode$ CantSearchLibrary | ValidPlayer$ Player | Description$ Players can't search libraries. | ||
| Oracle:Players can't search libraries. |
Uh oh!
There was an error while loading. Please reload this page.