mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Add DamageTargetControllerEffect and use it for existing cards. Implement card: Illuminate
This commit is contained in:
parent
ece8248f11
commit
3ea281ffbf
5 changed files with 215 additions and 134 deletions
79
Mage.Sets/src/mage/sets/apocalypse/Illuminate.java
Normal file
79
Mage.Sets/src/mage/sets/apocalypse/Illuminate.java
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.apocalypse;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.common.KickedCostCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class Illuminate extends CardImpl {
|
||||
|
||||
public Illuminate(UUID ownerId) {
|
||||
super(ownerId, 63, "Illuminate", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{X}{R}");
|
||||
this.expansionSetCode = "APC";
|
||||
|
||||
// Kicker {2}{R} and/or {3}{U}
|
||||
KickerAbility kickerAbility = new KickerAbility("{2}{R}");
|
||||
kickerAbility.addKickerCost("{3}{U}");
|
||||
this.addAbility(kickerAbility);
|
||||
// Illuminate deals X damage to target creature. If Illuminate was kicked with its {2}{R} kicker, it deals X damage to that creature's controller. If Illuminate was kicked with its {3}{U} kicker, you draw X cards.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(new ManacostVariableValue()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new DamageTargetControllerEffect(new ManacostVariableValue()),
|
||||
new KickedCostCondition("{2}{R}"),
|
||||
"If {this} was kicked with its {2}{R} kicker, it deals X damage to that creature's controller."));
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new DrawCardSourceControllerEffect(new ManacostVariableValue()),
|
||||
new KickedCostCondition("{3}{U}"),
|
||||
"If {this} was kicked with its {3}{U} kicker, you draw X cards."));
|
||||
|
||||
}
|
||||
|
||||
public Illuminate(final Illuminate card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Illuminate copy() {
|
||||
return new Illuminate(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,15 +28,12 @@
|
|||
package mage.sets.betrayersofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -50,9 +47,11 @@ public class FirstVolley extends CardImpl {
|
|||
this.expansionSetCode = "BOK";
|
||||
this.subtype.add("Arcane");
|
||||
|
||||
|
||||
// First Volley deals 1 damage to target creature and 1 damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new FirstVolleyEffect());
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(1));
|
||||
Effect effect = new DamageTargetControllerEffect(1);
|
||||
effect.setText("and 1 damage to that creature's controller");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
||||
}
|
||||
|
|
@ -66,34 +65,3 @@ public class FirstVolley extends CardImpl {
|
|||
return new FirstVolley(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FirstVolleyEffect extends OneShotEffect {
|
||||
|
||||
public FirstVolleyEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "{this} deals 1 damage to target creature and 1 damage to that creature's controller";
|
||||
}
|
||||
|
||||
public FirstVolleyEffect(final FirstVolleyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirstVolleyEffect copy() {
|
||||
return new FirstVolleyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(permanent.getControllerId());
|
||||
if (controller != null) {
|
||||
permanent.damage(1, source.getSourceId(), game, false, true);
|
||||
controller.damage(1, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* 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.
|
||||
|
|
@ -29,15 +29,12 @@
|
|||
package mage.sets.magic2011;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -50,7 +47,11 @@ public class ChandrasOutrage extends CardImpl {
|
|||
super(ownerId, 128, "Chandra's Outrage", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{R}{R}");
|
||||
this.expansionSetCode = "M11";
|
||||
|
||||
this.getSpellAbility().addEffect(new ChandrasOutrageEffect());
|
||||
// Chandra's Outrage deals 4 damage to target creature and 2 damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
|
||||
Effect effect = new DamageTargetControllerEffect(2);
|
||||
effect.setText("and 2 damage to that creature's controller");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
|
|
@ -64,35 +65,3 @@ public class ChandrasOutrage extends CardImpl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class ChandrasOutrageEffect extends OneShotEffect {
|
||||
|
||||
public ChandrasOutrageEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "{this} deals 4 damage to target creature and 2 damage to that creature's controller";
|
||||
}
|
||||
|
||||
public ChandrasOutrageEffect(final ChandrasOutrageEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
permanent.damage(4, source.getSourceId(), game, false, true);
|
||||
player.damage(2, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChandrasOutrageEffect copy() {
|
||||
return new ChandrasOutrageEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -28,16 +28,14 @@
|
|||
package mage.sets.magicorigins;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.SpellMasteryCondition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -50,10 +48,12 @@ public class RavagingBlaze extends CardImpl {
|
|||
super(ownerId, 159, "Ravaging Blaze", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{X}{R}{R}");
|
||||
this.expansionSetCode = "ORI";
|
||||
|
||||
// Ravaging Blaze deals X damage to target creature.
|
||||
// <i>Spell mastery</i> — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new RavagingBlazeEffect());
|
||||
// Ravaging Blaze deals X damage to target creature.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(new ManacostVariableValue()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
// <i>Spell mastery</i> — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new DamageTargetControllerEffect(new ManacostVariableValue()),
|
||||
SpellMasteryCondition.getInstance(), "<br><i>Spell mastery</i> — If there are two or more instant and/or sorcery cards in your graveyard, Ravaging Blaze also deals X damage to that creature's controller."));
|
||||
}
|
||||
|
||||
public RavagingBlaze(final RavagingBlaze card) {
|
||||
|
|
@ -65,41 +65,3 @@ public class RavagingBlaze extends CardImpl {
|
|||
return new RavagingBlaze(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RavagingBlazeEffect extends OneShotEffect {
|
||||
|
||||
public RavagingBlazeEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "{this} deals X damage to target creature.<br>"
|
||||
+ "<i>Spell mastery</i> — If there are two or more instant and/or sorcery cards in your graveyard, {this} also deals X damage to that creature's controller.";
|
||||
}
|
||||
|
||||
public RavagingBlazeEffect(final RavagingBlazeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RavagingBlazeEffect copy() {
|
||||
return new RavagingBlazeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
int xValue = source.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
permanent.damage(xValue, source.getSourceId(), game, false, true);
|
||||
if (SpellMasteryCondition.getInstance().apply(game, source)) {
|
||||
Player targetController = game.getPlayer(permanent.getControllerId());
|
||||
if (targetController != null) {
|
||||
targetController.damage(xValue, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* 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.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class DamageTargetControllerEffect extends OneShotEffect {
|
||||
|
||||
protected DynamicValue amount;
|
||||
protected boolean preventable;
|
||||
|
||||
public DamageTargetControllerEffect(int amount) {
|
||||
this(new StaticValue(amount), true);
|
||||
}
|
||||
|
||||
public DamageTargetControllerEffect(int amount, boolean preventable) {
|
||||
this(new StaticValue(amount), preventable);
|
||||
}
|
||||
|
||||
public DamageTargetControllerEffect(DynamicValue amount) {
|
||||
this(amount, true);
|
||||
}
|
||||
|
||||
public DamageTargetControllerEffect(DynamicValue amount, boolean preventable) {
|
||||
super(Outcome.Damage);
|
||||
this.amount = amount;
|
||||
this.preventable = preventable;
|
||||
}
|
||||
|
||||
public DamageTargetControllerEffect(final DamageTargetControllerEffect effect) {
|
||||
super(effect);
|
||||
amount = effect.amount.copy();
|
||||
preventable = effect.preventable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageTargetControllerEffect copy() {
|
||||
return new DamageTargetControllerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if(permanent != null) {
|
||||
Player targetController = game.getPlayer(permanent.getControllerId());
|
||||
if(targetController != null) {
|
||||
targetController.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
String text = "{this} deals " + amount.getMessage() + " damage to target "
|
||||
+ mode.getTargets().get(0).getTargetName() + "'s controller";
|
||||
if(!preventable) {
|
||||
text += ". The damage can't be prevented";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue