-
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 1 commit
98f3002
6200bd6
d318e09
4de14fc
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,52 @@ | ||
| 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; | ||
| import static forge.game.staticability.StaticAbilityMode.CantCauseToSearchLibrary; | ||
|
|
||
|
|
||
| public class StaticAbilityCantSearchLibrary { | ||
|
|
||
| /** | ||
| * @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).isPresent(); | ||
| } | ||
|
|
||
| public static boolean cantCauseToSearchLibrary(Player player) { | ||
| return findStaticAbilityForValidPlayer(player, CantCauseToSearchLibrary).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 |
|---|---|---|
|
|
@@ -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 |
||
| 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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ Name:Leonin Arbiter | |
| ManaCost:1 W | ||
| Types:Creature Cat Cleric | ||
| PT:2/2 | ||
| S:Mode$ Continuous | Affected$ Player | AddKeyword$ CantSearchLibrary | IgnoreEffectCost$ 2 | Description$ Players can't search libraries. Any player may pay {2} for that player to ignore this effect until end of turn. | ||
| S:Mode$ CantSearchLibrary | ValidPlayer$ Player | IgnoreEffectCost$ 2 | Description$ Players can't search libraries. Any player may pay {2} for that player to ignore this effect until end of turn. | ||
|
||
| # TODO: The AI won't activate the effect yet, but then again, it won't activate it even if the human is playing with this card, so it doesn't affect specifically the AI playability of this card. | ||
| AI:RemoveDeck:Random | ||
| Oracle:Players can't search libraries. Any player may pay {2} for that player to ignore this effect until end of turn. | ||
| 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. |

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 should just use the same method above so it can be more dynamic
Uh oh!
There was an error while loading. Please reload this page.
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.
Do you mean:
cantCauseToSearchLibrary()method completelyCantCauseToSearchLibrarymode intocantSearchLibrary()?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.
it's just a slightly more specific variant, not a different mode
we usually have one entry point, so scripts can just use params for their needs