mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Some minor code reworks.
This commit is contained in:
parent
c764da43f3
commit
a8742b934a
3 changed files with 50 additions and 49 deletions
|
@ -28,19 +28,14 @@
|
||||||
package mage.sets.championsofkamigawa;
|
package mage.sets.championsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
|
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.LookLibraryControllerEffect;
|
import mage.abilities.effects.common.LookLibraryControllerEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||||
|
@ -49,6 +44,11 @@ import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -68,10 +68,8 @@ public class CallousDeceiver extends CardImpl {
|
||||||
// {1}: Look at the top card of your library.
|
// {1}: Look at the top card of your library.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
|
||||||
|
|
||||||
// {2}: Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains flying until end of turn.
|
// {2}: Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains flying until end of turn. Activate this ability only once each turn.
|
||||||
Ability ability = new CallousDeceiverAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0,Duration.EndOfTurn), new ManaCostsImpl("{2}"));
|
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new CallousDeceiverEffect(), new ManaCostsImpl("{2}")));
|
||||||
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(),Duration.EndOfTurn));
|
|
||||||
this.addAbility(ability);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CallousDeceiver(final CallousDeceiver card) {
|
public CallousDeceiver(final CallousDeceiver card) {
|
||||||
|
@ -85,38 +83,39 @@ public class CallousDeceiver extends CardImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CallousDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
|
class CallousDeceiverEffect extends OneShotEffect {
|
||||||
|
|
||||||
public CallousDeceiverAbility(Zone zone, Effect effect, Cost cost) {
|
public CallousDeceiverEffect() {
|
||||||
super(zone, effect, cost);
|
super(Outcome.BoostCreature);
|
||||||
|
this.staticText = "Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains flying until end of turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
public CallousDeceiverAbility(CallousDeceiverAbility ability) {
|
public CallousDeceiverEffect(final CallousDeceiverEffect effect) {
|
||||||
super(ability);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CallousDeceiverAbility copy() {
|
public CallousDeceiverEffect copy() {
|
||||||
return new CallousDeceiverAbility(this);
|
return new CallousDeceiverEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkIfClause(Game game) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(this.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
Cards cards = new CardsImpl();
|
if (controller != null && sourceObject != null) {
|
||||||
Card card = player.getLibrary().getFromTop(game);
|
Cards cards = new CardsImpl();
|
||||||
cards.add(card);
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
player.revealCards("Callous Deceiver", cards, game);
|
if (card != null) {
|
||||||
if (card != null && card.getCardType().contains(CardType.LAND)) {
|
cards.add(card);
|
||||||
return true;
|
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||||
}
|
if (card.getCardType().contains(CardType.LAND)) {
|
||||||
|
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);
|
||||||
|
game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "{2}: Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains flying until end of turn. Activate this ability only once each turn.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,7 +52,7 @@ public class CleverImpersonator extends CardImpl {
|
||||||
this.power = new MageInt(0);
|
this.power = new MageInt(0);
|
||||||
this.toughness = new MageInt(0);
|
this.toughness = new MageInt(0);
|
||||||
|
|
||||||
// You have may Clever Impersonator enter the battlefield as a copy of any nonland permanent on the battlefield.
|
// You may have Clever Impersonator enter the battlefield as a copy of any nonland permanent on the battlefield.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||||
new EntersBattlefieldEffect(new CopyPermanentEffect(new FilterNonlandPermanent()),
|
new EntersBattlefieldEffect(new CopyPermanentEffect(new FilterNonlandPermanent()),
|
||||||
"You may have {this} enter the battlefield as a copy of any nonland permanent on the battlefield",
|
"You may have {this} enter the battlefield as a copy of any nonland permanent on the battlefield",
|
||||||
|
|
|
@ -33,10 +33,10 @@ import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||||
import mage.abilities.costs.common.ControlPermanentCost;
|
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.mana.ColorlessManaAbility;
|
import mage.abilities.mana.ColorlessManaAbility;
|
||||||
import mage.abilities.mana.ConditionalAnyColorManaAbility;
|
import mage.abilities.mana.ConditionalAnyColorManaAbility;
|
||||||
|
@ -58,6 +58,7 @@ import mage.game.permanent.token.Token;
|
||||||
public class SliverHive extends CardImpl {
|
public class SliverHive extends CardImpl {
|
||||||
|
|
||||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Sliver");
|
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Sliver");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new SubtypePredicate("Sliver"));
|
filter.add(new SubtypePredicate("Sliver"));
|
||||||
}
|
}
|
||||||
|
@ -73,9 +74,10 @@ public class SliverHive extends CardImpl {
|
||||||
this.addAbility(new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new SliverHiveManaBuilder(), true));
|
this.addAbility(new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new SliverHiveManaBuilder(), true));
|
||||||
|
|
||||||
// {5}, {T}: Put a 1/1 colorless Sliver creature token onto the battlefield. Activate this ability only if you control a Sliver.
|
// {5}, {T}: Put a 1/1 colorless Sliver creature token onto the battlefield. Activate this ability only if you control a Sliver.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SliverToken()), new TapSourceCost());
|
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SliverToken()), new TapSourceCost(),
|
||||||
|
new PermanentsOnTheBattlefieldCondition(filter),
|
||||||
|
"{5}, {T}: Put a 1/1 colorless Sliver creature token onto the battlefield. Activate this ability only if you control a Sliver.");
|
||||||
ability.addCost(new GenericManaCost(5));
|
ability.addCost(new GenericManaCost(5));
|
||||||
ability.addCost(new ControlPermanentCost(filter));
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue