mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
* Some minor code optimisations.
This commit is contained in:
parent
c75c5ac9e1
commit
2e8bbf0406
4 changed files with 10 additions and 12 deletions
|
@ -94,10 +94,7 @@ class GeistOfSaintTraftEffect extends OneShotEffect<GeistOfSaintTraftEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
AngelToken token = new AngelToken();
|
AngelToken token = new AngelToken();
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null && token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
|
if (controller != null && token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), true, true)) {
|
||||||
Permanent p = game.getPermanent(token.getLastAddedToken());
|
|
||||||
p.setTapped(true);
|
|
||||||
game.getCombat().addAttackingCreature(p.getId(), game);
|
|
||||||
Effect effect = new ExileTargetEffect();
|
Effect effect = new ExileTargetEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
||||||
CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));
|
CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));
|
||||||
|
|
|
@ -95,10 +95,7 @@ class KessigCagebreakersEffect extends OneShotEffect<KessigCagebreakersEffect> {
|
||||||
WolfToken token = new WolfToken();
|
WolfToken token = new WolfToken();
|
||||||
int count = player.getGraveyard().count(new FilterCreatureCard(), game);
|
int count = player.getGraveyard().count(new FilterCreatureCard(), game);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId(), true, true);
|
||||||
Permanent permanent = game.getPermanent(token.getLastAddedToken());
|
|
||||||
permanent.setTapped(true);
|
|
||||||
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,9 +105,8 @@ class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
|
||||||
UUID cardId = target.getFirstTarget();
|
UUID cardId = target.getFirstTarget();
|
||||||
Card card = player.getHand().get(cardId, game);
|
Card card = player.getHand().get(cardId, game);
|
||||||
if (card != null) {
|
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 permanent = game.getPermanent(card.getId());
|
||||||
permanent.setTapped(true);
|
|
||||||
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ import mage.target.common.TargetControlledPermanent;
|
||||||
* put onto the battlefield unblocked. It will be attacking the same player or
|
* 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.
|
* planeswalker as the creature that was returned to its owner's hand.
|
||||||
*
|
*
|
||||||
* @param cost ninjutsu mana cost
|
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
@ -78,6 +77,10 @@ public class NinjutsuAbility extends ActivatedAbilityImpl<NinjutsuAbility> {
|
||||||
filter.add(new UnblockedPredicate());
|
filter.add(new UnblockedPredicate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param manaCost ninjutsu mana cost
|
||||||
|
*/
|
||||||
public NinjutsuAbility(ManaCost manaCost) {
|
public NinjutsuAbility(ManaCost manaCost) {
|
||||||
super(Zone.HAND,new NinjutsuEffect(), manaCost);
|
super(Zone.HAND,new NinjutsuEffect(), manaCost);
|
||||||
this.addCost(new RevealNinjutsuCardCost());
|
this.addCost(new RevealNinjutsuCardCost());
|
||||||
|
@ -95,7 +98,9 @@ public class NinjutsuAbility extends ActivatedAbilityImpl<NinjutsuAbility> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue