mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Some changes to cards committed by duncant.
This commit is contained in:
parent
a160cb2e99
commit
f77c930299
6 changed files with 99 additions and 110 deletions
|
@ -28,12 +28,9 @@
|
||||||
package mage.sets.futuresight;
|
package mage.sets.futuresight;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
||||||
|
|
||||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||||
import mage.filter.FilterSpell;
|
import mage.filter.FilterSpell;
|
||||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||||
|
@ -55,10 +52,7 @@ public class VeilstoneAmulet extends CardImpl {
|
||||||
this.expansionSetCode = "FUT";
|
this.expansionSetCode = "FUT";
|
||||||
|
|
||||||
// Whenever you cast a spell, creatures you control can't be the targets of spells or abilities your opponents control this turn.
|
// Whenever you cast a spell, creatures you control can't be the targets of spells or abilities your opponents control this turn.
|
||||||
this.addAbility(new SpellCastControllerTriggeredAbility(new VeilstoneAmuletEffect(),
|
this.addAbility(new SpellCastControllerTriggeredAbility(new VeilstoneAmuletEffect(), new FilterSpell("a spell"), false));
|
||||||
new FilterSpell(),
|
|
||||||
false,
|
|
||||||
"Whenever you cast a spell, creatures you control can't be the targets of spells or abilities your opponents control this turn."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VeilstoneAmulet(final VeilstoneAmulet card) {
|
public VeilstoneAmulet(final VeilstoneAmulet card) {
|
||||||
|
@ -78,6 +72,7 @@ class VeilstoneAmuletEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||||
|
|
||||||
public VeilstoneAmuletEffect() {
|
public VeilstoneAmuletEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||||
|
staticText = "creatures you control can't be the targets of spells or abilities your opponents control this turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
public VeilstoneAmuletEffect(final VeilstoneAmuletEffect effect) {
|
public VeilstoneAmuletEffect(final VeilstoneAmuletEffect effect) {
|
||||||
|
@ -99,12 +94,9 @@ class VeilstoneAmuletEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||||
if (event.getType() == EventType.TARGET) {
|
if (event.getType() == EventType.TARGET) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
UUID permanentController = permanent.getControllerId();
|
|
||||||
UUID abilityController = ability.getControllerId();
|
|
||||||
UUID sourceController = event.getPlayerId();
|
|
||||||
if (permanent.getCardType().contains(CardType.CREATURE) &&
|
if (permanent.getCardType().contains(CardType.CREATURE) &&
|
||||||
permanentController.equals(abilityController) &&
|
permanent.getControllerId().equals(ability.getControllerId()) &&
|
||||||
game.getPlayer(abilityController).hasOpponent(sourceController, game)) {
|
game.getPlayer(ability.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -56,6 +55,7 @@ import java.util.List;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.abilities.Modes;
|
import mage.abilities.Modes;
|
||||||
import mage.filter.predicate.mageobject.FromSetPredicate;
|
import mage.filter.predicate.mageobject.FromSetPredicate;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.util.SpellTargetAddress;
|
import mage.util.SpellTargetAddress;
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ public class InkTreaderNephilim extends CardImpl {
|
||||||
super(ownerId, 117, "Ink-Treader Nephilim", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{R}{G}{W}{U}");
|
super(ownerId, 117, "Ink-Treader Nephilim", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{R}{G}{W}{U}");
|
||||||
this.expansionSetCode = "GPT";
|
this.expansionSetCode = "GPT";
|
||||||
this.subtype.add("Nephilim");
|
this.subtype.add("Nephilim");
|
||||||
|
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null &&
|
if (spell != null &&
|
||||||
spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY)){
|
(spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))){
|
||||||
for (Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setValue("TriggeringSpell", spell);
|
effect.setValue("TriggeringSpell", spell);
|
||||||
}
|
}
|
||||||
|
@ -129,10 +130,10 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
boolean allTargetsInkTreaderNephilim = true;
|
boolean allTargetsInkTreaderNephilim = true;
|
||||||
boolean atLeastOneTargetsInkTreaderNephilim = false;
|
boolean atLeastOneTargetsInkTreaderNephilim = false;
|
||||||
for (SpellAbility sa: spell.getSpellAbilities()){
|
for (SpellAbility spellAbility: spell.getSpellAbilities()){
|
||||||
Modes modes = sa.getModes();
|
Modes modesSpell = spellAbility.getModes();
|
||||||
for (UUID mode : modes.getSelectedModes()) {
|
for (UUID mode : modesSpell.getSelectedModes()) {
|
||||||
for (Target targetInstance : modes.get(mode).getTargets()) {
|
for (Target targetInstance : modesSpell.get(mode).getTargets()) {
|
||||||
for (UUID target : targetInstance.getTargets()) {
|
for (UUID target : targetInstance.getTargets()) {
|
||||||
allTargetsInkTreaderNephilim &= target.equals(sourceId);
|
allTargetsInkTreaderNephilim &= target.equals(sourceId);
|
||||||
atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId);
|
atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId);
|
||||||
|
@ -149,7 +150,7 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Whenever a player casts an instant or sorcery spell, if that spell targets only Ink-Treader Nephilim, copy the spell for each other creature that spell could target. Each copy targets a different one of those creatures.";
|
return "Whenever a player casts an instant or sorcery spell, if that spell targets only {this}, copy the spell for each other creature that spell could target. Each copy targets a different one of those creatures.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +164,7 @@ class InkTreaderNephilimEffect extends OneShotEffect {
|
||||||
|
|
||||||
public InkTreaderNephilimEffect() {
|
public InkTreaderNephilimEffect() {
|
||||||
super(Outcome.Copy);
|
super(Outcome.Copy);
|
||||||
|
staticText = "copy the spell for each other creature that spell could target. Each copy targets a different one of those creatures";
|
||||||
}
|
}
|
||||||
|
|
||||||
public InkTreaderNephilimEffect(final InkTreaderNephilimEffect effect) {
|
public InkTreaderNephilimEffect(final InkTreaderNephilimEffect effect) {
|
||||||
|
@ -171,13 +173,17 @@ class InkTreaderNephilimEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Spell spell = (Spell) getValue("TriggeringSpell");
|
Spell spell = (Spell) getValue("TriggeringSpell");
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
Map<UUID, Spell> targetable = new HashMap<>();
|
Map<UUID, Spell> targetable = new HashMap<>();
|
||||||
UUID controller = source.getControllerId();
|
// gather all creatures that can be targeted from the spell to copy
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller, source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller.getId(), source.getSourceId(), game)) {
|
||||||
Spell copy = spell.copySpell();
|
Spell copy = spell.copySpell();
|
||||||
copy.setControllerId(controller);
|
copy.setControllerId(controller.getId());
|
||||||
copy.setCopiedSpell(true);
|
copy.setCopiedSpell(true);
|
||||||
if (permanent.getId().equals(source.getSourceId())) {
|
if (permanent.getId().equals(source.getSourceId())) {
|
||||||
continue; // copy only for other creatures
|
continue; // copy only for other creatures
|
||||||
|
@ -200,28 +206,29 @@ class InkTreaderNephilimEffect extends OneShotEffect {
|
||||||
targetable.put(permanent.getId(), copy);
|
targetable.put(permanent.getId(), copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// controller
|
||||||
while (targetable.size() > 0) {
|
while (targetable.size() > 0) {
|
||||||
FilterPermanent filter = new FilterPermanent("creature that spell could target ("+targetable.size()+" remaining)");
|
FilterPermanent filterCreatures = new FilterPermanent("creature that spell could target ("+ targetable.size() + " remaining)");
|
||||||
filter.add(new FromSetPredicate(targetable.keySet()));
|
filterCreatures.add(new FromSetPredicate(targetable.keySet()));
|
||||||
TargetPermanent target = new TargetPermanent(0, 1, filter, true);
|
TargetPermanent target = new TargetPermanent(0, 1, filterCreatures, true);
|
||||||
if (target.possibleTargets(controller, game).size() > 1
|
if (target.possibleTargets(controller.getId(), game).size() > 1
|
||||||
&& target.canChoose(source.getSourceId(), controller, game)) {
|
&& target.canChoose(source.getSourceId(), controller.getId(), game)) {
|
||||||
game.getPlayer(controller).choose(Outcome.Neutral, target, source.getId(), game);
|
controller.choose(Outcome.Neutral, target, source.getId(), game);
|
||||||
}
|
}
|
||||||
Collection<UUID> chosen = target.getTargets();
|
Collection<UUID> choosenIds = target.getTargets();
|
||||||
if (chosen.size() == 0) {
|
if (choosenIds.isEmpty()) {
|
||||||
chosen = targetable.keySet();
|
choosenIds = targetable.keySet();
|
||||||
}
|
}
|
||||||
List<UUID> toDelete = new ArrayList<>();
|
List<UUID> toDelete = new ArrayList<>();
|
||||||
for (UUID chosenId : chosen) {
|
for (UUID chosenId : choosenIds) {
|
||||||
Spell chosenCopy = targetable.get(chosenId);
|
Spell chosenCopy = targetable.get(chosenId);
|
||||||
if (chosenCopy != null) {
|
if (chosenCopy != null) {
|
||||||
game.getStack().push(chosenCopy);
|
game.getStack().push(chosenCopy);
|
||||||
toDelete.add(chosenId);
|
toDelete.add(chosenId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (UUID id : toDelete) {
|
for (UUID idToDelte : toDelete) {
|
||||||
targetable.remove(id);
|
targetable.remove(idToDelte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,18 +28,15 @@
|
||||||
package mage.sets.ravnika;
|
package mage.sets.ravnika;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetControlledCreaturePermanent;
|
import mage.target.common.TargetControlledCreaturePermanent;
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -47,8 +44,6 @@ import mage.game.Game;
|
||||||
import mage.game.events.DamagedPlayerEvent;
|
import mage.game.events.DamagedPlayerEvent;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
import mage.target.targetpointer.FixedTarget;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
@ -105,12 +100,11 @@ class BreathOfFuryAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event instanceof DamagedPlayerEvent) {
|
if (event instanceof DamagedPlayerEvent) {
|
||||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
|
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
|
||||||
Permanent p = game.getPermanent(event.getSourceId());
|
Permanent enchantment = game.getPermanent(getSourceId());
|
||||||
if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
|
if (damageEvent.isCombatDamage() &&
|
||||||
for (Effect effect : getEffects()) {
|
enchantment != null &&
|
||||||
effect.setTargetPointer(new FixedTarget(p.getId()));
|
enchantment.getAttachedTo().equals(event.getSourceId())) {
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +113,7 @@ class BreathOfFuryAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "When enchanted creature deals combat damage to a player, sacrifice it and attach Breath of Fury to a creature you control. If you do, untap all creatures you control and after this phase, there is an additional combat phase.";
|
return "When enchanted creature deals combat damage to a player, " + super.getRule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +121,7 @@ class BreathOfFuryEffect extends OneShotEffect {
|
||||||
|
|
||||||
public BreathOfFuryEffect() {
|
public BreathOfFuryEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
staticText = "Sacrifice enchanted creature and attach Breath of Fury to a creature you control. If you do, untap all creatures you control and after this phase, there is an additional combat phase.";
|
staticText = "sacrifice enchanted creature and attach {this} to a creature you control. If you do, untap all creatures you control and after this phase, there is an additional combat phase.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public BreathOfFuryEffect(final BreathOfFuryEffect effect) {
|
public BreathOfFuryEffect(final BreathOfFuryEffect effect) {
|
||||||
|
@ -141,52 +135,39 @@ class BreathOfFuryEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source){
|
public boolean apply(Game game, Ability source){
|
||||||
Permanent enchantedCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
|
if (enchantment == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Target target = new TargetControlledCreaturePermanent(new FilterCanBeEnchantedControlledCreaturePermanent(enchantment));
|
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control that could be enchanted by " + enchantment.getName());
|
||||||
|
filter.add(new CanBeEnchantedPredicate(enchantment));
|
||||||
|
Target target = new TargetControlledCreaturePermanent(filter);
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
if (enchantedCreature != null &&
|
if (enchantedCreature != null && controller != null) {
|
||||||
enchantedCreature.sacrifice(source.getSourceId(), game) &&
|
// sacrifice the enchanted creature (don't check return state because controller has sarificed independant if something replaced later);
|
||||||
enchantment != null &&
|
// e.g. Commander replacement effect going to command zone
|
||||||
controller != null &&
|
enchantedCreature.sacrifice(source.getSourceId(), game);
|
||||||
target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||||
controller.choose(outcome, target, source.getId(), game);
|
controller.choose(outcome, target, source.getSourceId(), game);
|
||||||
Permanent newCreature = game.getPermanent(target.getFirstTarget());
|
Permanent newCreature = game.getPermanent(target.getFirstTarget());
|
||||||
if (newCreature != null &&
|
if (newCreature != null &&
|
||||||
newCreature.addAttachment(enchantment.getId(), game)) {
|
newCreature.addAttachment(enchantment.getId(), game)) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(),
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), controller.getId(), game)) {
|
||||||
controller.getId(), game)) {
|
permanent.untap(game);
|
||||||
permanent.untap(game);
|
}
|
||||||
|
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FilterCanBeEnchantedControlledCreaturePermanent extends FilterControlledCreaturePermanent {
|
|
||||||
|
|
||||||
public FilterCanBeEnchantedControlledCreaturePermanent(final FilterCanBeEnchantedControlledCreaturePermanent filter) {
|
|
||||||
super(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilterCanBeEnchantedControlledCreaturePermanent(MageObject auraEnchantment) {
|
|
||||||
super("creature you control that could be enchanted by " + auraEnchantment.getName());
|
|
||||||
this.add(new CanBeEnchantedPredicate(auraEnchantment));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FilterCanBeEnchantedControlledCreaturePermanent copy() {
|
|
||||||
return new FilterCanBeEnchantedControlledCreaturePermanent(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class CanBeEnchantedPredicate implements Predicate<Permanent> {
|
class CanBeEnchantedPredicate implements Predicate<Permanent> {
|
||||||
|
|
||||||
private final MageObject auraEnchantment;
|
private final MageObject auraEnchantment;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
package mage.sets.ravnika;
|
package mage.sets.ravnika;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObjectReference;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -77,7 +77,7 @@ class RallyTheRighteousUntapEffect extends OneShotEffect {
|
||||||
|
|
||||||
public RallyTheRighteousUntapEffect() {
|
public RallyTheRighteousUntapEffect() {
|
||||||
super(Outcome.Untap);
|
super(Outcome.Untap);
|
||||||
staticText = "<i>Radiance</i> — Untap target creature and each other creature that shares a color with it.";
|
staticText = "<i>Radiance</i> — Untap target creature and each other creature that shares a color with it";
|
||||||
}
|
}
|
||||||
|
|
||||||
public RallyTheRighteousUntapEffect(final RallyTheRighteousUntapEffect effect) {
|
public RallyTheRighteousUntapEffect(final RallyTheRighteousUntapEffect effect) {
|
||||||
|
@ -91,13 +91,13 @@ class RallyTheRighteousUntapEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
ObjectColor color = target.getColor();
|
ObjectColor color = target.getColor();
|
||||||
target.untap(game);
|
target.untap(game);
|
||||||
for (Permanent p : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (p.getColor().shares(color) && !p.getId().equals(target.getId())) {
|
if (permanent.getColor().shares(color) && !permanent.getId().equals(target.getId())) {
|
||||||
p.untap(game);
|
permanent.untap(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -111,7 +111,7 @@ class RallyTheRighteousBoostEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public RallyTheRighteousBoostEffect() {
|
public RallyTheRighteousBoostEffect() {
|
||||||
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||||
staticText = " Those creatures get +2/+0 until end of turn.";
|
staticText = "Those creatures get +2/+0 until end of turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
public RallyTheRighteousBoostEffect(final RallyTheRighteousBoostEffect effect) {
|
public RallyTheRighteousBoostEffect(final RallyTheRighteousBoostEffect effect) {
|
||||||
|
@ -119,19 +119,30 @@ class RallyTheRighteousBoostEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void init(Ability source, Game game) {
|
||||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
super.init(source, game);
|
||||||
|
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
|
affectedObjectList.add(new MageObjectReference(target));
|
||||||
ObjectColor color = target.getColor();
|
ObjectColor color = target.getColor();
|
||||||
target.addPower(2);
|
target.addPower(2);
|
||||||
for (Permanent p : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (p.getColor().shares(color) && !p.getId().equals(target.getId())) {
|
if (!permanent.getId().equals(target.getId()) && permanent.getColor().shares(color)) {
|
||||||
p.addPower(2);
|
affectedObjectList.add(new MageObjectReference(permanent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
for(MageObjectReference mageObjectReference :affectedObjectList) {
|
||||||
|
Permanent permanent = mageObjectReference.getPermanent(game);
|
||||||
|
if (permanent != null) {
|
||||||
|
permanent.addPower(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,7 +42,6 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author duncancmt
|
* @author duncancmt
|
||||||
|
@ -54,11 +53,9 @@ public class MercyKilling extends CardImpl {
|
||||||
this.expansionSetCode = "SHM";
|
this.expansionSetCode = "SHM";
|
||||||
|
|
||||||
// Target creature's controller sacrifices it, then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power.
|
// Target creature's controller sacrifices it, then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power.
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
this.getSpellAbility().addEffect(new SacrificeTargetEffect("Target creature's controller sacrifices it"));
|
||||||
Effect sacEffect = new SacrificeTargetEffect();
|
|
||||||
sacEffect.setText("Target creature's controller sacrifices it");
|
|
||||||
this.getSpellAbility().addEffect(sacEffect);
|
|
||||||
this.getSpellAbility().addEffect(new MercyKillingTokenEffect());
|
this.getSpellAbility().addEffect(new MercyKillingTokenEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MercyKilling(final MercyKilling card) {
|
public MercyKilling(final MercyKilling card) {
|
||||||
|
@ -75,7 +72,7 @@ class MercyKillingTokenEffect extends OneShotEffect {
|
||||||
|
|
||||||
public MercyKillingTokenEffect() {
|
public MercyKillingTokenEffect() {
|
||||||
super(Outcome.PutCreatureInPlay);
|
super(Outcome.PutCreatureInPlay);
|
||||||
staticText = ", then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power.";
|
staticText = ", then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power";
|
||||||
}
|
}
|
||||||
|
|
||||||
public MercyKillingTokenEffect(final MercyKillingTokenEffect effect) {
|
public MercyKillingTokenEffect(final MercyKillingTokenEffect effect) {
|
||||||
|
@ -89,13 +86,12 @@ class MercyKillingTokenEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source));
|
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
int power = permanent.getPower().getValue();
|
int power = permanent.getPower().getValue();
|
||||||
MercyKillingToken token = new MercyKillingToken();
|
return new MercyKillingToken().putOntoBattlefield(power, game, source.getSourceId(), permanent.getControllerId());
|
||||||
token.putOntoBattlefield(power, game, source.getSourceId(), permanent.getControllerId());
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,22 +29,24 @@ package mage.filter.predicate.mageobject;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
|
||||||
import mage.filter.predicate.ObjectPlayer;
|
import mage.filter.predicate.ObjectPlayer;
|
||||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||||
|
import mage.game.Controllable;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author duncancmt
|
* @author duncancmt
|
||||||
*/
|
*/
|
||||||
public class FromSetPredicate<T extends ObjectPlayer<MageObject>> implements ObjectPlayerPredicate<T> {
|
public class FromSetPredicate implements ObjectPlayerPredicate<ObjectPlayer<Controllable>> {
|
||||||
|
|
||||||
protected Set<UUID> set;
|
protected Set<UUID> set;
|
||||||
|
|
||||||
public FromSetPredicate(Set<UUID> set) {
|
public FromSetPredicate(Set<UUID> set) {
|
||||||
this.set = set;
|
this.set = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean apply(T input, Game game) {
|
@Override
|
||||||
|
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
||||||
return set.contains(input.getObject().getId());
|
return set.contains(input.getObject().getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue