MCPcopy Create free account
hub / github.com/Card-Forge/forge / canPlayLand

Method canPlayLand

forge-game/src/main/java/forge/game/player/Player.java:1668–1703  ·  view source on GitHub ↗
(final Card land, final boolean ignoreZoneAndTiming, SpellAbility landSa)

Source from the content-addressed store, hash-verified

1666 }
1667
1668 public final boolean canPlayLand(final Card land, final boolean ignoreZoneAndTiming, SpellAbility landSa) {
1669 if (!ignoreZoneAndTiming) {
1670 // CR 305.3
1671 if (!game.getPhaseHandler().isPlayerTurn(this)) {
1672 return false;
1673 }
1674 if (!canCastSorcery() && (landSa == null || !landSa.withFlash(land, this))) {
1675 return false;
1676 }
1677
1678 final boolean mayPlay = landSa == null ? !land.mayPlay(this).isEmpty() : landSa.getMayPlay() != null;
1679 if (land.getOwner() != this && !mayPlay) {
1680 return false;
1681 }
1682
1683 final Zone zone = game.getZoneOf(land);
1684 if (zone != null && (zone.is(ZoneType.Battlefield) || (!zone.is(ZoneType.Hand) && !mayPlay
1685 && (landSa == null || !landSa.isAlternativeCost(AlternativeCost.Mayhem))))) {
1686 return false;
1687 }
1688 }
1689
1690 // CantBeCast static abilities
1691 if (StaticAbilityCantBeCast.cantPlayLandAbility(landSa, land, this)) {
1692 return false;
1693 }
1694
1695 // **** Check for land play limit per turn ****
1696 // Dev Mode
1697 if (getMaxLandPlaysInfinite()) {
1698 return true;
1699 }
1700
1701 // check for adjusted max lands play per turn
1702 return getLandsPlayedThisTurn() < getMaxLandPlays();
1703 }
1704
1705 public final int getMaxLandPlays() {
1706 int adjMax = 1;

Callers 4

canPlayMethod · 0.95
resolveMethod · 0.95

Calls 15

canCastSorceryMethod · 0.95
isMethod · 0.95
cantPlayLandAbilityMethod · 0.95
getMaxLandPlaysMethod · 0.95
getPhaseHandlerMethod · 0.80
withFlashMethod · 0.80
mayPlayMethod · 0.80
getZoneOfMethod · 0.80
isEmptyMethod · 0.65
getOwnerMethod · 0.65

Tested by

no test coverage detected