mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
[THS] Some fixes for Bow of Nylea and Ashio, Nightmare Weaver.
This commit is contained in:
parent
13cc227ebb
commit
a21f7f315d
3 changed files with 28 additions and 8 deletions
|
@ -38,6 +38,8 @@ import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
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());
|
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));
|
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
|
||||||
Target target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source));
|
Target target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source));
|
||||||
|
target.setRequired(true);
|
||||||
|
|
||||||
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
|
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||||
if (player.chooseTarget(Outcome.PutCreatureInPlay, target, source, 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())) {
|
for (UUID opponentId: game.getOpponents(source.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(opponentId);
|
Player opponent = game.getPlayer(opponentId);
|
||||||
if (opponent != null) {
|
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);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game);
|
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);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game);
|
card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game);
|
||||||
|
|
|
@ -81,13 +81,14 @@ public class BowOfNylea extends CardImpl<BowOfNylea> {
|
||||||
this.color.setGreen(true);
|
this.color.setGreen(true);
|
||||||
|
|
||||||
// Attacking creatures you control have deathtouch.
|
// 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));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, gainEffect));
|
||||||
|
|
||||||
// {1}{G}, {T}: Choose one - Put a +1/+1 counter on target creature;
|
// {1}{G}, {T}: Choose one - Put a +1/+1 counter on target creature;
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||||
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
|
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
|
||||||
new ManaCostsImpl("{1}{G}"));
|
new ManaCostsImpl("{1}{G}"));
|
||||||
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
// or Bow of Nylea deals 2 damage to target creature with flying;
|
// or Bow of Nylea deals 2 damage to target creature with flying;
|
||||||
Mode mode = new Mode();
|
Mode mode = new Mode();
|
||||||
|
|
|
@ -71,18 +71,25 @@ public class TargetCardInExile extends TargetCard<TargetCardInExile> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
if (allExileZones) {
|
|
||||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||||
|
if (allExileZones) {
|
||||||
for (Card card : game.getExile().getAllCards(game)) {
|
for (Card card : game.getExile().getAllCards(game)) {
|
||||||
if (filter.match(card, sourceControllerId, game)) {
|
if (filter.match(card, sourceControllerId, game)) {
|
||||||
possibleTargets.add(card.getId());
|
possibleTargets.add(card.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return possibleTargets;
|
|
||||||
} else {
|
} 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
|
@Override
|
||||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
|
@ -94,11 +101,16 @@ public class TargetCardInExile extends TargetCard<TargetCardInExile> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
} 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
|
@Override
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
|
|
Loading…
Reference in a new issue