mirror of
https://github.com/correl/mage.git
synced 2025-04-10 17:00:08 -09:00
* Fixed that spells with targets cast without paying mana could simply be canceled by canceling the target selection (e.g. player was able to cancel a spell cast by suspend what's not allowed by the rules).
This commit is contained in:
parent
963f371c12
commit
69dc4f10ac
6 changed files with 118 additions and 119 deletions
Mage.Sets/src/mage/sets
gatecrash
lorwyn
magic2014
magic2015
Mage/src/mage
|
@ -76,6 +76,7 @@ public class IllusionistsBracers extends CardImpl {
|
|||
}
|
||||
|
||||
class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
AbilityActivatedTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CopyActivatedAbilityEffect());
|
||||
}
|
||||
|
@ -142,7 +143,7 @@ class CopyActivatedAbilityEffect extends OneShotEffect {
|
|||
if (newAbility.getTargets().size() > 0) {
|
||||
if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) {
|
||||
newAbility.getTargets().clearChosen();
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class RingsOfBrighthearthEffect extends OneShotEffect {
|
|||
if (newAbility.getTargets().size() > 0) {
|
||||
if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) {
|
||||
newAbility.getTargets().clearChosen();
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,6 @@ import mage.target.TargetObject;
|
|||
*/
|
||||
public class StrionicResonator extends CardImpl {
|
||||
|
||||
|
||||
|
||||
public StrionicResonator(UUID ownerId) {
|
||||
super(ownerId, 224, "Strionic Resonator", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "M14";
|
||||
|
@ -104,7 +102,7 @@ class StrionicResonatorEffect extends OneShotEffect {
|
|||
if (newAbility.getTargets().size() > 0) {
|
||||
if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) {
|
||||
newAbility.getTargets().clearChosen();
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +141,6 @@ class TargetTriggeredAbility extends TargetObject {
|
|||
super(target);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
if (source != null && source.getSourceId().equals(id)) {
|
||||
|
|
|
@ -152,7 +152,7 @@ class KurkeshOnakkeAncientEffect extends OneShotEffect {
|
|||
if (newAbility.getTargets().size() > 0) {
|
||||
if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) {
|
||||
newAbility.getTargets().clearChosen();
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
|
||||
if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.counter;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -40,8 +39,8 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author Loki
|
||||
*/
|
||||
|
||||
public class RemoveCounterSourceEffect extends OneShotEffect {
|
||||
|
||||
private final Counter counter;
|
||||
|
||||
public RemoveCounterSourceEffect(Counter counter) {
|
||||
|
@ -57,22 +56,21 @@ public class RemoveCounterSourceEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null && p.getCounters().getCount(counter.getName()) >= counter.getCount()) {
|
||||
p.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && permanent.getCounters().getCount(counter.getName()) >= counter.getCount()) {
|
||||
permanent.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
|
||||
.append(" counter from ").append(p.getName()).toString());
|
||||
game.informPlayers("Removed " + counter.getCount() + " " + counter.getName() + " counter from " + permanent.getLogName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Card c = game.getCard(source.getSourceId());
|
||||
if (c != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) {
|
||||
c.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null && card.getCounters(game).getCount(counter.getName()) >= counter.getCount()) {
|
||||
card.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
|
||||
.append(" counter from ").append(c.getName())
|
||||
.append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString());
|
||||
game.informPlayers("Removed " + counter.getCount() + " " + counter.getName()
|
||||
+ " counter from " + card.getLogName()
|
||||
+ " (" + card.getCounters(game).getCount(counter.getName()) + " left)");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,24 +25,23 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.target;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Targets extends ArrayList<Target> {
|
||||
|
||||
public Targets() {}
|
||||
public Targets() {
|
||||
}
|
||||
|
||||
public Targets(final Targets targets) {
|
||||
for (Target target : targets) {
|
||||
|
@ -90,7 +89,7 @@ public class Targets extends ArrayList<Target> {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean chooseTargets(Outcome outcome, UUID playerId, Ability source, Game game) {
|
||||
public boolean chooseTargets(Outcome outcome, UUID playerId, Ability source, boolean noMana, Game game) {
|
||||
if (this.size() > 0) {
|
||||
if (!canChoose(source.getSourceId(), playerId, game)) {
|
||||
return false;
|
||||
|
@ -101,6 +100,9 @@ public class Targets extends ArrayList<Target> {
|
|||
if (target.getTargetController() != null) { // some targets can have controller different than ability controller
|
||||
targetController = target.getTargetController();
|
||||
}
|
||||
if (noMana) { // if cast without mana (e.g. by supend you may notr be able to cancel the casting if you are able to cast it
|
||||
target.setRequired(true);
|
||||
}
|
||||
if (!target.chooseTarget(outcome, targetController, source, game)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -123,8 +125,8 @@ public class Targets extends ArrayList<Target> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if there are enough targets that can be chosen. Should only be used
|
||||
* for Ability targets since this checks for protection, shroud etc.
|
||||
* Checks if there are enough targets that can be chosen. Should only be
|
||||
* used for Ability targets since this checks for protection, shroud etc.
|
||||
*
|
||||
* @param sourceId - the target event source
|
||||
* @param sourceControllerId - controller of the target event source
|
||||
|
@ -141,8 +143,9 @@ public class Targets extends ArrayList<Target> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if there are enough objects that can be selected. Should not be used
|
||||
* for Ability targets since this does not check for protection, shroud etc.
|
||||
* Checks if there are enough objects that can be selected. Should not be
|
||||
* used for Ability targets since this does not check for protection, shroud
|
||||
* etc.
|
||||
*
|
||||
* @param sourceControllerId - controller of the select event
|
||||
* @param game
|
||||
|
|
Loading…
Add table
Reference in a new issue