Merge origin/master

This commit is contained in:
LevelX2 2020-08-12 16:26:52 +02:00
commit cc684ad6bb
21 changed files with 158 additions and 50 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.UUID;
@ -94,7 +93,12 @@ class CloakingDeviceLoseLifeDefendingPlayerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player defender = game.getPlayer(game.getCombat().getDefendingPlayerId(enchantment.getAttachedTo(), game));
if (defender != null) {

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.HashSet;
@ -19,6 +18,7 @@ import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.players.Player;
@ -71,7 +71,12 @@ class CurseOfBountyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.HashSet;
@ -16,6 +15,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ZombieToken;
@ -72,7 +72,12 @@ class CurseOfDisturbanceEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {

View file

@ -22,6 +22,7 @@ import mage.target.targetpointer.FixedTarget;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.constants.Zone;
/**
* @author Saga
@ -71,7 +72,12 @@ class CurseOfOpulenceEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.HashSet;
@ -16,6 +15,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -70,7 +70,12 @@ class CurseOfVerbosityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.HashSet;
@ -20,6 +19,7 @@ import mage.abilities.Ability;
import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.constants.Zone;
import mage.players.Player;
/**
@ -70,7 +70,12 @@ class CurseOfVitalityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {

View file

@ -1,14 +1,11 @@
package mage.cards.f;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -107,8 +104,13 @@ class FrayingSanityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (enchantment == null || enchantment.getAttachedTo() == null) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());

View file

@ -70,7 +70,12 @@ class IronclawCurseEffect extends CantBlockAttachedEffect {
if (attacker == null) {
return true;
}
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.cards.l;
import java.util.UUID;
@ -30,7 +29,7 @@ import mage.target.common.TargetCreaturePermanent;
public final class LaccolithRig extends CardImpl {
public LaccolithRig(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -76,7 +75,15 @@ class LaccolithRigEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}
Permanent ownCreature = game.getPermanent(enchantment.getAttachedTo());
if (ownCreature != null) {
int damage = ownCreature.getPower().getValue();

View file

@ -1,4 +1,3 @@
package mage.cards.m;
import java.util.UUID;
@ -16,6 +15,7 @@ import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
@ -71,8 +71,13 @@ class MirrorMockeryEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (enchantment == null || enchantment.getAttachedTo() == null) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}
Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());

View file

@ -76,7 +76,12 @@ class OverwhelmingSplendorLoseAbilitiesEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}

View file

@ -19,6 +19,7 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import mage.constants.Zone;
/**
* @author LoneFox
@ -49,7 +50,6 @@ public final class Seizures extends CardImpl {
}
}
class SeizuresEffect extends OneShotEffect {
public SeizuresEffect() {
@ -68,7 +68,12 @@ class SeizuresEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.cards.s;
import java.util.Optional;
@ -93,7 +92,12 @@ class SerraBestiaryRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -96,7 +95,12 @@ class TreacherousLinkEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
Player controller = game.getPlayer(source.getControllerId());
DamageEvent damageEvent = (DamageEvent) event;
if (controller != null && enchantment != null) {

View file

@ -1,4 +1,3 @@
package mage.cards.v;
import java.util.UUID;
@ -30,7 +29,7 @@ import mage.target.common.TargetCreaturePermanent;
public final class VisionsOfBrutality extends CardImpl {
public VisionsOfBrutality(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
this.subtype.add(SubType.AURA);
// Devoid
@ -79,8 +78,14 @@ class VisionsOfBrutalityEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null
&& enchantment.getAttachedTo() != null) {
Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
if (enchanted != null) {
Player controllerEnchanted = game.getPlayer(enchanted.getControllerId());

View file

@ -1,4 +1,3 @@
package mage.cards.w;
import java.util.HashSet;
@ -33,7 +32,7 @@ import mage.target.common.TargetCreaturePermanent;
public final class WeightOfConscience extends CardImpl {
public WeightOfConscience(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -79,8 +78,15 @@ class WeightOfConscienceEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && enchantment != null && enchantment.getAttachedTo() != null) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (controller != null
&& enchantment != null
&& enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
controller.moveCardsToExile(creature, source, game, true, null, "");
@ -93,6 +99,7 @@ class WeightOfConscienceEffect extends OneShotEffect {
class WeightOfConscienceTarget extends TargetControlledCreaturePermanent {
private static final FilterControlledCreaturePermanent filterUntapped = new FilterControlledCreaturePermanent("untapped creatures you control that share a creature type");
static {
filterUntapped.add(Predicates.not(TappedPredicate.instance));
}
@ -121,8 +128,7 @@ class WeightOfConscienceTarget extends TargetControlledCreaturePermanent {
}
}
}
}
// Choosing second target
} // Choosing second target
else {
UUID firstTargetId = this.getTargets().get(0);
Permanent firstTargetCreature = game.getPermanent(firstTargetId);
@ -165,8 +171,7 @@ class WeightOfConscienceTarget extends TargetControlledCreaturePermanent {
}
}
}
}
else {
} else {
Permanent firstTarget = game.getPermanent(this.getTargets().get(0));
if (firstTarget != null && firstTarget.shareSubtypes(targetPermanent, game)) {
return true;

View file

@ -8,6 +8,7 @@ package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -19,7 +20,15 @@ public enum AttachedPermanentToughnessValue implements DynamicValue {
@Override
public int calculate(Game game, Ability source, Effect effect) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return 0;
}
Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
return enchanted.getToughness().getValue();
}

View file

@ -6,6 +6,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -39,7 +40,12 @@ public class DamageAttachedControllerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}

View file

@ -8,6 +8,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -48,8 +49,13 @@ public class DamageAttachedEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if(enchantment == null) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment == null) {
return false;
}
Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());

View file

@ -37,7 +37,12 @@ public class ExileAttachedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
// The LKI must be used for this step. 608.2g
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (controller != null
&& enchantment != null
&& enchantment.getAttachedTo() != null) {

View file

@ -1,9 +1,9 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -29,10 +29,15 @@ public class PhaseOutAttachedEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if(enchantment != null) {
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
if (enchantment != null) {
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
if(enchanted != null) {
if (enchanted != null) {
return enchanted.phaseOut(game);
}
}