mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +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
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
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());
|
Permanent creature = game.getPermanent(source.getFirstTarget());
|
||||||
if (creature != null) {
|
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);
|
creature.addAbility(ability);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//20091005 - 608.2b
|
//20091005 - 608.2b
|
||||||
|
game.informPlayers(getName() + " has been fizzled.");
|
||||||
counter(null, game);
|
counter(null, game);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,12 +243,12 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
||||||
public boolean isLegal(Ability source, Game game) {
|
public boolean isLegal(Ability source, Game game) {
|
||||||
//20101001 - 608.2b
|
//20101001 - 608.2b
|
||||||
for (UUID targetId: targets.keySet()) {
|
for (UUID targetId: targets.keySet()) {
|
||||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getId(), source.getControllerId())))
|
if (game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getId(), source.getControllerId())))
|
||||||
return true;
|
return false;
|
||||||
if (canTarget(targetId, source, game))
|
if (!canTarget(targetId, source, game))
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -99,12 +99,16 @@ public class Targets extends ArrayList<Target> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean stillLegal(Ability source, Game game) {
|
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) {
|
for (Target target: this) {
|
||||||
if (!target.isLegal(source, game)) {
|
if (target.isLegal(source, game)) {
|
||||||
return false;
|
illegalCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
// check all are illegal
|
||||||
|
return this.size() == illegalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue