mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Fixed Protection from color. Fixed spell fizzling.
This commit is contained in:
parent
8e13ebffcd
commit
3521c7dd08
4 changed files with 17 additions and 11 deletions
|
@ -65,11 +65,12 @@ public class GainProtectionFromColorTargetEffect extends GainAbilityTargetEffect
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
protectionFilter.setColor(choice.getColor());
|
||||
protectionFilter.setMessage(choice.getChoice());
|
||||
Permanent creature = game.getPermanent(source.getFirstTarget());
|
||||
if (creature != null) {
|
||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
protectionFilter.setColor(choice.getColor());
|
||||
protectionFilter.setMessage(choice.getChoice());
|
||||
((ProtectionAbility)ability).setFilter(protectionFilter);
|
||||
creature.addAbility(ability);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return result;
|
||||
}
|
||||
//20091005 - 608.2b
|
||||
game.informPlayers(getName() + " has been fizzled.");
|
||||
counter(null, game);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -243,12 +243,12 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
|||
public boolean isLegal(Ability source, Game game) {
|
||||
//20101001 - 608.2b
|
||||
for (UUID targetId: targets.keySet()) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getId(), source.getControllerId())))
|
||||
return true;
|
||||
if (canTarget(targetId, source, game))
|
||||
return true;
|
||||
if (game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getId(), source.getControllerId())))
|
||||
return false;
|
||||
if (!canTarget(targetId, source, game))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -99,12 +99,16 @@ public class Targets extends ArrayList<Target> {
|
|||
}
|
||||
|
||||
public boolean stillLegal(Ability source, Game game) {
|
||||
// 608.2
|
||||
// The spell or ability is countered if all its targets, for every instance of the word "target," are now illegal
|
||||
int illegalCount = 0;
|
||||
for (Target target: this) {
|
||||
if (!target.isLegal(source, game)) {
|
||||
return false;
|
||||
if (target.isLegal(source, game)) {
|
||||
illegalCount++;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
// check all are illegal
|
||||
return this.size() == illegalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue