mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
* Tap any number of untapped creatures - added card hint, improved targeting, fixed cheating (example: Harmony Of Nature);
This commit is contained in:
parent
fe4d4c0834
commit
bf67c4c6b4
4 changed files with 123 additions and 141 deletions
|
@ -1,12 +1,9 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -14,22 +11,31 @@ import mage.constants.Outcome;
|
|||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.AngelToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class DevoutInvocation extends CardImpl {
|
||||
|
||||
static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public DevoutInvocation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{6}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{6}{W}");
|
||||
|
||||
// Tap any number of untapped creatures you control. Create a 4/4 white Angel creature token with flying for each creature tapped this way.
|
||||
this.getSpellAbility().addEffect(new DevoutInvocationEffect());
|
||||
|
||||
this.getSpellAbility().addHint(new ValueHint(filter.getMessage(), new PermanentsOnBattlefieldCount(filter)));
|
||||
}
|
||||
|
||||
private DevoutInvocation(final DevoutInvocation card) {
|
||||
|
@ -44,14 +50,8 @@ public final class DevoutInvocation extends CardImpl {
|
|||
|
||||
class DevoutInvocationEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public DevoutInvocationEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
super(Outcome.AIDontUseIt);
|
||||
staticText = "Tap any number of untapped creatures you control. Create a 4/4 white Angel creature token with flying for each creature tapped this way";
|
||||
}
|
||||
|
||||
|
@ -62,36 +62,31 @@ class DevoutInvocationEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetPermanent target = new TargetControlledPermanent(0, Integer.MAX_VALUE, DevoutInvocation.filter, true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
if (target.getTargets().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
while (controller.canRespond()) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(source, game);
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null && permanent.tap(source, game)) {
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tappedAmount > 0) {
|
||||
AngelToken angelToken = new AngelToken();
|
||||
angelToken.putOntoBattlefield(tappedAmount, game, source, source.getControllerId());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevoutInvocationEffect copy() {
|
||||
|
|
|
@ -1,34 +1,40 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class HarmonyOfNature extends CardImpl {
|
||||
|
||||
static final FilterControlledPermanent filter = new FilterControlledPermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public HarmonyOfNature(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
|
||||
// Tap any number of untapped creatures you control. You gain 4 life for each creature tapped this way.
|
||||
this.getSpellAbility().addEffect(new HarmonyOfNatureEffect());
|
||||
this.getSpellAbility().addHint(new ValueHint(filter.getMessage(), new PermanentsOnBattlefieldCount(filter)));
|
||||
}
|
||||
|
||||
private HarmonyOfNature(final HarmonyOfNature card) {
|
||||
|
@ -43,15 +49,8 @@ public final class HarmonyOfNature extends CardImpl {
|
|||
|
||||
class HarmonyOfNatureEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public HarmonyOfNatureEffect() {
|
||||
super(Outcome.GainLife);
|
||||
super(Outcome.AIDontUseIt);
|
||||
staticText = "Tap any number of untapped creatures you control. You gain 4 life for each creature tapped this way";
|
||||
}
|
||||
|
||||
|
@ -62,35 +61,29 @@ class HarmonyOfNatureEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetPermanent target = new TargetControlledPermanent(0, Integer.MAX_VALUE, HarmonyOfNature.filter, true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
if (target.getTargets().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(source, game);
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null && permanent.tap(source, game)) {
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tappedAmount > 0) {
|
||||
controller.gainLife(tappedAmount * 4, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HarmonyOfNatureEffect copy() {
|
||||
|
|
|
@ -1,34 +1,40 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class MarshalingTheTroops extends CardImpl {
|
||||
|
||||
static final FilterControlledPermanent filter = new FilterControlledPermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public MarshalingTheTroops(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
|
||||
|
||||
// Tap any number of untapped creatures you control. You gain 4 life for each creature tapped this way.
|
||||
this.getSpellAbility().addEffect(new MarshalingTheTroopsEffect());
|
||||
this.getSpellAbility().addHint(new ValueHint(filter.getMessage(), new PermanentsOnBattlefieldCount(filter)));
|
||||
}
|
||||
|
||||
private MarshalingTheTroops(final MarshalingTheTroops card) {
|
||||
|
@ -43,15 +49,8 @@ public final class MarshalingTheTroops extends CardImpl {
|
|||
|
||||
class MarshalingTheTroopsEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("untapped creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public MarshalingTheTroopsEffect() {
|
||||
super(Outcome.GainLife);
|
||||
super(Outcome.AIDontUseIt);
|
||||
staticText = "Tap any number of untapped creatures you control. You gain 4 life for each creature tapped this way";
|
||||
}
|
||||
|
||||
|
@ -62,35 +61,29 @@ class MarshalingTheTroopsEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetPermanent target = new TargetControlledPermanent(0, Integer.MAX_VALUE, MarshalingTheTroops.filter, true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
if (target.getTargets().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int tappedAmount = 0;
|
||||
TargetPermanent target = new TargetPermanent(0, 1, filter, false);
|
||||
while (true) {
|
||||
target.clearChosen();
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(source, game);
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null && permanent.tap(source, game)) {
|
||||
tappedAmount++;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tappedAmount > 0) {
|
||||
controller.gainLife(tappedAmount * 4, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MarshalingTheTroopsEffect copy() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package org.mage.test.cards.abilities.oneshot.destroy;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
@ -7,14 +6,13 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class WrathOfGodTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testDestroy() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains",4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
|
||||
addCard(Zone.HAND, playerA, "Wrath of God");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
|
@ -33,8 +31,11 @@ public class WrathOfGodTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wrath of God");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||
assertPermanentCount(playerA, "Mossbridge Troll", 0);
|
||||
assertPermanentCount(playerA, "Darksteel Gargoyle", 1);
|
||||
|
|
Loading…
Reference in a new issue