mirror of
https://github.com/correl/mage.git
synced 2025-04-04 17:00:13 -09:00
Refactored Target pointers. All tests pass now.
This commit is contained in:
parent
13f547f1a2
commit
12954eceee
138 changed files with 259 additions and 182 deletions
Mage.Sets/src/mage/sets
avacynrestored
BurnAtTheStake.javaGallowsAtWillowHill.javaGhostlyFlicker.javaJointAssault.javaStolenGoods.javaTamiyoTheMoonSage.javaTibaltTheFiendBlooded.java
championsofkamigawa
BudokaGardener.javaCranialExtraction.javaHeartbeatOfSpring.javaHisokaMinamoSensei.javaHisokasGuard.javaKikuNightsFlower.javaMindblaze.javaNezumiGraverobber.javaSosukeSonOfSeshiro.java
conflux
darkascension
AfflictedDeserter.javaCurseOfEchoes.javaDungeonGeists.javaHavengulLich.javaIncreasingSavagery.javaIncreasingVengeance.javaLostInTheWoods.javaSoulSeizer.javaSpitefulShadows.javaWrackWithMadness.java
darksteel
eventide
innistrad
BackFromTheBrink.javaBalefireDragon.javaBrimstoneVolley.javaCacklingCounterpart.javaCreepyDoll.javaElderCathar.javaFrightfulDelusion.javaGarrukRelentless.javaHereticsPunishment.javaSeverTheBloodline.javaSkaabRuinator.javaSnapcasterMage.java
magic2010
magic2011
magic2012
BloodlordOfVaasgoth.javaCrownOfEmpires.javaGoblinBangchuckers.javaJaceMemoryAdept.javaScepterOfEmpires.javaScrambleverse.java
mirrodinbesieged
newphyrexia
AuriokSurvivors.javaBeastWithin.javaCorruptedResolve.javaExclusionRitual.javaGitaxianProbe.javaInvaderParasite.javaIsolationCell.javaMortisDogs.javaOmenMachine.javaVorinclexVoiceOfHunger.javaWhisperingSpecter.java
ravnika
riseoftheeldrazi
scarsofmirrodin
ArcTrail.javaEngulfingSlagwurm.javaFulgentDistraction.javaGolemArtisan.javaLiegeOfTheTangle.javaMemoricide.javaMimicVat.javaNimDeathmantle.javaPainfulQuandary.javaPrecursorGolem.javaPsychicMiasma.javaRustTick.javaShapeAnew.javaVenserTheSojourner.java
shardsofalara
tenth
worldwake
zendikar
Mage/src/mage/abilities
common
effects
|
@ -158,13 +158,13 @@ class BurnAtTheStakeEffect extends OneShotEffect<BurnAtTheStakeEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int amount = (new GetXValue()).calculate(game, source) * 3;
|
||||
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(amount, source.getSourceId(), game, true, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.damage(amount, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -104,8 +104,8 @@ class GallowsAtWillowHillEffect extends OneShotEffect<GallowsAtWillowHillEffect>
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
if (targetPointer.getTargets(source).size() > 0) {
|
||||
for (UUID permanentId : targetPointer.getTargets(source)) {
|
||||
if (targetPointer.getTargets(game, source).size() > 0) {
|
||||
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(permanent.getControllerId());
|
||||
|
|
|
@ -96,7 +96,7 @@ class GhostlyFlickerEffect extends OneShotEffect<GhostlyFlickerEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID exileId = source.getSourceId();
|
||||
for (UUID permanentId : targetPointer.getTargets(source)) {
|
||||
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
||||
Permanent target = game.getPermanent(permanentId);
|
||||
if (target != null) {
|
||||
target.moveToExile(exileId, "Ghostly Flicker", source.getId(), game);
|
||||
|
|
|
@ -92,7 +92,7 @@ class JointAssaultBoostTargetEffect extends ContinuousEffectImpl<JointAssaultBoo
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
UUID permanentId = targetPointer.getFirst(source);
|
||||
UUID permanentId = targetPointer.getFirst(game, source);
|
||||
Permanent target = game.getPermanent(permanentId);
|
||||
if (target != null) {
|
||||
if (target.getPairedCard() != null) {
|
||||
|
@ -104,7 +104,7 @@ class JointAssaultBoostTargetEffect extends ContinuousEffectImpl<JointAssaultBoo
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
UUID permanentId = targetPointer.getFirst(source);
|
||||
UUID permanentId = targetPointer.getFirst(game, source);
|
||||
|
||||
Permanent target = game.getPermanent(permanentId);
|
||||
if (target != null) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class StolenGoodsEffect extends OneShotEffect<StolenGoodsEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null && player.getLibrary().size() > 0) {
|
||||
Library library = player.getLibrary();
|
||||
Card card;
|
||||
|
|
|
@ -199,7 +199,7 @@ class TamiyoTheMoonSageEffect extends OneShotEffect<TamiyoTheMoonSageEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(this.targetPointer.getFirst(source));
|
||||
Card card = game.getCard(this.targetPointer.getFirst(game, source));
|
||||
if (card != null) {
|
||||
return card.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl<TibaltTheF
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null && controllerId != null) {
|
||||
return permanent.changeControllerId(controllerId, game);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class BudokaGardenerEffect extends OneShotEffect<BudokaGardenerEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card c = game.getCard(targetPointer.getFirst(source));
|
||||
Card c = game.getCard(targetPointer.getFirst(game, source));
|
||||
if (c != null) {
|
||||
c.moveToZone(Constants.Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class CranialExtractionEffect extends OneShotEffect<CranialExtractionEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (player != null && controller != null) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
|
|
|
@ -124,7 +124,7 @@ class HeartbeatOfSpringEffect extends ManaEffect<HeartbeatOfSpringEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(source));
|
||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
|
||||
Abilities<ManaAbility> mana = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD);
|
||||
Mana types = new Mana();
|
||||
for (ManaAbility ability: mana) {
|
||||
|
|
|
@ -140,11 +140,11 @@ class HisokaMinamoSenseiCounterEffect extends OneShotEffect<HisokaMinamoSenseiCo
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
HisokaMinamoSenseiDiscardTargetCost cost = (HisokaMinamoSenseiDiscardTargetCost) source.getCosts().get(0);
|
||||
if (cost != null && cost.getConvertedCosts() == spell.getManaCost().convertedManaCost()) {
|
||||
return game.getStack().counter(targetPointer.getFirst(source), source.getSourceId(), game);
|
||||
return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -110,7 +110,7 @@ class HisokasGuardGainAbilityTargetEffect extends ContinuousEffectImpl<HisokasGu
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
// remember the guarded creature
|
||||
Permanent guardedCreature = game.getPermanent(this.getTargetPointer().getFirst(source));
|
||||
Permanent guardedCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
Permanent hisokasGuard = game.getPermanent(source.getSourceId());
|
||||
if (guardedCreature != null && hisokasGuard != null) {
|
||||
hisokasGuard.addConnectedCard("HisokasGuard", guardedCreature.getId());
|
||||
|
|
|
@ -100,7 +100,7 @@ class KikuNightsFlowerEffect extends OneShotEffect<KikuNightsFlowerEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, true, false);
|
||||
return true;
|
||||
|
|
|
@ -90,7 +90,7 @@ class MindblazeEffect extends OneShotEffect<MindblazeEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player playerControls = game.getPlayer(source.getControllerId());
|
||||
if (player != null && playerControls != null) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
|
|
|
@ -99,7 +99,7 @@ class NezumiGraverobberFlipEffect extends OneShotEffect<NezumiGraverobberFlipEff
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(targetPointer.getFirst(source));
|
||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||
if (card != null) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
|
|
|
@ -139,7 +139,7 @@ class SosukeSonOfSeshiroEffect extends OneShotEffect<SosukeSonOfSeshiroEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(source));
|
||||
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
AtTheEndOfCombatDelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect());
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
|
|
|
@ -85,7 +85,7 @@ class DarkTemperEffect extends OneShotEffect<DarkTemperEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -152,8 +152,8 @@ class WerewolfRansackerEffect extends OneShotEffect<WerewolfRansackerEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
if (targetPointer.getTargets(source).size() > 0) {
|
||||
for (UUID permanentId : targetPointer.getTargets(source)) {
|
||||
if (targetPointer.getTargets(game, source).size() > 0) {
|
||||
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
if (permanent.destroy(source.getId(), game, false)) {
|
||||
|
|
|
@ -142,7 +142,7 @@ class CurseOfEchoesEffect extends OneShotEffect<CurseOfEchoesEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
String chooseMessage = "Copy target spell? You may choose new targets for the copy.";
|
||||
for (UUID playerId: game.getPlayerList()) {
|
||||
|
|
|
@ -136,7 +136,7 @@ class DungeonGeistsEffect extends ReplacementEffectImpl<DungeonGeistsEffect> {
|
|||
|
||||
|
||||
if (game.getTurn().getStepType() == Constants.PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
||||
if (event.getTargetId().equals(targetPointer.getFirst(source))) {
|
||||
if (event.getTargetId().equals(targetPointer.getFirst(game, source))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ class HavengulLichPlayEffect extends AsThoughEffectImpl<HavengulLichPlayEffect>
|
|||
public boolean applies(UUID sourceId, Ability source, Game game) {
|
||||
Card card = game.getCard(sourceId);
|
||||
if (card != null && game.getState().getZone(card.getId()) == Constants.Zone.GRAVEYARD) {
|
||||
if (targetPointer.getFirst(source).equals(card.getId()))
|
||||
if (targetPointer.getFirst(game, source).equals(card.getId()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -136,7 +136,7 @@ class HavengulLichPlayedEffect extends OneShotEffect<HavengulLichPlayedEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
DelayedTriggeredAbility ability = new HavengulLichDelayedTriggeredAbility(targetPointer.getFirst(source));
|
||||
DelayedTriggeredAbility ability = new HavengulLichDelayedTriggeredAbility(targetPointer.getFirst(game, source));
|
||||
ability.setSourceId(source.getSourceId());
|
||||
ability.setControllerId(source.getControllerId());
|
||||
game.addDelayedTriggeredAbility(ability);
|
||||
|
|
|
@ -91,7 +91,7 @@ class IncreasingSavageryEffect extends OneShotEffect<IncreasingSavageryEffect> {
|
|||
if (spell.getFromZone() == Constants.Zone.GRAVEYARD) {
|
||||
amount = 10;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class IncreasingVengeanceEffect extends OneShotEffect<IncreasingVengeanceEffect>
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
|
|
|
@ -97,7 +97,7 @@ class LostInTheWoodsEffect extends OneShotEffect<LostInTheWoodsEffect> {
|
|||
|
||||
if (card != null) {
|
||||
if (card.getSubtype().contains("Forest")) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.removeFromCombat(game);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class SoulSeizerEffect extends OneShotEffect<SoulSeizerEffect> {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && permanent.canTransform()) {
|
||||
if (permanent.transform(game)) {
|
||||
Permanent attachTo = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent attachTo = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (attachTo != null) {
|
||||
return attachTo.addAttachment(source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ class SpitefulShadowsEffect extends OneShotEffect<SpitefulShadowsEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Integer damageAmount = (Integer) this.getValue("damageAmount");
|
||||
UUID targetId = this.targetPointer.getFirst(source);
|
||||
UUID targetId = this.targetPointer.getFirst(game, source);
|
||||
if (damageAmount != null && targetId != null) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent == null) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class WrackWithMadnessEffect extends OneShotEffect<WrackWithMadnessEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(permanent.getPower().getValue(), permanent.getId(), game, true, false);
|
||||
return true;
|
||||
|
|
|
@ -93,7 +93,7 @@ class EmissaryOfHopeEffect extends OneShotEffect<EmissaryOfHopeEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player sourcePlayer = game.getPlayer(source.getControllerId());
|
||||
if (targetPlayer != null && sourcePlayer != null) {
|
||||
int amount = game.getBattlefield().count(filter, targetPlayer.getId(), game);
|
||||
|
|
|
@ -108,7 +108,7 @@ class DeathbringerLiegeEffect extends OneShotEffect<DeathbringerLiegeEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (p != null && p.isTapped()) {
|
||||
p.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class BackFromTheBrinkEffect extends OneShotEffect<BackFromTheBrinkEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(this.targetPointer.getFirst(source));
|
||||
Card card = game.getCard(this.targetPointer.getFirst(game, source));
|
||||
if (card != null) {
|
||||
EmptyToken token = new EmptyToken();
|
||||
CardUtil.copyTo(token).from(card);
|
||||
|
|
|
@ -86,7 +86,7 @@ class BalefireDragonEffect extends OneShotEffect<BalefireDragonEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
int amount = (Integer)getValue("damage");
|
||||
if (amount > 0) {
|
||||
|
|
|
@ -86,12 +86,12 @@ class BrimstoneVolleyEffect extends OneShotEffect<BrimstoneVolleyEffect> {
|
|||
if (watcher.conditionMet()) {
|
||||
damage = 5;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(damage, source.getSourceId(), game, true, false);
|
||||
return true;
|
||||
}
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.damage(damage, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -85,7 +85,7 @@ class CacklingCounterpartEffect extends OneShotEffect<CacklingCounterpartEffect>
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(this.targetPointer.getFirst(source));
|
||||
Card card = game.getCard(this.targetPointer.getFirst(game, source));
|
||||
if (card != null) {
|
||||
EmptyToken token = new EmptyToken();
|
||||
CardUtil.copyTo(token).from(card);
|
||||
|
|
|
@ -123,7 +123,7 @@ class CreepyDollEffect extends OneShotEffect<CreepyDollEffect> {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.flipCoin(game)) {
|
||||
UUID targetId = getTargetPointer().getFirst(source);
|
||||
UUID targetId = getTargetPointer().getFirst(game, source);
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.destroy(source.getId(), game, false);
|
||||
|
|
|
@ -94,7 +94,7 @@ class ElderCatharAddCountersTargetEffect extends OneShotEffect<ElderCatharAddCou
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
if (counter != null) {
|
||||
if (permanent.hasSubtype("Human")) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class FrightfulDelusionEffect extends OneShotEffect<FrightfulDelusionEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
StackObject spell = game.getStack().getStackObject(
|
||||
targetPointer.getFirst(source));
|
||||
targetPointer.getFirst(game, source));
|
||||
Cost cost = new GenericManaCost(1);
|
||||
if (spell != null) {
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
|
|
|
@ -135,7 +135,7 @@ class GarrukRelentlessDamageEffect extends OneShotEffect<GarrukRelentlessDamageE
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
int damage = permanent.getPower().getValue();
|
||||
permanent.damage(3, source.getSourceId(), game, true, false);
|
||||
|
|
|
@ -96,12 +96,12 @@ class HereticsPunishmentEffect extends OneShotEffect<HereticsPunishmentEffect> {
|
|||
maxCost = test;
|
||||
}
|
||||
}
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(maxCost, source.getSourceId(), game, true, false);
|
||||
return true;
|
||||
}
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
targetPlayer.damage(maxCost, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -90,7 +90,7 @@ class SeverTheBloodlineEffect extends OneShotEffect<SeverTheBloodlineEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (targetPermanent != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.getName().add(targetPermanent.getName());
|
||||
|
|
|
@ -138,7 +138,7 @@ class SkaabRuinatorEffect extends OneShotEffect<SkaabRuinatorEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card target = (Card) game.getObject(targetPointer.getFirst(source));
|
||||
Card target = (Card) game.getObject(targetPointer.getFirst(game, source));
|
||||
if (target != null) {
|
||||
Player controller = game.getPlayer(target.getOwnerId());
|
||||
if (controller != null) {
|
||||
|
|
|
@ -108,7 +108,7 @@ class SnapcasterMageEffect extends ContinuousEffectImpl<SnapcasterMageEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(targetPointer.getFirst(source));
|
||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||
if (card != null) {
|
||||
FlashbackAbility ability;
|
||||
if (card.getCardType().contains(CardType.INSTANT))
|
||||
|
|
|
@ -90,11 +90,11 @@ class ConsumeSpiritEffect extends OneShotEffect<ConsumeSpiritEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int damage = source.getManaCostsToPay().getX();
|
||||
if (damage > 0) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(source));
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(damage, source.getSourceId(), game, true, false);
|
||||
} else {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(source));
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.damage(damage, source.getSourceId(), game, false, true);
|
||||
}
|
||||
|
|
|
@ -86,12 +86,12 @@ class FireballEffect extends OneShotEffect<FireballEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int numTargets = targetPointer.getTargets(source).size();
|
||||
int numTargets = targetPointer.getTargets(game, source).size();
|
||||
int damage = source.getManaCostsToPay().getX();
|
||||
if (numTargets > 0) {
|
||||
int damagePer = damage/numTargets;
|
||||
if (damagePer > 0) {
|
||||
for (UUID targetId: targetPointer.getTargets(source)) {
|
||||
for (UUID targetId: targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.damage(damagePer, source.getSourceId(), game, true, false);
|
||||
|
|
|
@ -121,7 +121,7 @@ class HiveMindEffect extends OneShotEffect<HiveMindEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (spell != null && player != null) {
|
||||
Set<UUID> players = player.getInRange();
|
||||
|
|
|
@ -96,7 +96,7 @@ class SphinxAmbassadorEffect extends OneShotEffect<SphinxAmbassadorEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
|
||||
if (player != null && targetPlayer != null) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary();
|
||||
|
|
|
@ -87,7 +87,7 @@ class MerfolkSpyEffect extends OneShotEffect<MerfolkSpyEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null && player.getHand().size() > 0) {
|
||||
Cards revealed = new CardsImpl();
|
||||
revealed.add(player.getHand().getRandom(game));
|
||||
|
|
|
@ -108,7 +108,7 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell object = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell object = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (object != null) {
|
||||
Permanent permanent = game.getPermanent(object.getSourceId());
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class CrownOfEmpiresEffect extends OneShotEffect<CrownOfEmpiresEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent target = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
boolean scepter = false;
|
||||
boolean throne = false;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
||||
|
@ -130,7 +130,7 @@ class CrownOfEmpiresControlEffect extends ContinuousEffectImpl<CrownOfEmpiresCon
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString());
|
||||
if (permanent != null && controllerId != null) {
|
||||
return permanent.changeControllerId(controllerId, game);
|
||||
|
|
|
@ -91,12 +91,12 @@ class GoblinBangchuckersEffect extends OneShotEffect<GoblinBangchuckersEffect> {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(2, source.getSourceId(), game, true, false);
|
||||
return true;
|
||||
}
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.damage(2, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -99,7 +99,7 @@ class JaceMemoryAdeptEffect extends DrawCardTargetEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID target : targetPointer.getTargets(source)) {
|
||||
for (UUID target : targetPointer.getTargets(game, source)) {
|
||||
Player player = game.getPlayer(target);
|
||||
if (player != null) {
|
||||
player.drawCards(amount.calculate(game, source), game);
|
||||
|
|
|
@ -95,7 +95,7 @@ class ScepterOfEmpiresEffect extends OneShotEffect<ScepterOfEmpiresEffect> {
|
|||
|
||||
int amount = throne && crown ? 3 : 1;
|
||||
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.damage(amount, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -125,7 +125,7 @@ class ScrambleverseControlEffect extends ContinuousEffectImpl<ScrambleverseContr
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null && controllerId != null) {
|
||||
return permanent.changeControllerId(controllerId, game);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class CryptoplasmTransformEffect extends ContinuousEffectImpl<CryptoplasmTransfo
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(targetPointer.getFirst(source));
|
||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
|
||||
if (card == null || permanent == null)
|
||||
|
|
|
@ -153,7 +153,7 @@ class KnowledgePoolEffect2 extends OneShotEffect<KnowledgePoolEffect2> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
if (spell.moveToExile(source.getSourceId(), "Knowledge Pool Exile", id, game)) {
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
|
|
|
@ -132,7 +132,7 @@ class MirrorworksEffect extends OneShotEffect<MirrorworksEffect> {
|
|||
if (player.chooseUse(outcome, "Pay " + cost.getText() + " and " + staticText, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
|
||||
UUID targetId = targetPointer.getFirst(source);
|
||||
UUID targetId = targetPointer.getFirst(game, source);
|
||||
if (targetId != null) {
|
||||
MageObject target = game.getLastKnownInformation(targetId, Constants.Zone.BATTLEFIELD);
|
||||
if (target != null && target instanceof Permanent) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class MorbidPlunderEffect extends OneShotEffect<MorbidPlunderEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
for (UUID target : targetPointer.getTargets(source)) {
|
||||
for (UUID target : targetPointer.getTargets(game, source)) {
|
||||
Card card = game.getCard(target);
|
||||
if (card != null) {
|
||||
result |= card.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
|
|
|
@ -96,7 +96,7 @@ class AuriokSurvivorsEffect extends OneShotEffect<AuriokSurvivorsEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (p != null && player != null && sourcePermanent != null) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class BeastWithinEffect extends OneShotEffect<BeastWithinEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(source), Constants.Zone.BATTLEFIELD);
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
|
||||
if (permanent != null) {
|
||||
BeastToken token = new BeastToken();
|
||||
token.putOntoBattlefield(1, game, source.getId(), permanent.getControllerId());
|
||||
|
|
|
@ -80,11 +80,11 @@ class CorruptedResolveEffect extends OneShotEffect<CorruptedResolveEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
if (player != null && player.getCounters().containsKey(CounterType.POISON))
|
||||
return game.getStack().counter(targetPointer.getFirst(source), source.getSourceId(), game);
|
||||
return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class ExclusionRitualImprintEffect extends OneShotEffect<ExclusionRitualImprintE
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (sourcePermanent != null && targetPermanent != null) {
|
||||
targetPermanent.moveToExile(getId(), "Exclusion Ritual (Imprint)", source.getSourceId(), game);
|
||||
sourcePermanent.imprint(targetPermanent.getId(), game);
|
||||
|
|
|
@ -80,7 +80,7 @@ class GitaxianProbeEffect extends OneShotEffect<GitaxianProbeEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null && controller != null) {
|
||||
controller.lookAtCards("Gitaxian Probe", player.getHand(), game);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class InvaderParasiteImprintEffect extends OneShotEffect<InvaderParasiteImprintE
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (sourcePermanent != null && targetPermanent != null) {
|
||||
targetPermanent.moveToExile(getId(), "Invader Parasite (Imprint)", source.getSourceId(), game);
|
||||
sourcePermanent.imprint(targetPermanent.getId(), game);
|
||||
|
|
|
@ -119,7 +119,7 @@ class IsolationCellEffect extends OneShotEffect<IsolationCellEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
GenericManaCost cost = new GenericManaCost(2);
|
||||
if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ class MortisDogsEffect extends OneShotEffect<MortisDogsEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && sourcePermanent != null) {
|
||||
player.loseLife(sourcePermanent.getPower().getValue(), game);
|
||||
|
|
|
@ -152,7 +152,7 @@ class OmenMachineEffect2 extends OneShotEffect<OmenMachineEffect2> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -136,7 +136,7 @@ class VorinclexEffect extends ManaEffect<VorinclexEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(source));
|
||||
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
|
||||
Abilities<ManaAbility> mana = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD);
|
||||
Mana types = new Mana();
|
||||
for (ManaAbility ability: mana) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class WhisperingSpecterEffect extends OneShotEffect<WhisperingSpecterEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
int value = player.getCounters().getCount(CounterType.POISON);
|
||||
if (value > 0) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class ClutchOfTheUndercityEffect extends OneShotEffect<ClutchOfTheUndercityEffec
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(source), Constants.Zone.BATTLEFIELD);
|
||||
Permanent p = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
|
||||
if (p != null) {
|
||||
Player player = game.getPlayer(p.getControllerId());
|
||||
if (player != null) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class LeaveNoTraceEffect extends OneShotEffect<LeaveNoTraceEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent target = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (target != null) {
|
||||
ObjectColor color = target.getColor();
|
||||
target.destroy(source.getSourceId(), game, false);
|
||||
|
|
|
@ -122,7 +122,7 @@ class GravityWellEffect extends ContinuousEffectImpl<GravityWellEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Constants.Layer layer, Constants.SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
|
|
|
@ -95,7 +95,7 @@ class ArcTrailEffect extends OneShotEffect {
|
|||
boolean twoDamageDone = false;
|
||||
int damage = 2;
|
||||
|
||||
for ( UUID target : targetPointer.getTargets(source) ) {
|
||||
for ( UUID target : targetPointer.getTargets(game, source) ) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
|
||||
if ( twoDamageDone ) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class EngulfingSlagwurmEffect extends OneShotEffect<EngulfingSlagwurmEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject c = game.getLastKnownInformation(targetPointer.getFirst(source), Constants.Zone.BATTLEFIELD);
|
||||
MageObject c = game.getLastKnownInformation(targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
|
||||
if (c != null && controller != null) {
|
||||
controller.gainLife(c.getPower().getValue(), game);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class FulgentDistractionEffect extends OneShotEffect<FulgentDistractionEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for ( UUID target : targetPointer.getTargets(source) ) {
|
||||
for ( UUID target : targetPointer.getTargets(game, source) ) {
|
||||
Permanent creature = game.getPermanent(target);
|
||||
|
||||
List<UUID> copiedAttachments = new ArrayList<UUID>(creature.getAttachments());
|
||||
|
|
|
@ -113,7 +113,7 @@ class GolemArtisanEffect extends OneShotEffect<GolemArtisanEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
Player playerControls = game.getPlayer(source.getControllerId());
|
||||
if (permanent != null && playerControls != null) {
|
||||
Choice abilityChoice = new ChoiceImpl();
|
||||
|
|
|
@ -174,7 +174,7 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl<LiegeOfTheTangleEffect
|
|||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (this.affectedObjectsSet) {
|
||||
for (UUID permId: targetPointer.getTargets(source)) {
|
||||
for (UUID permId: targetPointer.getTargets(game, source)) {
|
||||
objects.add(permId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class MemoricideEffect extends OneShotEffect<MemoricideEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (player != null && controller != null) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
|
|
|
@ -155,7 +155,7 @@ class MimicVatEffect extends OneShotEffect<MimicVatEffect> {
|
|||
permanent.clearImprinted(game);
|
||||
|
||||
// Imprint a new one
|
||||
UUID target = targetPointer.getFirst(source);
|
||||
UUID target = targetPointer.getFirst(game, source);
|
||||
if (target != null) {
|
||||
Card card = game.getCard(target);
|
||||
card.moveToExile(getId(), "Mimic Vat (Imprint)", source.getSourceId(), game);
|
||||
|
|
|
@ -160,7 +160,7 @@ class NimDeathmantleEffect extends OneShotEffect<NimDeathmantleEffect> {
|
|||
if (player.chooseUse(Constants.Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + "?", game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
|
||||
UUID target = targetPointer.getFirst(source);
|
||||
UUID target = targetPointer.getFirst(game, source);
|
||||
if (target != null && equipment != null) {
|
||||
Card card = game.getCard(target);
|
||||
// check if it's still in graveyard
|
||||
|
|
|
@ -117,7 +117,7 @@ class PainfulQuandryEffect extends OneShotEffect<PainfulQuandryEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
Cost cost = new DiscardTargetCost(new TargetCardInHand());
|
||||
if (cost.canPay(player.getId(), player.getId(), game)) {
|
||||
|
|
|
@ -121,7 +121,7 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl<PrecursorG
|
|||
UUID targetGolem = null;
|
||||
SpellAbility sa = spell.getSpellAbility();
|
||||
for (Effect effect : sa.getEffects()) {
|
||||
for (UUID target : effect.getTargetPointer().getTargets(sa)) {
|
||||
for (UUID target : effect.getTargetPointer().getTargets(game, sa)) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
if (!permanent.hasSubtype("Golem")) {
|
||||
|
@ -170,7 +170,7 @@ class PrecursorGolemCopySpellEffect extends OneShotEffect<PrecursorGolemCopySpel
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
SpellAbility sa = spell.getSpellAbility();
|
||||
UUID targetedGolem = (UUID) getValue("targetedGolem");
|
||||
|
|
|
@ -82,7 +82,7 @@ class PsychicMiasmaEffect1 extends OneShotEffect<PsychicMiasmaEffect1> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
TargetDiscard target = new TargetDiscard(player.getId());
|
||||
player.choose(Outcome.Discard, target, source.getSourceId(), game);
|
||||
|
|
|
@ -97,7 +97,7 @@ class RustTickTapTargetEffect extends TapTargetEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent rustTick = game.getPermanent(source.getSourceId());
|
||||
if (rustTick != null) rustTick.clearConnectedCards("HisokasGuard");
|
||||
for (UUID target : targetPointer.getTargets(source)) {
|
||||
for (UUID target : targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
rustTick.addConnectedCard("HisokasGuard", permanent.getId());
|
||||
|
|
|
@ -89,7 +89,7 @@ public class ShapeAnew extends CardImpl<ShapeAnew> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(source), Constants.Zone.BATTLEFIELD);
|
||||
Permanent sourcePermanent = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ class VenserTheSojournerEffect extends OneShotEffect<VenserTheSojournerEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (getTargetPointer().getFirst(source) != null) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(source));
|
||||
if (getTargetPointer().getFirst(game, source) != null) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
if (permanent.moveToExile(source.getSourceId(), "Venser, the Sojourner", source.getSourceId(), game)) {
|
||||
//create delayed triggered ability
|
||||
|
|
|
@ -124,7 +124,7 @@ class CradleOfVitalityEffect extends OneShotEffect<CradleOfVitalityEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
Integer amount = (Integer) getValue("amount");
|
||||
for (UUID uuid : targetPointer.getTargets(source)) {
|
||||
for (UUID uuid : targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(uuid);
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
affectedTargets ++;
|
||||
|
|
|
@ -81,7 +81,7 @@ class PeekEffect extends OneShotEffect<PeekEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null && controller != null) {
|
||||
controller.lookAtCards("Peek", player.getHand(), game);
|
||||
}
|
||||
|
|
|
@ -126,10 +126,10 @@ class ArchonOfRedemptionEffect extends OneShotEffect<ArchonOfRedemptionEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (p == null) {
|
||||
p = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(source), Constants.Zone.BATTLEFIELD);
|
||||
p = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
|
||||
}
|
||||
if (p != null && player != null) {
|
||||
player.gainLife(p.getPower().getValue(), game);
|
||||
|
|
|
@ -87,7 +87,7 @@ class NaturesClaimEffect extends OneShotEffect<NaturesClaimEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent target = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(source), Constants.Zone.BATTLEFIELD);
|
||||
Permanent target = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
|
||||
if (target != null) {
|
||||
Player player = game.getPlayer(target.getControllerId());
|
||||
if (player != null) {
|
||||
|
|
|
@ -100,7 +100,7 @@ class StrengthOfTheTajuruAddCountersTargetEffect extends OneShotEffect<StrengthO
|
|||
int affectedTargets = 0;
|
||||
int amount = source.getManaCostsToPay().getX() + 1;
|
||||
Counter counter = CounterType.P1P1.createInstance(amount);
|
||||
for (UUID uuid : targetPointer.getTargets(source)) {
|
||||
for (UUID uuid : targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(uuid);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(counter.copy(), game);
|
||||
|
|
|
@ -84,7 +84,7 @@ class WalkingAtlasEffect extends OneShotEffect<WalkingAtlasEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card c = game.getCard(targetPointer.getFirst(source));
|
||||
Card c = game.getCard(targetPointer.getFirst(game, source));
|
||||
if (c != null) {
|
||||
c.moveToZone(Constants.Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
return true;
|
||||
|
|
|
@ -182,12 +182,12 @@ class BlazingTorchDamageEffect extends OneShotEffect<BlazingTorchDamageEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null && sourceId != null) {
|
||||
permanent.damage(2, sourceId, game, true, false);
|
||||
return true;
|
||||
}
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null && sourceId != null) {
|
||||
player.damage(2, sourceId, game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -142,13 +142,13 @@ class ChandraAblazeEffect2 extends OneShotEffect<ChandraAblazeEffect2> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Card card = (Card) this.getValue("discardedCard");
|
||||
if (card != null && card.getColor().isRed()) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(4, source.getSourceId(), game, true, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.damage(4, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
|
|
|
@ -101,7 +101,7 @@ class KhalniGemReturnToHandTargetEffect extends OneShotEffect<KhalniGemReturnToH
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for ( UUID target : targetPointer.getTargets(source) ) {
|
||||
for ( UUID target : targetPointer.getTargets(game, source) ) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if ( permanent != null ) {
|
||||
permanent.moveToZone(Zone.HAND, source.getId(), game, true);
|
||||
|
|
|
@ -172,8 +172,8 @@ class MindbreakEffect extends OneShotEffect<MindbreakEffect>{
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
if (targetPointer.getTargets(source).size() > 0) {
|
||||
for (UUID spellId : targetPointer.getTargets(source)) {
|
||||
if (targetPointer.getTargets(game, source).size() > 0) {
|
||||
for (UUID spellId : targetPointer.getTargets(game, source)) {
|
||||
Spell spell = game.getStack().getSpell(spellId);
|
||||
if (spell != null) {
|
||||
spell.moveToExile(null, null, source.getId(), game);
|
||||
|
|
|
@ -103,7 +103,7 @@ class SorinMarkovEffect extends OneShotEffect<SorinMarkovEffect> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.setLife(10, game);
|
||||
return true;
|
||||
|
|
|
@ -40,7 +40,7 @@ import mage.abilities.effects.EntersBattlefieldEffect;
|
|||
public class EntersBattlefieldAbility extends StaticAbility<EntersBattlefieldAbility> {
|
||||
|
||||
public EntersBattlefieldAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, ""));
|
||||
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, null));
|
||||
}
|
||||
|
||||
public EntersBattlefieldAbility(Effect effect, String rule) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl<AuraReplacement
|
|||
if (sourceObject instanceof StackAbility) {
|
||||
StackAbility stackAbility = (StackAbility) sourceObject;
|
||||
if (!stackAbility.getEffects().isEmpty()) {
|
||||
targetId = stackAbility.getEffects().get(0).getTargetPointer().getFirst(stackAbility);
|
||||
targetId = stackAbility.getEffects().get(0).getTargetPointer().getFirst(game, stackAbility);
|
||||
}
|
||||
}
|
||||
if (targetId == null) {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (text.length() == 0)
|
||||
if (text == null || text.length() == 0)
|
||||
return "{this} enters the battlefield " + baseEffects.getText(mode);
|
||||
else
|
||||
return "{this} enters the battlefield " + text;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class CopyTargetSpellEffect extends OneShotEffect<CopyTargetSpellEffect>
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(source));
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
|
|
|
@ -62,7 +62,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect<CounterUnlessPaysEffe
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(source));
|
||||
StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
|
||||
if (spell != null) {
|
||||
Player player = game.getPlayer(spell.getControllerId());
|
||||
if (player != null) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue