* Gain abilities - fixed wrong text with quotes;

This commit is contained in:
Oleg Agafonov 2020-04-19 23:50:31 +04:00
parent 3e8dbbd894
commit ba86bf0c15
12 changed files with 75 additions and 50 deletions

View file

@ -54,8 +54,9 @@ public final class CallapheBelovedOfTheSea extends CardImpl {
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
new SimpleStaticAbility(
new CallapheBelovedOfTheSeaEffect()
), Duration.WhileOnBattlefield, filter
)));
), Duration.WhileOnBattlefield, filter)
.withForceQuotes()
));
}
private CallapheBelovedOfTheSea(final CallapheBelovedOfTheSea card) {

View file

@ -1,7 +1,5 @@
package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
@ -15,8 +13,9 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class CathedralOfSerra extends CardImpl {
@ -32,7 +31,10 @@ public final class CathedralOfSerra extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// White legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(
new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)
.withForceQuotes()
));
}
public CathedralOfSerra(final CathedralOfSerra card) {

View file

@ -1,7 +1,5 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -15,8 +13,9 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.permanent.token.TrooperToken;
import java.util.UUID;
/**
*
* @author Styxo
*/
public final class CommanderCody extends CardImpl {
@ -29,7 +28,7 @@ public final class CommanderCody extends CardImpl {
}
public CommanderCody(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{U}{B}{R}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}{R}{G}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.TROOPER);
@ -37,7 +36,11 @@ public final class CommanderCody extends CardImpl {
this.toughness = new MageInt(7);
// Non-token Trooper creatures you control have "At the beginning of your upkeep, create a 1/1 white Trooper creature token."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new TrooperToken()), TargetController.YOU, false), Duration.WhileOnBattlefield, filter, false)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(
new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new TrooperToken()), TargetController.YOU, false),
Duration.WhileOnBattlefield, filter, false)
.withForceQuotes()
));
}
public CommanderCody(final CommanderCody card) {

View file

@ -34,8 +34,9 @@ public final class LavabellySliver extends CardImpl {
ability.addEffect(new GainLifeEffect(1).concatBy("and"));
ability.addTarget(new TargetPlayerOrPlaneswalker());
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS
)));
ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS)
.withForceQuotes()
));
}
private LavabellySliver(final LavabellySliver card) {

View file

@ -1,7 +1,5 @@
package mage.cards.m;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
@ -15,8 +13,9 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class MountainStronghold extends CardImpl {
@ -32,7 +31,10 @@ public final class MountainStronghold extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Red legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(
new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)
.withForceQuotes()
));
}
public MountainStronghold(final MountainStronghold card) {

View file

@ -1,6 +1,5 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -8,16 +7,17 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author NinthWorld
*/
public final class MudTrooper extends CardImpl {
@ -30,7 +30,7 @@ public final class MudTrooper extends CardImpl {
public MudTrooper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.TROOPER);
this.power = new MageInt(1);
@ -39,10 +39,12 @@ public final class MudTrooper extends CardImpl {
// Trooper creatures you control have "2: This creature gets +1/+1 until end of turn."
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(1, 1, Duration.EndOfTurn)
.setText("This creature gets +1/+1 until end of turn"),
.setText("This creature gets +1/+1 until end of turn"),
new GenericManaCost(2));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityControlledEffect(ability, Duration.WhileOnBattlefield, filter, false)));
new GainAbilityControlledEffect(ability, Duration.WhileOnBattlefield, filter, false)
.withForceQuotes()
));
}
public MudTrooper(final MudTrooper card) {

View file

@ -1,14 +1,12 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -22,19 +20,20 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class OverlaidTerrain extends CardImpl {
public OverlaidTerrain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}");
// As Overlaid Terrain enters the battlefield, sacrifice all lands you control.
this.addAbility(new AsEntersBattlefieldAbility(new SacrificeAllLandEffect()));
// Lands you control have "{tap}: Add two mana of any one color."
// Lands you control have "{T}: Add two mana of any one color."
SimpleManaAbility manaAbility = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(manaAbility, Duration.WhileOnBattlefield, new FilterLandPermanent(), false)));
}
@ -52,20 +51,20 @@ public final class OverlaidTerrain extends CardImpl {
class SacrificeAllLandEffect extends OneShotEffect {
SacrificeAllLandEffect() {
super(Outcome.Detriment);
super(Outcome.Detriment);
staticText = "sacrifice all lands you control";
}
SacrificeAllLandEffect(final SacrificeAllLandEffect effect) {
super(effect);
}
@Override
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for(Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), source.getControllerId(), game)){
permanent.sacrifice(source.getControllerId(), game);
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), source.getControllerId(), game)) {
permanent.sacrifice(source.getControllerId(), game);
}
return true;
}

View file

@ -32,8 +32,9 @@ public final class ScuttlingSliver extends CardImpl {
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
new SimpleActivatedAbility(
new UntapSourceEffect().setText("untap this creature"), new GenericManaCost(2)
), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS
)));
), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS)
.withForceQuotes()
));
}
private ScuttlingSliver(final ScuttlingSliver card) {

View file

@ -1,7 +1,5 @@
package mage.cards.s;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
@ -15,8 +13,9 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class SeafarersQuay extends CardImpl {
@ -32,7 +31,10 @@ public final class SeafarersQuay extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Blue legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(
new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)
.withForceQuotes()
));
}
public SeafarersQuay(final SeafarersQuay card) {

View file

@ -1,7 +1,5 @@
package mage.cards.u;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
@ -15,8 +13,9 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class UnholyCitadel extends CardImpl {
@ -32,7 +31,10 @@ public final class UnholyCitadel extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Black legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(
new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)
.withForceQuotes()
));
}
public UnholyCitadel(final UnholyCitadel card) {

View file

@ -60,6 +60,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
this.filter = effect.filter.copy();
this.excludeSource = effect.excludeSource;
this.forceQuotes = effect.forceQuotes;
}
@Override

View file

@ -11,7 +11,6 @@ import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
@ -24,6 +23,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
protected CompoundAbility ability;
protected boolean excludeSource;
protected FilterPermanent filter;
protected boolean forceQuotes = false;
public GainAbilityControlledEffect(Ability ability, Duration duration) {
this(ability, duration, StaticFilters.FILTER_PERMANENT);
@ -60,7 +60,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
this.ability = effect.ability.copy();
this.filter = effect.filter.copy();
this.excludeSource = effect.excludeSource;
this.forceQuotes = effect.forceQuotes;
}
@Override
@ -139,7 +139,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
sb.append(filter.getMessage()).append(" you control ");
if (duration == Duration.WhileOnBattlefield || duration == Duration.EndOfGame) {
sb.append("have ");
if (gainedAbility.startsWith("Whenever ") || gainedAbility.startsWith("{T}")) {
if (forceQuotes || gainedAbility.startsWith("When") || gainedAbility.startsWith("{T}")) {
gainedAbility = '"' + gainedAbility + '"';
}
} else {
@ -149,7 +149,16 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
sb.append(' ').append(duration.toString());
}
staticText = sb.toString() + ".";
staticText = sb.toString();
}
/**
* Add quotes to gains abilities (by default static abilities don't have it)
*/
public GainAbilityControlledEffect withForceQuotes() {
this.forceQuotes = true;
setText();
return this;
}
}