[SWS] Fixed some bugs of starwars cards.

This commit is contained in:
LevelX2 2016-09-30 01:22:56 +02:00
parent 81b74c1519
commit ca414417e3
16 changed files with 140 additions and 76 deletions

View file

@ -33,6 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -93,7 +94,14 @@ class BaneOfBalaGedEffect extends OneShotEffect {
if (defendingPlayer != null) {
Target target = new TargetControlledPermanent(2);
defendingPlayer.chooseTarget(outcome, target, source, game);
defendingPlayer.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
Cards toExile = new CardsImpl();
target.getTargets().stream().map((targetId)
-> game.getPermanent(targetId)).filter((permanent)
-> (permanent != null)).forEach((permanent)
-> {
toExile.add(permanent);
});
defendingPlayer.moveCards(toExile, Zone.EXILED, source, game);
return true;
}
return false;

View file

@ -51,7 +51,7 @@ import mage.target.common.TargetOpponentsCreaturePermanent;
public class BountySpotter extends CardImpl {
public BountySpotter(UUID ownerId) {
super(ownerId, 69, "Bounty Spotter", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}");
super(ownerId, 69, "Bounty Spotter", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.expansionSetCode = "SWS";
this.subtype.add("Zabrak");
this.subtype.add("Hunter");

View file

@ -28,9 +28,11 @@
package mage.sets.starwars;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -39,11 +41,12 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterNonlandCard;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -58,7 +61,7 @@ public class DarkDecision extends CardImpl {
// As an additional cost to cast Dark Decision, pay 1 life.
this.getSpellAbility().addCost(new PayLifeCost(1));
// Search the top 10 cards of your library for a nonland card, exile it, then shuffle your library. Until end of turn, you may cast that card.
// Search the top 10 cards of your library for a nonland cardId, exile it, then shuffle your library. Until end of turn, you may cast that cardId.
this.getSpellAbility().addEffect(new DarkDecisionEffect());
}
@ -91,15 +94,18 @@ class DarkDecisionEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard());
target.setCardLimit(10);
if (controller.searchLibrary(target, game)) {
UUID targetId = target.getFirstTarget();
Card card = controller.getLibrary().remove(targetId, game);
Card card = game.getCard(targetId);
if (card != null) {
card.moveToExile(source.getSourceId(), "Dark Decision", source.getSourceId(), game);
game.addEffect(new DarkDecisionMayPlayExiledEffect(targetId), source);
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName());
ContinuousEffect effect = new DarkDecisionMayPlayExiledEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
controller.shuffleLibrary(source, game);
}
@ -112,16 +118,12 @@ class DarkDecisionEffect extends OneShotEffect {
class DarkDecisionMayPlayExiledEffect extends AsThoughEffectImpl {
public UUID card;
public DarkDecisionMayPlayExiledEffect(UUID card) {
public DarkDecisionMayPlayExiledEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
this.card = card;
}
public DarkDecisionMayPlayExiledEffect(final DarkDecisionMayPlayExiledEffect effect) {
super(effect);
this.card = effect.card;
}
@Override
@ -135,11 +137,10 @@ class DarkDecisionMayPlayExiledEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(sourceId);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(sourceId) == Zone.EXILED && this.card.equals(sourceId)) {
return true;
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (objectId.equals(getTargetPointer().getFirst(game, source)) && affectedControllerId.equals(source.getSourceId())) {
ExileZone exileZone = game.getExile().getExileZone(source.getSourceId());
return exileZone != null && exileZone.contains(getTargetPointer().getFirst(game, source));
}
return false;
}

View file

@ -40,6 +40,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -70,10 +71,10 @@ public class HanSolo extends CardImpl {
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// At the beggining of each combat, target starship gets +2/+2 and gains haste until end of turn.
// At the beginning of each combat, target starship you control gets +2/+2 and gains haste until end of turn.
Effect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn);
effect.setText("target Starship you control gets +2/+2");
BeginningOfCombatTriggeredAbility ability = new BeginningOfCombatTriggeredAbility(effect, TargetController.ANY, false);
BeginningOfCombatTriggeredAbility ability = new BeginningOfCombatTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, false, false);
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setText("and gains haste until end of turn");
ability.addEffect(effect);

View file

@ -60,7 +60,7 @@ public class InsatiableRakghoul extends CardImpl {
this.toughness = new MageInt(6);
// Insatiable Rakghoul enters the battlefield with a +1/+1 counter on it, if a non-artifact creature died this turn.
this.addAbility(new EntersBattlefieldAbility(new InsatiableRakghoulEffect(), false));
this.addAbility(new EntersBattlefieldAbility(new InsatiableRakghoulEffect(), false), new NonArtifactCreaturesDiedWatcher());
}
public InsatiableRakghoul(final InsatiableRakghoul card) {
@ -86,8 +86,8 @@ class InsatiableRakghoulEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
NonArtifactCreaturesDiedWatcher watcher = (NonArtifactCreaturesDiedWatcher) game.getState().getWatchers().get("NonArtifactCreaturesDiedWatcher");
if (watcher != null && watcher.conditionMet()) {
Permanent permanent = game.getPermanentEntering(source.getSourceId());

View file

@ -30,7 +30,6 @@ package mage.sets.starwars;
import java.util.HashSet;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -47,8 +46,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.filter.predicate.other.CounterCardPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
@ -62,7 +60,7 @@ public class MaintenanceDroid extends CardImpl {
private static final FilterCard filter = new FilterCard("target card you own with a repair counter on it");
static {
filter.add(new CounterPredicate(CounterType.REPAIR));
filter.add(new CounterCardPredicate(CounterType.REPAIR));
}
public MaintenanceDroid(UUID ownerId) {
@ -143,4 +141,4 @@ class MaintenanceDroidEffect extends OneShotEffect {
return false;
}
}
}

View file

@ -33,6 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.RepairAbility;
@ -46,12 +47,9 @@ import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.players.Player;
@ -71,13 +69,15 @@ public class MaintenanceHangar extends CardImpl {
super(ownerId, 23, "Maintenance Hangar", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
this.expansionSetCode = "SWS";
// At the beggining of your upkeep, remove an additional repair counter from each card in your graveyard.
// At the beginning of your upkeep, remove an additional repair counter from each card in your graveyard.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RemoveCounterMaintenanceHangarEffect(), TargetController.YOU, false));
// Starship creatures you control and starship creatures in your graveyard have Repair 6.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new RepairAbility(6), Duration.WhileOnBattlefield, filterPermanent)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MaintenanceHangarEffect()));
Effect effect = new GainAbilityControlledEffect(new RepairAbility(6), Duration.WhileOnBattlefield, filterPermanent);
effect.setText("Starship creatures you control");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
ability.addEffect(new MaintenanceHangarEffect());
this.addAbility(ability);
}
public MaintenanceHangar(final MaintenanceHangar card) {
@ -92,12 +92,6 @@ public class MaintenanceHangar extends CardImpl {
class RemoveCounterMaintenanceHangarEffect extends OneShotEffect {
private static final FilterCard filterCard = new FilterCard("each card");
static {
filterCard.add(new CounterPredicate(CounterType.REPAIR));
}
public RemoveCounterMaintenanceHangarEffect() {
super(Outcome.Detriment);
staticText = "remove an additional repair counter from each card in your graveyard";
@ -111,9 +105,8 @@ class RemoveCounterMaintenanceHangarEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Set<Card> cards = controller.getGraveyard().getCards(filterCard, game);
for (Card card : cards) {
if (card != null) {
for (Card card : controller.getGraveyard().getCards(game)) {
if (card.getCounters(game).getCount("repair") > 0) {
card.removeCounters("repair", 1, game);
}
}
@ -138,7 +131,7 @@ class MaintenanceHangarEffect extends ContinuousEffectImpl {
public MaintenanceHangarEffect() {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.staticText = "Starship creatures in your graveyard have Repair 6";
this.staticText = "and starship creatures in your graveyard have Repair 6";
}
public MaintenanceHangarEffect(final MaintenanceHangarEffect effect) {
@ -155,14 +148,9 @@ class MaintenanceHangarEffect extends ContinuousEffectImpl {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Set<Card> cards = controller.getGraveyard().getCards(filterCard, game);
for (Card card : cards) {
if (card != null) {
RepairAbility ability = new RepairAbility(6);
ability.setSourceId(card.getId());
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
}
}
cards.stream().forEach((card) -> {
game.getState().addOtherAbility(card, new RepairAbility(6));
});
return true;
}
return false;

View file

@ -53,7 +53,7 @@ public class SandTrooper extends CardImpl {
}
public SandTrooper(UUID ownerId) {
super(ownerId, 28, "Sand Trooper", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");
super(ownerId, 28, "Sand Trooper", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "SWS";
this.subtype.add("Human");
this.subtype.add("Trooper");

View file

@ -37,7 +37,7 @@ import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetOpponent;
import mage.target.TargetPlayer;
import mage.watchers.common.LifeLossOtherFromCombatWatcher;
/**
@ -59,7 +59,7 @@ public class SithInquisitor extends CardImpl {
new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1, true)),
HateCondition.getInstance(),
"<i>Hate</i> &mdash; When {this} enters the battlefield, if an opponent lost life from a source other then combat damage this turn, target player discard a card at random.");
ability.addTarget(new TargetOpponent());
ability.addTarget(new TargetPlayer());
this.addAbility(ability, new LifeLossOtherFromCombatWatcher());
}

View file

@ -50,8 +50,8 @@ public class TIEInterceptor extends CardImpl {
super(ownerId, 93, "TIE Interceptor", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "SWS";
this.subtype.add("Starship");
this.power = new MageInt(3);
this.toughness = new MageInt(2);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Spaceflight
this.addAbility(SpaceflightAbility.getInstance());

View file

@ -51,6 +51,7 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.OwnerPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
@ -79,7 +80,10 @@ public class YodaJediMaster extends CardImpl {
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1: Look at the top two cards of your library. Put one on the bottom of your library.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(new StaticValue(2), false, new StaticValue(1), new FilterCard(), Zone.LIBRARY, false, false), 1));
Effect effect = new LookLibraryAndPickControllerEffect(new StaticValue(2), false, new StaticValue(1),
new FilterCard(), Zone.LIBRARY, false, false, false, Zone.LIBRARY, false);
effect.setText("Look at the top two cards of your library. Put one on the bottom of your library");
this.addAbility(new LoyaltyAbility(effect, 1));
// 0: Exile another target permanent you own. Return that card to the battlefield under your control at the beggining of your next end step.
Ability ability = new LoyaltyAbility(new YodaJediMasterEffect(), 0);
@ -138,10 +142,10 @@ class YodaEmblem extends Emblem {
// You get an emblem with "Hexproof, you and your creatures have."
public YodaEmblem() {
this.setName("Emblem - Yoda");
Effect effect = new GainAbilityControlledEffect(HexproofAbility.getInstance(), Duration.EndOfGame);
effect.setText("Hexproof,");
Effect effect = new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.EndOfGame);
effect.setText("Hexproof, you");
Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect);
effect = new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.EndOfGame);
effect = new GainAbilityControlledEffect(HexproofAbility.getInstance(), Duration.EndOfGame, new FilterCreaturePermanent());
effect.setText(" you and your creatures have");
ability.addEffect(effect);
getAbilities().add(ability);

View file

@ -29,9 +29,23 @@ package mage.sets.starwars;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.CopyEffect;
import mage.abilities.effects.common.RevealHandTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
/**
*
@ -48,8 +62,10 @@ public class ZamWessel extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
//
// When you cast Zam Wessel, target opponent reveals his or her hand. You may choose a creature card from it and have Zam Wessel enter the battlefield as a copy of that creature card.
Ability ability = new CastSourceTriggeredAbility(new RevealHandTargetEffect());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public ZamWessel(final ZamWessel card) {
@ -61,3 +77,40 @@ public class ZamWessel extends CardImpl {
return new ZamWessel(this);
}
}
class ZamWesselEffect extends OneShotEffect {
public ZamWesselEffect() {
super(Outcome.Benefit);
this.staticText = "You may choose a creature card from it and have {this} enter the battlefield as a copy of that creature card";
}
public ZamWesselEffect(final ZamWesselEffect effect) {
super(effect);
}
@Override
public ZamWesselEffect copy() {
return new ZamWesselEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
TargetCard targetCard = new TargetCard(0, 1, Zone.HAND, new FilterCreatureCard());
controller.choose(outcome, targetPlayer.getHand(), targetCard, game);
Card copyFromCard = game.getCard(targetCard.getFirstTarget());
if (copyFromCard != null) {
game.informPlayers(controller.getLogName() + " chooses to copy " + copyFromCard.getName());
CopyEffect copyEffect = new CopyEffect(Duration.Custom, copyFromCard, source.getSourceId());
game.addEffect(copyEffect, source);
}
}
return true;
}
return false;
}
}

View file

@ -9,7 +9,7 @@ import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl {
private TargetController targetController;
private boolean setTargetPointer;
@ -46,27 +46,27 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl {
boolean yours = event.getPlayerId().equals(this.controllerId);
if (yours && setTargetPointer) {
if (getTargets().isEmpty()) {
for (Effect effect : this.getEffects()) {
this.getEffects().stream().forEach((effect) -> {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
});
}
}
return yours;
case OPPONENT:
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
if (setTargetPointer) {
for (Effect effect : this.getEffects()) {
this.getEffects().stream().forEach((effect) -> {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
});
}
return true;
}
break;
break;
case ANY:
if (setTargetPointer) {
for (Effect effect : this.getEffects()) {
this.getEffects().stream().forEach((effect) -> {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
});
}
return true;
}

View file

@ -86,6 +86,19 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, upTo, Zone.HAND, false);
}
/**
*
* @param numberOfCards
* @param mayShuffleAfter
* @param numberToPick
* @param pickFilter
* @param targetZoneLookedCards
* @param putOnTop
* @param reveal
* @param upTo
* @param targetZonePickedCards
* @param optional
*/
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick,
FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional) {
super(Outcome.DrawCard, numberOfCards, mayShuffleAfter, targetZoneLookedCards, putOnTop);

View file

@ -85,7 +85,7 @@ public class LookLibraryTopCardTargetPlayerEffect extends OneShotEffect {
if (player != null && targetPlayer != null && sourceObject != null) {
Cards cards = new CardsImpl();
cards.addAll(targetPlayer.getLibrary().getTopCards(game, amount));
player.lookAtCards(sourceObject.getName(), cards, game);
player.lookAtCards(sourceObject.getIdName(), cards, game);
if (putToGraveyard) {
for (Card card : cards.getCards(game)) {
if (player.chooseUse(outcome, "Do you wish to put card into the player's graveyard?", source, game)) {

View file

@ -24,7 +24,7 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
@ -37,11 +37,10 @@ import mage.game.permanent.Permanent;
*
* @author LevelX2
*/
public class RemoveFromCombatSourceEffect extends OneShotEffect {
public RemoveFromCombatSourceEffect() {
super(Outcome.Detriment);
super(Outcome.AIDontUseIt);
staticText = setText();
}
@ -63,7 +62,6 @@ public class RemoveFromCombatSourceEffect extends OneShotEffect {
return new RemoveFromCombatSourceEffect(this);
}
private String setText() {
return "Remove {this} from combat";
}