* Some minor code optimisations.

This commit is contained in:
LevelX2 2014-01-27 18:04:14 +01:00
parent c75c5ac9e1
commit 2e8bbf0406
4 changed files with 10 additions and 12 deletions

View file

@ -94,10 +94,7 @@ class GeistOfSaintTraftEffect extends OneShotEffect<GeistOfSaintTraftEffect> {
public boolean apply(Game game, Ability source) {
AngelToken token = new AngelToken();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
Permanent p = game.getPermanent(token.getLastAddedToken());
p.setTapped(true);
game.getCombat().addAttackingCreature(p.getId(), game);
if (controller != null && token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), true, true)) {
Effect effect = new ExileTargetEffect();
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));

View file

@ -95,10 +95,7 @@ class KessigCagebreakersEffect extends OneShotEffect<KessigCagebreakersEffect> {
WolfToken token = new WolfToken();
int count = player.getGraveyard().count(new FilterCreatureCard(), game);
for (int i = 0; i < count; i++) {
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
Permanent permanent = game.getPermanent(token.getLastAddedToken());
permanent.setTapped(true);
game.getCombat().addAttackingCreature(permanent.getId(), game);
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId(), true, true);
}
return true;
}

View file

@ -105,9 +105,8 @@ class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
UUID cardId = target.getFirstTarget();
Card card = player.getHand().get(cardId, game);
if (card != null) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId(), true)) {
Permanent permanent = game.getPermanent(card.getId());
permanent.setTapped(true);
game.getCombat().addAttackingCreature(permanent.getId(), game);
}
}

View file

@ -66,7 +66,6 @@ import mage.target.common.TargetControlledPermanent;
* put onto the battlefield unblocked. It will be attacking the same player or
* planeswalker as the creature that was returned to its owner's hand.
*
* @param cost ninjutsu mana cost
*
* @author LevelX2
*/
@ -78,6 +77,10 @@ public class NinjutsuAbility extends ActivatedAbilityImpl<NinjutsuAbility> {
filter.add(new UnblockedPredicate());
}
/**
*
* @param manaCost ninjutsu mana cost
*/
public NinjutsuAbility(ManaCost manaCost) {
super(Zone.HAND,new NinjutsuEffect(), manaCost);
this.addCost(new RevealNinjutsuCardCost());
@ -95,7 +98,9 @@ public class NinjutsuAbility extends ActivatedAbilityImpl<NinjutsuAbility> {
@Override
public String getRule() {
return "Ninjutsu " + getManaCostsToPay().getText()+ " <i>(" + getManaCostsToPay().getText() +" Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand tapped and attacking.)</i>";
return new StringBuilder("Ninjutsu ").append(getManaCostsToPay().getText()).append(" <i>(")
.append(getManaCostsToPay().getText())
.append(" Return an unblocked attacker you control to hand: Put this card onto the battlefield from your hand tapped and attacking.)</i>").toString();
}
}