mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
A little more refactoring
This commit is contained in:
parent
3eb9d24abf
commit
102c18dad6
42 changed files with 921 additions and 764 deletions
|
|
@ -1,20 +1,21 @@
|
||||||
|
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
|
||||||
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
|
import mage.abilities.effects.common.continuous.SetBaseToughnessSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -22,6 +23,13 @@ import mage.players.Player;
|
||||||
*/
|
*/
|
||||||
public final class AnHavvaConstable extends CardImpl {
|
public final class AnHavvaConstable extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
|
||||||
|
private static final DynamicValue creatureValue = new IntPlusDynamicValue(1, new PermanentsOnBattlefieldCount(filter));
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new ColorPredicate(ObjectColor.GREEN));
|
||||||
|
}
|
||||||
|
|
||||||
public AnHavvaConstable(UUID ownerId, CardSetInfo setInfo) {
|
public AnHavvaConstable(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{G}");
|
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{G}");
|
||||||
this.subtype.add(SubType.HUMAN);
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
|
@ -29,7 +37,8 @@ public final class AnHavvaConstable extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// An-Havva Constable's toughness is equal to 1 plus the number of green creatures on the battlefield.
|
// An-Havva Constable's toughness is equal to 1 plus the number of green creatures on the battlefield.
|
||||||
this.addAbility(new SimpleStaticAbility(new AnHavvaConstableEffect()));
|
this.addAbility(new SimpleStaticAbility(new SetBaseToughnessSourceEffect(creatureValue)
|
||||||
|
.setText("An-Havva Constable's toughness is equal to 1 plus the number of green creatures on the battlefield")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private AnHavvaConstable(final AnHavvaConstable card) {
|
private AnHavvaConstable(final AnHavvaConstable card) {
|
||||||
|
|
@ -41,41 +50,3 @@ public final class AnHavvaConstable extends CardImpl {
|
||||||
return new AnHavvaConstable(this);
|
return new AnHavvaConstable(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AnHavvaConstableEffect extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
AnHavvaConstableEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, Outcome.BoostCreature);
|
|
||||||
staticText = "{this}'s toughness is equal to 1 plus the number of green creatures on the battlefield";
|
|
||||||
}
|
|
||||||
|
|
||||||
private AnHavvaConstableEffect(final AnHavvaConstableEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AnHavvaConstableEffect copy() {
|
|
||||||
return new AnHavvaConstableEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MageObject mageObject = game.getObject(source.getSourceId());
|
|
||||||
if (mageObject == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
|
|
||||||
filter.add(new ColorPredicate(ObjectColor.GREEN));
|
|
||||||
int numberOfGreenCreatures = game.getBattlefield().count(filter, source.getSourceId(), source, game);
|
|
||||||
|
|
||||||
mageObject.getToughness().setModifiedBaseValue(1 + numberOfGreenCreatures);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -19,6 +20,7 @@ import mage.players.Player;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -69,6 +71,35 @@ class AnheloThePainterGainCausalityEffect extends ContinuousEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Card card = (Card) object;
|
||||||
|
game.getState().addOtherAbility(card, new CasualtyAbility(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
AnheloThePainterWatcher watcher = game.getState().getWatcher(AnheloThePainterWatcher.class);
|
||||||
|
if (controller == null || watcher == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (StackObject stackObject : game.getStack()) {
|
||||||
|
if (!(stackObject instanceof Spell)
|
||||||
|
|| stackObject.isCopy()
|
||||||
|
|| !stackObject.isControlledBy(source.getControllerId())
|
||||||
|
|| !AnheloThePainterWatcher.checkSpell(stackObject, game)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Card card = ((Spell) stackObject).getCard();
|
||||||
|
affectedObjects.add(card);
|
||||||
|
}
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import java.util.UUID;
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -18,6 +18,10 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetArtifactPermanent;
|
import mage.target.common.TargetArtifactPermanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author MTGfan
|
* @author MTGfan
|
||||||
|
|
@ -72,8 +76,25 @@ class AnimateArtifactContinuousEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
// Not sure, if this is layerwise handled absolutely correctly
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
switch (layer) {
|
||||||
|
case TypeChangingEffects_4:
|
||||||
|
permanent.addCardType(game, CardType.CREATURE);
|
||||||
|
break;
|
||||||
|
case PTChangingEffects_7:
|
||||||
|
if (sublayer != SubLayer.SetPT_7b) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
permanent.getPower().setModifiedBaseValue(permanent.getManaValue());
|
||||||
|
permanent.getToughness().setModifiedBaseValue(permanent.getManaValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
if (enchantment == null) {
|
if (enchantment == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -82,24 +103,24 @@ class AnimateArtifactContinuousEffect extends ContinuousEffectImpl {
|
||||||
if (permanent == null || permanent.isCreature(game)) {
|
if (permanent == null || permanent.isCreature(game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sublayer != SubLayer.NA) {
|
affectedObjects.add(permanent);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
permanent.addCardType(game, CardType.CREATURE);
|
|
||||||
permanent.getPower().setModifiedBaseValue(permanent.getManaValue());
|
|
||||||
permanent.getToughness().setModifiedBaseValue(permanent.getManaValue());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.TypeChangingEffects_4;
|
return layer == Layer.TypeChangingEffects_4 ||
|
||||||
|
layer == Layer.PTChangingEffects_7;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
|
@ -16,6 +17,7 @@ import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,12 +69,20 @@ class AraumiOfTheDeadTideEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Card card = (Card) object;
|
||||||
|
game.getState().addOtherAbility(card, new EncoreAbility(card.getManaCost()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
game.getState().addOtherAbility(card, new EncoreAbility(card.getManaCost()));
|
affectedObjects.add(card);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
|
@ -22,6 +23,7 @@ import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetAttackingOrBlockingCreature;
|
import mage.target.common.TargetAttackingOrBlockingCreature;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -78,7 +80,22 @@ class ArcheryTrainingEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent aura = game.getPermanent(source.getSourceId());
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = game.getPermanent(object.getId());
|
||||||
|
String rule = "this creature deals X damage to target attacking or blocking creature, " +
|
||||||
|
"where X is the number of arrow counters on " + aura.getName();
|
||||||
|
Ability ability = new SimpleActivatedAbility(
|
||||||
|
new DamageTargetEffect(new ArcheryTrainingValue(aura)).setText(rule), new TapSourceCost()
|
||||||
|
);
|
||||||
|
ability.addTarget(new TargetAttackingOrBlockingCreature());
|
||||||
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent aura = game.getPermanent(source.getSourceId());
|
Permanent aura = game.getPermanent(source.getSourceId());
|
||||||
if (aura == null) {
|
if (aura == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -87,13 +104,7 @@ class ArcheryTrainingEffect extends ContinuousEffectImpl {
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String rule = "this creature deals X damage to target attacking or blocking creature, " +
|
affectedObjects.add(permanent);
|
||||||
"where X is the number of arrow counters on " + aura.getName();
|
|
||||||
Ability ability = new SimpleActivatedAbility(
|
|
||||||
new DamageTargetEffect(new ArcheryTrainingValue(aura)).setText(rule), new TapSourceCost()
|
|
||||||
);
|
|
||||||
ability.addTarget(new TargetAttackingOrBlockingCreature());
|
|
||||||
permanent.addAbility(ability, source.getSourceId(), game);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
import mage.abilities.condition.common.SaddledCondition;
|
import mage.abilities.condition.common.SaddledCondition;
|
||||||
|
|
@ -16,6 +17,7 @@ import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -77,11 +79,10 @@ class ArchmagesNewtEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
for (MageItem object : affectedObjects) {
|
||||||
if (card == null) {
|
Card card = (Card) object;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
FlashbackAbility ability;
|
FlashbackAbility ability;
|
||||||
if (saddled) {
|
if (saddled) {
|
||||||
ability = new FlashbackAbility(card, new GenericManaCost(0));
|
ability = new FlashbackAbility(card, new GenericManaCost(0));
|
||||||
|
|
@ -90,7 +91,18 @@ class ArchmagesNewtEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
ability.setSourceId(card.getId());
|
ability.setSourceId(card.getId());
|
||||||
ability.setControllerId(card.getOwnerId());
|
ability.setControllerId(card.getOwnerId());
|
||||||
|
|
||||||
game.getState().addOtherAbility(card, ability);
|
game.getState().addOtherAbility(card, ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
|
if (card == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.add(card);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
|
@ -22,6 +23,7 @@ import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,14 +89,22 @@ class ArixmethesIsLandEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
permanent.removeAllCardTypes(game);
|
||||||
|
permanent.addCardType(game, CardType.LAND);
|
||||||
|
permanent.removeAllSubTypes(game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
permanent.removeAllCardTypes(game);
|
affectedObjects.add(permanent);
|
||||||
permanent.addCardType(game, CardType.LAND);
|
|
||||||
permanent.removeAllSubTypes(game);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||||
import mage.abilities.effects.mana.BasicManaEffect;
|
import mage.abilities.effects.mana.BasicManaEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.abilities.keyword.IndestructibleAbility;
|
import mage.abilities.keyword.IndestructibleAbility;
|
||||||
|
|
@ -11,9 +10,11 @@ import mage.abilities.keyword.NightboundAbility;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
import mage.game.Game;
|
import mage.constants.Duration;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SuperType;
|
||||||
|
import mage.game.permanent.token.custom.CreatureToken;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -41,7 +42,15 @@ public final class ArlinnTheMoonsFury extends CardImpl {
|
||||||
)), 2));
|
)), 2));
|
||||||
|
|
||||||
// 0: Until end of turn, Arlinn, the Moon's Fury becomes a 5/5 Werewolf creature with trample, indestructible, and haste.
|
// 0: Until end of turn, Arlinn, the Moon's Fury becomes a 5/5 Werewolf creature with trample, indestructible, and haste.
|
||||||
this.addAbility(new LoyaltyAbility(new ArlinnTheMoonsFuryEffect(), 0));
|
this.addAbility(new LoyaltyAbility(new BecomesCreatureSourceEffect(
|
||||||
|
new CreatureToken(5, 5, "5/5 Werewolf creature with trample, indestructible, and haste")
|
||||||
|
.withSubType(SubType.WEREWOLF)
|
||||||
|
.withAbility(TrampleAbility.getInstance())
|
||||||
|
.withAbility(IndestructibleAbility.getInstance())
|
||||||
|
.withAbility(HasteAbility.getInstance()),
|
||||||
|
null,
|
||||||
|
Duration.EndOfTurn)
|
||||||
|
.withDurationRuleAtStart(true), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArlinnTheMoonsFury(final ArlinnTheMoonsFury card) {
|
private ArlinnTheMoonsFury(final ArlinnTheMoonsFury card) {
|
||||||
|
|
@ -53,66 +62,3 @@ public final class ArlinnTheMoonsFury extends CardImpl {
|
||||||
return new ArlinnTheMoonsFury(this);
|
return new ArlinnTheMoonsFury(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ArlinnTheMoonsFuryEffect extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
ArlinnTheMoonsFuryEffect() {
|
|
||||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
|
||||||
staticText = "until end of turn, {this} becomes a 5/5 Werewolf creature with trample, indestructible, and haste";
|
|
||||||
this.dependencyTypes.add(DependencyType.BecomeCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArlinnTheMoonsFuryEffect(final ArlinnTheMoonsFuryEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArlinnTheMoonsFuryEffect copy() {
|
|
||||||
return new ArlinnTheMoonsFuryEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
|
||||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
|
||||||
if (permanent == null) {
|
|
||||||
discard();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch (layer) {
|
|
||||||
case TypeChangingEffects_4:
|
|
||||||
permanent.removeAllCardTypes(game);
|
|
||||||
permanent.addCardType(game, CardType.CREATURE);
|
|
||||||
permanent.removeAllCreatureTypes(game);
|
|
||||||
permanent.addSubType(game, SubType.WEREWOLF);
|
|
||||||
return true;
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
|
||||||
permanent.addAbility(TrampleAbility.getInstance(), source.getSourceId(), game);
|
|
||||||
permanent.addAbility(IndestructibleAbility.getInstance(), source.getSourceId(), game);
|
|
||||||
permanent.addAbility(HasteAbility.getInstance(), source.getSourceId(), game);
|
|
||||||
return true;
|
|
||||||
case PTChangingEffects_7:
|
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
|
||||||
permanent.getPower().setModifiedBaseValue(5);
|
|
||||||
permanent.getToughness().setModifiedBaseValue(5);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasLayer(Layer layer) {
|
|
||||||
switch (layer) {
|
|
||||||
case TypeChangingEffects_4:
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
|
||||||
case PTChangingEffects_7:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,14 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
@ -50,7 +52,7 @@ public final class ArmamentMaster extends CardImpl {
|
||||||
|
|
||||||
class ArmamentMasterEffect extends ContinuousEffectImpl {
|
class ArmamentMasterEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Other Kor creatures you control");
|
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Other Kor creatures you control");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(SubType.KOR.getPredicate());
|
filter.add(SubType.KOR.getPredicate());
|
||||||
|
|
@ -71,16 +73,23 @@ class ArmamentMasterEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
int count = countEquipment(game, source);
|
int equipmentCount = countEquipment(game, source);
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
for (MageItem object : affectedObjects) {
|
||||||
for (Permanent perm : permanents) {
|
Permanent permanent = (Permanent) object;
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
permanent.addPower(2 * equipmentCount);
|
||||||
perm.addPower(2 * count);
|
permanent.addToughness(2 * equipmentCount);
|
||||||
perm.addToughness(2 * count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
int equipmentCount = countEquipment(game, source);
|
||||||
|
if (equipmentCount < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int countEquipment(Game game, Ability source) {
|
private int countEquipment(Game game, Ability source) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -15,6 +16,8 @@ import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -62,10 +65,9 @@ class ArmedWithProofEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
for (MageItem object : affectedObjects) {
|
||||||
filter, source.getControllerId(), source, game
|
Permanent permanent = (Permanent) object;
|
||||||
)) {
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
permanent.addSubType(game, SubType.EQUIPMENT);
|
permanent.addSubType(game, SubType.EQUIPMENT);
|
||||||
|
|
@ -78,11 +80,21 @@ class ArmedWithProofEffect extends ContinuousEffectImpl {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -18,6 +19,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.BloodToken;
|
import mage.game.permanent.token.BloodToken;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -72,10 +75,9 @@ class ArterialAlchemyEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
for (MageItem object : affectedObjects) {
|
||||||
filter, source.getControllerId(), source, game
|
Permanent permanent = (Permanent) object;
|
||||||
)) {
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
permanent.addSubType(game, SubType.EQUIPMENT);
|
permanent.addSubType(game, SubType.EQUIPMENT);
|
||||||
|
|
@ -88,11 +90,21 @@ class ArterialAlchemyEffect extends ContinuousEffectImpl {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
|
|
@ -19,6 +20,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,11 +136,10 @@ class AsForetoldAddAltCostEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
for (MageItem object : affectedObjects) {
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = (Permanent) object;
|
||||||
if (sourcePermanent != null) {
|
|
||||||
Boolean wasItUsed = (Boolean) game.getState().getValue(
|
Boolean wasItUsed = (Boolean) game.getState().getValue(
|
||||||
sourcePermanent.getId().toString()
|
sourcePermanent.getId().toString()
|
||||||
+ sourcePermanent.getZoneChangeCounter(game)
|
+ sourcePermanent.getZoneChangeCounter(game)
|
||||||
|
|
@ -149,15 +151,31 @@ class AsForetoldAddAltCostEffect extends ContinuousEffectImpl {
|
||||||
alternateCostAbility.setSourceId(source.getSourceId());
|
alternateCostAbility.setSourceId(source.getSourceId());
|
||||||
controller.getAlternativeSourceCosts().add(alternateCostAbility);
|
controller.getAlternativeSourceCosts().add(alternateCostAbility);
|
||||||
}
|
}
|
||||||
// Return true even if we didn't add the alt cost. We still applied the effect
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
// Return true even if we didn't add the alt cost. We still applied the effect
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.dynamicvalue.common.LandsYouControlCount;
|
import mage.abilities.dynamicvalue.common.LandsYouControlCount;
|
||||||
|
|
@ -16,6 +17,7 @@ import mage.filter.predicate.permanent.TokenPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,11 +78,10 @@ class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
for (MageItem object : affectedObjects) {
|
||||||
filter, source.getControllerId(), source, game
|
Permanent permanent = (Permanent) object;
|
||||||
)) {
|
if (!permanent.isLand()) {
|
||||||
if (!permanent.isLand(game)) {
|
|
||||||
permanent.addCardType(game, CardType.LAND);
|
permanent.addCardType(game, CardType.LAND);
|
||||||
}
|
}
|
||||||
permanent.addSubType(game, SubType.FOREST);
|
permanent.addSubType(game, SubType.FOREST);
|
||||||
|
|
@ -88,6 +89,11 @@ class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
|
||||||
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -10,11 +10,12 @@ import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,32 +56,31 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(permanent.getId(), game);
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Card card = (Card) object;
|
||||||
|
card.addSubType(game, subType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (controller != null && permanent != null) {
|
if (controller == null || permanent == null) {
|
||||||
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(permanent.getId(), game);
|
|
||||||
if (subType != null) {
|
|
||||||
for (UUID cardId : controller.getGraveyard()) {
|
|
||||||
Card card = game.getCard(cardId);
|
|
||||||
if (card != null && card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
|
||||||
MageObject mageObject = game.getObject(card.getId());
|
|
||||||
if (mageObject != null) {
|
|
||||||
CardUtil.getObjectPartsAsObjects(mageObject).forEach(objectPart ->{
|
|
||||||
if (objectPart.isCreature(game)) {
|
|
||||||
game.getState().getCreateMageObjectAttribute(objectPart, game).getSubtype().add(subType);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
discard();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(permanent.getId(), game);
|
||||||
|
for (Card card : controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game)) {
|
||||||
|
if (!card.hasSubtype(subType, game)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
affectedObjects.add(card);
|
||||||
|
}
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AshesOfTheFallenEffect copy() {
|
public AshesOfTheFallenEffect copy() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -12,6 +12,7 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||||
import mage.abilities.keyword.EquipAbility;
|
import mage.abilities.keyword.EquipAbility;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
|
@ -20,7 +21,7 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -78,13 +79,25 @@ class AssaultSuitCantBeSacrificed extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Optional.ofNullable(source.getSourcePermanentIfItStillExists(game))
|
for (MageItem object : affectedObjects) {
|
||||||
.map(Permanent::getAttachedTo)
|
((Permanent) object).setCanBeSacrificed(false);
|
||||||
.map(game::getPermanent)
|
}
|
||||||
.ifPresent(permanent -> permanent.setCanBeSacrificed(false));
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent attachment = source.getSourcePermanentIfItStillExists(game);
|
||||||
|
if (attachment == null || attachment.getAttachedTo() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(attachment.getAttachedTo());
|
||||||
|
if (permanent != null) {
|
||||||
|
affectedObjects.add(permanent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AssaultSuitGainControlEffect extends OneShotEffect {
|
class AssaultSuitGainControlEffect extends OneShotEffect {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
|
@ -16,6 +16,9 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
|
@ -37,7 +40,6 @@ public final class AvenMimeomancer extends CardImpl {
|
||||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersTargetEffect(CounterType.FEATHER.createInstance()), true);
|
Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersTargetEffect(CounterType.FEATHER.createInstance()), true);
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
ability.addEffect(new AvenEffect());
|
ability.addEffect(new AvenEffect());
|
||||||
ability.addEffect(new AvenEffect2());
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +56,7 @@ public final class AvenMimeomancer extends CardImpl {
|
||||||
class AvenEffect extends ContinuousEffectImpl {
|
class AvenEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
AvenEffect() {
|
AvenEffect() {
|
||||||
super(Duration.Custom, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature);
|
super(Duration.Custom, Outcome.BoostCreature);
|
||||||
this.staticText = "If you do, that creature has base power and toughness 3/1 and has flying for as long as it has a feather counter on it";
|
this.staticText = "If you do, that creature has base power and toughness 3/1 and has flying for as long as it has a feather counter on it";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,59 +70,37 @@ class AvenEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
switch (layer) {
|
||||||
|
case AbilityAddingRemovingEffects_6:
|
||||||
|
permanent.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
|
||||||
|
break;
|
||||||
|
case PTChangingEffects_7:
|
||||||
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
|
permanent.getPower().setModifiedBaseValue(3);
|
||||||
|
permanent.getToughness().setModifiedBaseValue(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target == null) {
|
if (target == null || target.getCounters(game).getCount(CounterType.FEATHER) < 1) {
|
||||||
|
this.discard();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
target.getPower().setModifiedBaseValue(3);
|
affectedObjects.add(target);
|
||||||
target.getToughness().setModifiedBaseValue(1);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean hasLayer(Layer layer) {
|
||||||
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
return layer == Layer.AbilityAddingRemovingEffects_6
|
||||||
if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) {
|
|| layer == Layer.PTChangingEffects_7;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AvenEffect2 extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
public AvenEffect2() {
|
|
||||||
super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.BoostCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
private AvenEffect2(final AvenEffect2 effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AvenEffect2 copy() {
|
|
||||||
return new AvenEffect2(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
|
||||||
if (target != null) {
|
|
||||||
if (!target.getAbilities().contains(FlyingAbility.getInstance())) {
|
|
||||||
target.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInactive(Ability source, Game game) {
|
|
||||||
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
|
||||||
if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,25 @@
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
import java.util.UUID;
|
import mage.MageItem;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.common.counter.AddCountersAttachedEffect;
|
|
||||||
import mage.constants.*;
|
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
import mage.abilities.effects.common.counter.AddCountersAttachedEffect;
|
||||||
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
|
||||||
import mage.cards.CardImpl;
|
import java.util.List;
|
||||||
import mage.cards.CardSetInfo;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -72,7 +74,16 @@ class AwakenedAwarenessEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
permanent.getPower().setModifiedBaseValue(1);
|
||||||
|
permanent.getToughness().setModifiedBaseValue(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent enchantment = source.getSourcePermanentIfItStillExists(game);
|
Permanent enchantment = source.getSourcePermanentIfItStillExists(game);
|
||||||
if (enchantment == null) {
|
if (enchantment == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -82,9 +93,7 @@ class AwakenedAwarenessEffect extends ContinuousEffectImpl {
|
||||||
if (creature == null || !creature.isCreature(game)) {
|
if (creature == null || !creature.isCreature(game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
affectedObjects.add(creature);
|
||||||
creature.getPower().setModifiedBaseValue(1);
|
|
||||||
creature.getToughness().setModifiedBaseValue(1);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksTriggeredAbility;
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
|
|
@ -14,6 +15,7 @@ import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -82,24 +84,24 @@ class BackdraftHellkiteEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
for (MageItem object : affectedObjects) {
|
||||||
if (player == null) {
|
Card card = (Card) object;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
player.getGraveyard()
|
|
||||||
.stream()
|
|
||||||
.filter(cardId -> affectedObjectList.contains(new MageObjectReference(cardId, game)))
|
|
||||||
.forEachOrdered(cardId -> {
|
|
||||||
Card card = game.getCard(cardId);
|
|
||||||
if (card == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
|
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
|
||||||
ability.setSourceId(cardId);
|
ability.setSourceId(card.getId());
|
||||||
ability.setControllerId(card.getOwnerId());
|
ability.setControllerId(card.getOwnerId());
|
||||||
game.getState().addOtherAbility(card, ability);
|
game.getState().addOtherAbility(card, ability);
|
||||||
});
|
}
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageObjectReference mor : affectedObjectList) {
|
||||||
|
Card card = mor.getCard(game);
|
||||||
|
if (card != null) {
|
||||||
|
affectedObjects.add(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -10,12 +11,12 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -94,20 +95,29 @@ class BannerOfKinshipBoostEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
int boost = game.getPermanent(source.getSourceId())
|
||||||
|
.getCounters(game)
|
||||||
|
.getCount(CounterType.FELLOWSHIP);
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
permanent.addPower(boost);
|
||||||
|
permanent.addToughness(boost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent == null) {
|
||||||
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
|
return false;
|
||||||
if (subtype != null) {
|
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game)) {
|
|
||||||
if (perm.hasSubtype(subtype, game)) {
|
|
||||||
int boost = permanent.getCounters(game).getCount(CounterType.FELLOWSHIP);
|
|
||||||
perm.addPower(boost);
|
|
||||||
perm.addToughness(boost);
|
|
||||||
}
|
}
|
||||||
|
SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type");
|
||||||
|
if (subtype == null) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(subtype);
|
||||||
}
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game));
|
||||||
return true;
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
|
|
@ -19,7 +20,8 @@ import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -81,46 +83,59 @@ class BelloBardOfTheBramblesEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
if (!source.isControlledBy(game.getActivePlayerId())) {
|
for (MageItem object : affectedObjects) {
|
||||||
return false;
|
Permanent permanent = (Permanent) object;
|
||||||
}
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
affectedObjectList.clear();
|
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
|
||||||
permanent.addCardType(game, CardType.CREATURE);
|
permanent.addCardType(game, CardType.CREATURE);
|
||||||
permanent.addSubType(game, SubType.ELEMENTAL);
|
permanent.addSubType(game, SubType.ELEMENTAL);
|
||||||
affectedObjectList.add(new MageObjectReference(permanent, game));
|
break;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
case AbilityAddingRemovingEffects_6:
|
||||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
|
|
||||||
Permanent permanent = it.next().getPermanent(game);
|
|
||||||
if (permanent == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
permanent.addAbility(IndestructibleAbility.getInstance(), source.getSourceId(), game);
|
permanent.addAbility(IndestructibleAbility.getInstance(), source.getSourceId(), game);
|
||||||
permanent.addAbility(HasteAbility.getInstance(), source.getSourceId(), game);
|
permanent.addAbility(HasteAbility.getInstance(), source.getSourceId(), game);
|
||||||
permanent.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1)), source.getSourceId(), game);
|
permanent.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1)), source.getSourceId(), game);
|
||||||
}
|
break;
|
||||||
return true;
|
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer != SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
|
|
||||||
Permanent permanent = it.next().getPermanent(game);
|
|
||||||
if (permanent == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
permanent.getPower().setModifiedBaseValue(4);
|
permanent.getPower().setModifiedBaseValue(4);
|
||||||
permanent.getToughness().setModifiedBaseValue(4);
|
permanent.getToughness().setModifiedBaseValue(4);
|
||||||
}
|
}
|
||||||
return true;
|
break;
|
||||||
default:
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
if (!source.isControlledBy(game.getActivePlayerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (layer == Layer.TypeChangingEffects_4) {
|
||||||
|
affectedObjectList.clear();
|
||||||
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||||
|
affectedObjectList.add(new MageObjectReference(permanent, game));
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (MageObjectReference mor : affectedObjectList) {
|
||||||
|
Permanent permanent = mor.getPermanent(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -130,11 +145,6 @@ class BelloBardOfTheBramblesEffect extends ContinuousEffectImpl {
|
||||||
|| layer == Layer.PTChangingEffects_7;
|
|| layer == Layer.PTChangingEffects_7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BelloBardOfTheBramblesEffect copy() {
|
public BelloBardOfTheBramblesEffect copy() {
|
||||||
return new BelloBardOfTheBramblesEffect(this);
|
return new BelloBardOfTheBramblesEffect(this);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||||
|
|
@ -67,7 +69,14 @@ class BiotransferenceEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
((MageObject) object).addCardType(game, CardType.ARTIFACT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -77,26 +86,26 @@ class BiotransferenceEffect extends ContinuousEffectImpl {
|
||||||
for (UUID cardId : controller.getGraveyard()) {
|
for (UUID cardId : controller.getGraveyard()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null && card.isCreature(game) && !card.isArtifact(game)) {
|
if (card != null && card.isCreature(game) && !card.isArtifact(game)) {
|
||||||
card.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// on Hand
|
// on Hand
|
||||||
for (UUID cardId : controller.getHand()) {
|
for (UUID cardId : controller.getHand()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null && card.isCreature(game) && !card.isArtifact(game)) {
|
if (card != null && card.isCreature(game) && !card.isArtifact(game)) {
|
||||||
card.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in Exile
|
// in Exile
|
||||||
for (Card card : game.getState().getExile().getAllCards(game, source.getControllerId())) {
|
for (Card card : game.getState().getExile().getAllCards(game, source.getControllerId())) {
|
||||||
if (card.isCreature(game) && !card.isArtifact(game)) {
|
if (card.isCreature(game) && !card.isArtifact(game)) {
|
||||||
card.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in Library (e.g. for Mystical Teachings)
|
// in Library (e.g. for Mystical Teachings)
|
||||||
for (Card card : controller.getLibrary().getCards(game)) {
|
for (Card card : controller.getLibrary().getCards(game)) {
|
||||||
if (card.isOwnedBy(controller.getId()) && card.isCreature(game) && !card.isArtifact(game)) {
|
if (card.isOwnedBy(controller.getId()) && card.isCreature(game) && !card.isArtifact(game)) {
|
||||||
card.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// commander in command zone
|
// commander in command zone
|
||||||
|
|
@ -105,7 +114,7 @@ class BiotransferenceEffect extends ContinuousEffectImpl {
|
||||||
Card card = game.getCard((commandObject).getId());
|
Card card = game.getCard((commandObject).getId());
|
||||||
if (card != null && card.isOwnedBy(controller.getId())
|
if (card != null && card.isOwnedBy(controller.getId())
|
||||||
&& card.isCreature(game) && !card.isArtifact(game)) {
|
&& card.isCreature(game) && !card.isArtifact(game)) {
|
||||||
card.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +126,7 @@ class BiotransferenceEffect extends ContinuousEffectImpl {
|
||||||
&& stackObject.isCreature(game)
|
&& stackObject.isCreature(game)
|
||||||
&& !stackObject.isArtifact(game)) {
|
&& !stackObject.isArtifact(game)) {
|
||||||
Card card = ((Spell) stackObject).getCard();
|
Card card = ((Spell) stackObject).getCard();
|
||||||
card.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// creatures you control
|
// creatures you control
|
||||||
|
|
@ -125,10 +134,9 @@ class BiotransferenceEffect extends ContinuousEffectImpl {
|
||||||
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
|
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
creature.addCardType(game, CardType.ARTIFACT);
|
affectedObjects.add(creature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return !affectedObjects.isEmpty();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -12,6 +13,8 @@ import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -65,7 +68,31 @@ class BladeOfTheOniEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
switch (layer) {
|
||||||
|
case TypeChangingEffects_4:
|
||||||
|
permanent.addSubType(game, SubType.DEMON);
|
||||||
|
break;
|
||||||
|
case ColorChangingEffects_5:
|
||||||
|
permanent.getColor(game).setBlack(true);
|
||||||
|
break;
|
||||||
|
case AbilityAddingRemovingEffects_6:
|
||||||
|
permanent.addAbility(new MenaceAbility(false), source.getSourceId(), game);
|
||||||
|
break;
|
||||||
|
case PTChangingEffects_7:
|
||||||
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
|
permanent.getPower().setModifiedBaseValue(5);
|
||||||
|
permanent.getToughness().setModifiedBaseValue(5);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
if (sourcePermanent == null) {
|
if (sourcePermanent == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -74,29 +101,17 @@ class BladeOfTheOniEffect extends ContinuousEffectImpl {
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (layer) {
|
affectedObjects.add(permanent);
|
||||||
case AbilityAddingRemovingEffects_6:
|
|
||||||
permanent.addAbility(new MenaceAbility(false), source.getSourceId(), game);
|
|
||||||
return true;
|
return true;
|
||||||
case ColorChangingEffects_5:
|
|
||||||
permanent.getColor(game).setBlack(true);
|
|
||||||
return true;
|
|
||||||
case TypeChangingEffects_4:
|
|
||||||
permanent.addSubType(game, SubType.DEMON);
|
|
||||||
return true;
|
|
||||||
case PTChangingEffects_7:
|
|
||||||
if (sublayer != SubLayer.SetPT_7b) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
permanent.getPower().setModifiedBaseValue(5);
|
|
||||||
permanent.getToughness().setModifiedBaseValue(5);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -16,6 +16,10 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class BloodBaronOfVizkopa extends CardImpl {
|
public final class BloodBaronOfVizkopa extends CardImpl {
|
||||||
|
|
||||||
public BloodBaronOfVizkopa(UUID ownerId, CardSetInfo setInfo) {
|
public BloodBaronOfVizkopa(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
|
@ -61,16 +65,9 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
if (!conditionState(source, game)) {
|
for (MageItem object : affectedObjects) {
|
||||||
return false;
|
Permanent creature = (Permanent) object;
|
||||||
}
|
|
||||||
|
|
||||||
Permanent creature = game.getPermanent(source.getSourceId());
|
|
||||||
if (creature == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.ModifyPT_7c) {
|
if (sublayer == SubLayer.ModifyPT_7c) {
|
||||||
|
|
@ -79,17 +76,36 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AbilityAddingRemovingEffects_6:
|
case AbilityAddingRemovingEffects_6:
|
||||||
if (sublayer == SubLayer.NA) {
|
|
||||||
creature.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
|
creature.addAbility(FlyingAbility.getInstance(), source.getSourceId(), game);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
if (!conditionState(source, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Permanent creature = game.getPermanent(source.getSourceId());
|
||||||
|
if (creature == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.add(creature);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean conditionState(Ability source, Game game) {
|
private boolean conditionState(Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller == null || controller.getLife() < 30) {
|
if (controller == null || controller.getLife() < 30) {
|
||||||
|
|
@ -104,11 +120,6 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return (layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.PTChangingEffects_7);
|
return (layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.PTChangingEffects_7);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -12,6 +13,7 @@ import mage.filter.predicate.Predicates;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,7 +46,7 @@ public final class BloodMoon extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
BloodMoonEffect() {
|
BloodMoonEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
|
||||||
this.staticText = "Nonbasic lands are Mountains";
|
this.staticText = "Nonbasic lands are Mountains";
|
||||||
this.dependencyTypes.add(DependencyType.BecomeMountain);
|
this.dependencyTypes.add(DependencyType.BecomeMountain);
|
||||||
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
|
this.dependendToTypes.add(DependencyType.BecomeNonbasicLand);
|
||||||
|
|
@ -54,21 +56,15 @@ public final class BloodMoon extends CardImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BloodMoonEffect copy() {
|
public BloodMoonEffect copy() {
|
||||||
return new BloodMoonEffect(this);
|
return new BloodMoonEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
for (Permanent land : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
for (MageItem object : affectedObjects) {
|
||||||
switch (layer) {
|
Permanent land = (Permanent) object;
|
||||||
case TypeChangingEffects_4:
|
|
||||||
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
|
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
|
||||||
// So the ability removing has to be done before Layer 6
|
// So the ability removing has to be done before Layer 6
|
||||||
// Lands have their mana ability intrinsically, so that is added in layer 4
|
// Lands have their mana ability intrinsically, so that is added in layer 4
|
||||||
|
|
@ -76,15 +72,13 @@ public final class BloodMoon extends CardImpl {
|
||||||
land.addSubType(game, SubType.MOUNTAIN);
|
land.addSubType(game, SubType.MOUNTAIN);
|
||||||
land.removeAllAbilities(source.getSourceId(), game);
|
land.removeAllAbilities(source.getSourceId(), game);
|
||||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
return layer == Layer.TypeChangingEffects_4;
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -46,7 +47,7 @@ public final class BloodSun extends CardImpl {
|
||||||
class BloodSunEffect extends ContinuousEffectImpl {
|
class BloodSunEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
BloodSunEffect(Duration duration) {
|
BloodSunEffect(Duration duration) {
|
||||||
super(duration, Outcome.LoseAbility);
|
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility);
|
||||||
staticText = "all lands lose all abilities except mana abilities";
|
staticText = "all lands lose all abilities except mana abilities";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,12 +61,9 @@ class BloodSunEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
for (MageItem object : affectedObjects) {
|
||||||
if (player != null) {
|
Permanent permanent = (Permanent) object;
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LANDS, player.getId(), source, game)) {
|
|
||||||
switch (layer) {
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
|
||||||
List<Ability> toRemove = new ArrayList<>();
|
List<Ability> toRemove = new ArrayList<>();
|
||||||
permanent.getAbilities().forEach(ability -> {
|
permanent.getAbilities().forEach(ability -> {
|
||||||
if (!ability.getAbilityType().isManaAbility()) {
|
if (!ability.getAbilityType().isManaAbility()) {
|
||||||
|
|
@ -73,22 +71,16 @@ class BloodSunEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
permanent.removeAbilities(toRemove, source.getSourceId(), game);
|
permanent.removeAbilities(toRemove, source.getSourceId(), game);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LANDS, player.getId(), source, game));
|
||||||
@Override
|
return !affectedObjects.isEmpty();
|
||||||
public boolean hasLayer(Layer layer) {
|
|
||||||
return layer == Layer.AbilityAddingRemovingEffects_6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -15,6 +17,7 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,8 +62,6 @@ public final class BloodlordOfVaasgoth extends CardImpl {
|
||||||
class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private Ability ability = new BloodthirstAbility(3);
|
private Ability ability = new BloodthirstAbility(3);
|
||||||
private int zoneChangeCounter;
|
|
||||||
private UUID permanentId;
|
|
||||||
|
|
||||||
BloodlordOfVaasgothEffect() {
|
BloodlordOfVaasgothEffect() {
|
||||||
super(Duration.OneUse, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
super(Duration.OneUse, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
|
|
@ -70,8 +71,6 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
||||||
private BloodlordOfVaasgothEffect(final BloodlordOfVaasgothEffect effect) {
|
private BloodlordOfVaasgothEffect(final BloodlordOfVaasgothEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.ability = effect.ability.copy();
|
this.ability = effect.ability.copy();
|
||||||
this.zoneChangeCounter = effect.zoneChangeCounter;
|
|
||||||
this.permanentId = effect.permanentId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -84,25 +83,39 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
Spell object = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
Spell object = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
zoneChangeCounter = game.getState().getZoneChangeCounter(object.getSourceId()) + 1;
|
int zcc = game.getState().getZoneChangeCounter(object.getSourceId()) + 1;
|
||||||
permanentId = object.getSourceId();
|
affectedObjectList.add(new MageObjectReference(object.getSourceId(), zcc, game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
for (MageItem object : affectedObjects) {
|
||||||
if (permanent != null && permanent.getZoneChangeCounter(game) <= zoneChangeCounter) {
|
if (object instanceof Spell) {
|
||||||
permanent.addAbility(ability, source.getSourceId(), game);
|
game.getState().addOtherAbility(((Spell) object).getCard(), ability, true);
|
||||||
} else {
|
} else {
|
||||||
if (game.getState().getZoneChangeCounter(permanentId) >= zoneChangeCounter) {
|
((Permanent) object).addAbility(ability, source.getSourceId(), game);
|
||||||
discard();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null) { // Bloodthirst checked while spell is on the stack so needed to give it already to the spell
|
if (spell != null) { // Bloodthirst checked while spell is on the stack so needed to give it already to the spell
|
||||||
game.getState().addOtherAbility(spell.getCard(), ability, true);
|
affectedObjects.add(spell);
|
||||||
|
} else {
|
||||||
|
for (MageObjectReference mor : affectedObjectList) {
|
||||||
|
Permanent permanent = mor.getPermanent(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
affectedObjects.add(permanent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (affectedObjects.isEmpty()) {
|
||||||
|
this.discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
|
@ -16,6 +17,8 @@ import mage.filter.predicate.Predicates;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,15 +62,9 @@ class BludgeonBrawlEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
if (layer == Layer.TypeChangingEffects_4) {
|
for (MageItem object : affectedObjects) {
|
||||||
affectedObjectList.clear();
|
Permanent permanent = (Permanent) object;
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
|
||||||
affectedObjectList.add(new MageObjectReference(permanent, game));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (MageObjectReference mor : affectedObjectList) {
|
|
||||||
Permanent permanent = mor.getPermanent(game);
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
permanent.addSubType(game, SubType.EQUIPMENT);
|
permanent.addSubType(game, SubType.EQUIPMENT);
|
||||||
|
|
@ -80,11 +77,33 @@ class BludgeonBrawlEffect extends ContinuousEffectImpl {
|
||||||
permanent.addAbility(new EquipAbility(mv, false), source.getSourceId(), game);
|
permanent.addAbility(new EquipAbility(mv, false), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
if (layer == Layer.TypeChangingEffects_4) {
|
||||||
|
affectedObjectList.clear();
|
||||||
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||||
|
affectedObjectList.add(new MageObjectReference(permanent, game));
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (MageObjectReference mor : affectedObjectList) {
|
||||||
|
Permanent permanent = mor.getPermanent(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.constants.*;
|
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.other.AnotherTargetPredicate;
|
import mage.filter.predicate.other.AnotherTargetPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
@ -17,6 +17,11 @@ import mage.target.Target;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author weirddan455
|
* @author weirddan455
|
||||||
|
|
@ -71,6 +76,8 @@ public final class BlueDragon extends CardImpl {
|
||||||
|
|
||||||
class BlueDragonEffect extends ContinuousEffectImpl {
|
class BlueDragonEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
|
Map<UUID, Integer> powerMap = new HashMap<>();
|
||||||
|
|
||||||
BlueDragonEffect() {
|
BlueDragonEffect() {
|
||||||
super(Duration.UntilYourNextTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.UnboostCreature);
|
super(Duration.UntilYourNextTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.UnboostCreature);
|
||||||
this.staticText = "until your next turn, target creature an opponent controls gets -3/-0, up to one other target creature gets -2/-0, and up to one other target creature gets -1/-0";
|
this.staticText = "until your next turn, target creature an opponent controls gets -3/-0, up to one other target creature gets -2/-0, and up to one other target creature gets -1/-0";
|
||||||
|
|
@ -78,6 +85,7 @@ class BlueDragonEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private BlueDragonEffect(final BlueDragonEffect effect) {
|
private BlueDragonEffect(final BlueDragonEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
powerMap.putAll(effect.powerMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -86,17 +94,24 @@ class BlueDragonEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
int power = -3;
|
for (MageItem object : affectedObjects) {
|
||||||
int affectedTargets = 0;
|
Permanent permanent = (Permanent) object;
|
||||||
|
int power = -4 + powerMap.get(permanent.getId());
|
||||||
|
permanent.addPower(power);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
powerMap.clear();
|
||||||
for (Target target : source.getTargets()) {
|
for (Target target : source.getTargets()) {
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (permanent != null && permanent.isCreature(game)) {
|
if (permanent != null && permanent.isCreature()) {
|
||||||
permanent.addPower(power);
|
affectedObjects.add(permanent);
|
||||||
affectedTargets++;
|
powerMap.put(permanent.getId(), target.getTargetTag());
|
||||||
}
|
}
|
||||||
power++;
|
|
||||||
}
|
}
|
||||||
return affectedTargets > 0;
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -15,6 +16,7 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -66,20 +68,27 @@ class BravadoBoostEnchantedEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||||
int count = game.getBattlefield().count(filter, source.getControllerId(), source, game) - 1;
|
int count = game.getBattlefield().count(filter, source.getControllerId(), source, game) - 1;
|
||||||
if (count > 0) {
|
for (MageItem object : affectedObjects) {
|
||||||
|
Permanent permanent = (Permanent) object;
|
||||||
|
permanent.addPower(count);
|
||||||
|
permanent.addToughness(count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
||||||
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
|
|
||||||
if (creature != null) {
|
|
||||||
creature.addPower(count);
|
|
||||||
creature.addToughness(count);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
|
@ -26,6 +24,10 @@ import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LevelX2, TheElk801
|
* @author LevelX2, TheElk801
|
||||||
*/
|
*/
|
||||||
|
|
@ -124,23 +126,9 @@ class BronzehideLionContinuousEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
return false;
|
for (MageItem object : affectedObjects) {
|
||||||
}
|
Permanent lion = (Permanent) object;
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
|
||||||
if (game.getState().getZoneChangeCounter(source.getSourceId()) > zoneChangeCounter) {
|
|
||||||
discard();
|
|
||||||
}
|
|
||||||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
|
||||||
if (sourceObject == null) {
|
|
||||||
sourceObject = game.getPermanentEntering(source.getSourceId());
|
|
||||||
}
|
|
||||||
if (sourceObject == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Permanent lion = sourceObject;
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
lion.removeAllCardTypes(game);
|
lion.removeAllCardTypes(game);
|
||||||
|
|
@ -169,9 +157,35 @@ class BronzehideLionContinuousEffect extends ContinuousEffectImpl {
|
||||||
lion.addAbility(activatedAbility, source.getSourceId(), game);
|
lion.addAbility(activatedAbility, source.getSourceId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
if (game.getState().getZoneChangeCounter(source.getSourceId()) > zoneChangeCounter) {
|
||||||
|
discard();
|
||||||
|
}
|
||||||
|
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||||
|
if (sourceObject == null) {
|
||||||
|
sourceObject = game.getPermanentEntering(source.getSourceId());
|
||||||
|
}
|
||||||
|
if (sourceObject == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.add(sourceObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.TypeChangingEffects_4 || layer == Layer.AbilityAddingRemovingEffects_6;
|
return layer == Layer.TypeChangingEffects_4 || layer == Layer.AbilityAddingRemovingEffects_6;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -89,16 +90,16 @@ class BrothersYamazakiIgnoreLegendRuleEffectEffect extends ContinuousEffectImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(
|
for (MageItem object : affectedObjects) {
|
||||||
filter, source.getControllerId(), source, game
|
Permanent permanent = (Permanent) object;
|
||||||
);
|
|
||||||
if (permanents.size() != 2) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (Permanent permanent : permanents) {
|
|
||||||
permanent.setLegendRuleApplies(false);
|
permanent.setLegendRuleApplies(false);
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game));
|
||||||
|
return affectedObjects.size() == 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -18,6 +19,7 @@ import mage.players.Player;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -69,11 +71,9 @@ class BruenorBattlehammerBoostEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
for (MageItem object : affectedObjects) {
|
||||||
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
Permanent permanent = (Permanent) object;
|
||||||
source.getControllerId(), source, game
|
|
||||||
)) {
|
|
||||||
int equipped = permanent
|
int equipped = permanent
|
||||||
.getAttachments()
|
.getAttachments()
|
||||||
.stream()
|
.stream()
|
||||||
|
|
@ -82,7 +82,15 @@ class BruenorBattlehammerBoostEffect extends ContinuousEffectImpl {
|
||||||
.sum();
|
.sum();
|
||||||
permanent.addPower(2 * equipped);
|
permanent.addPower(2 * equipped);
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getActivePermanents(
|
||||||
|
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||||
|
source.getControllerId(), source, game
|
||||||
|
));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
|
|
@ -21,8 +22,8 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.ArrayList;
|
||||||
import java.util.Optional;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,35 +86,45 @@ class BurdenOfProofEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
if (layer != Layer.PTChangingEffects_7) {
|
for (MageItem object : affectedObjects) {
|
||||||
return false;
|
Permanent permanent = (Permanent) object;
|
||||||
}
|
|
||||||
Permanent permanent = Optional
|
|
||||||
.ofNullable(source.getSourcePermanentIfItStillExists(game))
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.map(Permanent::getAttachedTo)
|
|
||||||
.map(game::getPermanent)
|
|
||||||
.orElse(null);
|
|
||||||
if (permanent == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (permanent.isControlledBy(source.getControllerId()) && permanent.hasSubtype(SubType.DETECTIVE, game)) {
|
if (permanent.isControlledBy(source.getControllerId()) && permanent.hasSubtype(SubType.DETECTIVE, game)) {
|
||||||
if (sublayer == SubLayer.ModifyPT_7c) {
|
if (sublayer == SubLayer.ModifyPT_7c) {
|
||||||
permanent.getPower().increaseBoostedValue(2);
|
permanent.getPower().increaseBoostedValue(2);
|
||||||
permanent.getToughness().increaseBoostedValue(2);
|
permanent.getToughness().increaseBoostedValue(2);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} else if (sublayer == SubLayer.SetPT_7b) {
|
} else if (sublayer == SubLayer.SetPT_7b) {
|
||||||
permanent.getPower().setModifiedBaseValue(1);
|
permanent.getPower().setModifiedBaseValue(1);
|
||||||
permanent.getToughness().setModifiedBaseValue(1);
|
permanent.getToughness().setModifiedBaseValue(1);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
|
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
if (layer != Layer.PTChangingEffects_7) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||||
|
|
@ -160,13 +161,19 @@ class BurningCinderFuryOfCrimsonChaosFireCreatureGainControlEffect extends Conti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
for (MageItem object : affectedObjects) {
|
||||||
permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
((Permanent) object).changeControllerId(controller, game, source);
|
||||||
if (permanent != null && controller != null) {
|
|
||||||
return permanent.changeControllerId(controller, game, source);
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
|
if (permanent != null) {
|
||||||
|
affectedObjects.add(permanent);
|
||||||
|
}
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import mage.MageItem;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -20,6 +18,10 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,22 +69,30 @@ class CagedSunEffect2 extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
|
||||||
if (permanent != null) {
|
for (MageItem object : affectedObjects) {
|
||||||
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
|
Permanent permanent = (Permanent) object;
|
||||||
if (color != null) {
|
if (permanent.getColor(game).contains(color)) {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
permanent.addPower(1);
|
||||||
if (perm.getColor(game).contains(color)) {
|
permanent.addToughness(1);
|
||||||
perm.addPower(1);
|
|
||||||
perm.addToughness(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
|
||||||
|
if (color == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.addAll(game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game));
|
||||||
|
return !affectedObjects.isEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CagedSunTriggeredAbility extends TriggeredManaAbility {
|
class CagedSunTriggeredAbility extends TriggeredManaAbility {
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,33 @@
|
||||||
|
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
|
||||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.BoostAllOfChosenSubtypeEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Plopman
|
* @author Plopman
|
||||||
*/
|
*/
|
||||||
public final class DoorOfDestinies extends CardImpl {
|
public final class DoorOfDestinies extends CardImpl {
|
||||||
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control of the chosen type");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(TargetController.YOU.getControllerPredicate());
|
||||||
|
}
|
||||||
public DoorOfDestinies(UUID ownerId, CardSetInfo setInfo) {
|
public DoorOfDestinies(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||||
|
|
||||||
|
|
@ -36,7 +38,8 @@ public final class DoorOfDestinies extends CardImpl {
|
||||||
this.addAbility(new AddCounterAbility());
|
this.addAbility(new AddCounterAbility());
|
||||||
|
|
||||||
// Creatures you control of the chosen type get +1/+1 for each charge counter on Door of Destinies.
|
// Creatures you control of the chosen type get +1/+1 for each charge counter on Door of Destinies.
|
||||||
this.addAbility(new SimpleStaticAbility(new BoostCreatureEffectEffect()));
|
this.addAbility(new SimpleStaticAbility(new BoostAllOfChosenSubtypeEffect(1, 1,
|
||||||
|
Duration.WhileOnBattlefield, filter, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private DoorOfDestinies(final DoorOfDestinies card) {
|
private DoorOfDestinies(final DoorOfDestinies card) {
|
||||||
|
|
@ -88,39 +91,3 @@ class AddCounterAbility extends TriggeredAbilityImpl {
|
||||||
return "Whenever you cast a spell of the chosen type, put a charge counter on {this}.";
|
return "Whenever you cast a spell of the chosen type, put a charge counter on {this}.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BoostCreatureEffectEffect extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
BoostCreatureEffectEffect() {
|
|
||||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
|
||||||
staticText = "Creatures you control of the chosen type get +1/+1 for each charge counter on {this}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private BoostCreatureEffectEffect(final BoostCreatureEffectEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BoostCreatureEffectEffect copy() {
|
|
||||||
return new BoostCreatureEffectEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
SubType subtype = (SubType) game.getState().getValue(permanent.getId() + "_type");
|
|
||||||
if (subtype != null) {
|
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), game)) {
|
|
||||||
if (perm.hasSubtype(subtype, game)) {
|
|
||||||
int boost = permanent.getCounters(game).getCount(CounterType.CHARGE);
|
|
||||||
perm.addPower(boost);
|
|
||||||
perm.addToughness(boost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,22 @@
|
||||||
|
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.common.continuous.BecomesColorTargetEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubLayer;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
|
@ -39,7 +35,9 @@ public final class IndigoFaerie extends CardImpl {
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// {U}: Target permanent becomes blue in addition to its other colors until end of turn.
|
// {U}: Target permanent becomes blue in addition to its other colors until end of turn.
|
||||||
Ability ability = new SimpleActivatedAbility(new BecomesBlueTargetEffect(), new ManaCostsImpl<>("{U}"));
|
Ability ability = new SimpleActivatedAbility(
|
||||||
|
new BecomesColorTargetEffect(ObjectColor.BLUE, true, Duration.EndOfTurn),
|
||||||
|
new ManaCostsImpl<>("{U}"));
|
||||||
ability.addTarget(new TargetPermanent());
|
ability.addTarget(new TargetPermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
|
@ -54,31 +52,3 @@ public final class IndigoFaerie extends CardImpl {
|
||||||
return new IndigoFaerie(this);
|
return new IndigoFaerie(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BecomesBlueTargetEffect extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
BecomesBlueTargetEffect() {
|
|
||||||
super(Duration.EndOfTurn, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Neutral);
|
|
||||||
staticText = "Target permanent becomes blue in addition to its other colors until end of turn";
|
|
||||||
}
|
|
||||||
|
|
||||||
private BecomesBlueTargetEffect(final BecomesBlueTargetEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BecomesBlueTargetEffect copy() {
|
|
||||||
return new BecomesBlueTargetEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
|
||||||
if (permanent != null) {
|
|
||||||
permanent.getColor(game).setBlue(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,18 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.common.continuous.BecomesColorSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubLayer;
|
import java.util.UUID;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -32,7 +27,7 @@ public final class Scrapbasket extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// {1}: Scrapbasket becomes all colors until end of turn.
|
// {1}: Scrapbasket becomes all colors until end of turn.
|
||||||
this.addAbility(new SimpleActivatedAbility(new BecomesAllColorsEffect(), new ManaCostsImpl<>("{1}")));
|
this.addAbility(new SimpleActivatedAbility(new BecomesColorSourceEffect(new ObjectColor("WUBRG"), Duration.EndOfTurn), new ManaCostsImpl<>("{1}")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,35 +40,3 @@ public final class Scrapbasket extends CardImpl {
|
||||||
return new Scrapbasket(this);
|
return new Scrapbasket(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BecomesAllColorsEffect extends ContinuousEffectImpl {
|
|
||||||
|
|
||||||
BecomesAllColorsEffect() {
|
|
||||||
super(Duration.EndOfTurn, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Neutral);
|
|
||||||
staticText = "{this} becomes all colors until end of turn";
|
|
||||||
}
|
|
||||||
|
|
||||||
private BecomesAllColorsEffect(final BecomesAllColorsEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BecomesAllColorsEffect copy() {
|
|
||||||
return new BecomesAllColorsEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
permanent.getColor(game).setBlack(true);
|
|
||||||
permanent.getColor(game).setBlue(true);
|
|
||||||
permanent.getColor(game).setRed(true);
|
|
||||||
permanent.getColor(game).setGreen(true);
|
|
||||||
permanent.getColor(game).setWhite(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -13,6 +15,8 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,33 +61,18 @@ class BecomesColorlessForestLandEffect extends ContinuousEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BecomesColorlessForestLandEffect copy() {
|
public BecomesColorlessForestLandEffect copy() {
|
||||||
return new BecomesColorlessForestLandEffect(this);
|
return new BecomesColorlessForestLandEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
for (MageItem object : affectedObjects) {
|
||||||
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
Permanent permanent = (Permanent) object;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
|
||||||
if (permanent == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case ColorChangingEffects_5:
|
case ColorChangingEffects_5:
|
||||||
permanent.getColor(game).setWhite(false);
|
permanent.getColor(game).setColor(ObjectColor.COLORLESS);
|
||||||
permanent.getColor(game).setGreen(false);
|
|
||||||
permanent.getColor(game).setBlack(false);
|
|
||||||
permanent.getColor(game).setBlue(false);
|
|
||||||
permanent.getColor(game).setRed(false);
|
|
||||||
break;
|
break;
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
permanent.removeAllCardTypes(game);
|
permanent.removeAllCardTypes(game);
|
||||||
|
|
@ -94,9 +83,33 @@ class BecomesColorlessForestLandEffect extends ContinuousEffectImpl {
|
||||||
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
|
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
affectedObjects.add(permanent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
List<MageItem> affectedObjects = new ArrayList<>();
|
||||||
|
if (queryAffectedObjects(layer, source, game, affectedObjects)) {
|
||||||
|
applyToObjects(layer, sublayer, source, game, affectedObjects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.ColorChangingEffects_5
|
return layer == Layer.ColorChangingEffects_5
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,10 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
for (MageItem object : affectedObjects) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@ public class AscendEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return AscendAbility.checkAscend(game, source, true);
|
if (AscendAbility.checkAscend(game, source, true)) {
|
||||||
|
AscendAbility.applyAscend(game, game.getPlayer(source.getControllerId()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
|
@ -15,6 +16,8 @@ import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
@ -40,8 +43,7 @@ public class AscendAbility extends SimpleStaticAbility {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
if (!controller.hasDesignation(DesignationType.CITYS_BLESSING)) {
|
if (!controller.hasDesignation(DesignationType.CITYS_BLESSING)) {
|
||||||
if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT, controller.getId(), game) > 9) {
|
if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT, controller.getId(), game) > 9) {
|
||||||
controller.addDesignation(new CitysBlessing());
|
return true;
|
||||||
game.informPlayers(controller.getLogName() + " gets the city's blessing for the rest of the game.");
|
|
||||||
} else {
|
} else {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
game.informPlayers(controller.getLogName() + " does not get the city's blessing.");
|
game.informPlayers(controller.getLogName() + " does not get the city's blessing.");
|
||||||
|
|
@ -52,11 +54,15 @@ public class AscendAbility extends SimpleStaticAbility {
|
||||||
game.informPlayers(controller.getLogName() + " already has the city's blessing.");
|
game.informPlayers(controller.getLogName() + " already has the city's blessing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void applyAscend(Game game, Player player) {
|
||||||
|
player.addDesignation(new CitysBlessing());
|
||||||
|
game.informPlayers(player.getLogName() + " gets the city's blessing for the rest of the game.");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return ASCEND_RULE;
|
return ASCEND_RULE;
|
||||||
|
|
@ -76,8 +82,20 @@ class AscendContinuousEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void applyToObjects(Layer layer, SubLayer sublayer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
return AscendAbility.checkAscend(game, source, false);
|
for (MageItem object : affectedObjects) {
|
||||||
|
Player player = (Player) object;
|
||||||
|
AscendAbility.applyAscend(game, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryAffectedObjects(Layer layer, Ability source, Game game, List<MageItem> affectedObjects) {
|
||||||
|
if (AscendAbility.checkAscend(game, source, false)) {
|
||||||
|
affectedObjects.add(game.getPlayer(source.getControllerId()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue