mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- non-card refactoring related to #8375
This commit is contained in:
parent
bcac7bd47c
commit
328b1f1eec
31 changed files with 32 additions and 34 deletions
|
@ -102,7 +102,7 @@ class KinshipBaseEffect extends OneShotEffect {
|
|||
if (controller.chooseUse(outcome, new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append('?').toString(), source, game)) {
|
||||
controller.revealCards(sourcePermanent.getName(), cards, game);
|
||||
for (Effect effect : kinshipEffects) {
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), game));
|
||||
if (effect.getEffectType() == EffectType.ONESHOT) {
|
||||
effect.apply(game, source);
|
||||
} else {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BecomesBlockedByCreatureTriggeredAbility extends TriggeredAbilityIm
|
|||
return false;
|
||||
}
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Jeff
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class BecomesTappedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (setTargetPointer) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BlocksTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getSourceId().equals(this.getSourceId())) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DealsDamageToACreatureAttachedTriggeredAbility extends TriggeredAbi
|
|||
&& attachment.isAttachedTo(event.getSourceId())) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class DealsDamageToACreatureTriggeredAbility extends TriggeredAbilityImpl
|
|||
}
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl
|
|||
}
|
||||
if(setTargetPointer) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class DealtDamageAndDiedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (damageDealt) {
|
||||
if (this.setTargetPointer == SetTargetPointer.PERMANENT) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DealtDamageAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
effect.setValue("damage", event.getAmount());
|
||||
switch(setTargetPointer) {
|
||||
case PERMANENT:
|
||||
effect.setTargetPointer(new FixedTarget(targetId));
|
||||
effect.setTargetPointer(new FixedTarget(targetId, game));
|
||||
break;
|
||||
case PLAYER:
|
||||
effect.setTargetPointer(new FixedTarget(game.getPermanentOrLKIBattlefield(targetId).getControllerId()));
|
||||
|
|
|
@ -103,7 +103,7 @@ public class EntersBattlefieldOrAttacksAllTriggeredAbility extends TriggeredAbil
|
|||
for (Effect effect : this.getEffects()) {
|
||||
switch (setTargetPointer) {
|
||||
case PERMANENT:
|
||||
effect.setTargetPointer(new FixedTarget(attacker.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(attacker.getId(), game));
|
||||
break;
|
||||
case PLAYER:
|
||||
UUID playerId = controlledText ? attacker.getControllerId() : game.getCombat().getDefendingPlayerId(attacker.getId(), game);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getSourceId().equals(getSourceId())) {
|
||||
for (Effect effect : getEffects()) {
|
||||
if (setTargetPointer == SetTargetPointer.PERMANENT) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -31,7 +31,7 @@ public class OpponentSacrificesPermanentTriggeredAbility extends TriggeredAbilit
|
|||
MageObject object = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (object instanceof Permanent) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class TurnedFaceUpAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TurnedFaceUpSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getTargetId().equals(this.getSourceId())) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect: getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class CreateTokenCopySourceEffect extends OneShotEffect {
|
|||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(
|
||||
source.getControllerId(), null, false, number, tapped, false
|
||||
);
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class CipherEffect extends OneShotEffect {
|
|||
String ruleText = "you may cast a copy of " + sourceCard.getLogName() + " without paying its mana cost";
|
||||
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new CipherStoreEffect(source.getSourceId(), ruleText), true);
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
|
||||
game.addEffect(effect, source);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourceCard.getLogName() + ": Spell ciphered to " + targetCreature.getLogName());
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CrewsVehicleSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (event.getTargetId().equals(getSourceId())) {
|
||||
for (Effect effect : getEffects()) {
|
||||
// set the vehicle id as target
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class DestroyTargetAtBeginningOfNextEndStepEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
DestroyTargetEffect effect = new DestroyTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class PopulateEffect extends OneShotEffect {
|
|||
Effect effect = new CreateTokenCopyTargetEffect(
|
||||
null, null, false, 1, tappedAndAttacking, tappedAndAttacking
|
||||
);
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -13,7 +12,6 @@ import mage.constants.Outcome;
|
|||
import mage.constants.PhaseStep;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,10 +50,10 @@ public class GoadTargetEffect extends OneShotEffect {
|
|||
or the player that goaded it. (2016-08-23)
|
||||
*/
|
||||
ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn);
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source), game));
|
||||
game.addEffect(effect, source);
|
||||
effect = new CantAttackControllerDueToGoadEffect(Duration.UntilYourNextTurn); // remember current controller
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source), game));
|
||||
game.addEffect(effect, source);
|
||||
game.informPlayers(controller.getLogName() + " is goading " + targetCreature.getLogName());
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BecomesChosenCreatureTypeTargetEffect extends OneShotEffect {
|
|||
if (chosenType != null && !chosenType.isEmpty()) {
|
||||
// ADD TYPE TO TARGET
|
||||
ContinuousEffect effect = new BecomesCreatureTypeTargetEffect(duration, SubType.byDescription(chosenType));
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
|
||||
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect {
|
|||
String colors = new String(sb);
|
||||
ObjectColor chosenColors = new ObjectColor(colors);
|
||||
ContinuousEffect effect = new BecomesColorTargetEffect(chosenColors, duration);
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
|
||||
game.addEffect(effect, source);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
|
|||
if (fixedTarget) {
|
||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo()));
|
||||
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game));
|
||||
}
|
||||
}
|
||||
super.init(source, game); // inits the target pointer so call it after setting the targetPointer
|
||||
|
|
|
@ -103,7 +103,7 @@ public class AwakenAbility extends SpellAbility {
|
|||
}
|
||||
}
|
||||
if (targetId != null) {
|
||||
FixedTarget fixedTarget = new FixedTarget(targetId);
|
||||
FixedTarget fixedTarget = new FixedTarget(targetId, game);
|
||||
ContinuousEffect continuousEffect = new BecomesCreatureTargetEffect(new AwakenElementalToken(), false, true, Duration.Custom);
|
||||
continuousEffect.setTargetPointer(fixedTarget);
|
||||
game.addEffect(continuousEffect, source);
|
||||
|
|
|
@ -88,7 +88,7 @@ public class EvolveAbility extends TriggeredAbilityImpl {
|
|||
&& triggeringCreature.isControlledBy(this.controllerId)) {
|
||||
Permanent sourceCreature = game.getPermanent(sourceId);
|
||||
if (sourceCreature != null && isPowerOrThoughnessGreater(sourceCreature, triggeringCreature)) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class FlankingAbility extends TriggeredAbilityImpl {
|
|||
|
||||
if (!hasFlankingAbility) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class ForetellAbility extends SpecialAction {
|
|||
|
||||
// exile the card face-down
|
||||
effect.setWithName(false);
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), game));
|
||||
effect.apply(game, source);
|
||||
card.setFaceDown(true, game);
|
||||
game.addEffect(new ForetellAddCostEffect(new MageObjectReference(card, game)), source);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class GraftAbility extends TriggeredAbilityImpl {
|
|||
&& sourcePermanent.getCounters(game).containsKey(CounterType.P1P1)
|
||||
&& filter.match(permanent, game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ class HauntEffect extends OneShotEffect {
|
|||
.append(source.getSourceId().toString())
|
||||
.append(card.getZoneChangeCounter(game)
|
||||
+ hauntedCreature.getZoneChangeCounter(game)).toString(); // in case it is blinked
|
||||
game.getState().setValue(key, new FixedTarget(targetPointer.getFirst(game, source)));
|
||||
game.getState().setValue(key, new FixedTarget(targetPointer.getFirst(game, source), game));
|
||||
card.addInfo("hauntinfo", new StringBuilder("Haunting ").append(hauntedCreature.getLogName()).toString(), game);
|
||||
hauntedCreature.addInfo("hauntinfo", new StringBuilder("Haunted by ").append(card.getLogName()).toString(), game);
|
||||
game.informPlayers(new StringBuilder(card.getName()).append(" haunting ").append(hauntedCreature.getLogName()).toString());
|
||||
|
|
|
@ -58,7 +58,7 @@ class DarettiScrapSavantTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (zEvent.isDiesEvent()
|
||||
&& zEvent.getTarget().isArtifact(game)
|
||||
&& zEvent.getTarget().isOwnedBy(this.controllerId)) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(zEvent.getTargetId()));
|
||||
this.getEffects().setTargetPointer(new FixedTarget(zEvent.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue