Moved the tap-symbol searching effect into from within Ability Predicate into MagewrightStone itself, since it is a single-use predicate.

Goblin Wizard's set number has been corrected.

References to "goblin permanent" have been shortened to "Goblin" within the Goblin Wizard's tooltip text.
This commit is contained in:
BursegSardaukar 2015-09-14 15:43:06 -04:00
parent ac0795c7bf
commit 94fcb96e4d
3 changed files with 50 additions and 23 deletions

View file

@ -28,17 +28,23 @@
package mage.sets.dissension;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.target.common.TargetCreaturePermanent;
/**
@ -50,7 +56,7 @@ public class MagewrightsStone extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that has an ability with {T} in its cost");
static {
filter.add(new AbilityPredicate(SimpleActivatedAbility.class));
filter.add(new HasAbilityWithTapSymbolPredicate());
}
public MagewrightsStone(UUID ownerId) {
@ -73,3 +79,40 @@ public class MagewrightsStone extends CardImpl {
return new MagewrightsStone(this);
}
}
/**
*
* @author North
*/
class HasAbilityWithTapSymbolPredicate implements Predicate<MageObject> {
public HasAbilityWithTapSymbolPredicate() {
}
@Override
public boolean apply(MageObject input, Game game) {
Abilities<Ability> abilities;
if (input instanceof Card){
abilities = ((Card)input).getAbilities(game);
} else {
abilities = input.getAbilities();
}
for (Ability ability : abilities) {
if((ability instanceof ActivatedAbilityImpl) && ability.getCosts().size() > 0){
for (Cost cost : ability.getCosts()) {
if (cost instanceof TapSourceCost) {
return true;
}
}
}
}
return false;
}
@Override
public String toString() {
return "Ability contains {T} symbol.";
}
}

View file

@ -56,9 +56,9 @@ import mage.target.TargetPermanent;
*/
public class GoblinWizard extends CardImpl {
private static final FilterPermanentCard filter = new FilterPermanentCard("a Goblin permanent card");
private static final FilterPermanentCard filter = new FilterPermanentCard("Goblin");
private static final FilterCard protectionFilter = new FilterCard("white");
private static final FilterPermanent goblinCard = new FilterPermanent("a Goblin permanent card");
private static final FilterPermanent goblinCard = new FilterPermanent("Goblin");
static {
filter.add(new SubtypePredicate("Goblin"));
@ -67,8 +67,7 @@ public class GoblinWizard extends CardImpl {
}
public GoblinWizard(UUID ownerId) {
//Can't find the card ID....?
super(ownerId, 66, "Goblin Wizard", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
super(ownerId, 68, "Goblin Wizard", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.expansionSetCode = "DRK";
this.rarity = Rarity.RARE;
@ -99,4 +98,4 @@ public class GoblinWizard extends CardImpl {
public GoblinWizard copy() {
return new GoblinWizard(this);
}
}
}

View file

@ -30,9 +30,6 @@ package mage.filter.predicate.mageobject;
import mage.MageObject;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.TapSourceCost;
import mage.cards.Card;
import mage.filter.predicate.Predicate;
import mage.game.Game;
@ -60,19 +57,7 @@ public class AbilityPredicate implements Predicate<MageObject> {
for (Ability ability : abilities) {
if (abilityClass.equals(ability.getClass())) {
//Burseg Hack: Magewright's Stone [DIS] specifically looks for activated ability containing {T}
//As of 9/13/2015, no other AbilityPredicate is filtering for ActivatedAbilityImpl
//if (abilityClass.equals(SimpleActivatedAbility.class) && ability.getCosts().size() > 0){
if((ability instanceof ActivatedAbilityImpl) && ability.getCosts().size() > 0){
for (Cost cost : ability.getCosts()) {
if (cost instanceof TapSourceCost) {
return true;
}
}
return false;
} else {
return true;
}
return true;
}
}
return false;