* Trickbind and Stiffle - Fixed that the spells could wronly also counter spells.

This commit is contained in:
LevelX2 2014-08-14 15:27:33 +02:00
parent f0e8041906
commit 2326fcc0d1
4 changed files with 21 additions and 21 deletions

View file

@ -116,10 +116,7 @@ class TrickbindCantActivateEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (getTargetPointer().getFirst(game, source).equals(permanent.getId())) {
return true;
}
return false;
return getTargetPointer().getFirst(game, source).equals(permanent.getId());
}
@Override

View file

@ -80,11 +80,7 @@ public class CreateTokenTargetEffect extends OneShotEffect {
return staticText;
}
StringBuilder sb = new StringBuilder("put ");
if (amount.toString().equals("1")) {
sb.append("a");
} else {
sb.append(amount.toString());
}
sb.append(CardUtil.numberToText(amount.toString(), "a"));
sb.append(" ").append(token.getDescription()).append(" onto the battlefield");
if (tapped) {
sb.append(" tapped");

View file

@ -49,7 +49,7 @@ public class MatchOptions implements Serializable {
protected String gameType;
protected String deckType;
protected boolean limited;
protected List<String> playerTypes = new ArrayList<String>();
protected List<String> playerTypes = new ArrayList<>();
/**
* Time each player has during the game to play using his\her priority.
*/

View file

@ -33,8 +33,7 @@ import java.util.Set;
import java.util.UUID;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.TriggeredAbility;
import mage.constants.AbilityType;
import mage.filter.Filter;
import mage.filter.FilterAbility;
import mage.game.Game;
@ -69,10 +68,7 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject {
}
StackObject stackObject = game.getStack().getStackObject(id);
if (stackObject.getStackAbility() != null && (stackObject.getStackAbility() instanceof ActivatedAbility || stackObject.getStackAbility() instanceof TriggeredAbility)) {
return true;
}
return false;
return isActivatedOrTriggeredAbility(stackObject);
}
@Override
@ -82,11 +78,11 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject {
@Override
public boolean canChoose(UUID sourceControllerId, Game game) {
for (StackObject stackObject : game.getStack()) {
if (stackObject.getStackAbility() != null && (stackObject.getStackAbility() instanceof ActivatedAbility || stackObject.getStackAbility() instanceof TriggeredAbility) && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getStackAbility().getControllerId())) {
return true;
}
for (StackObject stackObject : game.getStack()) {
if (isActivatedOrTriggeredAbility(stackObject)) {
return true;
}
}
return false;
}
@ -99,7 +95,7 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject {
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>();
for (StackObject stackObject : game.getStack()) {
if (stackObject.getStackAbility() != null && (stackObject.getStackAbility() instanceof ActivatedAbility || stackObject.getStackAbility() instanceof TriggeredAbility) && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getStackAbility().getControllerId())) {
if (isActivatedOrTriggeredAbility(stackObject)) {
possibleTargets.add(stackObject.getStackAbility().getId());
}
}
@ -116,4 +112,15 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject {
return new FilterAbility();
}
static boolean isActivatedOrTriggeredAbility(StackObject stackObject) {
if (stackObject == null) {
return false;
}
if (stackObject instanceof Ability) {
Ability ability = (Ability)stackObject;
return ability.getAbilityType().equals(AbilityType.TRIGGERED)
|| ability.getAbilityType().equals(AbilityType.ACTIVATED);
}
return false;
}
}