mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
refactor: improved usage of target pointers
This commit is contained in:
parent
78612ddc91
commit
46d751f996
476 changed files with 548 additions and 563 deletions
|
|
@ -68,7 +68,7 @@ class AcademicDisputeEffect extends OneShotEffect {
|
||||||
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) {
|
||||||
Permanent permanent = game.getPermanent(this.targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (player.chooseUse(outcome, "Have " + permanent.getLogName() + " gain reach until end of turn?", source, game)) {
|
if (player.chooseUse(outcome, "Have " + permanent.getLogName() + " gain reach until end of turn?", source, game)) {
|
||||||
GainAbilityTargetEffect effect = new GainAbilityTargetEffect(ReachAbility.getInstance(), Duration.EndOfTurn);
|
GainAbilityTargetEffect effect = new GainAbilityTargetEffect(ReachAbility.getInstance(), Duration.EndOfTurn);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class AcademicProbationRestrictionEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
return this.targetPointer.getTargets(game, source).contains(permanent.getId());
|
return this.getTargetPointer().getTargets(game, source).contains(permanent.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class AccessDeniedEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
StackObject stackObject = game.getStack().getStackObject(getTargetPointer().getFirst(game, source));
|
||||||
if (stackObject != null) {
|
if (stackObject != null) {
|
||||||
game.getStack().counter(source.getFirstTarget(), source, game);
|
game.getStack().counter(source.getFirstTarget(), source, game);
|
||||||
return new ThopterColorlessToken().putOntoBattlefield(stackObject.getManaValue(), game, source);
|
return new ThopterColorlessToken().putOntoBattlefield(stackObject.getManaValue(), game, source);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class AccursedWitchReturnTransformedEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player attachTo = game.getPlayer(targetPointer.getFirst(game, source));
|
Player attachTo = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller == null || !(game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) || attachTo == null) {
|
if (controller == null || !(game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) || attachTo == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,9 @@ class ActOfAuthorityGainControlEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent;
|
Permanent permanent;
|
||||||
if (targetPointer == null) {
|
permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
|
if (permanent == null) {
|
||||||
permanent = game.getPermanent(source.getFirstTarget());
|
permanent = game.getPermanent(source.getFirstTarget());
|
||||||
} else {
|
|
||||||
permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class AethertowEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (targetCreature != null) {
|
if (targetCreature != null) {
|
||||||
return controller.putCardsOnTopOfLibrary(targetCreature, game, source, true);
|
return controller.putCardsOnTopOfLibrary(targetCreature, game, source, true);
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,9 @@ class AkroanHorseGainControlEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent;
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPointer == null) {
|
if (permanent == null) {
|
||||||
permanent = game.getPermanent(source.getFirstTarget());
|
permanent = game.getPermanent(source.getFirstTarget());
|
||||||
} else {
|
|
||||||
permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
|
||||||
}
|
}
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class AnaBattlemageKickerEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean applied = false;
|
boolean applied = false;
|
||||||
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (targetCreature != null) {
|
if (targetCreature != null) {
|
||||||
applied = targetCreature.tap(source, game);
|
applied = targetCreature.tap(source, game);
|
||||||
Player controller = game.getPlayer(targetCreature.getControllerId());
|
Player controller = game.getPlayer(targetCreature.getControllerId());
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ class AncientRunesDamageTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int damage = game.getBattlefield().getAllActivePermanents(new FilterControlledArtifactPermanent("artifacts"), targetPointer.getFirst(game, source), game).size();
|
int damage = game.getBattlefield().getAllActivePermanents(new FilterControlledArtifactPermanent("artifacts"), getTargetPointer().getFirst(game, source), game).size();
|
||||||
player.damage(damage, source.getSourceId(), source, game);
|
player.damage(damage, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class AngelOfDestinyGainLifeEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
int damage = (int) getValue("damage");
|
int damage = (int) getValue("damage");
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.gainLife(damage, game, source);
|
controller.gainLife(damage, game, source);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class AnowonTheRuinThiefEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class AnvilOfBogardanEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
targetPlayer.drawCards(1, source, game);
|
targetPlayer.drawCards(1, source, game);
|
||||||
targetPlayer.discard(1, false, false, source, game);
|
targetPlayer.discard(1, false, false, source, game);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class AquitectsWillEffect extends BecomesBasicLandTargetEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
|
Permanent land = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||||
if (land == null || land.getCounters(game).getCount(CounterType.FLOOD) < 1) {
|
if (land == null || land.getCounters(game).getCount(CounterType.FLOOD) < 1) {
|
||||||
discard();
|
discard();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ class ArahboEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (creature != null && creature.isCreature(game)) {
|
if (creature != null && creature.isCreature(game)) {
|
||||||
int pow = creature.getPower().getValue();
|
int pow = creature.getPower().getValue();
|
||||||
ContinuousEffect effect = new BoostTargetEffect(pow, pow, Duration.EndOfTurn);
|
ContinuousEffect effect = new BoostTargetEffect(pow, pow, Duration.EndOfTurn);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class AraumiOfTheDeadTideEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class AtemsisAllSeeingEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller == null || opponent == null) {
|
if (controller == null || opponent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class AuraGraftMoveAuraEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent enchantment = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent enchantment = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (enchantment == null || controller == null) {
|
if (enchantment == null || controller == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class AuriokSurvivorsEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent p = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (p != null && player != null && sourcePermanent != null) {
|
if (p != null && player != null && sourcePermanent != null) {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class BacklashEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (targetCreature != null) {
|
if (targetCreature != null) {
|
||||||
targetCreature.tap(source, game);
|
targetCreature.tap(source, game);
|
||||||
Player controller = game.getPlayer(targetCreature.getControllerId());
|
Player controller = game.getPlayer(targetCreature.getControllerId());
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class BalshanBeguilerEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
Player you = game.getPlayer(source.getControllerId());
|
Player you = game.getPlayer(source.getControllerId());
|
||||||
if (player == null || you == null) {
|
if (player == null || you == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class BarbedShockerEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer == null || targetPlayer.getHand().isEmpty()) {
|
if (targetPlayer == null || targetPlayer.getHand().isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class BarbwireDamageEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player activePlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player activePlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (activePlayer != null) {
|
if (activePlayer != null) {
|
||||||
activePlayer.damage(1, source.getSourceId(), source, game);
|
activePlayer.damage(1, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class BasaltGolemEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (creature == null)
|
if (creature == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class BazaarOfWondersEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Spell spell = game.getSpell(targetPointer.getFirst(game, source));
|
Spell spell = game.getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell == null) {
|
if (spell == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class BillFernyEffect extends OneShotEffect {
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID opponentToGainControl = targetPointer.getFirst(game, source);
|
UUID opponentToGainControl = getTargetPointer().getFirst(game, source);
|
||||||
game.addEffect(new GainControlTargetEffect(
|
game.addEffect(new GainControlTargetEffect(
|
||||||
Duration.Custom, true, opponentToGainControl
|
Duration.Custom, true, opponentToGainControl
|
||||||
).setTargetPointer(new FixedTarget(permanent.getId(), game)), source);
|
).setTargetPointer(new FixedTarget(permanent.getId(), game)), source);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class BiolumeEggEffect extends OneShotEffect {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE);
|
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE);
|
||||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class BiomancersFamiliarReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getTargetId().equals(targetPointer.getFirst(game, source));
|
return event.getTargetId().equals(getTargetPointer().getFirst(game, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class BlazeOfGloryRequirementEffect extends RequirementEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
return permanent.getId().equals(targetPointer.getFirst(game, source));
|
return permanent.getId().equals(getTargetPointer().getFirst(game, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class BlazingSalvoEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Player player = game.getPlayer(permanent.getControllerId());
|
Player player = game.getPlayer(permanent.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class BlightwingBanditEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
|
|
||||||
if (controller == null || opponent == null || sourceObject == null) {
|
if (controller == null || opponent == null || sourceObject == null) {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ class BlimComedicGeniusEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
game.addEffect(new GainControlTargetEffect(
|
game.addEffect(new GainControlTargetEffect(
|
||||||
Duration.Custom, true, targetPointer.getFirst(game, source)
|
Duration.Custom, true, getTargetPointer().getFirst(game, source)
|
||||||
).setTargetPointer(new FixedTarget(source.getFirstTarget(), game)), source);
|
).setTargetPointer(new FixedTarget(source.getFirstTarget(), game)), source);
|
||||||
game.getState().processAction(game);
|
game.getState().processAction(game);
|
||||||
Map<UUID, Cards> cardsMap = new HashMap<>();
|
Map<UUID, Cards> cardsMap = new HashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class ReturnToHandEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class BloodClockEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
super.init(source, game);
|
super.init(source, game);
|
||||||
Spell object = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
Spell object = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
zoneChangeCounter = game.getState().getZoneChangeCounter(object.getSourceId()) + 1;
|
zoneChangeCounter = game.getState().getZoneChangeCounter(object.getSourceId()) + 1;
|
||||||
permanentId = object.getSourceId();
|
permanentId = object.getSourceId();
|
||||||
|
|
@ -98,7 +98,7 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
||||||
if (game.getState().getZoneChangeCounter(permanentId) >= zoneChangeCounter) {
|
if (game.getState().getZoneChangeCounter(permanentId) >= zoneChangeCounter) {
|
||||||
discard();
|
discard();
|
||||||
}
|
}
|
||||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null) { // Bloodthirst checked while spell is on the stack so needed to give it already to the spell
|
if (spell != null) { // Bloodthirst checked while spell is on the stack so needed to give it already to the spell
|
||||||
game.getState().addOtherAbility(spell.getCard(), ability, true);
|
game.getState().addOtherAbility(spell.getCard(), ability, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class BloodthirstyAdversaryCopyEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Card> cardsToExile = new LinkedHashSet<>();
|
Set<Card> cardsToExile = new LinkedHashSet<>();
|
||||||
for (UUID cardId : targetPointer.getTargets(game, source)) {
|
for (UUID cardId : getTargetPointer().getTargets(game, source)) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cardsToExile.add(card);
|
cardsToExile.add(card);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class BoneDancerEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player defendingPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && defendingPlayer != null) {
|
if (controller != null && defendingPlayer != null) {
|
||||||
Card lastCreatureCard = null;
|
Card lastCreatureCard = null;
|
||||||
for (Card card : defendingPlayer.getGraveyard().getCards(game)) {
|
for (Card card : defendingPlayer.getGraveyard().getCards(game)) {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class BrainPryEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = game.getObject(source);
|
MageObject sourceObject = game.getObject(source);
|
||||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class BrightflameEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int damageDealt = 0;
|
int damageDealt = 0;
|
||||||
|
|
||||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class BuildersBaneEffect extends OneShotEffect {
|
||||||
Map<UUID, Integer> destroyedArtifactPerPlayer = new HashMap<>();
|
Map<UUID, Integer> destroyedArtifactPerPlayer = new HashMap<>();
|
||||||
|
|
||||||
// Destroy X target artifacts.
|
// Destroy X target artifacts.
|
||||||
for (UUID targetID : this.targetPointer.getTargets(game, source)) {
|
for (UUID targetID : this.getTargetPointer().getTargets(game, source)) {
|
||||||
Permanent permanent = game.getPermanent(targetID);
|
Permanent permanent = game.getPermanent(targetID);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (permanent.destroy(source, game, false)) {
|
if (permanent.destroy(source, game, false)) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class BulwarkDamageEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (opponent != null && controller != null) {
|
if (opponent != null && controller != null) {
|
||||||
int amount = controller.getHand().size() - opponent.getHand().size();
|
int amount = controller.getHand().size() - opponent.getHand().size();
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,13 @@ class BurnAtTheStakeEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int amount = (GetXValue.instance).calculate(game, source, this) * 3;
|
int amount = (GetXValue.instance).calculate(game, source, this) * 3;
|
||||||
|
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.damage(amount, source.getSourceId(), source, game, false, true);
|
permanent.damage(amount, source.getSourceId(), source, game, false, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.damage(amount, source.getSourceId(), source, game);
|
player.damage(amount, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -162,9 +162,7 @@ class BurningCinderFuryOfCrimsonChaosFireCreatureGainControlEffect extends Conti
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||||
if (targetPointer != null) {
|
permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
|
||||||
}
|
|
||||||
if (permanent != null && controller != null) {
|
if (permanent != null && controller != null) {
|
||||||
return permanent.changeControllerId(controller, game, source);
|
return permanent.changeControllerId(controller, game, source);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class CabalTherapistDiscardEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = game.getObject(source);
|
MageObject sourceObject = game.getObject(source);
|
||||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class CabalTherapyEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = game.getObject(source);
|
MageObject sourceObject = game.getObject(source);
|
||||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class CatacombDragonEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent == null || !permanent.isCreature(game)) {
|
if (permanent == null || !permanent.isCreature(game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class CavalcadeOfCalamityEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return game.damagePlayerOrPermanent(
|
return game.damagePlayerOrPermanent(
|
||||||
game.getCombat().getDefenderId(targetPointer.getFirst(game, source)), 1,
|
game.getCombat().getDefenderId(getTargetPointer().getFirst(game, source)), 1,
|
||||||
source.getSourceId(), source, game, false, true
|
source.getSourceId(), source, game, false, true
|
||||||
) > 0;
|
) > 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class CemeteryRecruitmentEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
if (controller.moveCards(card, Zone.HAND, source, game)
|
if (controller.moveCards(card, Zone.HAND, source, game)
|
||||||
&& card.hasSubtype(SubType.ZOMBIE, game)) {
|
&& card.hasSubtype(SubType.ZOMBIE, game)) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class CephalidSnitchEffect extends LoseAbilityTargetEffect{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (targetCreature != null) {
|
if (targetCreature != null) {
|
||||||
List<Ability> toRemove = new ArrayList<>();
|
List<Ability> toRemove = new ArrayList<>();
|
||||||
//Go through protection abilities and sort out any containing black
|
//Go through protection abilities and sort out any containing black
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,6 @@ class ChampionsOfMinasTirithDoIfCostPaid extends DoIfCostPaid {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Player getPayingPlayer(Game game, Ability source) {
|
protected Player getPayingPlayer(Game game, Ability source) {
|
||||||
return game.getPlayer(targetPointer.getFirst(game, source));
|
return game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,13 +120,13 @@ class ChandraAblazeEffect2 extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = (Card) this.getValue("discardedCard");
|
Card card = (Card) this.getValue("discardedCard");
|
||||||
if (card != null && card.getColor(game).isRed()) {
|
if (card != null && card.getColor(game).isRed()) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.damage(4, source.getSourceId(), source, game, false, true);
|
permanent.damage(4, source.getSourceId(), source, game, false, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.damage(4, source.getSourceId(), source, game);
|
player.damage(4, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class ChaosWarpShuffleIntoLibraryEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Player owner = game.getPlayer(permanent.getOwnerId());
|
Player owner = game.getPlayer(permanent.getOwnerId());
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
|
|
@ -93,7 +93,7 @@ class ChaosWarpRevealEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.BATTLEFIELD);
|
Permanent permanent = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class ChargingCinderhornDamageTargetEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicValue amount = new CountersSourceCount(CounterType.FURY);
|
DynamicValue amount = new CountersSourceCount(CounterType.FURY);
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game);
|
player.damage(amount.calculate(game, source, this), source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class ChariotOfTheSunEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
this.discard();
|
this.discard();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class CheckForTrapsEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller == null || opponent == null) {
|
if (controller == null || opponent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class ChoiceOfDamnationsEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
int numberPermanents = game.getState().getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game);
|
int numberPermanents = game.getState().getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class CleansingBeamEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
ObjectColor color = target.getColor(game);
|
ObjectColor color = target.getColor(game);
|
||||||
target.damage(2, source, game);
|
target.damage(2, source, game);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class CloneLegionEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && targetPlayer != null) {
|
if (controller != null && targetPlayer != null) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, targetPlayer.getId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, targetPlayer.getId(), game)) {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class CoercedConfessionMillEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,9 @@ class ColdSnapDamageTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int damage = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game).size();
|
int damage = game.getBattlefield().getAllActivePermanents(filter, getTargetPointer().getFirst(game, source), game).size();
|
||||||
player.damage(damage, source.getSourceId(), source, game);
|
player.damage(damage, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class CollectiveDefianceEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ class CombustibleGearhulkMillAndDamageEffect extends OneShotEffect {
|
||||||
.stream()
|
.stream()
|
||||||
.mapToInt(MageObject::getManaValue)
|
.mapToInt(MageObject::getManaValue)
|
||||||
.sum();
|
.sum();
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
targetPlayer.damage(sumCMC, source.getSourceId(), source, game);
|
targetPlayer.damage(sumCMC, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class CommandeerEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && spell != null) {
|
if (controller != null && spell != null) {
|
||||||
spell.setControllerId(controller.getId());
|
spell.setControllerId(controller.getId());
|
||||||
spell.chooseNewTargets(game, controller.getId(), false, false, null);
|
spell.chooseNewTargets(game, controller.getId(), false, false, null);
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class CommandersPlateEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
Permanent permanent = null;
|
Permanent permanent = null;
|
||||||
if (affectedObjectsSet) {
|
if (affectedObjectsSet) {
|
||||||
permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
discard();
|
discard();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class ConfoundingConundrumEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class ContainmentConstructEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card discardedCard = game.getCard(targetPointer.getFirst(game, source));
|
Card discardedCard = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
Card containmentConstruct = game.getCard(source.getSourceId());
|
Card containmentConstruct = game.getCard(source.getSourceId());
|
||||||
if (discardedCard != null
|
if (discardedCard != null
|
||||||
&& containmentConstruct != null) {
|
&& containmentConstruct != null) {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class CoralFightersEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player defendingPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if(controller != null && defendingPlayer != null) {
|
if(controller != null && defendingPlayer != null) {
|
||||||
Card card = defendingPlayer.getLibrary().getFromTop(game);
|
Card card = defendingPlayer.getLibrary().getFromTop(game);
|
||||||
if(card != null) {
|
if(card != null) {
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,11 @@ class CorruptedResolveEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
Player player = game.getPlayer(spell.getControllerId());
|
Player player = game.getPlayer(spell.getControllerId());
|
||||||
if (player != null && player.getCounters().containsKey(CounterType.POISON))
|
if (player != null && player.getCounters().containsKey(CounterType.POISON))
|
||||||
return game.getStack().counter(targetPointer.getFirst(game, source), source, game);
|
return game.getStack().counter(getTargetPointer().getFirst(game, source), source, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ class TheOmenkeelEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
int damage = (Integer) getValue("damage");
|
int damage = (Integer) getValue("damage");
|
||||||
if (player == null || damage < 1) {
|
if (player == null || damage < 1) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class CounterbalanceEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if (controller != null && sourcePermanent != null) {
|
if (controller != null && sourcePermanent != null) {
|
||||||
Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
Spell spell = (Spell) game.getStack().getStackObject(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
Card topcard = controller.getLibrary().getFromTop(game);
|
Card topcard = controller.getLibrary().getFromTop(game);
|
||||||
if (topcard != null) {
|
if (topcard != null) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class CountermandEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean countered = false;
|
boolean countered = false;
|
||||||
StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
StackObject stackObject = game.getStack().getStackObject(getTargetPointer().getFirst(game, source));
|
||||||
if (game.getStack().counter(source.getFirstTarget(), source, game)) {
|
if (game.getStack().counter(source.getFirstTarget(), source, game)) {
|
||||||
countered = true;
|
countered = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class KillerEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
target.damage(3, source, game);
|
target.damage(3, source, game);
|
||||||
for (Permanent p : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
for (Permanent p : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class CrownOfEmpiresEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
boolean scepter = false;
|
boolean scepter = false;
|
||||||
boolean throne = false;
|
boolean throne = false;
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
||||||
|
|
@ -103,7 +103,7 @@ class CrownOfEmpiresControlEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString());
|
UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString());
|
||||||
if (permanent != null && controllerId != null) {
|
if (permanent != null && controllerId != null) {
|
||||||
return permanent.changeControllerId(controllerId, game, source);
|
return permanent.changeControllerId(controllerId, game, source);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class CruelRealityEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player cursedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player cursedPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (cursedPlayer == null || controller == null) {
|
if (cursedPlayer == null || controller == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ class CulturalExchangeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player1 = game.getPlayer(targetPointer.getTargets(game, source).get(0));
|
Player player1 = game.getPlayer(getTargetPointer().getTargets(game, source).get(0));
|
||||||
Player player2 = game.getPlayer(targetPointer.getTargets(game, source).get(1));
|
Player player2 = game.getPlayer(getTargetPointer().getTargets(game, source).get(1));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player1 == null || player2 == null || controller == null) {
|
if (player1 == null || player2 == null || controller == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class CunningAbductionExileEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
MageObject sourceObject = game.getObject(source);
|
MageObject sourceObject = game.getObject(source);
|
||||||
if (opponent != null && sourceObject != null) {
|
if (opponent != null && sourceObject != null) {
|
||||||
opponent.revealCards(sourceObject.getName(), opponent.getHand(), game);
|
opponent.revealCards(sourceObject.getName(), opponent.getHand(), game);
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class CurseOfThePiercedHeartEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller == null || opponent == null) {
|
if (controller == null || opponent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class CurseOfTheWerefoxFightEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent triggeredCreature = game.getPermanent(this.targetPointer.getFirst(game, source));
|
Permanent triggeredCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||||
if (triggeredCreature != null
|
if (triggeredCreature != null
|
||||||
&& target != null
|
&& target != null
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,12 @@ class CursedScrollEffect extends OneShotEffect {
|
||||||
revealed.add(card);
|
revealed.add(card);
|
||||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||||
if (CardUtil.haveSameNames(card, cardName, game)) {
|
if (CardUtil.haveSameNames(card, cardName, game)) {
|
||||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
creature.damage(2, source.getSourceId(), source, game, false, true);
|
creature.damage(2, source.getSourceId(), source, game, false, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.damage(2, source.getSourceId(), source, game);
|
player.damage(2, source.getSourceId(), source, game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class BecomeSwampEffect extends BecomesBasicLandTargetEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
|
Permanent land = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||||
if (land == null || land.getCounters(game).getCount(CounterType.MIRE) < 1) {
|
if (land == null || land.getCounters(game).getCount(CounterType.MIRE) < 1) {
|
||||||
this.discard();
|
this.discard();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class DamnablePactEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
targetPlayer.drawCards(source.getManaCostsToPay().getX(), source, game);
|
targetPlayer.drawCards(source.getManaCostsToPay().getX(), source, game);
|
||||||
targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, source, false);
|
targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, source, false);
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class DarkTemperEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@ class DarthTyranusEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player1 = game.getPlayer(targetPointer.getTargets(game, source).get(0));
|
Player player1 = game.getPlayer(getTargetPointer().getTargets(game, source).get(0));
|
||||||
Player player2 = game.getPlayer(targetPointer.getTargets(game, source).get(1));
|
Player player2 = game.getPlayer(getTargetPointer().getTargets(game, source).get(1));
|
||||||
if (player1 != null && player2 != null) {
|
if (player1 != null && player2 != null) {
|
||||||
player1.setLife(5, game, source);
|
player1.setLife(5, game, source);
|
||||||
player1.setLife(30, game, source);
|
player1.setLife(30, game, source);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class DazzlingSphinxEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller == null || opponent == null) {
|
if (controller == null || opponent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class DeathbringerLiegeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent p = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (p != null && p.isTapped()) {
|
if (p != null && p.isTapped()) {
|
||||||
p.destroy(source, game, false);
|
p.destroy(source, game, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class DebtOfLoyaltyEffect extends RegenerateTargetEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (super.replaceEvent(event, source, game) && permanent != null) {
|
if (super.replaceEvent(event, source, game) && permanent != null) {
|
||||||
GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||||
effect.setTargetPointer(this.getTargetPointer().copy());
|
effect.setTargetPointer(this.getTargetPointer().copy());
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class DefiantVanguardEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
Permanent blockedCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent blockedCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
Permanent defiantVanguard = game.getPermanent(source.getSourceId());
|
Permanent defiantVanguard = game.getPermanent(source.getSourceId());
|
||||||
if (blockedCreature != null) {
|
if (blockedCreature != null) {
|
||||||
if (game.getState().getValue(blockedCreature.toString()).equals(blockedCreature.getZoneChangeCounter(game))) { // true if it did not change zones
|
if (game.getState().getValue(blockedCreature.toString()).equals(blockedCreature.getZoneChangeCounter(game))) { // true if it did not change zones
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ class DelifsConeLifeEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
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());
|
||||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null || permanent != null) {
|
if (player != null || permanent != null) {
|
||||||
player.gainLife(permanent.getPower().getValue(), game, source);
|
player.gainLife(permanent.getPower().getValue(), game, source);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class DementiaSliverEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
MageObject sourceObject = game.getObject(source);
|
MageObject sourceObject = game.getObject(source);
|
||||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
|
||||||
if (opponent != null && sourceObject != null && cardName != null && !cardName.isEmpty()) {
|
if (opponent != null && sourceObject != null && cardName != null && !cardName.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,7 @@ class DescendantsFurySacrificeCost extends CostImpl implements SacrificeCost {
|
||||||
if (watcher == null) {
|
if (watcher == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TargetPointer targetPointer = source.getEffects().get(0).getTargetPointer();
|
Player damagedPlayer = game.getPlayer(source.getEffects().get(0).getTargetPointer().getFirst(game, source));
|
||||||
if (targetPointer == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller == null || damagedPlayer == null) {
|
if (controller == null || damagedPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -114,11 +110,7 @@ class DescendantsFurySacrificeCost extends CostImpl implements SacrificeCost {
|
||||||
if (watcher == null) {
|
if (watcher == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TargetPointer targetPointer = source.getEffects().get(0).getTargetPointer();
|
Player damagedPlayer = game.getPlayer(source.getEffects().get(0).getTargetPointer().getFirst(game, source));
|
||||||
if (targetPointer == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller == null || damagedPlayer == null) {
|
if (controller == null || damagedPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class DesertionEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
StackObject spell = game.getStack().getStackObject(getTargetPointer().getFirst(game, source));
|
||||||
if (spell == null) {
|
if (spell == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class DevourFleshSacrificeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class DimirCutpurseEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player you = game.getPlayer(source.getControllerId());
|
Player you = game.getPlayer(source.getControllerId());
|
||||||
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
Player damagedPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (damagedPlayer != null) {
|
if (damagedPlayer != null) {
|
||||||
damagedPlayer.discard(1, false, false, source, game);
|
damagedPlayer.discard(1, false, false, source, game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class DinOfTheFireherdEffect extends OneShotEffect {
|
||||||
int blackCreaturesControllerControls = game.getBattlefield().countAll(blackCreatureFilter, source.getControllerId(), game);
|
int blackCreaturesControllerControls = game.getBattlefield().countAll(blackCreatureFilter, source.getControllerId(), game);
|
||||||
int redCreaturesControllerControls = game.getBattlefield().countAll(redCreatureFilter, source.getControllerId(), game);
|
int redCreaturesControllerControls = game.getBattlefield().countAll(redCreatureFilter, source.getControllerId(), game);
|
||||||
|
|
||||||
Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (targetOpponent != null) {
|
if (targetOpponent != null) {
|
||||||
Effect effect = new SacrificeEffect(new FilterControlledCreaturePermanent(), blackCreaturesControllerControls, "Target Opponent");
|
Effect effect = new SacrificeEffect(new FilterControlledCreaturePermanent(), blackCreaturesControllerControls, "Target Opponent");
|
||||||
effect.setTargetPointer(new FixedTarget(targetOpponent.getId()));
|
effect.setTargetPointer(new FixedTarget(targetOpponent.getId()));
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class DireBlunderbussGainAbilityEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = null;
|
Permanent permanent = null;
|
||||||
if (affectedObjectsSet) {
|
if (affectedObjectsSet) {
|
||||||
permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
discard();
|
discard();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class DispersalShieldEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
DynamicValue amount = new HighestManaValueCount();
|
DynamicValue amount = new HighestManaValueCount();
|
||||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null && spell.getManaValue() <= amount.calculate(game, source, this)) {
|
if (spell != null && spell.getManaValue() <= amount.calculate(game, source, this)) {
|
||||||
return game.getStack().counter(source.getFirstTarget(), source, game);
|
return game.getStack().counter(source.getFirstTarget(), source, game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class DispossessEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExi
|
||||||
if (cardName == null) {
|
if (cardName == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return super.applySearchAndExile(game, source, cardName, targetPointer.getFirst(game, source));
|
return super.applySearchAndExile(game, source, cardName, getTargetPointer().getFirst(game, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class DisruptingShoalCounterTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
|
||||||
if (spell != null && isManaValueEqual(source, spell.getManaValue())) {
|
if (spell != null && isManaValueEqual(source, spell.getManaValue())) {
|
||||||
return game.getStack().counter(source.getFirstTarget(), source, game);
|
return game.getStack().counter(source.getFirstTarget(), source, game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class ChangeColorEffect extends OneShotEffect {
|
||||||
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());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
Permanent chosen = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent chosen = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null && permanent != null) {
|
if (player != null && permanent != null) {
|
||||||
ContinuousEffect effect = new BecomesColorTargetEffect(null, Duration.EndOfTurn);
|
ContinuousEffect effect = new BecomesColorTargetEffect(null, Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(new FixedTarget(chosen.getId(), game));
|
effect.setTargetPointer(new FixedTarget(chosen.getId(), game));
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ class DragonsFireEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent targetedPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent targetedPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (targetedPermanent == null) {
|
if (targetedPermanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class DralnuLichLordFlashbackEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
|
FlashbackAbility ability = new FlashbackAbility(card, card.getManaCost());
|
||||||
ability.setSourceId(card.getId());
|
ability.setSourceId(card.getId());
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue