mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
add more isActivePlayer and isAttachedTo calls
This commit is contained in:
parent
490217facd
commit
c456a1961e
83 changed files with 109 additions and 122 deletions
|
@ -111,7 +111,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||||
if (game.getActivePlayerId().equals(event.getPlayerId())
|
if (game.isActivePlayer(event.getPlayerId())
|
||||||
&& game.getPhase().getStep().getType() == PhaseStep.DRAW) {
|
&& game.getPhase().getStep().getType() == PhaseStep.DRAW) {
|
||||||
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
|
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class AngelicArbiterCantAttackTargetEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
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());
|
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get(CastSpellLastTurnWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(permanent.getControllerId()) > 0) {
|
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(permanent.getControllerId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,7 +113,7 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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());
|
PlayerAttackedWatcher watcher = (PlayerAttackedWatcher) game.getState().getWatchers().get(PlayerAttackedWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getNumberOfAttackersCurrentTurn(event.getPlayerId()) > 0) {
|
if (watcher != null && watcher.getNumberOfAttackersCurrentTurn(event.getPlayerId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -62,7 +62,7 @@ class AngelicBenedictionTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(this.controllerId)) {
|
if (game.isActivePlayer(this.controllerId)) {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class AssaultSuit extends CardImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT) {
|
if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT) {
|
||||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
if (equipment != null) {
|
||||||
return equipment.isAttachedTo(event.getTargetId());
|
return equipment.isAttachedTo(event.getTargetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
UUID opponentId = getTargetPointer().getFirst(game, source);
|
UUID opponentId = getTargetPointer().getFirst(game, source);
|
||||||
if (game.getActivePlayerId().equals(opponentId)) {
|
if (game.isActivePlayer(opponentId)) {
|
||||||
if (playersNextTurn == 0) {
|
if (playersNextTurn == 0) {
|
||||||
playersNextTurn = game.getTurnNum();
|
playersNextTurn = game.getTurnNum();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ class BattlegraceAngelAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(this.controllerId) ) {
|
if (game.isActivePlayer(this.controllerId) ) {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
for (Effect effect: this.getEffects()) {
|
for (Effect effect: this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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());
|
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ChancellorOfTheTangleDelayedTriggeredAbility extends DelayedTriggeredAbili
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return game.getActivePlayerId().equals(controllerId);
|
return game.isActivePlayer(controllerId);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ChancellorOfTheTangleDelayedTriggeredAbility copy() {
|
public ChancellorOfTheTangleDelayedTriggeredAbility copy() {
|
||||||
|
|
|
@ -72,10 +72,9 @@ class ChronicFloodingAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent source = game.getPermanent(this.sourceId);
|
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());
|
Permanent attached = game.getPermanent(source.getAttachedTo());
|
||||||
if (attached != null) {
|
if (attached != null) {
|
||||||
|
|
||||||
for (Effect e : getEffects()) {
|
for (Effect e : getEffects()) {
|
||||||
e.setTargetPointer(new FixedTarget(attached.getControllerId()));
|
e.setTargetPointer(new FixedTarget(attached.getControllerId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class CityOfSolitudeEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return !game.getActivePlayerId().equals(event.getPlayerId());
|
return !game.isActivePlayer(event.getPlayerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -105,7 +105,7 @@ class CommuneWithLavaMayPlayEffect extends AsThoughEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) {
|
if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) {
|
||||||
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
if (game.isActivePlayer(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)) {
|
&& game.getPlayer(source.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class CowedByWisdomayCostToAttackBlockEffect extends PayCostToAttackBlockEffectI
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
return enchantment != null && enchantment.getAttachedTo().equals(event.getSourceId());
|
return enchantment != null && enchantment.isAttachedTo(event.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -85,7 +85,7 @@ class CruelRealityTriggeredAbiilty extends TriggeredAbilityImpl {
|
||||||
&& enchantment.getAttachedTo() != null) {
|
&& enchantment.getAttachedTo() != null) {
|
||||||
Player cursedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
Player cursedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||||
if (cursedPlayer != null
|
if (cursedPlayer != null
|
||||||
&& game.getActivePlayerId().equals(cursedPlayer.getId())) {
|
&& game.isActivePlayer(cursedPlayer.getId())) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(cursedPlayer.getId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(cursedPlayer.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
@ -16,14 +15,15 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
*/
|
*/
|
||||||
public final class CurseOfBloodletting extends CardImpl {
|
public final class CurseOfBloodletting extends CardImpl {
|
||||||
|
|
||||||
public CurseOfBloodletting(UUID ownerId, CardSetInfo setInfo) {
|
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);
|
this.subtype.add(SubType.AURA, SubType.CURSE);
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,10 +71,9 @@ class CurseOfBloodlettingEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
if (enchantment != null &&
|
if (enchantment != null &&
|
||||||
enchantment.getAttachedTo() != null &&
|
enchantment.isAttachedTo(event.getTargetId())) {
|
||||||
event.getTargetId().equals(enchantment.getAttachedTo())) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ class CurseOfOblivionAbility extends TriggeredAbilityImpl {
|
||||||
Permanent enchantment = game.getPermanent(this.sourceId);
|
Permanent enchantment = game.getPermanent(this.sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
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()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class CurseOfOpulenceEffect extends OneShotEffect {
|
||||||
if (enchantment != null) {
|
if (enchantment != null) {
|
||||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||||
if (enchantedPlayer != null) {
|
if (enchantedPlayer != null) {
|
||||||
Set<UUID> players = new HashSet();
|
Set<UUID> players = new HashSet<>();
|
||||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||||
UUID defender = game.getCombat().getDefenderId(attacker);
|
UUID defender = game.getCombat().getDefenderId(attacker);
|
||||||
if (defender.equals(enchantedPlayer.getId())
|
if (defender.equals(enchantedPlayer.getId())
|
||||||
|
|
|
@ -84,8 +84,7 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (defender != null) {
|
if (defender != null) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
Permanent enchantment = game.getPermanent(this.getSourceId());
|
||||||
if (enchantment != null
|
if (enchantment != null
|
||||||
&& enchantment.getAttachedTo() != null
|
&& enchantment.isAttachedTo(defender.getId())) {
|
||||||
&& enchantment.getAttachedTo().equals(defender.getId())) {
|
|
||||||
for (Effect effect: this.getEffects()) {
|
for (Effect effect: this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ class CurseOfTheBloodyTomeAbility extends TriggeredAbilityImpl {
|
||||||
Permanent enchantment = game.getPermanent(this.sourceId);
|
Permanent enchantment = game.getPermanent(this.sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
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()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,7 @@ class CurseOfTheForsakenTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (defender != null) {
|
if (defender != null) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
Permanent enchantment = game.getPermanent(this.getSourceId());
|
||||||
if (enchantment != null
|
if (enchantment != null
|
||||||
&& enchantment.getAttachedTo() != null
|
&& enchantment.isAttachedTo(defender.getId())) {
|
||||||
&& enchantment.getAttachedTo().equals(defender.getId())) {
|
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class CurseOfThePiercedHeartAbility extends TriggeredAbilityImpl {
|
||||||
Permanent enchantment = game.getPermanent(this.sourceId);
|
Permanent enchantment = game.getPermanent(this.sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
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()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class CurseOfThirstAbility extends TriggeredAbilityImpl {
|
||||||
Permanent enchantment = game.getPermanent(this.sourceId);
|
Permanent enchantment = game.getPermanent(this.sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
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()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,7 @@ class CurseOfVengeanceTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Spell spell = game.getStack().getSpell(event.getSourceId());
|
Spell spell = game.getStack().getSpell(event.getSourceId());
|
||||||
|
|
||||||
if (enchantment != null && spell != null
|
if (enchantment != null && spell != null
|
||||||
&& enchantment.getAttachedTo() != null
|
&& enchantment.isAttachedTo(spell.getControllerId())) {
|
||||||
&& enchantment.getAttachedTo().equals(spell.getControllerId())) {
|
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(getSourceId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(getSourceId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,7 @@ class CurseOfVengeancePlayerLosesTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent sourceObject = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
Permanent sourceObject = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
||||||
return sourceObject != null && sourceObject.getAttachedTo().equals(event.getPlayerId());
|
return sourceObject != null && sourceObject.isAttachedTo(event.getPlayerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -76,7 +76,7 @@ class DawnsReflectionTriggeredAbility extends TriggeredManaAbility {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
Permanent enchantment = game.getPermanent(this.getSourceId());
|
||||||
return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo());
|
return enchantment != null && enchantment.isAttachedTo(event.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -54,7 +54,7 @@ class DosanTheFallingLeafEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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
|
@Override
|
||||||
|
|
|
@ -78,7 +78,7 @@ class DragonlordDromokaEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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)) {
|
game.getPlayer(source.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ class EdificeOfAuthorityRestrictionEffect extends RestrictionEffect {
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP
|
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP
|
||||||
&& game.getStep().getStepPart() == Step.StepPart.PRE) {
|
&& game.getStep().getStepPart() == Step.StepPart.PRE) {
|
||||||
if (game.getActivePlayerId().equals(source.getControllerId())
|
if (game.isActivePlayer(source.getControllerId())
|
||||||
|| game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
|| game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
||||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
|
|
|
@ -123,7 +123,7 @@ class MaximumHandSizeEffect extends MaximumHandSizeControllerEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class FaithsFettersEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
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());
|
Optional<Ability> ability = game.getAbility(event.getTargetId(), event.getSourceId());
|
||||||
if (ability.isPresent() && ability.get().getAbilityType() != AbilityType.MANA) {
|
if (ability.isPresent() && ability.get().getAbilityType() != AbilityType.MANA) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -74,7 +74,7 @@ class FinestHourAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(this.controllerId)) {
|
if (game.isActivePlayer(this.controllerId)) {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
for (Effect effect: this.getEffects()) {
|
for (Effect effect: this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
||||||
|
|
|
@ -77,7 +77,7 @@ class GabrielAngelfireGainAbilityEffect extends GainAbilitySourceEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -138,7 +138,7 @@ class GideonBattleForgedAttacksIfAbleTargetEffect extends RequirementEffect {
|
||||||
if (targetPermanent == null) {
|
if (targetPermanent == null) {
|
||||||
return true;
|
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();
|
nextTurnTargetController = game.getTurnNum();
|
||||||
}
|
}
|
||||||
return game.getPhase().getType() == TurnPhase.END && nextTurnTargetController > 0 && game.getTurnNum() > nextTurnTargetController;
|
return game.getPhase().getType() == TurnPhase.END && nextTurnTargetController > 0 && game.getTurnNum() > nextTurnTargetController;
|
||||||
|
@ -157,7 +157,7 @@ class GideonBattleForgedAttacksIfAbleTargetEffect extends RequirementEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
|
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());
|
Permanent planeswalker = game.getPermanent(source.getSourceId());
|
||||||
if (planeswalker != null) {
|
if (planeswalker != null) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -129,7 +129,7 @@ class GideonJuraEffect extends RequirementEffect {
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
return (startingTurn != game.getTurnNum()
|
return (startingTurn != game.getTurnNum()
|
||||||
&& (game.getPhase().getType() == TurnPhase.END
|
&& (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.
|
|| // 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;
|
creatingPermanent.getPermanent(game) == null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class GisaAndGeralfContinuousEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (!game.getActivePlayerId().equals(player.getId())) {
|
if (!game.isActivePlayer(player.getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Card card : player.getGraveyard().getCards(filter, game)) {
|
for (Card card : player.getGraveyard().getCards(filter, game)) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
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()) {
|
switch(event.getType()) {
|
||||||
case CAST_SPELL:
|
case CAST_SPELL:
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -124,7 +124,7 @@ class GrinningTotemMayPlayEffect extends AsThoughEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -178,7 +178,7 @@ class GrinningTotemDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
return game.getActivePlayerId().equals(this.getControllerId());
|
return game.isActivePlayer(this.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -145,7 +145,7 @@ class HakimLoreweaverCondition implements Condition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PhaseStep.UPKEEP == game.getStep().getType()
|
return PhaseStep.UPKEEP == game.getStep().getType()
|
||||||
&& game.getActivePlayerId().equals(source.getControllerId());
|
&& game.isActivePlayer(source.getControllerId());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
||||||
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
||||||
Permanent targetCreature = game.getPermanent(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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent equipment = game.getPermanent(this.getSourceId());
|
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());
|
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||||
if (!(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
|
if (!(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
|
||||||
Effect effect = this.getEffects().get(0);
|
Effect effect = this.getEffects().get(0);
|
||||||
|
|
|
@ -87,7 +87,7 @@ class InfectiousCurseAbility extends TriggeredAbilityImpl {
|
||||||
Permanent enchantment = game.getPermanent(this.sourceId);
|
Permanent enchantment = game.getPermanent(this.sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
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()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ class JaceArchitectOfThoughtDelayedTriggeredAbility extends DelayedTriggeredAbil
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Game game) {
|
public boolean isInactive(Game game) {
|
||||||
return game.getActivePlayerId().equals(getControllerId()) && game.getTurnNum() != startingTurn;
|
return game.isActivePlayer(getControllerId()) && game.getTurnNum() != startingTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -111,7 +111,7 @@ class KaradorGhostChieftainContinuousEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (game.getActivePlayerId() == null || !game.getActivePlayerId().equals(player.getId())) {
|
if (game.getActivePlayerId() == null || !game.isActivePlayer(player.getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
if (game.getActivePlayerId().equals(this.getControllerId())) {
|
if (game.isActivePlayer(this.getControllerId())) {
|
||||||
CardsAmountDrawnThisTurnWatcher watcher =
|
CardsAmountDrawnThisTurnWatcher watcher =
|
||||||
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
(CardsAmountDrawnThisTurnWatcher) game.getState().getWatchers().get(CardsAmountDrawnThisTurnWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
|
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ class KessDissidentMageContinuousEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (!game.getActivePlayerId().equals(player.getId())) {
|
if (!game.isActivePlayer(player.getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Card card : player.getGraveyard().getCards(filter, game)) {
|
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) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
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());
|
KessDissidentMageWatcher watcher = (KessDissidentMageWatcher) game.getState().getWatchers().get(KessDissidentMageWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
if (!(source instanceof FlashbackAbility)) {
|
if (!(source instanceof FlashbackAbility)) {
|
||||||
return !watcher.isAbilityUsed();
|
return !watcher.isAbilityUsed();
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.k;
|
package mage.cards.k;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -24,15 +21,18 @@ import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class KumanosBlessing extends CardImpl {
|
public final class KumanosBlessing extends CardImpl {
|
||||||
|
|
||||||
public KumanosBlessing(UUID ownerId, CardSetInfo setInfo) {
|
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);
|
this.subtype.add(SubType.AURA);
|
||||||
|
|
||||||
// Flash
|
// Flash
|
||||||
|
@ -77,7 +77,7 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
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());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null && permanent != null) {
|
if (controller != null && permanent != null) {
|
||||||
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
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) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == EventType.ZONE_CHANGE;
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||||
if (zce.isDiesEvent()) {
|
if (zce.isDiesEvent()) {
|
||||||
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get(DamagedByEnchantedWatcher.class.getSimpleName(), source.getSourceId());
|
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get(DamagedByEnchantedWatcher.class.getSimpleName(), source.getSourceId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
|
@ -126,16 +126,15 @@ class DamagedByEnchantedWatcher extends Watcher {
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.DAMAGED_CREATURE) {
|
if (event.getType() == EventType.DAMAGED_CREATURE) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
Permanent enchantment = game.getPermanent(this.getSourceId());
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) {
|
||||||
if (enchantment.getAttachedTo().equals(event.getSourceId())) {
|
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
|
||||||
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
|
damagedCreatures.add(mor);
|
||||||
damagedCreatures.add(mor);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
|
|
|
@ -78,7 +78,7 @@ class MarketFestivalTriggeredAbility extends TriggeredManaAbility {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
Permanent enchantment = game.getPermanent(this.getSourceId());
|
||||||
return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo());
|
return enchantment != null && enchantment.isAttachedTo(event.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,7 +89,7 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
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());
|
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get(CardsDrawnDuringDrawStepWatcher.class.getSimpleName());
|
||||||
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -139,7 +139,7 @@ class OracleEnVecMustAttackRequirementEffect extends RequirementEffect {
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
return startingTurn != game.getTurnNum()
|
return startingTurn != game.getTurnNum()
|
||||||
&& (game.getPhase().getType() == TurnPhase.END
|
&& (game.getPhase().getType() == TurnPhase.END
|
||||||
&& game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
|
&& game.isActivePlayer(this.getTargetPointer().getFirst(game, source)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -177,7 +177,7 @@ class OracleEnVecCantAttackRestrictionEffect extends RestrictionEffect {
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
return startingTurn != game.getTurnNum()
|
return startingTurn != game.getTurnNum()
|
||||||
&& (game.getPhase().getType() == TurnPhase.END
|
&& (game.getPhase().getType() == TurnPhase.END
|
||||||
&& game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
|
&& game.isActivePlayer(this.getTargetPointer().getFirst(game, source)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -207,7 +207,7 @@ class OracleEnVecDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
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
|
@Override
|
||||||
|
|
|
@ -77,7 +77,7 @@ class OvergrowthTriggeredAbility extends TriggeredManaAbility {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
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());
|
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||||
if (enchanted != null) {
|
if (enchanted != null) {
|
||||||
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId()));
|
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId()));
|
||||||
|
|
|
@ -79,7 +79,7 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Permanent permanent = game.getPermanent(getSourceId());
|
Permanent permanent = game.getPermanent(getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Player player = game.getPlayer(permanent.getAttachedTo());
|
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());
|
FirstTimeStepWatcher watcher = (FirstTimeStepWatcher) game.getState().getWatchers().get(EventType.UPKEEP_STEP_POST.toString() + FirstTimeStepWatcher.class.getSimpleName());
|
||||||
if (watcher != null && !watcher.conditionMet()) {
|
if (watcher != null && !watcher.conditionMet()) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||||
|
|
|
@ -68,7 +68,7 @@ class PersonalSanctuaryEffect extends PreventionEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
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 super.applies(event, source, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -76,7 +76,7 @@ class CastCreatureWatcher extends Watcher {
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST
|
if (event.getType() == GameEvent.EventType.SPELL_CAST
|
||||||
&& game.getActivePlayerId().equals(event.getPlayerId())
|
&& game.isActivePlayer(event.getPlayerId())
|
||||||
&& game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
&& game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||||
if (spell.isCreature()) {
|
if (spell.isCreature()) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class PrimitiveEtchingsAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
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());
|
Card card = game.getCard(event.getTargetId());
|
||||||
Player controller = game.getPlayer(this.getControllerId());
|
Player controller = game.getPlayer(this.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
||||||
|
|
|
@ -77,7 +77,7 @@ class RafiqOfTheManyAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(this.controllerId) ) {
|
if (game.isActivePlayer(this.controllerId) ) {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
for (Effect effect: this.getEffects()) {
|
for (Effect effect: this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
||||||
|
|
|
@ -59,7 +59,7 @@ class RaidBombardmentTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(this.controllerId)) {
|
if (game.isActivePlayer(this.controllerId)) {
|
||||||
Permanent attacker = game.getPermanent(event.getSourceId());
|
Permanent attacker = game.getPermanent(event.getSourceId());
|
||||||
if (attacker != null) {
|
if (attacker != null) {
|
||||||
if (attacker.getPower().getValue() <= 2) {
|
if (attacker.getPower().getValue() <= 2) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class ReturnToDust extends CardImpl {
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
if (ability instanceof SpellAbility) {
|
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));
|
ability.addTarget(new TargetPermanent(1, 2, StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, false));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -114,7 +114,7 @@ class RowanKenrithAttackEffect extends RequirementEffect {
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
return (startingTurn != game.getTurnNum()
|
return (startingTurn != game.getTurnNum()
|
||||||
&& (game.getPhase().getType() == TurnPhase.END
|
&& (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.
|
|| // 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;
|
creatingPermanent.getPermanent(game) == null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class RowenAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
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());
|
Card card = game.getCard(event.getTargetId());
|
||||||
Player controller = game.getPlayer(this.getControllerId());
|
Player controller = game.getPlayer(this.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());
|
||||||
|
|
|
@ -61,7 +61,7 @@ class SentinelTowerTriggeredAbility extends SpellCastAllTriggeredAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(getControllerId())
|
if (game.isActivePlayer(getControllerId())
|
||||||
&& super.checkTrigger(event, game)) {
|
&& super.checkTrigger(event, game)) {
|
||||||
SentinelTowerWatcher watcher = (SentinelTowerWatcher) game.getState().getWatchers().get(SentinelTowerWatcher.class.getSimpleName());
|
SentinelTowerWatcher watcher = (SentinelTowerWatcher) game.getState().getWatchers().get(SentinelTowerWatcher.class.getSimpleName());
|
||||||
if (watcher == null) {
|
if (watcher == null) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ class CantCastSerraAvengerEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
|
if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
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
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,12 @@ class SigilOfValorTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(getControllerId())) {
|
if (game.isActivePlayer(getControllerId())) {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
Permanent equipment = game.getPermanent(getSourceId());
|
Permanent equipment = game.getPermanent(getSourceId());
|
||||||
UUID attackerId = game.getCombat().getAttackers().get(0);
|
UUID attackerId = game.getCombat().getAttackers().get(0);
|
||||||
if (equipment != null
|
if (equipment != null
|
||||||
&& equipment.getAttachedTo() != null
|
&& equipment.isAttachedTo(attackerId)) {
|
||||||
&& equipment.getAttachedTo().equals(attackerId)) {
|
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(attackerId));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class SirensCallMustAttackEffect extends RequirementEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
return game.getActivePlayerId().equals(permanent.getControllerId());
|
return game.isActivePlayer(permanent.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -106,7 +106,7 @@ class SoulEchoReplacementEffect extends ReplacementEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -77,7 +77,7 @@ class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(this.controllerId)) {
|
if (game.isActivePlayer(this.controllerId)) {
|
||||||
if (game.getCombat().attacksAlone()) {
|
if (game.getCombat().attacksAlone()) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -103,7 +103,7 @@ class SphinxsDecreeCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
UUID opponentId = getTargetPointer().getFirst(game, source);
|
UUID opponentId = getTargetPointer().getFirst(game, source);
|
||||||
if (game.getActivePlayerId().equals(opponentId)) {
|
if (game.isActivePlayer(opponentId)) {
|
||||||
if (playersNextTurn == 0) {
|
if (playersNextTurn == 0) {
|
||||||
playersNextTurn = game.getTurnNum();
|
playersNextTurn = game.getTurnNum();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class SpitefulReturnedTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (sourcePermanent.getAttachedTo() != null && sourcePermanent.getAttachedTo().equals(event.getSourceId())) {
|
if (sourcePermanent.isAttachedTo(event.getSourceId())) {
|
||||||
UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game);
|
UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game);
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -150,7 +150,7 @@ class TamiyoFieldResearcherDelayedTriggeredAbility extends DelayedTriggeredAbili
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Game game) {
|
public boolean isInactive(Game game) {
|
||||||
return game.getActivePlayerId().equals(getControllerId()) && game.getTurnNum() != startingTurn;
|
return game.isActivePlayer(getControllerId()) && game.getTurnNum() != startingTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,7 @@ class TauntEffect extends RequirementEffect {
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
return startingTurn != game.getTurnNum() &&
|
return startingTurn != game.getTurnNum() &&
|
||||||
(game.getPhase().getType() == TurnPhase.END &&
|
(game.getPhase().getType() == TurnPhase.END &&
|
||||||
game.getActivePlayerId().equals(this.getTargetPointer().getFirst(game, source)));
|
game.isActivePlayer(this.getTargetPointer().getFirst(game, source)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -118,7 +118,7 @@ class TidebinderMageEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
||||||
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && game.getActivePlayerId().equals(permanent.getControllerId())) {
|
if (permanent != null && game.isActivePlayer(permanent.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class TormentOfScarabsAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent enchantment = game.getPermanent(this.getSourceId());
|
Permanent enchantment = game.getPermanent(this.getSourceId());
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
if (game.getActivePlayerId().equals(enchantment.getAttachedTo())) {
|
if (game.isActivePlayer(enchantment.getAttachedTo())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ class AtBeginningOfUntapDelayedTriggeredAbility extends DelayedTriggeredAbility
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getActivePlayerId().equals(controllerId)) {
|
if (game.isActivePlayer(controllerId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -67,7 +67,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl {
|
||||||
applied = Boolean.FALSE;
|
applied = Boolean.FALSE;
|
||||||
}
|
}
|
||||||
if (!applied && layer == Layer.RulesEffects) {
|
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);
|
game.getState().setValue(source.getSourceId() + "applied", true);
|
||||||
for (Permanent artifact : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent artifact : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
boolean untap = true;
|
boolean untap = true;
|
||||||
|
|
|
@ -82,7 +82,7 @@ class UrbanBurgeoningUntapEffect extends ContinuousEffectImpl {
|
||||||
applied = Boolean.FALSE;
|
applied = Boolean.FALSE;
|
||||||
}
|
}
|
||||||
if (!applied && layer == Layer.RulesEffects) {
|
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);
|
game.getState().setValue(source.getSourceId() + "applied", true);
|
||||||
Permanent land = game.getPermanent(source.getSourceId());
|
Permanent land = game.getPermanent(source.getSourceId());
|
||||||
boolean untap = true;
|
boolean untap = true;
|
||||||
|
|
|
@ -68,7 +68,7 @@ class VoiceOfResurgenceTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null
|
if (spell != null
|
||||||
&& game.getOpponents(super.getControllerId()).contains(spell.getControllerId())
|
&& game.getOpponents(super.getControllerId()).contains(spell.getControllerId())
|
||||||
&& game.getActivePlayerId().equals(super.getControllerId())) {
|
&& game.isActivePlayer(super.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ class VraskaTheUnseenGainAbilityEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (startingTurn != 0 && game.getTurnNum() != startingTurn) {
|
if (startingTurn != 0 && game.getTurnNum() != startingTurn) {
|
||||||
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
if (game.isActivePlayer(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class WallOfDustRestrictionEffect extends RestrictionEffect {
|
||||||
if (targetPermanent == null) {
|
if (targetPermanent == null) {
|
||||||
return true;
|
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();
|
nextTurnTargetController = game.getTurnNum();
|
||||||
}
|
}
|
||||||
return game.getPhase().getType() == TurnPhase.END && nextTurnTargetController > 0 && game.getTurnNum() > nextTurnTargetController;
|
return game.getPhase().getType() == TurnPhase.END && nextTurnTargetController > 0 && game.getTurnNum() > nextTurnTargetController;
|
||||||
|
@ -95,7 +95,7 @@ class WallOfDustRestrictionEffect extends RestrictionEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
|
if (permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
|
||||||
if (game.getActivePlayerId().equals(permanent.getControllerId())) {
|
if (game.isActivePlayer(permanent.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class WitchstalkerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return spell != null
|
return spell != null
|
||||||
&& filter.match(spell,game)
|
&& filter.match(spell,game)
|
||||||
&& game.getOpponents(this.getControllerId()).contains(spell.getControllerId())
|
&& game.getOpponents(this.getControllerId()).contains(spell.getControllerId())
|
||||||
&& game.getActivePlayerId().equals(this.getControllerId());
|
&& game.isActivePlayer(this.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,7 +97,6 @@ class WritOfPassageAttachedEffect extends RestrictionEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||||
return attachment != null && attachment.getAttachedTo() != null
|
return attachment != null && attachment.isAttachedTo(permanent.getId());
|
||||||
&& attachment.getAttachedTo().equals(permanent.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
|
if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
|
||||||
if (game.getActivePlayerId().equals(source.getControllerId())) {
|
if (game.isActivePlayer(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,7 @@ public class DealsDamageToACreatureAttachedTriggeredAbility extends TriggeredAbi
|
||||||
if (!combatOnly || ((DamagedCreatureEvent) event).isCombatDamage()) {
|
if (!combatOnly || ((DamagedCreatureEvent) event).isCombatDamage()) {
|
||||||
Permanent attachment = game.getPermanent(this.getSourceId());
|
Permanent attachment = game.getPermanent(this.getSourceId());
|
||||||
if (attachment != null
|
if (attachment != null
|
||||||
&& attachment.getAttachedTo() != null
|
&& attachment.isAttachedTo(event.getSourceId())) {
|
||||||
&& event.getSourceId().equals(attachment.getAttachedTo())) {
|
|
||||||
if (setTargetPointer) {
|
if (setTargetPointer) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class CantBeBlockedAttachedEffect extends RestrictionEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||||
return attachment != null && attachment.getAttachedTo() != null
|
return attachment != null
|
||||||
&& attachment.getAttachedTo().equals(permanent.getId());
|
&& attachment.isAttachedTo(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class CantCastMoreThanOneSpellEffect extends ContinuousRuleModifyingEffec
|
||||||
break;
|
break;
|
||||||
case CONTROLLER_ATTACHED_TO:
|
case CONTROLLER_ATTACHED_TO:
|
||||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||||
if (attachment == null || !attachment.getAttachedTo().equals(event.getPlayerId())) {
|
if (attachment == null || !attachment.isAttachedTo(event.getPlayerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -630,11 +630,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UUID> getConnectedCards(String key) {
|
public List<UUID> getConnectedCards(String key) {
|
||||||
if (this.connectedCards.containsKey(key)) {
|
return this.connectedCards.getOrDefault(key, emptyList);
|
||||||
return this.connectedCards.get(key);
|
|
||||||
} else {
|
|
||||||
return emptyList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue