mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Puppeteer Clique - Fixed that the ability also tiggered without a valid target.
This commit is contained in:
parent
04f9227349
commit
e5a792a8f5
3 changed files with 34 additions and 6 deletions
|
@ -69,7 +69,6 @@ public class PuppeteerClique extends CardImpl {
|
||||||
this.subtype.add("Faerie");
|
this.subtype.add("Faerie");
|
||||||
this.subtype.add("Wizard");
|
this.subtype.add("Wizard");
|
||||||
|
|
||||||
this.color.setBlack(true);
|
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ class PuppeteerCliqueEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
Card card = game.getCard(source.getFirstTarget());
|
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
Player you = game.getPlayer(source.getControllerId());
|
Player you = game.getPlayer(source.getControllerId());
|
||||||
if (you != null) {
|
if (you != null) {
|
||||||
|
@ -125,7 +124,7 @@ class PuppeteerCliqueEffect extends OneShotEffect {
|
||||||
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
||||||
hasteEffect.setTargetPointer(new FixedTarget(permanent.getId()));
|
hasteEffect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||||
game.addEffect(hasteEffect, source);
|
game.addEffect(hasteEffect, source);
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect(new StringBuilder("exile ").append(permanent.getName()).toString());
|
ExileTargetEffect exileEffect = new ExileTargetEffect("exile " + permanent.getLogName());
|
||||||
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
|
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect, TargetController.YOU);
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect, TargetController.YOU);
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
|
|
@ -95,7 +95,6 @@ public class FilterCard extends FilterObject<Card> {
|
||||||
if (!this.match(card, game)) {
|
if (!this.match(card, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(card, sourceId, playerId), game);
|
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(card, sourceId, playerId), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ import mage.game.Game;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
|
||||||
public class TargetCardInOpponentsGraveyard extends TargetCard {
|
public class TargetCardInOpponentsGraveyard extends TargetCard {
|
||||||
|
@ -52,9 +54,37 @@ public class TargetCardInOpponentsGraveyard extends TargetCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||||
return true;
|
return canChoose(null, sourceControllerId, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if there are enough {@link Card} that can be chosen.
|
||||||
|
*
|
||||||
|
* @param sourceId - the target event source
|
||||||
|
* @param sourceControllerId - controller of the target event source
|
||||||
|
* @param game
|
||||||
|
* @return - true if enough valid {@link Card} exist
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
|
int possibleTargets = 0;
|
||||||
|
for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) {
|
||||||
|
if (!playerId.equals(sourceControllerId)) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
for (Card card : player.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) {
|
||||||
|
if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) {
|
||||||
|
possibleTargets++;
|
||||||
|
if (possibleTargets >= this.minNumberOfTargets) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public TargetCardInOpponentsGraveyard copy() {
|
public TargetCardInOpponentsGraveyard copy() {
|
||||||
return new TargetCardInOpponentsGraveyard(this);
|
return new TargetCardInOpponentsGraveyard(this);
|
||||||
|
|
Loading…
Reference in a new issue