Minor formatting and game log changes.

This commit is contained in:
LevelX2 2014-03-19 13:51:44 +01:00
parent 9b82be530d
commit 1856df8987
6 changed files with 33 additions and 22 deletions

View file

@ -120,11 +120,14 @@ class DesecratorHagEffect extends OneShotEffect<DesecratorHagEffect> {
if (cards.size() > 1
&& you.choose(Outcome.DrawCard, cards, target, game)) {
if (target != null) {
return game.getCard(target.getFirstTarget()).moveToZone(Zone.HAND, source.getId(), game, false);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
return you.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
}
}
} else {
for (Card card : cards.getCards(game)) {
return card.moveToZone(Zone.HAND, source.getId(), game, false);
return you.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
}
}
}

View file

@ -53,7 +53,7 @@ import mage.game.permanent.Permanent;
public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl<BecomesBasicLandEnchantedEffect> {
protected ArrayList<String> landTypes = new ArrayList();
protected ArrayList<String> landTypes = new ArrayList<>();
public BecomesBasicLandEnchantedEffect(String... landNames) {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
@ -87,7 +87,7 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl<Become
land.removeAllAbilities(source.getSourceId(), game);
for (String landType : landTypes) {
if (landType.equals("Swamp")) {
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
} else if (landType.equals("Mountain")) {
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
} else if (landType.equals("Forest")) {

View file

@ -1,6 +1,5 @@
package mage.abilities.keyword;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.common.DiesTriggeredAbility;
@ -16,9 +15,12 @@ import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetArtifactPermanent;
import mage.util.CardUtil;
/**
@ -50,7 +52,9 @@ public class ModularAbility extends DiesTriggeredAbility {
public ModularAbility(Card card, int amount, boolean sunburst) {
super(new ModularDistributeCounterEffect(), true);
this.addTarget(new TargetArtifactPermanent(filter));
Target target = new TargetArtifactPermanent(filter);
target.setRequired(true);
this.addTarget(target);
this.amount = amount;
this.sunburst = sunburst;
if (sunburst) {
@ -70,9 +74,11 @@ public class ModularAbility extends DiesTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
MageObject before = game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD);
if (before != null && ((Permanent) before).getCounters().getCount(CounterType.P1P1) > 0) {
return super.checkTrigger(event, game);
if (super.checkTrigger(event, game)) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getTarget().getCounters().getCount(CounterType.P1P1) > 0) {
return true;
}
}
return false;
}
@ -89,7 +95,9 @@ public class ModularAbility extends DiesTriggeredAbility {
sb.append("-Sunburst <i>(This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
} else {
sb.append(" ").append(amount).append(" <i>(This enters the battlefield with ")
.append(amount).append(" +1/+1 counter on it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
.append(CardUtil.numberToText(amount, "a"))
.append(" +1/+1 counter").append(amount != 1 ? "s":"")
.append(" on it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
}
return sb.toString();
}
@ -102,7 +110,9 @@ class ModularStaticAbility extends StaticAbility<ModularStaticAbility> {
public ModularStaticAbility(int amount) {
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount))));
ruleText = new StringBuilder("This enters the battlefield with ").append(amount).append(" +1/+1 counter on it.").toString();
ruleText = new StringBuilder("This enters the battlefield with ").append(CardUtil.numberToText(amount, "a"))
.append(" +1/+1 counter").append(amount != 1 ? "s":"")
.append(" on it.").toString();
this.setRuleVisible(false);
}
@ -146,18 +156,14 @@ class ModularDistributeCounterEffect extends OneShotEffect<ModularDistributeCoun
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (sourcePermanent != null) {
Permanent targetArtifact = game.getPermanent(targetPointer.getFirst(game, source));
Player player = game.getPlayer(source.getControllerId());
if (sourcePermanent != null && targetArtifact != null && player != null) {
int numberOfCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1);
if (numberOfCounters > 0) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Permanent targetArtifact = game.getPermanent(targetPointer.getFirst(game, source));
if (targetArtifact != null) {
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), game);
return true;
}
}
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), game);
}
return true;
}
return false;
}

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.ManaEffect;
/**
*
* @author BetaSteward_at_googlemail.com
* @param <T>
*/
public abstract class BasicManaAbility<T extends BasicManaAbility<T>> extends ManaAbility<T> {

View file

@ -41,6 +41,7 @@ import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
* @param <T>
*/
public abstract class ManaAbility<T extends ManaAbility<T>> extends ActivatedAbilityImpl<T> {

View file

@ -190,7 +190,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.range = range;
hand = new CardsImpl(Zone.HAND);
graveyard = new CardsImpl(Zone.GRAVEYARD);
abilities = new AbilitiesImpl<Ability>();
abilities = new AbilitiesImpl<>();
counters = new Counters();
manaPool = new ManaPool();
library = new Library(playerId);
@ -1383,7 +1383,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
}
@Override
public Abilities getAbilities() {
public Abilities<Ability> getAbilities() {
return this.abilities;
}