mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
- refactoring related to #8375 "D" cards
This commit is contained in:
parent
aa4397dee5
commit
0e8218e8c4
10 changed files with 18 additions and 24 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import mage.MageInt;
|
||||
|
@ -89,7 +88,7 @@ class DecimatorBeetleEffect extends OneShotEffect {
|
|||
targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
Effect effect = new AddCountersTargetEffect(CounterType.M1M1.createInstance(1));
|
||||
effect.setTargetPointer(new FixedTarget(source.getTargets().get(1).getFirstTarget()));
|
||||
effect.setTargetPointer(new FixedTarget(source.getTargets().get(1).getFirstTarget(), game));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -81,7 +80,7 @@ class DermoplasmEffect extends OneShotEffect {
|
|||
if (effect.apply(game, source)) {
|
||||
if (thisCreature != null) {
|
||||
effect = new ReturnToHandTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(thisCreature.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(thisCreature.getId(), game));
|
||||
effect.apply(game, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class DevouringRageEffect extends OneShotEffect {
|
|||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
ContinuousEffect effect = new BoostTargetEffect(amount, 0, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -21,7 +20,6 @@ import mage.constants.Zone;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
@ -148,7 +146,7 @@ class DiabolicServitudeExileCreatureEffect extends OneShotEffect {
|
|||
Object object = game.getState().getValue(source.getSourceId().toString() + "returnedCreature");
|
||||
if ((object instanceof MageObjectReference)) {
|
||||
Effect effect = new ExileTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(((MageObjectReference) object).getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(((MageObjectReference) object).getSourceId(), game));
|
||||
effect.apply(game, source);
|
||||
return new ReturnToHandSourceEffect(true).apply(game, source);
|
||||
}
|
||||
|
@ -177,7 +175,7 @@ class DiabolicServitudeSourceLeftBattlefieldEffect extends OneShotEffect {
|
|||
Object object = game.getState().getValue(source.getSourceId().toString() + "returnedCreature");
|
||||
if ((object instanceof MageObjectReference)) {
|
||||
Effect effect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||
effect.setTargetPointer(new FixedTarget(((MageObjectReference) object).getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(((MageObjectReference) object).getSourceId(), game));
|
||||
effect.apply(game, source);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -21,7 +20,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public final class DingusEgg extends CardImpl {
|
||||
|
||||
public DingusEgg(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
// Whenever a land is put into a graveyard from the battlefield, Dingus Egg deals 2 damage to that land's controller.
|
||||
this.addAbility(new DingusEggTriggeredAbility());
|
||||
|
@ -58,9 +57,9 @@ class DingusEggTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (zEvent.isDiesEvent()
|
||||
&& zEvent.getTarget().isLand(game)) {
|
||||
if (getTargets().isEmpty()) {
|
||||
UUID targetId = zEvent.getTarget().getControllerId();
|
||||
UUID targetControllerId = zEvent.getTarget().getControllerId();
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(targetId));
|
||||
effect.setTargetPointer(new FixedTarget(targetControllerId));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -27,7 +26,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public final class DistortingLens extends CardImpl {
|
||||
|
||||
public DistortingLens(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// {tap}: Target permanent becomes the color of your choice until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ChangeColorEffect(), new TapSourceCost());
|
||||
|
@ -63,7 +62,7 @@ class ChangeColorEffect extends OneShotEffect {
|
|||
Permanent chosen = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (player != null && permanent != null) {
|
||||
ContinuousEffect effect = new BecomesColorTargetEffect(null, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(chosen.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(chosen.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -69,7 +68,7 @@ class DreadSlaverEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||
ContinuousEffect effect = new BecomesBlackZombieAdditionEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
|
@ -88,11 +87,11 @@ class DreadWightTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(getSourceId())) { // Dread Wight is the blocker
|
||||
getAllEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
getAllEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
if (event.getTargetId().equals(getSourceId())) { // Dread Wight is the attacker
|
||||
getAllEffects().setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
getAllEffects().setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -62,9 +62,11 @@ public final class DroolingOgre extends CardImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player newController = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (newController != null && controller != null && !controller.equals(newController)) {
|
||||
if (newController != null
|
||||
&& controller != null
|
||||
&& !controller.equals(newController)) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class DwarvenArmorerEffect extends OneShotEffect {
|
|||
if (controller.choose(outcome, choice, game)) {
|
||||
Counter counter = choice.getChoice().equals("+0/+1") ? CounterType.P0P1.createInstance() : CounterType.P1P0.createInstance();
|
||||
Effect effect = new AddCountersTargetEffect(counter);
|
||||
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
|
||||
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source), game));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue