mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Some minor changes.
This commit is contained in:
parent
76bf596b57
commit
9f7ce41679
5 changed files with 168 additions and 83 deletions
|
@ -35,16 +35,13 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayTargetPlayerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterBasicLandCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
|
@ -63,8 +60,10 @@ public class Fertilid extends CardImpl {
|
|||
|
||||
// Fertilid enters the battlefield with two +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), "with two +1/+1 counters on it"));
|
||||
|
||||
// {1}{G}, Remove a +1/+1 counter from Fertilid: Target player searches his or her library for a basic land card and puts it onto the battlefield tapped. Then that player shuffles his or her library.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FertilidEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true), new ManaCostsImpl("{1}{G}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true), new ManaCostsImpl("{1}{G}"));
|
||||
ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1)));
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
@ -79,47 +78,3 @@ public class Fertilid extends CardImpl {
|
|||
return new Fertilid(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FertilidEffect extends SearchLibraryPutInPlayEffect {
|
||||
|
||||
public FertilidEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle) {
|
||||
super(target, tapped, forceShuffle);
|
||||
|
||||
this.staticText = "Target player searches his or her library for a basic land card and puts it onto the battlefield tapped. Then that player shuffles his or her library.";
|
||||
}
|
||||
|
||||
public FertilidEffect(final FertilidEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FertilidEffect copy() {
|
||||
return new FertilidEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
|
||||
if (player != null) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), tapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (forceShuffle) {
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,21 +77,23 @@ class PainMagnificationTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public PainMagnificationTriggeredAbility copy() {
|
||||
return new PainMagnificationTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
|
||||
// If the damaged player is an opponent
|
||||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
int amount = event.getAmount();
|
||||
if(amount >= 3) {
|
||||
// If at least 3 damage is dealt, set the opponent as the Discard target
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// If the damaged player is an opponent
|
||||
if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
|
||||
if(event.getAmount() >= 3) {
|
||||
// If at least 3 damage is dealt, set the opponent as the Discard target
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,9 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -49,22 +51,20 @@ import mage.target.common.TargetLandPermanent;
|
|||
* @author ilcartographer
|
||||
*/
|
||||
public class AquitectsWill extends CardImpl {
|
||||
private static final String rule = "land is an Island in addition to its other types for as long as it has a flood counter on it.";
|
||||
|
||||
public AquitectsWill(UUID ownerId) {
|
||||
super(ownerId, 52, "Aquitect's Will", Rarity.COMMON, new CardType[]{CardType.TRIBAL, CardType.SORCERY}, "{U}");
|
||||
this.expansionSetCode = "LRW";
|
||||
this.subtype.add("Merfolk");
|
||||
|
||||
// Put a flood counter on target land. That land is an Island in addition to its other types for as long as it has a flood counter on it. If you control a Merfolk, draw a card.
|
||||
// Add the flood counter to target land
|
||||
// Put a flood counter on target land.
|
||||
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.FLOOD.createInstance()));
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
|
||||
// Add the Flood counter effect
|
||||
// That land is an Island in addition to its other types for as long as it has a flood counter on it.
|
||||
this.getSpellAbility().addEffect(new AquitectsWillEffect(Duration.Custom, false, false, "Island"));
|
||||
|
||||
// Draw if you control a Merfolk
|
||||
// If you control a Merfolk, draw a card.
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new DrawCardSourceControllerEffect(1),
|
||||
new PermanentsOnTheBattlefieldCondition(new FilterControlledCreaturePermanent("Merfolk", "Merfolk")),
|
||||
|
@ -85,6 +85,7 @@ class AquitectsWillEffect extends BecomesBasicLandTargetEffect {
|
|||
|
||||
public AquitectsWillEffect(Duration duration, boolean chooseLandType, boolean loseType, String... landNames) {
|
||||
super(duration, chooseLandType, loseType, landNames);
|
||||
staticText = "That land is an Island in addition to its other types for as long as it has a flood counter on it";
|
||||
}
|
||||
|
||||
public AquitectsWillEffect(final AquitectsWillEffect effect) {
|
||||
|
@ -92,18 +93,20 @@ class AquitectsWillEffect extends BecomesBasicLandTargetEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
|
||||
if (land != null && land.getCounters().getCount(CounterType.FLOOD) < 1) {
|
||||
if (land == null) {
|
||||
// if permanent left battlefield the effect can be removed because it was only valid for that object
|
||||
this.discard();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else if (land.getCounters().getCount(CounterType.FLOOD) > 0) {
|
||||
// only if Flood counter is on the object it becomes an Island.(it would be possible to remove and return the counters with e.g. Fate Transfer if the land becomes a creature too)
|
||||
super.apply(layer, sublayer, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AquitectsWillEffect copy() {
|
||||
return new AquitectsWillEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,16 +135,22 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
case AbilityAddingRemovingEffects_6:
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
for (String landType : landTypes) {
|
||||
if (landType.equals("Swamp")) {
|
||||
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
||||
} else if (landType.equals("Mountain")) {
|
||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
} else if (landType.equals("Forest")) {
|
||||
land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
} else if (landType.equals("Island")) {
|
||||
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
|
||||
} else if (landType.equals("Plains")) {
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
switch (landType) {
|
||||
case "Swamp":
|
||||
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
case "Mountain":
|
||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
case "Forest":
|
||||
land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
case "Island":
|
||||
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
case "Plains":
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common.search;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.SearchEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
|
||||
|
||||
protected boolean tapped;
|
||||
protected boolean forceShuffle;
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target) {
|
||||
this(target, false, true, Outcome.PutCardInPlay);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped) {
|
||||
this(target, tapped, true, Outcome.PutCardInPlay);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle) {
|
||||
this(target, tapped, forceShuffle, Outcome.PutCardInPlay);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, Outcome outcome) {
|
||||
this(target, tapped, true, outcome);
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle, Outcome outcome) {
|
||||
super(target, outcome);
|
||||
this.tapped = tapped;
|
||||
this.forceShuffle = forceShuffle;
|
||||
setText();
|
||||
}
|
||||
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect(final SearchLibraryPutInPlayTargetPlayerEffect effect) {
|
||||
super(effect);
|
||||
this.tapped = effect.tapped;
|
||||
this.forceShuffle = effect.forceShuffle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchLibraryPutInPlayTargetPlayerEffect copy() {
|
||||
return new SearchLibraryPutInPlayTargetPlayerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), tapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (forceShuffle) {
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("target player searches his or her library for ");
|
||||
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
|
||||
if ( target.getMaxNumberOfTargets() == Integer.MAX_VALUE ) {
|
||||
sb.append("any number of ").append(" ");
|
||||
}
|
||||
else {
|
||||
sb.append("up to ").append(target.getMaxNumberOfTargets()).append(" ");
|
||||
}
|
||||
sb.append(target.getTargetName()).append(" and put them onto the battlefield");
|
||||
}
|
||||
else {
|
||||
sb.append("a ").append(target.getTargetName()).append(" and put it onto the battlefield");
|
||||
}
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
if (forceShuffle) {
|
||||
sb.append(". Then that player shuffles his or her library");
|
||||
}
|
||||
else {
|
||||
sb.append(". If that player does, he or she shuffles his or her library");
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
public List<UUID> getTargets() {
|
||||
return target.getTargets();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue