mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
[AVR] Rain Of Thorns. Fixed Wild Defiance trigger.
This commit is contained in:
parent
32e29392d2
commit
b3b0d25af7
3 changed files with 119 additions and 3 deletions
96
Mage.Sets/src/mage/sets/avacynrestored/RainOfThorns.java
Normal file
96
Mage.Sets/src/mage/sets/avacynrestored/RainOfThorns.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.avacynrestored;
|
||||
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterEnchantment;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
|
||||
*/
|
||||
public class RainOfThorns extends CardImpl<RainOfThorns> {
|
||||
|
||||
public RainOfThorns(UUID ownerId) {
|
||||
super(ownerId, 190, "Rain of Thorns", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
|
||||
this.expansionSetCode = "AVR";
|
||||
|
||||
this.color.setGreen(true);
|
||||
|
||||
// Choose one or more - Destroy target artifact; destroy target enchantment; and/or destroy target land.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
|
||||
Mode mode1 = new Mode();
|
||||
mode1.getEffects().add(new DestroyTargetEffect());
|
||||
mode1.getTargets().add(new TargetPermanent(new FilterEnchantment()));
|
||||
this.getSpellAbility().addMode(mode1);
|
||||
|
||||
Mode mode2 = new Mode();
|
||||
mode2.getEffects().add(new DestroyTargetEffect());
|
||||
mode2.getTargets().add(new TargetPermanent(new FilterLandPermanent()));
|
||||
this.getSpellAbility().addMode(mode2);
|
||||
|
||||
Mode mode3 = new Mode();
|
||||
mode3.getEffects().add(new DestroyTargetEffect("Destroy target artifact, then destroy target enchantment"));
|
||||
mode3.getTargets().add(new TargetArtifactPermanent());
|
||||
mode3.getTargets().add(new TargetPermanent(new FilterEnchantment()));
|
||||
this.getSpellAbility().addMode(mode3);
|
||||
|
||||
Mode mode4 = new Mode();
|
||||
mode4.getEffects().add(new DestroyTargetEffect("Destroy target artifact, then destroy target land"));
|
||||
mode4.getTargets().add(new TargetArtifactPermanent());
|
||||
mode4.getTargets().add(new TargetPermanent(new FilterLandPermanent()));
|
||||
this.getSpellAbility().addMode(mode4);
|
||||
|
||||
Mode mode5 = new Mode();
|
||||
mode5.getEffects().add(new DestroyTargetEffect("Destroy target enchantment, then destroy target land"));
|
||||
mode5.getTargets().add(new TargetPermanent(new FilterEnchantment()));
|
||||
mode5.getTargets().add(new TargetPermanent(new FilterLandPermanent()));
|
||||
this.getSpellAbility().addMode(mode5);
|
||||
}
|
||||
|
||||
public RainOfThorns(final RainOfThorns card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RainOfThorns copy() {
|
||||
return new RainOfThorns(this);
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.TARGETED) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.getControllerId().equals(this.controllerId)) {
|
||||
if (permanent != null && permanent.getControllerId().equals(this.controllerId) && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object instanceof Spell) {
|
||||
Card c = (Spell)object;
|
||||
|
|
|
@ -30,12 +30,13 @@ package mage.abilities.effects.common;
|
|||
|
||||
import mage.Constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Mode;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,6 +49,11 @@ public class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
|
|||
public DestroyTargetEffect() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public DestroyTargetEffect(String ruleText) {
|
||||
this(false);
|
||||
staticText = ruleText;
|
||||
}
|
||||
|
||||
public DestroyTargetEffect(boolean noRegen) {
|
||||
super(Outcome.DestroyPermanent);
|
||||
|
@ -67,7 +73,18 @@ public class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
if (targetPointer.getTargets(source).size() > 0) {
|
||||
if (source.getTargets().size() > 1) { // for Rain of Thorns
|
||||
for (Target target : source.getTargets()) {
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
permanent.destroy(source.getId(), game, noRegen);
|
||||
affectedTargets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetPointer.getTargets(source).size() > 0) {
|
||||
for (UUID permanentId : targetPointer.getTargets(source)) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
|
@ -81,6 +98,9 @@ public class DestroyTargetEffect extends OneShotEffect<DestroyTargetEffect> {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().size() == 0) {
|
||||
sb.append("destroy that creature"); //TODO add possibility to specify text with targetPointer usage
|
||||
|
|
Loading…
Reference in a new issue