mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
Some minor changes to framework classes.
This commit is contained in:
parent
1f12d0adf8
commit
3da35269af
5 changed files with 34 additions and 20 deletions
|
@ -36,7 +36,7 @@ public interface OptionalAdditionalCost extends Cost {
|
|||
String getName();
|
||||
|
||||
/**
|
||||
* Returns the complete text for the addional coast or if onlyCost is true
|
||||
* Returns the complete text for the addional cost or if onlyCost is true
|
||||
* only the pure text fore the included native cost
|
||||
*
|
||||
* @param onlyCost
|
||||
|
|
|
@ -145,6 +145,7 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl<T>
|
|||
* Set if the cost be multiple times activated
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void setRepeatable(boolean repeatable) {
|
||||
this.repeatable = repeatable;
|
||||
}
|
||||
|
@ -183,4 +184,4 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl<T>
|
|||
public OptionalAdditionalCostImpl copy() {
|
||||
return new OptionalAdditionalCostImpl(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.effects.RestrictionEffect;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -79,7 +80,7 @@ public class CantBlockTargetEffect extends RestrictionEffect<CantBlockTargetEffe
|
|||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(target.getMaxNumberOfTargets()).append(" ");
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -37,6 +38,8 @@ import mage.cards.Card;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -67,28 +70,37 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(source.getFirstTarget());
|
||||
if (card != null) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
if (tapped) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
for (UUID targetId: getTargetPointer().getTargets(game, source)) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
if (tapped) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Return target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield");
|
||||
Target target = mode.getTargets().get(0);
|
||||
sb.append("Return ");
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
|
|
|
@ -80,21 +80,21 @@ import mage.players.Player;
|
|||
*/
|
||||
public class KickerAbility extends StaticAbility<KickerAbility> implements OptionalAdditionalSourceCosts {
|
||||
|
||||
protected static final String KickerKeyword = "Kicker";
|
||||
protected static final String KickerReminderMana = "(You may pay an additional {cost} as you cast this spell.)";
|
||||
protected static final String KickerReminderCost = "(You may {cost} in addition to any other costs as you cast this spell.)";
|
||||
protected static final String KICKER_KEYWORD = "Kicker";
|
||||
protected static final String KICKER_REMINDER_MANA = "(You may pay an additional {cost} as you cast this spell.)";
|
||||
protected static final String KICKER_REMINDER_COST = "(You may {cost} in addition to any other costs as you cast this spell.)";
|
||||
|
||||
protected String keywordText;
|
||||
protected String reminderText;
|
||||
protected List<OptionalAdditionalCost> kickerCosts = new LinkedList<OptionalAdditionalCost>();
|
||||
|
||||
public KickerAbility(String manaString) {
|
||||
this(KickerKeyword, KickerReminderMana);
|
||||
this(KICKER_KEYWORD, KICKER_REMINDER_MANA);
|
||||
this.addKickerCost(manaString);
|
||||
}
|
||||
|
||||
public KickerAbility(Cost cost) {
|
||||
this(KickerKeyword, KickerReminderCost);
|
||||
this(KICKER_KEYWORD, KICKER_REMINDER_COST);
|
||||
this.addKickerCost(cost);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue