mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fixes and improvements to tooltip rule generation.
This commit is contained in:
parent
c3412211d3
commit
8cef2df859
9 changed files with 34 additions and 21 deletions
|
@ -51,7 +51,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class RestorationAngel extends CardImpl<RestorationAngel> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel");
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Angel creature you control, then ");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new SubtypePredicate("Angel")));
|
||||
|
|
|
@ -52,8 +52,8 @@ import mage.target.common.TargetCardInLibrary;
|
|||
*/
|
||||
public class BloodSpeaker extends CardImpl<BloodSpeaker> {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Demon");
|
||||
private static final FilterCard filterCard = new FilterCard("Demon");
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Demon under your control");
|
||||
private static final FilterCard filterCard = new FilterCard("Demon card");
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Demon"));
|
||||
filterCard.add(new SubtypePredicate("Demon"));
|
||||
|
|
|
@ -60,7 +60,7 @@ public class CruelUltimatum extends CardImpl<CruelUltimatum> {
|
|||
|
||||
// Target opponent sacrifices a creature, discards three cards, then loses 5 life. You return a creature card from your graveyard to your hand, draw three cards, then gain 5 life.
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
this.getSpellAbility().addEffect(new SacrificeEffect(new FilterCreaturePermanent(), 1, "Target opponent sacrifices a creature"));
|
||||
this.getSpellAbility().addEffect(new SacrificeEffect(new FilterCreaturePermanent(), 1, "Target opponent"));
|
||||
this.getSpellAbility().addEffect(new DiscardTargetEffect(3));
|
||||
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(5));
|
||||
|
||||
|
@ -83,7 +83,7 @@ class CruelUltimatumEffect extends OneShotEffect<CruelUltimatumEffect> {
|
|||
|
||||
public CruelUltimatumEffect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.staticText = "return a creature card from your graveyard to your hand";
|
||||
this.staticText = "Return a creature card from your graveyard to your hand";
|
||||
}
|
||||
|
||||
public CruelUltimatumEffect(final CruelUltimatumEffect effect) {
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -65,7 +66,7 @@ public class GoblinWelder extends CardImpl<GoblinWelder> {
|
|||
|
||||
// {tap}: Choose target artifact a player controls and target artifact card in that player's graveyard. If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield.
|
||||
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GoblinWelderEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetArtifactPermanent());
|
||||
ability.addTarget(new TargetArtifactPermanent(new FilterArtifactPermanent("artifact a player controls")));
|
||||
ability.addTarget(new GoblinWelderTarget());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -119,9 +120,8 @@ public class GoblinWelder extends CardImpl<GoblinWelder> {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "Sacrifices " + mode.getTargets().get(0).getTargetName() + " and returns " + mode.getTargets().get(1).getTargetName() + " to the battlefield";
|
||||
return "Choose " + mode.getTargets().get(0).getTargetName() + " and " + mode.getTargets().get(1).getTargetName() + ". If both targets are still legal as this ability resolves, that player simultaneously sacrifices the artifact and returns the artifact card to the battlefield";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class GoblinWelderTarget extends TargetCard<TargetCardInYourGraveyard> {
|
||||
|
|
|
@ -50,8 +50,9 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
|
|||
|
||||
public TriggeredAbilityImpl(Zone zone, Effect effect, boolean optional) {
|
||||
super(AbilityType.TRIGGERED, zone);
|
||||
if (effect != null)
|
||||
if (effect != null) {
|
||||
addEffect(effect);
|
||||
}
|
||||
this.optional = optional;
|
||||
}
|
||||
|
||||
|
@ -92,8 +93,9 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
|
|||
}
|
||||
}
|
||||
//20091005 - 603.4
|
||||
if (checkInterveningIfClause(game))
|
||||
if (checkInterveningIfClause(game)) {
|
||||
return super.resolve(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -101,11 +103,19 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
|
|||
public String getRule() {
|
||||
String superRule = super.getRule(true);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (optional && !superRule.toLowerCase().startsWith("you may")) {
|
||||
String ruleLow = superRule.toLowerCase();
|
||||
if (optional && !ruleLow.startsWith("you ")) {
|
||||
if (this.getTargets().isEmpty()
|
||||
|| ruleLow.startsWith("exile")
|
||||
|| ruleLow.startsWith("destroy")
|
||||
|| ruleLow.startsWith("return")
|
||||
|| ruleLow.startsWith("tap")
|
||||
|| ruleLow.startsWith("untap")) {
|
||||
sb.append("you may ");
|
||||
if (!this.getTargets().isEmpty()) {
|
||||
sb.append("have ");
|
||||
} else {
|
||||
sb.append("you may have ");
|
||||
}
|
||||
|
||||
}
|
||||
sb.append(superRule.substring(0, 1).toLowerCase());
|
||||
sb.append(superRule.substring(1));
|
||||
|
|
|
@ -68,7 +68,7 @@ public class EntersBattlefieldAbility extends StaticAbility<EntersBattlefieldAbi
|
|||
*/
|
||||
public EntersBattlefieldAbility(Effect effect, Condition condition, Boolean showRule, String abilityRule, String effectText) {
|
||||
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(effect, condition, effectText));
|
||||
this.showRule = true;
|
||||
this.showRule = showRule;
|
||||
this.abilityRule = abilityRule;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,9 +74,10 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
|
|||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
if (tapped) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null)
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -87,11 +88,11 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Put target ").append(mode.getTargets().get(0).getTargetName()).append(" onto the battlefield");
|
||||
if (tapped)
|
||||
sb.append("Return target ").append(mode.getTargets().get(0).getTargetName()).append(" to the battlefield");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
sb.append(" under your control");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect<ReturnF
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Put target ").append(mode.getTargets().get(0).getTargetName()).append(" into your hand");
|
||||
sb.append("Return target ").append(mode.getTargets().get(0).getTargetName()).append(" to your hand");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -122,13 +122,15 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
|
|||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(preText);
|
||||
if (preText.contains("player")) {
|
||||
if (preText.endsWith("player") || preText.endsWith("opponent")) {
|
||||
sb.append(" sacrifices ");
|
||||
} else {
|
||||
sb.append(" sacrifice ");
|
||||
}
|
||||
if (!count.toString().equals("1")) {
|
||||
sb.append(count).append(" ");
|
||||
} else {
|
||||
sb.append("a ");
|
||||
}
|
||||
sb.append(filter.getMessage());
|
||||
staticText = sb.toString();
|
||||
|
|
Loading…
Reference in a new issue