[THS] Some fixes for Bow of Nylea and Ashio, Nightmare Weaver.

This commit is contained in:
LevelX2 2013-09-12 20:17:11 +02:00
parent 13cc227ebb
commit a21f7f315d
3 changed files with 28 additions and 8 deletions

View file

@ -38,6 +38,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
@ -163,6 +165,7 @@ class AshiokNightmareWeaverPutIntoPlayEffect extends OneShotEffect<AshiokNightma
FilterCard filter = new FilterCreatureCard(new StringBuilder("creature card with converted mana cost {").append(cmc).append("} exiled with Ashiok, Nightmare Weaver").toString());
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
Target target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source));
target.setRequired(true);
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
if (player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
@ -247,13 +250,17 @@ class AshiokNightmareWeaverExileAllEffect extends OneShotEffect<AshiokNightmareW
for (UUID opponentId: game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
for (UUID cardId :opponent.getHand()) {
Cards cards = new CardsImpl();
cards.addAll(opponent.getHand());
for (UUID cardId : cards) {
Card card = game.getCard(cardId);
if (card != null) {
card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game);
}
}
for (UUID cardId :opponent.getGraveyard()) {
cards.clear();
cards.addAll(opponent.getGraveyard());
for (UUID cardId :cards) {
Card card = game.getCard(cardId);
if (card != null) {
card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game);

View file

@ -81,13 +81,14 @@ public class BowOfNylea extends CardImpl<BowOfNylea> {
this.color.setGreen(true);
// Attacking creatures you control have deathtouch.
GainAbilityControlledEffect gainEffect = new GainAbilityControlledEffect(DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield, new FilterAttackingCreature(), false);
GainAbilityControlledEffect gainEffect = new GainAbilityControlledEffect(DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield, new FilterAttackingCreature("Attacking creatures"), false);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, gainEffect));
// {1}{G}, {T}: Choose one - Put a +1/+1 counter on target creature;
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
new ManaCostsImpl("{1}{G}"));
ability.addTarget(new TargetCreaturePermanent());
ability.addCost(new TapSourceCost());
// or Bow of Nylea deals 2 damage to target creature with flying;
Mode mode = new Mode();

View file

@ -71,17 +71,24 @@ public class TargetCardInExile extends TargetCard<TargetCardInExile> {
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<UUID>();
if (allExileZones) {
Set<UUID> possibleTargets = new HashSet<UUID>();
for (Card card : game.getExile().getAllCards(game)) {
if (filter.match(card, sourceControllerId, game)) {
possibleTargets.add(card.getId());
}
}
return possibleTargets;
} else {
return super.possibleTargets(sourceId, sourceControllerId, game);
ExileZone exileZone = game.getExile().getExileZone(zoneId);
if (exileZone != null) {
for(Card card : exileZone.getCards(game)) {
if (filter.match(card, sourceControllerId, game)) {
possibleTargets.add(card.getId());
}
}
}
}
return possibleTargets;
}
@Override
@ -94,10 +101,15 @@ public class TargetCardInExile extends TargetCard<TargetCardInExile> {
return true;
}
}
return false;
} else {
return super.canChoose(sourceControllerId, game);
ExileZone exileZone = game.getExile().getExileZone(zoneId);
if (exileZone != null) {
if (exileZone.count(filter, sourceId, sourceControllerId, game) >= this.minNumberOfTargets) {
return true;
}
}
}
return false;
}
@Override