Merge pull request #3066 from ingmargoudt/cleanups

Cleanups
This commit is contained in:
LevelX2 2017-04-06 23:26:52 +02:00 committed by GitHub
commit 22e376699e
35 changed files with 97 additions and 104 deletions

View file

@ -42,17 +42,6 @@ public final class CardHelper {
private CardHelper() {
}
public static String getColor(CardView c) {
if (c.getColor().getColorCount() == 0) return "Colorless";
else if (c.getColor().getColorCount() > 1) return "Gold";
else if (c.getColor().isBlack()) return "Black";
else if (c.getColor().isBlue()) return "Blue";
else if (c.getColor().isWhite()) return "White";
else if (c.getColor().isGreen()) return "Green";
else if (c.getColor().isRed()) return "Red";
return "";
}
public static String getType(CardView c) {
StringBuilder type = new StringBuilder();
for (SuperType superType : c.getSuperTypes()) {
@ -77,7 +66,4 @@ public final class CardHelper {
return type.toString();
}
public static boolean isCreature(CardView c) {
return c.getCardTypes().contains(CardType.CREATURE);
}
}

View file

@ -26,10 +26,11 @@
*/
package mage.client.deckeditor.table;
import java.util.Comparator;
import mage.cards.MageCard;
import mage.view.CardView;
import java.util.Comparator;
/**
* {@link MageCard} comparator. Used to sort cards in Deck Editor Table View
* pane.
@ -73,8 +74,8 @@ public class MageCardComparator implements Comparator<CardView> {
break;
// Color
case 3:
aCom = CardHelper.getColor(a);
bCom = CardHelper.getColor(b);
aCom = a.getColorText();
bCom = a.getColorText();
break;
// Type
case 4:
@ -85,10 +86,10 @@ public class MageCardComparator implements Comparator<CardView> {
case 5:
aCom = (float) -1;
bCom = (float) -1;
if (CardHelper.isCreature(a)) {
if (a.isCreature()) {
aCom = new Float(a.getPower() + '.' + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
}
if (CardHelper.isCreature(b)) {
if (b.isCreature()) {
bCom = new Float(b.getPower() + '.' + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
}
break;

View file

@ -27,24 +27,6 @@
*/
package mage.client.deckeditor.table;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
import mage.client.MageFrame;
import mage.client.cards.BigCard;
import mage.client.cards.CardEventSource;
@ -64,6 +46,16 @@ import org.jdesktop.swingx.JXPanel;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.*;
import java.util.List;
import java.util.Map.Entry;
/**
* Table Model for card list.
*
@ -260,11 +252,11 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE);
return "<html>" + castingCost + "</html>";
case 3:
return CardHelper.getColor(c);
return c.getColorText();
case 4:
return CardHelper.getType(c);
case 5:
return CardHelper.isCreature(c) ? c.getPower() + '/'
return c.isCreature() ? c.getPower() + '/'
+ c.getToughness() : "-";
case 6:
return c.getRarity().toString();

View file

@ -957,4 +957,19 @@ public class CardView extends SimpleCardView {
this.canAttack = canAttack;
}
public boolean isCreature(){
return cardTypes.contains(CardType.CREATURE);
}
public String getColorText() {
if (getColor().getColorCount() == 0) return "Colorless";
else if (getColor().getColorCount() > 1) return "Gold";
else if (getColor().isBlack()) return "Black";
else if (getColor().isBlue()) return "Blue";
else if (getColor().isWhite()) return "White";
else if (getColor().isGreen()) return "Green";
else if (getColor().isRed()) return "Red";
return "";
}
}

View file

@ -74,7 +74,7 @@ public class AkutaBornOfAsh extends CardImpl {
new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filterSwamp))),
TargetController.YOU, false),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"At the beginning of your upkeep, if you have more cards in hand than each opponent, you may sacrifice a Swamp. If you do, return {this} from your graveyard to the battlefield.");
this.addAbility(ability);
}

View file

@ -62,7 +62,7 @@ public class AngelOfTheDireHour extends CardImpl {
// When Angel of the Dire Hour enters the battlefield, if you cast it from your hand, exile all attacking creatures.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new ExileAllEffect(new FilterAttackingCreature("attacking creatures")), false),
new CastFromHandSourceCondition(),
CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, exile all attacking creatures."),
new CastFromHandWatcher());
}

View file

@ -68,7 +68,7 @@ public class BreachingLeviathan extends CardImpl {
// When Breaching Leviathan enters the battlefield, if you cast it from your hand, tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new BreachingLeviathanEffect(), false),
new CastFromHandSourceCondition(),
CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, tap all nonblue creatures. Those creatures don't untap during their controllers' next untap steps."),
new CastFromHandWatcher());
}

View file

@ -55,7 +55,7 @@ public class CoalStoker extends CardImpl {
// When Coal Stoker enters the battlefield, if you cast it from your hand, add {R}{R}{R} to your mana pool.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new BasicManaEffect(Mana.RedMana(3)), false),
new CastFromHandSourceCondition(),
CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, add {R}{R}{R} to your mana pool."),
new CastFromHandWatcher());
}

View file

@ -66,7 +66,7 @@ public class DeathOfAThousandStings extends CardImpl {
new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToHandEffect(),
TargetController.YOU, true),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand.");
this.addAbility(ability);
}

View file

@ -88,7 +88,7 @@ class DeathbringerRegentCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return new CastFromHandSourceCondition().apply(game, source)
return CastFromHandSourceCondition.instance.apply(game, source)
&& game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game).size() >= 6;
}
}

View file

@ -61,11 +61,11 @@ public class DescendantOfKiyomaro extends CardImpl {
// As long as you have more cards in hand than each opponent, Descendant of Kiyomaro gets +1/+2 and has "Whenever this creature deals combat damage, you gain 3 life."
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostSourceEffect(1,2, Duration.WhileOnBattlefield),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"As long as you have more cards in hand than each opponent, {this} gets +1/+2"));
ability.addEffect(new ConditionalContinuousEffect(
new GainAbilitySourceEffect(new DealsCombatDamageTriggeredAbility(new GainLifeEffect(3), false)),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"and has \"Whenever this creature deals combat damage, you gain 3 life.\""));
this.addAbility(ability);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
@ -44,6 +43,8 @@ import mage.target.Target;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
*
* @author Styxo

View file

@ -71,7 +71,7 @@ public class DreadCacodemon extends CardImpl {
// if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(opponentsCreatures, false));
ability.addEffect(new TapAllEffect(otherCreaturesYouControl));
this.addAbility(new ConditionalTriggeredAbility(ability, new CastFromHandSourceCondition(),
this.addAbility(new ConditionalTriggeredAbility(ability, CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control."), new CastFromHandWatcher());
}

View file

@ -67,7 +67,7 @@ public class Epochrasite extends CardImpl {
// Epochrasite enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)),
new InvertCondition(new CastFromHandSourceCondition()),
new InvertCondition(CastFromHandSourceCondition.instance),
"{this} enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand",""),
new CastFromHandWatcher());

View file

@ -71,7 +71,7 @@ public class ExileIntoDarkness extends CardImpl {
new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToHandEffect(),
TargetController.YOU, true),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand.");
this.addAbility(ability);
}

View file

@ -70,7 +70,7 @@ public class FurnaceDragon extends CardImpl {
// When Furnace Dragon enters the battlefield, if you cast it from your hand, exile all artifacts.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new ExileAllEffect(filter), false),
new CastFromHandSourceCondition(),
CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, exile all artifacts."),
new CastFromHandWatcher());
}

View file

@ -78,7 +78,7 @@ public class InameAsOne extends CardImpl {
// When Iname as One enters the battlefield, if you cast it from your hand, you may search your library for a Spirit permanent card, put it onto the battlefield, then shuffle your library.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter)), true),
new CastFromHandSourceCondition(),
CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, you may search your library for a Spirit permanent card, put it onto the battlefield, then shuffle your library."),
new CastFromHandWatcher());

View file

@ -27,7 +27,6 @@
*/
package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition;
@ -41,6 +40,8 @@ import mage.constants.Duration;
import mage.constants.Zone;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -60,7 +61,7 @@ public class KitsuneBonesetter extends CardImpl {
Zone.BATTLEFIELD,
new PreventDamageToTargetEffect(Duration.EndOfTurn, 3),
new TapSourceCost(),
new MoreCardsInHandThanOpponentsCondition()
MoreCardsInHandThanOpponentsCondition.instance
);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);

View file

@ -62,7 +62,7 @@ public class LinvalaThePreserver extends CardImpl {
// When Linvala, the Preserver enters the battlefield, if an opponent has more life than you, you gain 5 life.
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(5), false),
new OpponentHasMoreLifeCondition(),
OpponentHasMoreLifeCondition.instance,
"When {this} enters the battlefield, if an opponent has more life than you, you gain 5 life."));
// When Linvala enters the battlefield, if an opponent controls more creatures than you, create a 3/3 white Angel creature token with flying.

View file

@ -74,7 +74,7 @@ public class MyojinOfCleansingFire extends CardImpl {
this.getSpellAbility().addWatcher(new CastFromHandWatcher());
// Myojin of Cleansing Fire enters the battlefield with a divinity counter on it if you cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
// Myojin of Cleansing Fire is indestructible as long as it has a divinity counter on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it")));

View file

@ -70,7 +70,7 @@ public class MyojinOfInfiniteRage extends CardImpl {
this.getSpellAbility().addWatcher(new CastFromHandWatcher());
// Myojin of Infinite Rage enters the battlefield with a divinity counter on it if you cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
// Myojin of Infinite Rage is indestructible as long as it has a divinity counter on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it")));

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -53,6 +52,8 @@ import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
/**
* @author LevelX
*/
@ -69,7 +70,7 @@ public class MyojinOfLifesWeb extends CardImpl {
this.getSpellAbility().addWatcher(new CastFromHandWatcher());
// Myojin of Life's Web enters the battlefield with a divinity counter on it if you cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
// Myojin of Life's Web is indestructible as long as it has a divinity counter on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),

View file

@ -27,9 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -47,11 +44,14 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.players.Player;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
/**
* @author LevelX
*/
@ -68,7 +68,7 @@ public class MyojinOfNightsReach extends CardImpl {
this.getSpellAbility().addWatcher(new CastFromHandWatcher());
// Myojin of Night's Reach enters the battlefield with a divinity counter on it if you cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
// Myojin of Night's Reach is indestructible as long as it has a divinity counter on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it")));

View file

@ -27,9 +27,6 @@
*/
package mage.cards.m;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -47,11 +44,14 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
/**
* @author LevelX
*/
@ -73,12 +73,12 @@ public class MyojinOfSeeingWinds extends CardImpl {
this.getSpellAbility().addWatcher(new CastFromHandWatcher());
// Myojin of Seeing Winds enters the battlefield with a divinity counter on it if you cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), new CastFromHandSourceCondition(), ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new AddCountersSourceEffect(CounterType.DIVINITY.createInstance()), CastFromHandSourceCondition.instance, ""), "{this} enters the battlefield with a divinity counter on it if you cast it from your hand"));
// Myojin of Seeing Winds is indestructible as long as it has a divinity counter on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it")));
// Remove a divinity counter from Myojin of Seeing Winds: Draw a card for each permanent you control.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter, 1)), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance()));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance()));
this.addAbility(ability);
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -40,6 +39,8 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import java.util.UUID;
/**
*
* @author LevelX2
@ -57,7 +58,7 @@ public class OkinaNightwatch extends CardImpl {
// As long as you have more cards in hand than each opponent, Okina Nightwatch gets +3/+3.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostSourceEffect(3,3, Duration.WhileOnBattlefield),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"As long as you have more cards in hand than each opponent, Okina Nightwatch gets +3/+3"));
this.addAbility(ability);
}

View file

@ -63,7 +63,7 @@ public class PhageTheUntouchable extends CardImpl {
// When Phage the Untouchable enters the battlefield, if you didn't cast it from your hand, you lose the game.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new LoseGameSourceControllerEffect(), false),
new InvertCondition(new CastFromHandSourceCondition()),
new InvertCondition(CastFromHandSourceCondition.instance),
"When {this} enters the battlefield, if you didn't cast it from your hand, you lose the game"
), new CastFromHandWatcher());

View file

@ -27,7 +27,6 @@
*/
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -44,6 +43,8 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
/**
*
* @author daagar
@ -69,7 +70,7 @@ public class ReiverDemon extends CardImpl {
// When Reiver Demon enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(filter, true), false),
new CastFromHandSourceCondition(),
CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated."),
new CastFromHandWatcher());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -41,6 +40,8 @@ import mage.constants.CardType;
import mage.game.permanent.token.BirdToken;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
/**
*
* @author LevelX2
@ -56,7 +57,7 @@ public class ScionOfVituGhazi extends CardImpl {
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new BirdToken()), false);
ability.addEffect(new PopulateEffect("then"));
this.addAbility(new ConditionalTriggeredAbility(ability, new CastFromHandSourceCondition(),
this.addAbility(new ConditionalTriggeredAbility(ability, CastFromHandSourceCondition.instance,
"When {this} enters the battlefield, if you cast it from your hand, create a 1/1 white Bird creature token with flying, then populate."),
new CastFromHandWatcher());
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -42,6 +41,8 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import java.util.UUID;
/**
*
* @author LevelX2
@ -58,11 +59,11 @@ public class Secretkeeper extends CardImpl {
// As long as you have more cards in hand than each opponent, Secretkeeper gets +2/+2 and has flying.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostSourceEffect(2,2, Duration.WhileOnBattlefield),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"As long as you have more cards in hand than each opponent, Secretkeeper gets +2/+2"));
ability.addEffect(new ConditionalContinuousEffect(
new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield),
new MoreCardsInHandThanOpponentsCondition(),
MoreCardsInHandThanOpponentsCondition.instance,
"and has flying"));
this.addAbility(ability);
}

View file

@ -13,7 +13,9 @@ import mage.watchers.common.CastFromHandWatcher;
*
* @author Loki
*/
public class CastFromHandSourceCondition implements Condition {
public enum CastFromHandSourceCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -7,7 +7,9 @@ import mage.players.Player;
import java.util.UUID;
public class MoreCardsInHandThanOpponentsCondition implements Condition {
public enum MoreCardsInHandThanOpponentsCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,21 +28,21 @@
package mage.abilities.condition.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class OpponentHasMoreLifeCondition implements Condition {
public enum OpponentHasMoreLifeCondition implements Condition {
public OpponentHasMoreLifeCondition() {
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -65,9 +65,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
if (!permanent.getCardType().contains(addedCardType)) {
permanent.addCardType(addedCardType);
}
return true;
} else if (this.getDuration() == Duration.Custom) {
this.discard();

View file

@ -42,7 +42,6 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements SourceEffect {
@ -113,13 +112,9 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
if (losePreviousTypes) {
permanent.getCardType().clear();
}
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.addCardType(t);
}
}
}
if (type != null && type.isEmpty() || type == null && permanent.isLand()) {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
}
@ -137,11 +132,10 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
break;
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
if (!token.getAbilities().isEmpty()) {
for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game);
}
}
}
break;
case PTChangingEffects_7:

View file

@ -46,17 +46,13 @@ public class CardTypeApplier extends ApplyToPermanent {
@Override
public boolean apply(Game game, Permanent permanent) {
if (!permanent.getCardType().contains(cardType)) {
permanent.addCardType(cardType);
}
return true;
}
@Override
public boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getCardType().contains(cardType)) {
mageObject.addCardType(cardType);
}
return true;
}
}