foul-magics/Mage/src/main/java/mage/abilities/PlayLandAbility.java
Oleg Agafonov 2d96d36ec8 AsThough effects improves and fixes:
* AsThough: added documentation about code usage and restrictions;
* AsThough: added additional checks for correct usage;
* AsThough: simplified some code;
* PlayFromNotOwnHandZoneTargetEffect - added permanents support as targets;
* Release to the Wind - fixed that it can't cast exiled cards (#7415, #7416);
* Test framework: fixed that checkExileCount checking card's owner;
* GUI: fixed typo in Trample card icons;
2021-01-31 22:32:23 +04:00

59 lines
1.5 KiB
Java

package mage.abilities;
import mage.ApprovingObject;
import mage.constants.AbilityType;
import mage.constants.AsThoughEffectType;
import mage.constants.Zone;
import mage.game.Game;
import java.util.UUID;
/**
* @author BetaSteward_at_googlemail.com
*/
public class PlayLandAbility extends ActivatedAbilityImpl {
public PlayLandAbility(String cardName) {
super(AbilityType.PLAY_LAND, Zone.HAND);
this.usesStack = false;
this.name = "Play " + cardName;
}
public PlayLandAbility(PlayLandAbility ability) {
super(ability);
}
@Override
public ActivationStatus canActivate(UUID playerId, Game game) {
ApprovingObject approvingObject = game.getContinuousEffects().asThough(getSourceId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this, playerId, game);
if (!controlsAbility(playerId, game) && null == approvingObject) {
return ActivationStatus.getFalse();
}
//20091005 - 114.2a
return new ActivationStatus(game.isActivePlayer(playerId)
&& game.getPlayer(playerId).canPlayLand()
&& game.canPlaySorcery(playerId),
approvingObject);
}
@Override
public String getGameLogMessage(Game game) {
return " plays " + getMessageText(game);
}
@Override
public String toString() {
return this.name;
}
@Override
public String getRule() {
return this.name;
}
@Override
public PlayLandAbility copy() {
return new PlayLandAbility(this);
}
}