mirror of
https://github.com/correl/mage.git
synced 2025-04-07 17:00:08 -09:00
* Switched from UUID to MageObjectReference to handle affected objects of continuous effects. Solvng problems with objects that changed (multiple times) zones while the effect lasts.
This commit is contained in:
parent
9ff1f60903
commit
02ba80b719
41 changed files with 407 additions and 342 deletions
Mage.Sets/src/mage/sets
apocalypse
bornofthegods
championsofkamigawa
commander2013
gatecrash
guildpact
iceage
innistrad
khansoftarkir
limitedalpha
magic2010
magic2015
ninthedition
odyssey
ravnika
riseoftheeldrazi
scarsofmirrodin
tenth
timespiral
urzasdestiny
visions
zendikar
Mage.Tests/src/test/java/org/mage/test
Mage/src/mage
MageObjectReference.java
abilities/effects
ContinuousEffect.java
common/continious
BecomesCreatureSourceEffect.javaBecomesFaceDownCreatureAllEffect.javaBoostAllEffect.javaBoostControlledEffect.javaBoostOpponentsEffect.javaBoostSourceEffect.javaGainAbilityAllEffect.javaGainAbilityControlledEffect.javaGainAbilitySourceEffect.javaGainAbilityTargetEffect.javaSetPowerToughnessAllEffect.javaSwitchPowerToughnessAllEffect.java
|
@ -28,8 +28,10 @@
|
||||||
|
|
||||||
package mage.sets.apocalypse;
|
package mage.sets.apocalypse;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
||||||
|
@ -106,18 +108,20 @@ class DayEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
||||||
for (Permanent creature : creatures) {
|
for (Permanent creature : creatures) {
|
||||||
objects.add(creature.getId());
|
affectedObjectList.add(new MageObjectReference(creature));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
for (Permanent creature : creatures) {
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if (!this.affectedObjectsSet || objects.contains(creature.getId())) {
|
if (permanent != null) {
|
||||||
creature.addPower(1);
|
permanent.addPower(1);
|
||||||
creature.addToughness(1);
|
permanent.addToughness(1);
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.bornofthegods;
|
package mage.sets.bornofthegods;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.common.continious.BoostAllEffect;
|
import mage.abilities.effects.common.continious.BoostAllEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -79,17 +80,17 @@ class BileBlightEffect extends BoostAllEffect {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
|
affectedObjectList.clear();
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
this.objects.clear();
|
|
||||||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
if (target.getName().isEmpty()) { // face down creature
|
if (target.getName().isEmpty()) { // face down creature
|
||||||
this.objects.add(target.getId());
|
affectedObjectList.add(new MageObjectReference(target));
|
||||||
} else {
|
} else {
|
||||||
String name = target.getLogName();
|
String name = target.getLogName();
|
||||||
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||||
if (perm.getLogName().equals(name)) {
|
if (perm.getLogName().equals(name)) {
|
||||||
this.objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,18 @@
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.*;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EmptyEffect;
|
import mage.abilities.common.EmptyEffect;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
|
||||||
import mage.abilities.effects.common.continious.BoostAllEffect;
|
import mage.abilities.effects.common.continious.BoostAllEffect;
|
||||||
import mage.abilities.keyword.ChangelingAbility;
|
|
||||||
import mage.abilities.keyword.EquipAbility;
|
import mage.abilities.keyword.EquipAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.SupertypePredicate;
|
import mage.filter.predicate.mageobject.SupertypePredicate;
|
||||||
|
@ -53,7 +54,6 @@ import mage.util.CardUtil;
|
||||||
*
|
*
|
||||||
* @author LevelX
|
* @author LevelX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class KondasBanner extends CardImpl {
|
public class KondasBanner extends CardImpl {
|
||||||
|
|
||||||
private static final FilterControlledCreaturePermanent legendaryFilter = new FilterControlledCreaturePermanent("Legendary creatures");
|
private static final FilterControlledCreaturePermanent legendaryFilter = new FilterControlledCreaturePermanent("Legendary creatures");
|
||||||
|
@ -80,8 +80,8 @@ public class KondasBanner extends CardImpl {
|
||||||
// Equip {2}
|
// Equip {2}
|
||||||
this.addAbility(new EquipAbility(
|
this.addAbility(new EquipAbility(
|
||||||
Outcome.AddAbility,
|
Outcome.AddAbility,
|
||||||
new GenericManaCost(2),
|
new GenericManaCost(2),
|
||||||
new TargetControlledCreaturePermanent(1,1, legendaryFilter, false)));
|
new TargetControlledCreaturePermanent(1, 1, legendaryFilter, false)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +92,15 @@ public class KondasBanner extends CardImpl {
|
||||||
@Override
|
@Override
|
||||||
public KondasBanner copy() {
|
public KondasBanner copy() {
|
||||||
return new KondasBanner(this);
|
return new KondasBanner(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KondasBannerTypeBoostEffect extends BoostAllEffect {
|
class KondasBannerTypeBoostEffect extends BoostAllEffect {
|
||||||
|
|
||||||
private static final String effectText = "Creatures that share a creature type with equipped creature get +1/+1";
|
private static final String effectText = "Creatures that share a creature type with equipped creature get +1/+1";
|
||||||
|
|
||||||
KondasBannerTypeBoostEffect() {
|
KondasBannerTypeBoostEffect() {
|
||||||
super(1,1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false);
|
super(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false);
|
||||||
staticText = effectText;
|
staticText = effectText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,27 +109,24 @@ class KondasBannerTypeBoostEffect extends BoostAllEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
// Check if the equipment is attached
|
// Check if the equipment is attached
|
||||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||||
if (equipment != null && equipment.getAttachedTo() != null)
|
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||||
{
|
Permanent equipedCreature = game.getPermanent(equipment.getAttachedTo());
|
||||||
Permanent equipedCreature = game.getPermanent(equipment.getAttachedTo());
|
if (equipedCreature != null) {
|
||||||
if (equipedCreature != null) {
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
if (CardUtil.shareSubtypes(perm, equipedCreature)) {
|
||||||
if (CardUtil.shareSubtypes(perm, equipedCreature)) {
|
perm.addPower(power.calculate(game, source, this));
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
perm.addToughness(toughness.calculate(game, source, this));
|
||||||
perm.addPower(power.calculate(game, source, this));
|
|
||||||
perm.addToughness(toughness.calculate(game, source, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KondasBannerTypeBoostEffect copy() {
|
public KondasBannerTypeBoostEffect copy() {
|
||||||
|
@ -138,13 +135,12 @@ class KondasBannerTypeBoostEffect extends BoostAllEffect {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class KondasBannerColorBoostEffect extends BoostAllEffect {
|
||||||
class KondasBannerColorBoostEffect extends BoostAllEffect {
|
|
||||||
|
|
||||||
private static final String effectText = "Creatures that share a color with equipped creature get +1/+1.";
|
private static final String effectText = "Creatures that share a color with equipped creature get +1/+1.";
|
||||||
|
|
||||||
KondasBannerColorBoostEffect() {
|
KondasBannerColorBoostEffect() {
|
||||||
super(1,1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false);
|
super(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false);
|
||||||
staticText = effectText;
|
staticText = effectText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,25 +149,22 @@ class KondasBannerColorBoostEffect extends BoostAllEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
// Check if the equipment is attached
|
// Check if the equipment is attached
|
||||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||||
if (equipment != null && equipment.getAttachedTo() != null)
|
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||||
{
|
Permanent equipedCreature = game.getPermanent(equipment.getAttachedTo());
|
||||||
Permanent equipedCreature = game.getPermanent(equipment.getAttachedTo());
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
if (equipedCreature.getColor().shares(perm.getColor())) {
|
||||||
if (equipedCreature.getColor().shares(perm.getColor())) {
|
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
|
||||||
perm.addPower(power.calculate(game, source, this));
|
perm.addPower(power.calculate(game, source, this));
|
||||||
perm.addToughness(toughness.calculate(game, source, this));
|
perm.addToughness(toughness.calculate(game, source, this));
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KondasBannerColorBoostEffect copy() {
|
public KondasBannerColorBoostEffect copy() {
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -41,6 +42,7 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Loki
|
* @author Loki
|
||||||
|
@ -101,7 +103,7 @@ class TakenoSamuraiGeneralEffect extends ContinuousEffectImpl {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
for (Ability ability : perm.getAbilities()) {
|
for (Ability ability : perm.getAbilities()) {
|
||||||
if (ability instanceof BushidoAbility) {
|
if (ability instanceof BushidoAbility) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,8 +113,23 @@ class TakenoSamuraiGeneralEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
if (this.affectedObjectsSet) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
for (Ability ability : permanent.getAbilities()) {
|
||||||
|
if (ability instanceof BushidoAbility) {
|
||||||
|
int value = ((BushidoAbility) ability).getValue(source, game, this);
|
||||||
|
permanent.addPower(value);
|
||||||
|
permanent.addToughness(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.remove(); // no longer on the battlefield, remove reference to object
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
for (Ability ability : perm.getAbilities()) {
|
for (Ability ability : perm.getAbilities()) {
|
||||||
if (ability instanceof BushidoAbility) {
|
if (ability instanceof BushidoAbility) {
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.commander2013;
|
package mage.sets.commander2013;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
@ -42,7 +42,6 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
|
@ -112,7 +111,7 @@ class BroodingSaurianControlEffect extends ContinuousEffectImpl {
|
||||||
FilterPermanent playerFilter = filter.copy();
|
FilterPermanent playerFilter = filter.copy();
|
||||||
playerFilter.add(new OwnerIdPredicate(playerId));
|
playerFilter.add(new OwnerIdPredicate(playerId));
|
||||||
for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
|
for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
|
||||||
objects.add(permanent.getId());
|
affectedObjectList.add(new MageObjectReference(permanent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,19 +119,17 @@ class BroodingSaurianControlEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Set<UUID> toRemove = new HashSet<UUID>();
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
for (UUID creatureId :objects) {
|
Permanent creature = it.next().getPermanent(game);
|
||||||
Permanent creature = game.getPermanent(creatureId);
|
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
if (!creature.getControllerId().equals(creature.getOwnerId())) {
|
if (!creature.getControllerId().equals(creature.getOwnerId())) {
|
||||||
creature.changeControllerId(creature.getOwnerId(), game);
|
creature.changeControllerId(creature.getOwnerId(), game);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toRemove.add(creatureId);
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objects.removeAll(toRemove);
|
if (affectedObjectList.isEmpty()) {
|
||||||
if (objects.isEmpty()) {
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,8 +28,10 @@
|
||||||
package mage.sets.commander2013;
|
package mage.sets.commander2013;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
|
@ -105,7 +107,7 @@ class HomewardPathControlEffect extends ContinuousEffectImpl {
|
||||||
FilterPermanent playerFilter = filter.copy();
|
FilterPermanent playerFilter = filter.copy();
|
||||||
playerFilter.add(new OwnerIdPredicate(playerId));
|
playerFilter.add(new OwnerIdPredicate(playerId));
|
||||||
for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
|
for (Permanent permanent :game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
|
||||||
objects.add(permanent.getId());
|
affectedObjectList.add(new MageObjectReference(permanent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,19 +115,17 @@ class HomewardPathControlEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Set<UUID> toRemove = new HashSet<UUID>();
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
for (UUID creatureId :objects) {
|
Permanent creature = it.next().getPermanent(game);
|
||||||
Permanent creature = game.getPermanent(creatureId);
|
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
if (!creature.getControllerId().equals(creature.getOwnerId())) {
|
if (!creature.getControllerId().equals(creature.getOwnerId())) {
|
||||||
creature.changeControllerId(creature.getOwnerId(), game);
|
creature.changeControllerId(creature.getOwnerId(), game);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toRemove.add(creatureId);
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objects.removeAll(toRemove);
|
if (affectedObjectList.isEmpty()) {
|
||||||
if (objects.isEmpty()) {
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
|
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
|
||||||
|
@ -99,13 +100,13 @@ class CantBeBlockedByTokenEffect extends RestrictionEffect {
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
affectedObjectsSet = true;
|
affectedObjectsSet = true;
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (objects.contains(permanent.getId())) {
|
if (affectedObjectList.contains(new MageObjectReference(permanent))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.guildpact;
|
package mage.sets.guildpact;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -95,32 +97,11 @@ class SetSupertypeAllEffect extends ContinuousEffectImpl {
|
||||||
return new SetSupertypeAllEffect(this);
|
return new SetSupertypeAllEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(Ability source, Game game) {
|
|
||||||
super.init(source, game);
|
|
||||||
if (affectedObjectsSet) {
|
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
|
||||||
objects.add(perm.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (affectedObjectsSet) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
for (UUID permanentId :objects) {
|
if (!permanent.getSupertype().contains("Legendary")) {
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
permanent.getSupertype().add("Legendary");
|
||||||
if (permanent != null) {
|
|
||||||
if (!permanent.getSupertype().contains("Legendary")) {
|
|
||||||
permanent.getSupertype().add("Legendary");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
|
||||||
if (!permanent.getSupertype().contains("Legendary")) {
|
|
||||||
permanent.getSupertype().add("Legendary");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.iceage;
|
package mage.sets.iceage;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
|
@ -259,12 +260,12 @@ class DanceOfTheDeadChangeAbilityEffect extends ContinuousEffectImpl implements
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
getAffectedObjects().add(source.getSourceId());
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = affectedObjectList.get(0).getPermanent(game);;
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Ability abilityToRemove = null;
|
Ability abilityToRemove = null;
|
||||||
for (Ability ability: permanent.getAbilities()) {
|
for (Ability ability: permanent.getAbilities()) {
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
|
@ -99,7 +100,7 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
|
||||||
for (UUID cardId: player.getGraveyard()) {
|
for (UUID cardId: player.getGraveyard()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) {
|
if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) {
|
||||||
objects.add(cardId);
|
affectedObjectList.add(new MageObjectReference(card));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +112,7 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (UUID cardId: player.getGraveyard()) {
|
for (UUID cardId: player.getGraveyard()) {
|
||||||
if (objects.contains(cardId)) {
|
if (affectedObjectList.contains(new MageObjectReference(cardId, game))) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
FlashbackAbility ability = null;
|
FlashbackAbility ability = null;
|
||||||
if (card.getCardType().contains(CardType.INSTANT)) {
|
if (card.getCardType().contains(CardType.INSTANT)) {
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.khansoftarkir;
|
package mage.sets.khansoftarkir;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
|
@ -98,8 +99,6 @@ public class SarkhanTheDragonspeaker extends CardImpl {
|
||||||
|
|
||||||
class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl {
|
class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
protected int zoneChangeCounter;
|
|
||||||
|
|
||||||
SarkhanTheDragonspeakerEffect() {
|
SarkhanTheDragonspeakerEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.BecomeCreature);
|
super(Duration.EndOfTurn, Outcome.BecomeCreature);
|
||||||
staticText = "Until end of turn, {this} becomes a legendary 4/4 red Dragon creature with flying, indestructible, and haste.";
|
staticText = "Until end of turn, {this} becomes a legendary 4/4 red Dragon creature with flying, indestructible, and haste.";
|
||||||
|
@ -107,7 +106,6 @@ class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
SarkhanTheDragonspeakerEffect(final SarkhanTheDragonspeakerEffect effect) {
|
SarkhanTheDragonspeakerEffect(final SarkhanTheDragonspeakerEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.zoneChangeCounter = effect.zoneChangeCounter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,17 +116,13 @@ class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
this.getAffectedObjects().add(source.getSourceId());
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
this.zoneChangeCounter = permanent.getZoneChangeCounter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
|
||||||
if (permanent != null && permanent.getZoneChangeCounter() == this.zoneChangeCounter) {
|
if (permanent != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.limitedalpha;
|
package mage.sets.limitedalpha;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||||
|
@ -246,12 +247,12 @@ class AnimateDeadChangeAbilityEffect extends ContinuousEffectImpl implements Sou
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
getAffectedObjects().add(source.getSourceId());
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Ability abilityToRemove = null;
|
Ability abilityToRemove = null;
|
||||||
for (Ability ability: permanent.getAbilities()) {
|
for (Ability ability: permanent.getAbilities()) {
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.magic2010;
|
package mage.sets.magic2010;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
|
@ -89,24 +91,16 @@ class CoatOfArmsEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
|
||||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
|
|
||||||
for (Permanent permanent : permanents) {
|
|
||||||
objects.add(permanent.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
|
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(permanent.getId())) {
|
int amount = getAmount(permanents, permanent);
|
||||||
int amount = getAmount(permanents, permanent);
|
permanent.addPower(amount);
|
||||||
permanent.addPower(amount);
|
permanent.addToughness(amount);
|
||||||
permanent.addToughness(amount);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.magic2015;
|
package mage.sets.magic2015;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
@ -89,26 +91,31 @@ class PolymorphistsJestEffect extends ContinuousEffectImpl {
|
||||||
return new PolymorphistsJestEffect(this);
|
return new PolymorphistsJestEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
super.init(source, game);
|
||||||
|
if (this.affectedObjectsSet) {
|
||||||
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, getTargetPointer().getFirst(game, source), game)) {
|
||||||
|
affectedObjectList.add(new MageObjectReference(permanent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
switch (layer) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
case TypeChangingEffects_4:
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if (sublayer == SubLayer.NA) {
|
if (permanent != null) {
|
||||||
objects.clear();
|
switch (layer) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, getTargetPointer().getFirst(game, source), game)){
|
case TypeChangingEffects_4:
|
||||||
if(permanent != null){
|
if (sublayer == SubLayer.NA) {
|
||||||
objects.add(permanent.getId());
|
|
||||||
permanent.getSubtype().clear();
|
permanent.getSubtype().clear();
|
||||||
permanent.getSubtype().add("Frog");
|
permanent.getSubtype().add("Frog");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
break;
|
||||||
break;
|
case ColorChangingEffects_5:
|
||||||
case ColorChangingEffects_5:
|
if (sublayer == SubLayer.NA) {
|
||||||
if (sublayer == SubLayer.NA) {
|
|
||||||
for(UUID uuid : objects){
|
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
|
||||||
if (permanent != null){
|
|
||||||
permanent.getColor().setBlack(false);
|
permanent.getColor().setBlack(false);
|
||||||
permanent.getColor().setGreen(false);
|
permanent.getColor().setGreen(false);
|
||||||
permanent.getColor().setBlue(false);
|
permanent.getColor().setBlue(false);
|
||||||
|
@ -116,27 +123,19 @@ class PolymorphistsJestEffect extends ContinuousEffectImpl {
|
||||||
permanent.getColor().setBlack(false);
|
permanent.getColor().setBlack(false);
|
||||||
permanent.getColor().setColor(ObjectColor.BLUE);
|
permanent.getColor().setColor(ObjectColor.BLUE);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
}
|
case AbilityAddingRemovingEffects_6:
|
||||||
break;
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
|
||||||
for(UUID uuid : objects){
|
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
|
||||||
if (permanent != null){
|
|
||||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||||
}
|
break;
|
||||||
}
|
case PTChangingEffects_7:
|
||||||
break;
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
case PTChangingEffects_7:
|
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
|
||||||
for(UUID uuid : objects){
|
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
|
||||||
if(permanent != null){
|
|
||||||
permanent.getPower().setValue(1);
|
permanent.getPower().setValue(1);
|
||||||
permanent.getToughness().setValue(1);
|
permanent.getToughness().setValue(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -146,10 +145,9 @@ class PolymorphistsJestEffect extends ContinuousEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.ColorChangingEffects_5 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7 || layer == Layer.ColorChangingEffects_5 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,19 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.ninthedition;
|
package mage.sets.ninthedition;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
|
import static mage.constants.Layer.PTChangingEffects_7;
|
||||||
|
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.filter.common.FilterLandPermanent;
|
import mage.filter.common.FilterLandPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -90,7 +93,7 @@ class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
this.affectedObjectsSet = true;
|
this.affectedObjectsSet = true;
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,10 +102,12 @@ class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
for(UUID uuid : objects){
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if(permanent != null){
|
if(permanent != null){
|
||||||
permanent.getCardType().add(CardType.CREATURE);
|
permanent.getCardType().add(CardType.CREATURE);
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,11 +115,13 @@ class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
for(UUID uuid : objects){
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if(permanent != null){
|
if(permanent != null){
|
||||||
permanent.getPower().setValue(2);
|
permanent.getPower().setValue(2);
|
||||||
permanent.getToughness().setValue(2);
|
permanent.getToughness().setValue(2);
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,4 +140,4 @@ class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ package mage.sets.odyssey;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.VariableManaCost;
|
import mage.abilities.costs.mana.VariableManaCost;
|
||||||
|
@ -91,7 +91,6 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i
|
||||||
super(effect);
|
super(effect);
|
||||||
this.token = effect.token.copy();
|
this.token = effect.token.copy();
|
||||||
this.type = effect.type;
|
this.type = effect.type;
|
||||||
this.zoneChangeCounter = effect.zoneChangeCounter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,17 +101,13 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
this.getAffectedObjects().add(source.getSourceId());
|
this.getAffectedObjects().add(new MageObjectReference(source.getSourceId(), game));
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
this.zoneChangeCounter = permanent.getZoneChangeCounter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
|
||||||
if (permanent != null && permanent.getZoneChangeCounter() == this.zoneChangeCounter) {
|
if (permanent != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
|
@ -151,10 +146,8 @@ class TestamentOfFaithBecomesCreatureSourceEffect extends ContinuousEffectImpl i
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
MageInt power = new MageInt(source.getManaCosts().getVariableCosts().get(0).getAmount());
|
MageInt power = new MageInt(source.getManaCosts().getVariableCosts().get(0).getAmount());
|
||||||
MageInt toughness = new MageInt(source.getManaCosts().getVariableCosts().get(0).getAmount());
|
MageInt toughness = new MageInt(source.getManaCosts().getVariableCosts().get(0).getAmount());
|
||||||
if (power != null && toughness != null) {
|
permanent.getPower().setValue(power.getValue());
|
||||||
permanent.getPower().setValue(power.getValue());
|
permanent.getToughness().setValue(toughness.getValue());
|
||||||
permanent.getToughness().setValue(toughness.getValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -100,11 +100,11 @@ class CrownOfConvergenceColorBoostEffect extends BoostAllEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player you = game.getPlayer(source.getControllerId());
|
Player you = game.getPlayer(source.getControllerId());
|
||||||
Card topCard = you.getLibrary().getFromTop(game);
|
if (you != null) {
|
||||||
if (you != null && topCard != null) {
|
Card topCard = you.getLibrary().getFromTop(game);
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
if (topCard != null) {
|
||||||
if (permanent.getColor().shares(topCard.getColor()) && !permanent.getColor().isColorless()) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(permanent.getId())) {
|
if (permanent.getColor().shares(topCard.getColor()) && !permanent.getColor().isColorless()) {
|
||||||
permanent.addPower(power.calculate(game, source, this));
|
permanent.addPower(power.calculate(game, source, this));
|
||||||
permanent.addToughness(toughness.calculate(game, source, this));
|
permanent.addToughness(toughness.calculate(game, source, this));
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ import mage.watchers.Watcher;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author magenoxx_at_gmail.com
|
* @author magenoxx_at_gmail.com
|
||||||
|
@ -64,11 +66,9 @@ public class CastThroughTime extends CardImpl {
|
||||||
super(ownerId, 55, "Cast Through Time", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}{U}{U}");
|
super(ownerId, 55, "Cast Through Time", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}{U}{U}");
|
||||||
this.expansionSetCode = "ROE";
|
this.expansionSetCode = "ROE";
|
||||||
|
|
||||||
this.color.setBlue(true);
|
|
||||||
|
|
||||||
// Instant and sorcery spells you control have rebound.
|
// Instant and sorcery spells you control have rebound.
|
||||||
|
// (Exile the spell as it resolves if you cast it from your hand. At the beginning of your next upkeep, you may cast that card from exile without paying its mana cost.)
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainReboundEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainReboundEffect()));
|
||||||
|
|
||||||
this.addWatcher(new LeavesBattlefieldWatcher());
|
this.addWatcher(new LeavesBattlefieldWatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class GainReboundEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public GainReboundEffect() {
|
public GainReboundEffect() {
|
||||||
super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
staticText = "Instant and sorcery spells you control have rebound";
|
staticText = "Instant and sorcery spells you control have rebound <i>(Exile the spell as it resolves if you cast it from your hand. At the beginning of your next upkeep, you may cast that card from exile without paying its mana cost.)</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public GainReboundEffect(final GainReboundEffect effect) {
|
public GainReboundEffect(final GainReboundEffect effect) {
|
||||||
|
@ -104,27 +104,42 @@ class GainReboundEffect extends ContinuousEffectImpl {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && permanent != null) {
|
if (player != null && permanent != null) {
|
||||||
for (Card card : player.getHand().getCards(CastThroughTime.filter, game)) {
|
for (Card card : player.getHand().getCards(CastThroughTime.filter, game)) {
|
||||||
boolean found = false;
|
addReboundAbility(card, source, game);
|
||||||
for (Ability ability : card.getAbilities()) {
|
}
|
||||||
if (ability instanceof ReboundAbility) {
|
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext();) {
|
||||||
found = true;
|
StackObject stackObject = iterator.next();
|
||||||
break;
|
if (stackObject instanceof Spell && stackObject.getControllerId().equals(source.getControllerId())) {
|
||||||
}
|
Spell spell = (Spell) stackObject;
|
||||||
}
|
Card card = spell.getCard();
|
||||||
if (!found) {
|
if (card != null) {
|
||||||
Ability ability = new AttachedReboundAbility();
|
addReboundAbility(card, source, game);
|
||||||
card.addAbility(ability);
|
}
|
||||||
ability.setControllerId(source.getControllerId());
|
|
||||||
ability.setSourceId(card.getId());
|
}
|
||||||
game.getState().addAbility(ability, source.getSourceId(), card);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addReboundAbility(Card card, Ability source, Game game) {
|
||||||
|
if (CastThroughTime.filter.match(card, game)) {
|
||||||
|
boolean found = false;
|
||||||
|
for (Ability ability : card.getAbilities()) {
|
||||||
|
if (ability instanceof ReboundAbility) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
Ability ability = new AttachedReboundAbility();
|
||||||
|
card.addAbility(ability);
|
||||||
|
ability.setControllerId(source.getControllerId());
|
||||||
|
ability.setSourceId(card.getId());
|
||||||
|
game.getState().addAbility(ability, card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttachedReboundAbility extends ReboundAbility {}
|
class AttachedReboundAbility extends ReboundAbility {}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.sets.scarsofmirrodin;
|
package mage.sets.scarsofmirrodin;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -38,6 +39,7 @@ import mage.constants.Rarity;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
@ -130,8 +132,8 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
for (UUID permId: objects) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
Permanent perm = game.getPermanent(permId);
|
Permanent perm = it.next().getPermanent(game);
|
||||||
if (perm != null) {
|
if (perm != null) {
|
||||||
if (perm.getCounters().getCount(CounterType.AWAKENING) > 0) {
|
if (perm.getCounters().getCount(CounterType.AWAKENING) > 0) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
|
@ -154,6 +156,8 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -169,7 +173,7 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (UUID permId: targetPointer.getTargets(game, source)) {
|
for (UUID permId: targetPointer.getTargets(game, source)) {
|
||||||
objects.add(permId);
|
affectedObjectList.add(new MageObjectReference(permId, game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.tenth;
|
package mage.sets.tenth;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -91,10 +93,10 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
objects.clear();
|
affectedObjectList.clear();
|
||||||
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){
|
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){
|
||||||
if(permanent != null){
|
if(permanent != null){
|
||||||
objects.add(permanent.getId());
|
affectedObjectList.add(new MageObjectReference(permanent));
|
||||||
permanent.getCardType().add(CardType.CREATURE);
|
permanent.getCardType().add(CardType.CREATURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,9 +105,9 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
for(UUID uuid : objects){
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if(permanent != null){
|
if (permanent != null){
|
||||||
int manaCost = permanent.getManaCost().convertedManaCost();
|
int manaCost = permanent.getManaCost().convertedManaCost();
|
||||||
permanent.getPower().setValue(manaCost);
|
permanent.getPower().setValue(manaCost);
|
||||||
permanent.getToughness().setValue(manaCost);
|
permanent.getToughness().setValue(manaCost);
|
||||||
|
@ -127,4 +129,4 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.timespiral;
|
package mage.sets.timespiral;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.keyword.SplitSecondAbility;
|
import mage.abilities.keyword.SplitSecondAbility;
|
||||||
|
@ -96,7 +97,7 @@ class SuddenSpoilingEffect extends ContinuousEffectImpl {
|
||||||
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent perm: game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
for (Permanent perm: game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,17 +107,17 @@ class SuddenSpoilingEffect extends ContinuousEffectImpl {
|
||||||
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||||
switch (layer) {
|
if (affectedObjectList.contains(new MageObjectReference(permanent))) {
|
||||||
case AbilityAddingRemovingEffects_6:
|
switch (layer) {
|
||||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
case AbilityAddingRemovingEffects_6:
|
||||||
break;
|
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||||
case PTChangingEffects_7:
|
break;
|
||||||
if (sublayer.equals(SubLayer.SetPT_7b)) {
|
case PTChangingEffects_7:
|
||||||
if(objects.contains(permanent.getId())){
|
if (sublayer.equals(SubLayer.SetPT_7b)) {
|
||||||
permanent.getPower().setValue(0);
|
permanent.getPower().setValue(0);
|
||||||
permanent.getToughness().setValue(2);
|
permanent.getToughness().setValue(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.urzasdestiny;
|
package mage.sets.urzasdestiny;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
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;
|
||||||
|
@ -99,30 +101,24 @@ class OpalescenceEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
switch (layer) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
case TypeChangingEffects_4:
|
switch (layer) {
|
||||||
if (sublayer == SubLayer.NA) {
|
case TypeChangingEffects_4:
|
||||||
objects.clear();
|
if (sublayer == SubLayer.NA) {
|
||||||
for(Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)){
|
|
||||||
objects.add(permanent.getId());
|
|
||||||
if (!permanent.getCardType().contains(CardType.CREATURE)) {
|
if (!permanent.getCardType().contains(CardType.CREATURE)) {
|
||||||
permanent.getCardType().add(CardType.CREATURE);
|
permanent.getCardType().add(CardType.CREATURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case PTChangingEffects_7:
|
case PTChangingEffects_7:
|
||||||
if (sublayer == SubLayer.SetPT_7b) {
|
if (sublayer == SubLayer.SetPT_7b) {
|
||||||
for(UUID uuid : objects){
|
int manaCost = permanent.getManaCost().convertedManaCost();
|
||||||
Permanent permanent = game.getPermanent(uuid);
|
permanent.getPower().setValue(manaCost);
|
||||||
if(permanent != null){
|
permanent.getToughness().setValue(manaCost);
|
||||||
int manaCost = permanent.getManaCost().convertedManaCost();
|
|
||||||
permanent.getPower().setValue(manaCost);
|
|
||||||
permanent.getToughness().setValue(manaCost);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.visions;
|
package mage.sets.visions;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -313,12 +314,12 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
getAffectedObjects().add(source.getSourceId());
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = affectedObjectList.get(0).getPermanent(game);;
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
|
|
|
@ -104,29 +104,14 @@ class ArmamentMasterEffect extends ContinuousEffectImpl {
|
||||||
return new ArmamentMasterEffect(this);
|
return new ArmamentMasterEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(Ability source, Game game) {
|
|
||||||
super.init(source, game);
|
|
||||||
if (this.affectedObjectsSet) {
|
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
|
||||||
for (Permanent perm : permanents) {
|
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
|
||||||
objects.add(perm.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int count = countEquipment(game, source);
|
int count = countEquipment(game, source);
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game);
|
||||||
for (Permanent perm : permanents) {
|
for (Permanent perm : permanents) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
if (!perm.getId().equals(source.getSourceId())) {
|
||||||
if (!perm.getId().equals(source.getSourceId())) {
|
perm.addPower(2 * count);
|
||||||
perm.addPower(2 * count);
|
perm.addToughness(2 * count);
|
||||||
perm.addToughness(2 * count);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.zendikar;
|
package mage.sets.zendikar;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.common.KickedCondition;
|
import mage.abilities.condition.common.KickedCondition;
|
||||||
import mage.abilities.decorator.ConditionalContinousEffect;
|
import mage.abilities.decorator.ConditionalContinousEffect;
|
||||||
|
@ -40,6 +41,7 @@ import mage.target.TargetPlayer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.keyword.KickerAbility;
|
import mage.abilities.keyword.KickerAbility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,8 +82,8 @@ public class MarshCasualties extends CardImpl {
|
||||||
|
|
||||||
class MarshCasualtiesEffect extends ContinuousEffectImpl {
|
class MarshCasualtiesEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private int power;
|
private final int power;
|
||||||
private int toughness;
|
private final int toughness;
|
||||||
|
|
||||||
public MarshCasualtiesEffect(int power, int toughness) {
|
public MarshCasualtiesEffect(int power, int toughness) {
|
||||||
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||||
|
@ -104,20 +106,21 @@ class MarshCasualtiesEffect extends ContinuousEffectImpl {
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game)) {
|
||||||
for (Permanent creature : creatures) {
|
affectedObjectList.add(new MageObjectReference(creature));
|
||||||
objects.add(creature.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
for (Permanent creature : creatures) {
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if (!this.affectedObjectsSet || objects.contains(creature.getId())) {
|
if (permanent != null) {
|
||||||
creature.addPower(power);
|
permanent.addPower(power);
|
||||||
creature.addToughness(toughness);
|
permanent.addToughness(toughness);
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,6 +17,9 @@ public class EvernightShadeTest extends CardTestPlayerBase {
|
||||||
public void testBoostWithUndying() {
|
public void testBoostWithUndying() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||||
|
// Evernight Shade Creature - Shade 1/1 {3}{B}
|
||||||
|
// {B}: Evernight Shade gets +1/+1 until end of turn.
|
||||||
|
// Undying (When this creature dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.)
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Evernight Shade");
|
addCard(Zone.BATTLEFIELD, playerA, "Evernight Shade");
|
||||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ package org.mage.test.combat;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
|
|
@ -128,4 +128,12 @@ public class MageObjectReference implements Comparable<MageObjectReference> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Card getCard(Game game) {
|
||||||
|
Card card = game.getPermanent(sourceId);
|
||||||
|
if (card != null && card.getZoneChangeCounter() == zoneChangeCounter) {
|
||||||
|
return card;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,16 +28,14 @@
|
||||||
|
|
||||||
package mage.abilities.effects;
|
package mage.abilities.effects;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -57,7 +55,7 @@ public interface ContinuousEffect extends Effect {
|
||||||
Layer getLayer();
|
Layer getLayer();
|
||||||
SubLayer getSublayer();
|
SubLayer getSublayer();
|
||||||
void overrideRuleText(String text);
|
void overrideRuleText(String text);
|
||||||
List<UUID> getAffectedObjects();
|
List<MageObjectReference> getAffectedObjects();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void newId();
|
void newId();
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
@ -49,7 +50,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
||||||
|
|
||||||
protected Token token;
|
protected Token token;
|
||||||
protected String type;
|
protected String type;
|
||||||
protected int zoneChangeCounter;
|
|
||||||
|
|
||||||
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
|
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
|
||||||
super(duration, Outcome.BecomeCreature);
|
super(duration, Outcome.BecomeCreature);
|
||||||
|
@ -62,7 +62,6 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
||||||
super(effect);
|
super(effect);
|
||||||
this.token = effect.token.copy();
|
this.token = effect.token.copy();
|
||||||
this.type = effect.type;
|
this.type = effect.type;
|
||||||
this.zoneChangeCounter = effect.zoneChangeCounter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,17 +72,20 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
this.getAffectedObjects().add(source.getSourceId());
|
if (affectedObjectsSet) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
if (permanent != null) {
|
|
||||||
this.zoneChangeCounter = permanent.getZoneChangeCounter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent;
|
||||||
if (permanent != null && permanent.getZoneChangeCounter() == this.zoneChangeCounter) {
|
if (affectedObjectsSet) {
|
||||||
|
permanent = affectedObjectList.get(0).getPermanent(game);
|
||||||
|
} else {
|
||||||
|
permanent = game.getPermanent(source.getSourceId());
|
||||||
|
}
|
||||||
|
if (permanent != null) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
||||||
|
|
||||||
protected Map<UUID,Ability> turnFaceUpAbilityMap = new HashMap<>();
|
protected Map<UUID,Ability> turnFaceUpAbilityMap = new HashMap<>();
|
||||||
protected FilterPermanent filter;
|
protected FilterPermanent filter;
|
||||||
protected ArrayList<MageObjectReference> objectList = new ArrayList<>();
|
|
||||||
|
|
||||||
public BecomesFaceDownCreatureAllEffect(FilterPermanent filter) {
|
public BecomesFaceDownCreatureAllEffect(FilterPermanent filter) {
|
||||||
super(Duration.EndOfGame, Outcome.BecomeCreature);
|
super(Duration.EndOfGame, Outcome.BecomeCreature);
|
||||||
|
@ -71,7 +70,6 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
||||||
|
|
||||||
public BecomesFaceDownCreatureAllEffect(final BecomesFaceDownCreatureAllEffect effect) {
|
public BecomesFaceDownCreatureAllEffect(final BecomesFaceDownCreatureAllEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.objectList.addAll(effect.objectList);
|
|
||||||
for (Map.Entry<UUID,Ability> entry: effect.turnFaceUpAbilityMap.entrySet()) {
|
for (Map.Entry<UUID,Ability> entry: effect.turnFaceUpAbilityMap.entrySet()) {
|
||||||
this.turnFaceUpAbilityMap.put(entry.getKey(), entry.getValue());
|
this.turnFaceUpAbilityMap.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
@ -88,7 +86,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!perm.isFaceDown()) {
|
if (!perm.isFaceDown()) {
|
||||||
objectList.add(new MageObjectReference(perm));
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
perm.setFaceDown(true);
|
perm.setFaceDown(true);
|
||||||
// check for Morph
|
// check for Morph
|
||||||
Card card = game.getCard(perm.getId());
|
Card card = game.getCard(perm.getId());
|
||||||
|
@ -106,7 +104,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
boolean targetExists = false;
|
boolean targetExists = false;
|
||||||
for (MageObjectReference mor: objectList) {
|
for (MageObjectReference mor: affectedObjectList) {
|
||||||
Permanent permanent = mor.getPermanent(game);
|
Permanent permanent = mor.getPermanent(game);
|
||||||
if (permanent != null && permanent.isFaceDown()) {
|
if (permanent != null && permanent.isFaceDown()) {
|
||||||
targetExists = true;
|
targetExists = true;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import mage.MageObjectReference;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -113,7 +113,7 @@ public class BoostAllEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,8 @@ public class BoostAllEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Iterator<UUID> it = objects.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
UUID permanentId = it.next();
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.addPower(power.calculate(game, source, this));
|
permanent.addPower(power.calculate(game, source, this));
|
||||||
permanent.addToughness(toughness.calculate(game, source, this));
|
permanent.addToughness(toughness.calculate(game, source, this));
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
|
@ -116,7 +116,7 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,9 +129,8 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Iterator<UUID> it = objects.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
UUID permanentId = it.next();
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.addPower(power.calculate(game, source, this));
|
permanent.addPower(power.calculate(game, source, this));
|
||||||
permanent.addToughness(toughness.calculate(game, source, this));
|
permanent.addToughness(toughness.calculate(game, source, this));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
@ -12,6 +13,7 @@ import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
|
||||||
public class BoostOpponentsEffect extends ContinuousEffectImpl {
|
public class BoostOpponentsEffect extends ContinuousEffectImpl {
|
||||||
protected int power;
|
protected int power;
|
||||||
|
@ -49,7 +51,7 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl {
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (opponents.contains(perm.getControllerId())) {
|
if (opponents.contains(perm.getControllerId())) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,8 +60,20 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
Set<UUID> opponents = game.getOpponents(source.getControllerId());
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
if (this.affectedObjectsSet) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
|
Permanent perm = it.next().getPermanent(game);
|
||||||
|
if (perm != null) {
|
||||||
|
if (opponents.contains(perm.getControllerId())) {
|
||||||
|
perm.addPower(power);
|
||||||
|
perm.addToughness(toughness);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (opponents.contains(perm.getControllerId())) {
|
if (opponents.contains(perm.getControllerId())) {
|
||||||
perm.addPower(power);
|
perm.addPower(power);
|
||||||
perm.addToughness(toughness);
|
perm.addToughness(toughness);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
|
@ -85,7 +86,9 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
getAffectedObjects().add(source.getSourceId());
|
if (affectedObjectsSet) {
|
||||||
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
|
}
|
||||||
if (lockedIn) {
|
if (lockedIn) {
|
||||||
power = new StaticValue(power.calculate(game, source, this));
|
power = new StaticValue(power.calculate(game, source, this));
|
||||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||||
|
@ -94,7 +97,12 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent target = game.getPermanent(source.getSourceId());
|
Permanent target;
|
||||||
|
if (affectedObjectsSet) {
|
||||||
|
target = affectedObjectList.get(0).getPermanent(game);
|
||||||
|
} else {
|
||||||
|
target = game.getPermanent(source.getSourceId());
|
||||||
|
}
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
target.addPower(power.calculate(game, source, this));
|
target.addPower(power.calculate(game, source, this));
|
||||||
target.addToughness(toughness.calculate(game, source, this));
|
target.addToughness(toughness.calculate(game, source, this));
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -84,7 +86,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,8 +99,17 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
if (this.affectedObjectsSet) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
|
} else {
|
||||||
|
it.remove(); // no longer on the battlefield, remove reference to object
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
perm.addAbility(ability, source.getSourceId(), game);
|
perm.addAbility(ability, source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -89,7 +91,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,8 +104,19 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
if (this.affectedObjectsSet) {
|
||||||
if (!this.affectedObjectsSet || objects.contains(perm.getId())) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
|
Permanent perm = it.next().getPermanent(game);
|
||||||
|
if (perm != null) {
|
||||||
|
for (Ability abilityToAdd : ability) {
|
||||||
|
perm.addAbility(abilityToAdd, source.getSourceId(), game);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.remove(); // no longer on the battlefield, remove reference to object
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
|
||||||
for (Ability abilityToAdd : ability) {
|
for (Ability abilityToAdd : ability) {
|
||||||
perm.addAbility(abilityToAdd, source.getSourceId(), game);
|
perm.addAbility(abilityToAdd, source.getSourceId(), game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
@ -90,13 +91,20 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
getAffectedObjects().add(source.getSourceId());
|
if (affectedObjectsSet) {
|
||||||
|
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (onCard) {
|
if (onCard) {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card;
|
||||||
|
if (affectedObjectsSet) {
|
||||||
|
card = affectedObjectList.get(0).getCard(game);
|
||||||
|
} else {
|
||||||
|
card = game.getCard(source.getSourceId());
|
||||||
|
}
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
// add ability to card only once
|
// add ability to card only once
|
||||||
card.addAbility(ability);
|
card.addAbility(ability);
|
||||||
|
@ -104,15 +112,20 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent;
|
||||||
|
if (affectedObjectsSet) {
|
||||||
|
permanent = affectedObjectList.get(0).getPermanent(game);
|
||||||
|
} else {
|
||||||
|
permanent = game.getPermanent(source.getSourceId());
|
||||||
|
}
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.addAbility(ability, source.getSourceId(), game);
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (duration.equals(Duration.Custom)) {
|
|
||||||
this.discard();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
if (duration.equals(Duration.Custom)) {
|
||||||
|
this.discard();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,22 +29,21 @@
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import mage.constants.Duration;
|
import java.util.UUID;
|
||||||
import mage.constants.Layer;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubLayer;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Layer;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.SubLayer;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.constants.PhaseStep;
|
|
||||||
import mage.game.turn.Step;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
@ -139,8 +138,16 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
||||||
} else {
|
} else {
|
||||||
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
Permanent permanent = game.getPermanent(permanentId);
|
||||||
|
boolean shortLivingLKI = false;
|
||||||
|
if (permanent == null) {
|
||||||
|
permanent = (Permanent) game.getShortLivingLKI(permanentId, Zone.BATTLEFIELD);
|
||||||
|
shortLivingLKI = true;
|
||||||
|
}
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.addAbility(ability, source.getSourceId(), game);
|
permanent.addAbility(ability, source.getSourceId(), game);
|
||||||
|
if (shortLivingLKI) { // needed for undying because TriggeredAbilities checks if the permanent has still the ability
|
||||||
|
game.rememberLKI(permanentId, Zone.BATTLEFIELD, permanent);
|
||||||
|
}
|
||||||
affectedTargets++;
|
affectedTargets++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,10 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
@ -89,7 +91,7 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
if (affectedObjectsSet) {
|
if (affectedObjectsSet) {
|
||||||
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
objects.add(perm.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lockedInPT) {
|
if (lockedInPT) {
|
||||||
|
@ -103,11 +105,13 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
int newPower = power.calculate(game, source, this);
|
int newPower = power.calculate(game, source, this);
|
||||||
int newToughness = toughness.calculate(game, source, this);
|
int newToughness = toughness.calculate(game, source, this);
|
||||||
if (affectedObjectsSet) {
|
if (affectedObjectsSet) {
|
||||||
for (UUID permanentId :objects) {
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
Permanent permanent = it.next().getPermanent(game);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.getPower().setValue(newPower);
|
permanent.getPower().setValue(newPower);
|
||||||
permanent.getToughness().setValue(newToughness);
|
permanent.getToughness().setValue(newToughness);
|
||||||
|
} else {
|
||||||
|
it.remove(); // no longer on the battlefield, remove reference to object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,8 +29,10 @@
|
||||||
package mage.abilities.effects.common.continious;
|
package mage.abilities.effects.common.continious;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
@ -71,8 +73,8 @@ public class SwitchPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
for (Permanent creature :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent perm :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
this.objects.add(creature.getId());
|
affectedObjectList.add(new MageObjectReference(perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,18 +85,16 @@ public class SwitchPowerToughnessAllEffect extends ContinuousEffectImpl {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
Set<UUID> toDelete = new HashSet<>();
|
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { // filter may not be used again, because object can have changed filter relevant attributes but still geets boost
|
||||||
for (UUID creatureId: objects) {
|
Permanent creature = it.next().getPermanent(game);
|
||||||
Permanent creature = game.getPermanent(creatureId);
|
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
int power = creature.getPower().getValue();
|
int power = creature.getPower().getValue();
|
||||||
creature.getPower().setValue(creature.getToughness().getValue());
|
creature.getPower().setValue(creature.getToughness().getValue());
|
||||||
creature.getToughness().setValue(power);
|
creature.getToughness().setValue(power);
|
||||||
} else {
|
} else {
|
||||||
toDelete.add(creatureId);
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.objects.removeAll(toDelete);
|
|
||||||
} else {
|
} else {
|
||||||
for (Permanent creature :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent creature :game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
int power = creature.getPower().getValue();
|
int power = creature.getPower().getValue();
|
||||||
|
|
Loading…
Add table
Reference in a new issue