mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
You may play an additional land - added card hint to all lands about played count and max limit (#13216)
This commit is contained in:
parent
0505f5159e
commit
a5c354f960
4 changed files with 60 additions and 24 deletions
|
|
@ -1,14 +1,13 @@
|
|||
package mage.abilities;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.abilities.hint.common.CanPlayAdditionalLandsHint;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -21,6 +20,8 @@ public class PlayLandAbility extends ActivatedAbilityImpl {
|
|||
super(AbilityType.PLAY_LAND, Zone.HAND);
|
||||
this.usesStack = false;
|
||||
this.name = "Play " + cardName;
|
||||
|
||||
this.addHint(CanPlayAdditionalLandsHint.instance);
|
||||
}
|
||||
|
||||
protected PlayLandAbility(final PlayLandAbility ability) {
|
||||
|
|
@ -43,7 +44,7 @@ public class PlayLandAbility extends ActivatedAbilityImpl {
|
|||
}
|
||||
|
||||
//20091005 - 114.2a
|
||||
if(!game.isActivePlayer(playerId)
|
||||
if (!game.isActivePlayer(playerId)
|
||||
|| !game.getPlayer(playerId).canPlayLand()
|
||||
|| !game.canPlaySorcery(playerId)) {
|
||||
return ActivationStatus.getFalse();
|
||||
|
|
@ -54,16 +55,15 @@ public class PlayLandAbility extends ActivatedAbilityImpl {
|
|||
if (!approvingObjects.isEmpty()) {
|
||||
Card card = game.getCard(sourceId);
|
||||
Zone zone = game.getState().getZone(sourceId);
|
||||
if(card != null && card.isOwnedBy(playerId) && Zone.HAND.match(zone)) {
|
||||
if (card != null && card.isOwnedBy(playerId) && Zone.HAND.match(zone)) {
|
||||
// Regular casting, to be an alternative to the AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE from hand (e.g. One with the Multiverse):
|
||||
approvingObjects.add(new ApprovingObject(this, game));
|
||||
}
|
||||
}
|
||||
|
||||
if(approvingObjects.isEmpty()) {
|
||||
if (approvingObjects.isEmpty()) {
|
||||
return ActivationStatus.withoutApprovingObject(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return new ActivationStatus(approvingObjects);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,5 +87,4 @@ public class PlayLandAbility extends ActivatedAbilityImpl {
|
|||
public PlayLandAbility copy() {
|
||||
return new PlayLandAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -9,6 +8,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* Each player may play an additional land on each of their turns.
|
||||
|
|
@ -49,14 +49,10 @@ public class PlayAdditionalLandsAllEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player != null) {
|
||||
if (numExtraLands == Integer.MAX_VALUE) {
|
||||
player.setLandsPerTurn(Integer.MAX_VALUE);
|
||||
} else {
|
||||
player.setLandsPerTurn(player.getLandsPerTurn() + numExtraLands);
|
||||
}
|
||||
return true;
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
player.setLandsPerTurn(CardUtil.overflowInc(player.getLandsPerTurn(), numExtraLands));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -37,14 +36,11 @@ public class PlayAdditionalLandsControllerEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.getLandsPerTurn() == Integer.MAX_VALUE || this.additionalCards == Integer.MAX_VALUE) {
|
||||
player.setLandsPerTurn(Integer.MAX_VALUE);
|
||||
} else {
|
||||
player.setLandsPerTurn(player.getLandsPerTurn() + this.additionalCards);
|
||||
}
|
||||
return true;
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
player.setLandsPerTurn(CardUtil.overflowInc(player.getLandsPerTurn(), additionalCards));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package mage.abilities.hint.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* Global hint for all lands
|
||||
*
|
||||
* @author JayDi85
|
||||
*/
|
||||
public enum CanPlayAdditionalLandsHint implements Hint {
|
||||
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// hide hint on default 1 land settings (useless to show)
|
||||
if (controller.getLandsPerTurn() == 1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String stats = String.format(" (played %d of %s)",
|
||||
controller.getLandsPlayed(),
|
||||
(controller.getLandsPerTurn() == Integer.MAX_VALUE ? "any" : String.valueOf(controller.getLandsPerTurn()))
|
||||
);
|
||||
if (controller.canPlayLand()) {
|
||||
return HintUtils.prepareText("Can play more lands" + stats, null, HintUtils.HINT_ICON_GOOD);
|
||||
} else {
|
||||
return HintUtils.prepareText("Can't play lands" + stats, null, HintUtils.HINT_ICON_BAD);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hint copy() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue