add more isActivePlayer and isAttachedTo calls

This commit is contained in:
igoudt 2018-07-08 22:25:25 +02:00
parent 490217facd
commit c456a1961e
83 changed files with 109 additions and 122 deletions

View file

@ -111,7 +111,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getPlayerId().equals(source.getControllerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId())
if (game.isActivePlayer(event.getPlayerId())
&& game.getPhase().getStep().getType() == PhaseStep.DRAW) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {

View file

@ -65,7 +65,7 @@ class AngelicArbiterCantAttackTargetEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (game.getActivePlayerId().equals(permanent.getControllerId()) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId())) {
if (game.isActivePlayer(permanent.getControllerId()) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId())) {
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(permanent.getControllerId()) > 0) {
return true;
@ -113,7 +113,7 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
if (game.isActivePlayer(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get(PlayerAttackedWatcher.class.getSimpleName());
if (watcher != null && watcher.getNumberOfAttackersCurrentTurn(event.getPlayerId()) > 0) {
return true;

View file

@ -62,7 +62,7 @@ class AngelicBenedictionTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
return true;
}

View file

@ -95,7 +95,7 @@ public final class AssaultSuit extends CardImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
if (equipment != null) {
return equipment.isAttachedTo(event.getTargetId());
}
}

View file

@ -123,7 +123,7 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
UUID opponentId = getTargetPointer().getFirst(game, source);
if (game.getActivePlayerId().equals(opponentId)) {
if (game.isActivePlayer(opponentId)) {
if (playersNextTurn == 0) {
playersNextTurn = game.getTurnNum();
}

View file

@ -77,7 +77,7 @@ class BattlegraceAngelAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId) ) {
if (game.isActivePlayer(this.controllerId) ) {
if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));

View file

@ -85,7 +85,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType() == PhaseStep.DRAW) {
if (game.isActivePlayer(event.getPlayerId()) && game.getPhase().getStep().getType() == PhaseStep.DRAW) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
return true;

View file

@ -67,7 +67,7 @@ class ChancellorOfTheTangleDelayedTriggeredAbility extends DelayedTriggeredAbili
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getActivePlayerId().equals(controllerId);
return game.isActivePlayer(controllerId);
}
@Override
public ChancellorOfTheTangleDelayedTriggeredAbility copy() {

View file

@ -72,10 +72,9 @@ class ChronicFloodingAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent source = game.getPermanent(this.sourceId);
if (source != null && source.getAttachedTo().equals(event.getTargetId())) {
if (source != null && source.isAttachedTo(event.getTargetId())) {
Permanent attached = game.getPermanent(source.getAttachedTo());
if (attached != null) {
for (Effect e : getEffects()) {
e.setTargetPointer(new FixedTarget(attached.getControllerId()));
}

View file

@ -67,7 +67,7 @@ class CityOfSolitudeEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return !game.getActivePlayerId().equals(event.getPlayerId());
return !game.isActivePlayer(event.getPlayerId());
}
@Override

View file

@ -105,7 +105,7 @@ class CommuneWithLavaMayPlayEffect extends AsThoughEffectImpl {
@Override
public boolean isInactive(Ability source, Game game) {
if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
if (game.isActivePlayer(source.getControllerId())) {
return true;
}
}

View file

@ -149,7 +149,7 @@ class ConquerorsFlailEffect extends ContinuousRuleModifyingEffectImpl {
}
}
if (isAttached && game.getActivePlayerId().equals(source.getControllerId())
if (isAttached && game.isActivePlayer(source.getControllerId())
&& game.getPlayer(source.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
return true;
}

View file

@ -80,7 +80,7 @@ class CowedByWisdomayCostToAttackBlockEffect extends PayCostToAttackBlockEffectI
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
return enchantment != null && enchantment.getAttachedTo().equals(event.getSourceId());
return enchantment != null && enchantment.isAttachedTo(event.getSourceId());
}
@Override

View file

@ -85,7 +85,7 @@ class CruelRealityTriggeredAbiilty extends TriggeredAbilityImpl {
&& enchantment.getAttachedTo() != null) {
Player cursedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (cursedPlayer != null
&& game.getActivePlayerId().equals(cursedPlayer.getId())) {
&& game.isActivePlayer(cursedPlayer.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(cursedPlayer.getId()));
return true;
}

View file

@ -1,7 +1,6 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
@ -16,14 +15,15 @@ import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.util.CardUtil;
import java.util.UUID;
/**
*
* @author BetaSteward
*/
public final class CurseOfBloodletting extends CardImpl {
public CurseOfBloodletting(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}");
this.subtype.add(SubType.AURA, SubType.CURSE);
@ -71,10 +71,9 @@ class CurseOfBloodlettingEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null &&
enchantment.getAttachedTo() != null &&
event.getTargetId().equals(enchantment.getAttachedTo())) {
return true;
if (enchantment != null &&
enchantment.isAttachedTo(event.getTargetId())) {
return true;
}
return false;
}

View file

@ -79,7 +79,7 @@ class CurseOfOblivionAbility extends TriggeredAbilityImpl {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
if (player != null && game.isActivePlayer(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}

View file

@ -78,7 +78,7 @@ class CurseOfOpulenceEffect extends OneShotEffect {
if (enchantment != null) {
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
if (enchantedPlayer != null) {
Set<UUID> players = new HashSet();
Set<UUID> players = new HashSet<>();
for (UUID attacker : game.getCombat().getAttackers()) {
UUID defender = game.getCombat().getDefenderId(attacker);
if (defender.equals(enchantedPlayer.getId())

View file

@ -84,8 +84,7 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl {
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(defender.getId())) {
&& enchantment.isAttachedTo(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}

View file

@ -79,7 +79,7 @@ class CurseOfTheBloodyTomeAbility extends TriggeredAbilityImpl {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
if (player != null && game.isActivePlayer(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}

View file

@ -83,8 +83,7 @@ class CurseOfTheForsakenTriggeredAbility extends TriggeredAbilityImpl {
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(defender.getId())) {
&& enchantment.isAttachedTo(defender.getId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -81,7 +81,7 @@ class CurseOfThePiercedHeartAbility extends TriggeredAbilityImpl {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
if (player != null && game.isActivePlayer(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}

View file

@ -81,7 +81,7 @@ class CurseOfThirstAbility extends TriggeredAbilityImpl {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
if (player != null && game.isActivePlayer(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}

View file

@ -84,8 +84,7 @@ class CurseOfVengeanceTriggeredAbility extends TriggeredAbilityImpl {
Spell spell = game.getStack().getSpell(event.getSourceId());
if (enchantment != null && spell != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(spell.getControllerId())) {
&& enchantment.isAttachedTo(spell.getControllerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(getSourceId()));
return true;
}
@ -126,7 +125,7 @@ class CurseOfVengeancePlayerLosesTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(this.getSourceId());
return sourceObject != null && sourceObject.getAttachedTo().equals(event.getPlayerId());
return sourceObject != null && sourceObject.isAttachedTo(event.getPlayerId());
}
@Override

View file

@ -76,7 +76,7 @@ class DawnsReflectionTriggeredAbility extends TriggeredManaAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo());
return enchantment != null && enchantment.isAttachedTo(event.getSourceId());
}
@Override

View file

@ -54,7 +54,7 @@ class DosanTheFallingLeafEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL && !game.getActivePlayerId().equals(event.getPlayerId());
return event.getType() == GameEvent.EventType.CAST_SPELL && !game.isActivePlayer(event.getPlayerId());
}
@Override

View file

@ -78,7 +78,7 @@ class DragonlordDromokaEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getActivePlayerId().equals(source.getControllerId()) &&
if (game.isActivePlayer(source.getControllerId()) &&
game.getPlayer(source.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
return true;
}

View file

@ -117,7 +117,7 @@ class EdificeOfAuthorityRestrictionEffect extends RestrictionEffect {
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP
&& game.getStep().getStepPart() == Step.StepPart.PRE) {
if (game.getActivePlayerId().equals(source.getControllerId())
if (game.isActivePlayer(source.getControllerId())
|| game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);

View file

@ -123,7 +123,7 @@ class MaximumHandSizeEffect extends MaximumHandSizeControllerEffect {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
if (game.isActivePlayer(source.getControllerId())) {
return true;
}
}

View file

@ -86,7 +86,7 @@ class FaithsFettersEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo().equals(event.getSourceId())) {
if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) {
Optional<Ability> ability = game.getAbility(event.getTargetId(), event.getSourceId());
if (ability.isPresent() && ability.get().getAbilityType() != AbilityType.MANA) {
return true;

View file

@ -74,7 +74,7 @@ class FinestHourAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));

View file

@ -77,7 +77,7 @@ class GabrielAngelfireGainAbilityEffect extends GainAbilitySourceEffect {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
if (!sameStep && game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
if (!sameStep && game.isActivePlayer(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
return true;
}
} else {

View file

@ -138,7 +138,7 @@ class GideonBattleForgedAttacksIfAbleTargetEffect extends RequirementEffect {
if (targetPermanent == null) {
return true;
}
if (nextTurnTargetController == 0 && startingTurn != game.getTurnNum() && game.getActivePlayerId().equals(targetPermanent.getControllerId())) {
if (nextTurnTargetController == 0 && startingTurn != game.getTurnNum() && game.isActivePlayer(targetPermanent.getControllerId())) {
nextTurnTargetController = game.getTurnNum();
}
return game.getPhase().getType() == TurnPhase.END && nextTurnTargetController > 0 && game.getTurnNum() > nextTurnTargetController;
@ -157,7 +157,7 @@ class GideonBattleForgedAttacksIfAbleTargetEffect extends RequirementEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
if (game.getActivePlayerId().equals(permanent.getControllerId())) {
if (game.isActivePlayer(permanent.getControllerId())) {
Permanent planeswalker = game.getPermanent(source.getSourceId());
if (planeswalker != null) {
return true;

View file

@ -129,7 +129,7 @@ class GideonJuraEffect extends RequirementEffect {
public boolean isInactive(Ability source, Game game) {
return (startingTurn != game.getTurnNum()
&& (game.getPhase().getType() == TurnPhase.END
&& game.getActivePlayerId().equals(source.getFirstTarget())))
&& game.isActivePlayer(source.getFirstTarget())))
|| // 6/15/2010: If a creature controlled by the affected player can't attack Gideon Jura (because he's no longer on the battlefield, for example), that player may have it attack you, another one of your planeswalkers, or nothing at all.
creatingPermanent.getPermanent(game) == null;
}

View file

@ -81,7 +81,7 @@ class GisaAndGeralfContinuousEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (!game.getActivePlayerId().equals(player.getId())) {
if (!game.isActivePlayer(player.getId())) {
return false;
}
for (Card card : player.getGraveyard().getCards(filter, game)) {

View file

@ -85,7 +85,7 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getActivePlayerId().equals(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
if (game.isActivePlayer(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
switch(event.getType()) {
case CAST_SPELL:
return true;

View file

@ -124,7 +124,7 @@ class GrinningTotemMayPlayEffect extends AsThoughEffectImpl {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
if (!sameStep && game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
if (!sameStep && game.isActivePlayer(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
return true;
}
} else {
@ -178,7 +178,7 @@ class GrinningTotemDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getActivePlayerId().equals(this.getControllerId());
return game.isActivePlayer(this.getControllerId());
}
@Override

View file

@ -145,7 +145,7 @@ class HakimLoreweaverCondition implements Condition {
}
}
return PhaseStep.UPKEEP == game.getStep().getType()
&& game.getActivePlayerId().equals(source.getControllerId());
&& game.isActivePlayer(source.getControllerId());
}
return false;
}

View file

@ -132,7 +132,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl {
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
return targetCreature != null && game.getActivePlayerId().equals(targetCreature.getControllerId());
return targetCreature != null && game.isActivePlayer(targetCreature.getControllerId());
}
}

View file

@ -72,7 +72,7 @@ class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent equipment = game.getPermanent(this.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null && equipment.getAttachedTo().equals(event.getSourceId())) {
if (equipment != null && equipment.isAttachedTo(event.getSourceId())) {
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
if (!(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
Effect effect = this.getEffects().get(0);

View file

@ -87,7 +87,7 @@ class InfectiousCurseAbility extends TriggeredAbilityImpl {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
if (player != null && game.isActivePlayer(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}

View file

@ -134,7 +134,7 @@ class JaceArchitectOfThoughtDelayedTriggeredAbility extends DelayedTriggeredAbil
@Override
public boolean isInactive(Game game) {
return game.getActivePlayerId().equals(getControllerId()) && game.getTurnNum() != startingTurn;
return game.isActivePlayer(getControllerId()) && game.getTurnNum() != startingTurn;
}
@Override

View file

@ -111,7 +111,7 @@ class KaradorGhostChieftainContinuousEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (game.getActivePlayerId() == null || !game.getActivePlayerId().equals(player.getId())) {
if (game.getActivePlayerId() == null || !game.isActivePlayer(player.getId())) {
return false;
}
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {

View file

@ -92,7 +92,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
if (game.getActivePlayerId().equals(this.getControllerId())) {
if (game.isActivePlayer(this.getControllerId())) {
CardsAmountDrawnThisTurnWatcher watcher =
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {

View file

@ -97,7 +97,7 @@ class KessDissidentMageContinuousEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (!game.getActivePlayerId().equals(player.getId())) {
if (!game.isActivePlayer(player.getId())) {
return false;
}
for (Card card : player.getGraveyard().getCards(filter, game)) {
@ -138,7 +138,7 @@ class KessDissidentMageCastFromGraveyardEffect extends AsThoughEffectImpl {
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
if (affectedControllerId.equals(source.getControllerId())) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
if (game.isActivePlayer(source.getControllerId())) {
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatchers().get(KessDissidentMageWatcher.class.getSimpleName(), source.getSourceId());
if (!(source instanceof FlashbackAbility)) {
return !watcher.isAbilityUsed();

View file

@ -1,9 +1,6 @@
package mage.cards.k;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -24,15 +21,18 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class KumanosBlessing extends CardImpl {
public KumanosBlessing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
this.subtype.add(SubType.AURA);
// Flash
@ -77,7 +77,7 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && permanent != null) {
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true);
@ -89,10 +89,10 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zce = (ZoneChangeEvent) event;
ZoneChangeEvent zce = (ZoneChangeEvent) event;
if (zce.isDiesEvent()) {
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get(DamagedByEnchantedWatcher.class.getSimpleName(), source.getSourceId());
if (watcher != null) {
@ -126,16 +126,15 @@ class DamagedByEnchantedWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == EventType.DAMAGED_CREATURE) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (enchantment.getAttachedTo().equals(event.getSourceId())) {
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
damagedCreatures.add(mor);
if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) {
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
damagedCreatures.add(mor);
}
}
}
}
@Override
public void reset() {
super.reset();

View file

@ -78,7 +78,7 @@ class MarketFestivalTriggeredAbility extends TriggeredManaAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo());
return enchantment != null && enchantment.isAttachedTo(event.getSourceId());
}
@Override

View file

@ -89,7 +89,7 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getStep().getType() == PhaseStep.DRAW) {
if (game.isActivePlayer(event.getPlayerId()) && game.getStep().getType() == PhaseStep.DRAW) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
return true;

View file

@ -139,7 +139,7 @@ class OracleEnVecMustAttackRequirementEffect extends RequirementEffect {
public boolean isInactive(Ability source, Game game) {
return startingTurn != game.getTurnNum()
&& (game.getPhase().getType() == TurnPhase.END
&& game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
&& game.isActivePlayer(this.getTargetPointer().getFirst(game, source)));
}
@Override
@ -177,7 +177,7 @@ class OracleEnVecCantAttackRestrictionEffect extends RestrictionEffect {
public boolean isInactive(Ability source, Game game) {
return startingTurn != game.getTurnNum()
&& (game.getPhase().getType() == TurnPhase.END
&& game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
&& game.isActivePlayer(this.getTargetPointer().getFirst(game, source)));
}
@Override
@ -207,7 +207,7 @@ class OracleEnVecDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return startingTurn != game.getTurnNum() && game.getActivePlayerId().equals(event.getPlayerId());
return startingTurn != game.getTurnNum() && game.isActivePlayer(event.getPlayerId());
}
@Override

View file

@ -77,7 +77,7 @@ class OvergrowthTriggeredAbility extends TriggeredManaAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) {
if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) {
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
if (enchanted != null) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId()));

View file

@ -79,7 +79,7 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
Permanent permanent = game.getPermanent(getSourceId());
if (permanent != null) {
Player player = game.getPlayer(permanent.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
if (player != null && game.isActivePlayer(player.getId())) {
FirstTimeStepWatcher watcher = (FirstTimeStepWatcher) game.getState().getWatchers().get(EventType.UPKEEP_STEP_POST.toString() + FirstTimeStepWatcher.class.getSimpleName());
if (watcher != null && !watcher.conditionMet()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));

View file

@ -68,7 +68,7 @@ class PersonalSanctuaryEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
if (event.getTargetId().equals(source.getControllerId()) && game.getActivePlayerId().equals(source.getControllerId()))
if (event.getTargetId().equals(source.getControllerId()) && game.isActivePlayer(source.getControllerId()))
return super.applies(event, source, game);
}
return false;

View file

@ -76,7 +76,7 @@ class CastCreatureWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST
&& game.getActivePlayerId().equals(event.getPlayerId())
&& game.isActivePlayer(event.getPlayerId())
&& game.getOpponents(controllerId).contains(event.getPlayerId())) {
Spell spell = (Spell) game.getObject(event.getTargetId());
if (spell.isCreature()) {

View file

@ -65,7 +65,7 @@ class PrimitiveEtchingsAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
if (game.getActivePlayerId().equals(this.getControllerId()) && this.lastTriggeredTurn != game.getTurnNum()) {
if (game.isActivePlayer(this.getControllerId()) && this.lastTriggeredTurn != game.getTurnNum()) {
Card card = game.getCard(event.getTargetId());
Player controller = game.getPlayer(this.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());

View file

@ -77,7 +77,7 @@ class RafiqOfTheManyAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId) ) {
if (game.isActivePlayer(this.controllerId) ) {
if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));

View file

@ -59,7 +59,7 @@ class RaidBombardmentTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.isActivePlayer(this.controllerId)) {
Permanent attacker = game.getPermanent(event.getSourceId());
if (attacker != null) {
if (attacker.getPower().getValue() <= 2) {

View file

@ -37,7 +37,7 @@ public final class ReturnToDust extends CardImpl {
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
if (game.getActivePlayerId().equals(ability.getControllerId()) && game.isMainPhase()) {
if (game.isActivePlayer(ability.getControllerId()) && game.isMainPhase()) {
ability.addTarget(new TargetPermanent(1, 2, StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, false));
}
else {

View file

@ -114,7 +114,7 @@ class RowanKenrithAttackEffect extends RequirementEffect {
public boolean isInactive(Ability source, Game game) {
return (startingTurn != game.getTurnNum()
&& (game.getPhase().getType() == TurnPhase.END
&& game.getActivePlayerId().equals(source.getFirstTarget())))
&& game.isActivePlayer(source.getFirstTarget())))
|| // 6/15/2010: If a creature controlled by the affected player can't attack Gideon Jura (because he's no longer on the battlefield, for example), that player may have it attack you, another one of your planeswalkers, or nothing at all.
creatingPermanent.getPermanent(game) == null;
}

View file

@ -65,7 +65,7 @@ class RowenAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
if (game.getActivePlayerId().equals(this.getControllerId()) && this.lastTriggeredTurn != game.getTurnNum()) {
if (game.isActivePlayer(this.getControllerId()) && this.lastTriggeredTurn != game.getTurnNum()) {
Card card = game.getCard(event.getTargetId());
Player controller = game.getPlayer(this.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());

View file

@ -61,7 +61,7 @@ class SentinelTowerTriggeredAbility extends SpellCastAllTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(getControllerId())
if (game.isActivePlayer(getControllerId())
&& super.checkTrigger(event, game)) {
SentinelTowerWatcher watcher = (SentinelTowerWatcher) game.getState().getWatchers().get(SentinelTowerWatcher.class.getSimpleName());
if (watcher == null) {

View file

@ -80,7 +80,7 @@ class CantCastSerraAvengerEffect extends ContinuousRuleModifyingEffectImpl {
if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
Player controller = game.getPlayer(source.getControllerId());
// it can be cast on other players turn 1 - 3 if some effect let allow you to do this
if (controller != null && controller.getTurns() <= 3 && game.getActivePlayerId().equals(source.getControllerId())) {
if (controller != null && controller.getTurns() <= 3 && game.isActivePlayer(source.getControllerId())) {
return true;
}
}

View file

@ -75,13 +75,12 @@ class SigilOfValorTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(getControllerId())) {
if (game.isActivePlayer(getControllerId())) {
if (game.getCombat().attacksAlone()) {
Permanent equipment = game.getPermanent(getSourceId());
UUID attackerId = game.getCombat().getAttackers().get(0);
if (equipment != null
&& equipment.getAttachedTo() != null
&& equipment.getAttachedTo().equals(attackerId)) {
&& equipment.isAttachedTo(attackerId)) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId));
return true;
}

View file

@ -73,7 +73,7 @@ class SirensCallMustAttackEffect extends RequirementEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return game.getActivePlayerId().equals(permanent.getControllerId());
return game.isActivePlayer(permanent.getControllerId());
}
@Override

View file

@ -106,7 +106,7 @@ class SoulEchoReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
if (!sameStep && game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
if (!sameStep && game.isActivePlayer(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
return true;
}
} else {

View file

@ -77,7 +77,7 @@ class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImp
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.isActivePlayer(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
return true;

View file

@ -103,7 +103,7 @@ class SphinxsDecreeCantCastEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
UUID opponentId = getTargetPointer().getFirst(game, source);
if (game.getActivePlayerId().equals(opponentId)) {
if (game.isActivePlayer(opponentId)) {
if (playersNextTurn == 0) {
playersNextTurn = game.getTurnNum();
}

View file

@ -86,7 +86,7 @@ class SpitefulReturnedTriggeredAbility extends TriggeredAbilityImpl {
return true;
}
} else {
if (sourcePermanent.getAttachedTo() != null && sourcePermanent.getAttachedTo().equals(event.getSourceId())) {
if (sourcePermanent.isAttachedTo(event.getSourceId())) {
UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;

View file

@ -150,7 +150,7 @@ class TamiyoFieldResearcherDelayedTriggeredAbility extends DelayedTriggeredAbili
@Override
public boolean isInactive(Game game) {
return game.getActivePlayerId().equals(getControllerId()) && game.getTurnNum() != startingTurn;
return game.isActivePlayer(getControllerId()) && game.getTurnNum() != startingTurn;
}
@Override

View file

@ -62,7 +62,7 @@ class TauntEffect extends RequirementEffect {
public boolean isInactive(Ability source, Game game) {
return startingTurn != game.getTurnNum() &&
(game.getPhase().getType() == TurnPhase.END &&
game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
game.isActivePlayer(this.getTargetPointer().getFirst(game, source)));
}
@Override

View file

@ -118,7 +118,7 @@ class TidebinderMageEffect extends ContinuousRuleModifyingEffectImpl {
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && game.getActivePlayerId().equals(permanent.getControllerId())) {
if (permanent != null && game.isActivePlayer(permanent.getControllerId())) {
return true;
}
}

View file

@ -80,7 +80,7 @@ class TormentOfScarabsAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (game.getActivePlayerId().equals(enchantment.getAttachedTo())) {
if (game.isActivePlayer(enchantment.getAttachedTo())) {
return true;
}
}

View file

@ -89,7 +89,7 @@ class AtBeginningOfUntapDelayedTriggeredAbility extends DelayedTriggeredAbility
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(controllerId)) {
if (game.isActivePlayer(controllerId)) {
return true;
}
return false;

View file

@ -67,7 +67,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl {
applied = Boolean.FALSE;
}
if (!applied && layer == Layer.RulesEffects) {
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
if (!game.isActivePlayer(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
game.getState().setValue(source.getSourceId() + "applied", true);
for (Permanent artifact : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
boolean untap = true;

View file

@ -82,7 +82,7 @@ class UrbanBurgeoningUntapEffect extends ContinuousEffectImpl {
applied = Boolean.FALSE;
}
if (!applied && layer == Layer.RulesEffects) {
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
if (!game.isActivePlayer(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
game.getState().setValue(source.getSourceId() + "applied", true);
Permanent land = game.getPermanent(source.getSourceId());
boolean untap = true;

View file

@ -68,7 +68,7 @@ class VoiceOfResurgenceTriggeredAbility extends TriggeredAbilityImpl {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null
&& game.getOpponents(super.getControllerId()).contains(spell.getControllerId())
&& game.getActivePlayerId().equals(super.getControllerId())) {
&& game.isActivePlayer(super.getControllerId())) {
return true;
}
}

View file

@ -112,7 +112,7 @@ class VraskaTheUnseenGainAbilityEffect extends ContinuousEffectImpl {
@Override
public boolean isInactive(Ability source, Game game) {
if (startingTurn != 0 && game.getTurnNum() != startingTurn) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
if (game.isActivePlayer(source.getControllerId())) {
return true;
}
}

View file

@ -76,7 +76,7 @@ class WallOfDustRestrictionEffect extends RestrictionEffect {
if (targetPermanent == null) {
return true;
}
if (nextTurnTargetController == 0 && startingTurn != game.getTurnNum() && game.getActivePlayerId().equals(targetPermanent.getControllerId())) {
if (nextTurnTargetController == 0 && startingTurn != game.getTurnNum() && game.isActivePlayer(targetPermanent.getControllerId())) {
nextTurnTargetController = game.getTurnNum();
}
return game.getPhase().getType() == TurnPhase.END && nextTurnTargetController > 0 && game.getTurnNum() > nextTurnTargetController;
@ -95,7 +95,7 @@ class WallOfDustRestrictionEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
if (game.getActivePlayerId().equals(permanent.getControllerId())) {
if (game.isActivePlayer(permanent.getControllerId())) {
return true;
}
}

View file

@ -78,7 +78,7 @@ class WitchstalkerTriggeredAbility extends TriggeredAbilityImpl {
return spell != null
&& filter.match(spell,game)
&& game.getOpponents(this.getControllerId()).contains(spell.getControllerId())
&& game.getActivePlayerId().equals(this.getControllerId());
&& game.isActivePlayer(this.getControllerId());
}
@Override

View file

@ -97,7 +97,6 @@ class WritOfPassageAttachedEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent attachment = game.getPermanent(source.getSourceId());
return attachment != null && attachment.getAttachedTo() != null
&& attachment.getAttachedTo().equals(permanent.getId());
return attachment != null && attachment.isAttachedTo(permanent.getId());
}
}

View file

@ -84,7 +84,7 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
if (game.isActivePlayer(source.getControllerId())) {
return true;
}
}

View file

@ -48,8 +48,7 @@ public class DealsDamageToACreatureAttachedTriggeredAbility extends TriggeredAbi
if (!combatOnly || ((DamagedCreatureEvent) event).isCombatDamage()) {
Permanent attachment = game.getPermanent(this.getSourceId());
if (attachment != null
&& attachment.getAttachedTo() != null
&& event.getSourceId().equals(attachment.getAttachedTo())) {
&& attachment.isAttachedTo(event.getSourceId())) {
if (setTargetPointer) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));

View file

@ -36,7 +36,7 @@ public class CantBeBlockedAttachedEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent attachment = game.getPermanent(source.getSourceId());
return attachment != null && attachment.getAttachedTo() != null
&& attachment.getAttachedTo().equals(permanent.getId());
return attachment != null
&& attachment.isAttachedTo(permanent.getId());
}
}

View file

@ -65,7 +65,7 @@ public class CantCastMoreThanOneSpellEffect extends ContinuousRuleModifyingEffec
break;
case CONTROLLER_ATTACHED_TO:
Permanent attachment = game.getPermanent(source.getSourceId());
if (attachment == null || !attachment.getAttachedTo().equals(event.getPlayerId())) {
if (attachment == null || !attachment.isAttachedTo(event.getPlayerId())) {
return false;
}
}

View file

@ -630,11 +630,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public List<UUID> getConnectedCards(String key) {
if (this.connectedCards.containsKey(key)) {
return this.connectedCards.get(key);
} else {
return emptyList;
}
return this.connectedCards.getOrDefault(key, emptyList);
}
@Override