mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
- refactoring related to #8375 "G and H" cards
This commit is contained in:
parent
e8db40bb8d
commit
bfdadc09c1
13 changed files with 21 additions and 28 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.Set;
|
||||
|
|
@ -16,7 +15,6 @@ import mage.constants.SuperType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
|
@ -28,7 +26,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public final class GahijiHonoredOne extends CardImpl {
|
||||
|
||||
public GahijiHonoredOne(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{G}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{G}{W}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.BEAST);
|
||||
|
||||
|
|
@ -53,7 +51,7 @@ public final class GahijiHonoredOne extends CardImpl {
|
|||
class GahijiHonoredOneTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public GahijiHonoredOneTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BoostTargetEffect(2,0, Duration.EndOfTurn), false);
|
||||
super(Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Duration.EndOfTurn), false);
|
||||
}
|
||||
|
||||
public GahijiHonoredOneTriggeredAbility(Effect effect, boolean optional, String text) {
|
||||
|
|
@ -81,8 +79,8 @@ class GahijiHonoredOneTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (defender != null) {
|
||||
Set<UUID> opponents = game.getOpponents(this.getControllerId());
|
||||
if (opponents != null && opponents.contains(defender.getId())) {
|
||||
for (Effect effect: this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,13 +132,13 @@ class GlyphOfDelusionEffect extends OneShotEffect {
|
|||
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousRuleModifyingEffect(new DontUntapInControllersUntapStepSourceEffect(),
|
||||
new SourceHasCounterCondition(CounterType.GLYPH)).setText("This creature doesn't untap during your untap step if it has a glyph counter on it"));
|
||||
GainAbilityTargetEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
|
||||
effect.setTargetPointer(new FixedTarget(targetPermanent.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(targetPermanent.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
|
||||
BeginningOfUpkeepTriggeredAbility ability2 = new BeginningOfUpkeepTriggeredAbility(new RemoveCounterSourceEffect(CounterType.GLYPH.createInstance()),
|
||||
TargetController.YOU, false);
|
||||
GainAbilityTargetEffect effect2 = new GainAbilityTargetEffect(ability2, Duration.Custom);
|
||||
effect2.setTargetPointer(new FixedTarget(targetPermanent.getId()));
|
||||
effect2.setTargetPointer(new FixedTarget(targetPermanent.getId(), game));
|
||||
game.addEffect(effect2, source);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class GoblinFestivalChangeControlEffect extends OneShotEffect {
|
|||
Player chosenOpponent = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenOpponent != null) {
|
||||
ContinuousEffect effect = new GoblinFestivalGainControlEffect(Duration.Custom, chosenOpponent.getId());
|
||||
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
game.informPlayers(chosenOpponent.getLogName() + " has gained control of " + sourcePermanent.getLogName());
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class GoblinGuideTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (defenderId != null) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
// set here because attacking creature can be removed until effect resolves
|
||||
effect.setTargetPointer(new FixedTarget(defenderId));
|
||||
effect.setTargetPointer(new FixedTarget(defenderId, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -22,7 +21,6 @@ import mage.game.ExileZone;
|
|||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
|
@ -109,7 +107,7 @@ class GodsendTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (!possibleTargets.isEmpty()) {
|
||||
this.getTargets().clear();
|
||||
if (possibleTargets.size() == 1) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(possibleTargets.iterator().next()));
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(possibleTargets.iterator().next(), game));
|
||||
} else {
|
||||
this.getEffects().get(0).setTargetPointer(new FirstTargetPointer());
|
||||
targetName = targetName + " equipped by " + equipment.getName();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class GravityWellTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Permanent attacker = game.getPermanent(event.getSourceId());
|
||||
if (attacker != null && attacker.getAbilities().contains(FlyingAbility.getInstance())) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class GruulRagebeastTriggeredAbility extends TriggeredAbilityImpl {
|
|||
for (Effect effect : this.getEffects()) {
|
||||
if (effect instanceof GruulRagebeastEffect) {
|
||||
effect.setTargetPointer(
|
||||
new FixedTarget(event.getTargetId())
|
||||
new FixedTarget(event.getTargetId(), game)
|
||||
.withData("triggeredName", GameLog.getColoredObjectIdNameForTooltip(sourceObject))
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -33,7 +32,7 @@ import mage.watchers.Watcher;
|
|||
public final class HallOfTheBanditLord extends CardImpl {
|
||||
|
||||
public HallOfTheBanditLord(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
|
||||
// Hall of the Bandit Lord enters the battlefield tapped.
|
||||
|
|
@ -99,7 +98,7 @@ class HallOfTheBanditLordWatcher extends Watcher {
|
|||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
if (creatures.contains(event.getSourceId())) {
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
game.addEffect(effect, source);
|
||||
creatures.remove(event.getSourceId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -64,7 +63,7 @@ class HammerHelperEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
|
||||
if (controller != null && targetCreature != null) {
|
||||
source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId()));
|
||||
source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId(), game));
|
||||
game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn), source);
|
||||
targetCreature.untap(game);
|
||||
int amount = controller.rollDice(outcome, source, game, 6);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class HeraldOfLeshracCumulativeCost extends CostImpl {
|
|||
Target target = new TargetPermanent(filter);
|
||||
if (target.choose(Outcome.GainControl, controllerId, source.getSourceId(), game)) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
|
||||
game.addEffect(effect, ability);
|
||||
game.getState().processAction(game);
|
||||
paid = true;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class HixusPrisonWardenTriggeredAbility extends TriggeredAbilityImpl {
|
|||
&& damageEvent.isCombatDamage()
|
||||
&& sourcePermanent != null
|
||||
&& sourcePermanent.isCreature(game)) {
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId(), game));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class HolisticWisdomEffect extends OneShotEffect {
|
|||
for (CardType cardtype : card.getCardType(game)) {
|
||||
if (cardtypes.contains(cardtype)) {
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), game));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -25,7 +24,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public final class HorobiDeathsWail extends CardImpl {
|
||||
|
||||
public HorobiDeathsWail(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ public final class HorobiDeathsWail extends CardImpl {
|
|||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
|
||||
// Whenever a creature becomes the target of a spell or ability, destroy that creature.
|
||||
this.addAbility(new HorobiDeathsWailAbility(new DestroyTargetEffect()));
|
||||
}
|
||||
|
|
@ -46,7 +45,7 @@ public final class HorobiDeathsWail extends CardImpl {
|
|||
@Override
|
||||
public HorobiDeathsWail copy() {
|
||||
return new HorobiDeathsWail(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +73,7 @@ class HorobiDeathsWailAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent creature = game.getPermanent(event.getTargetId());
|
||||
if (creature != null && creature.isCreature(game)) {
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue