* Fixed a problem with rule text generation. Reworked rule text generation of landwalk abilities.

This commit is contained in:
LevelX2 2015-08-25 13:40:44 +02:00
parent b47287c7f2
commit 61188dbdc3
19 changed files with 242 additions and 193 deletions

View file

@ -60,6 +60,7 @@ import mage.game.permanent.token.Token;
* @author LevelX2
*/
public class HelmOfKaldra extends CardImpl {
public static final FilterControlledArtifactPermanent filterHelm = new FilterControlledArtifactPermanent();
public static final FilterControlledArtifactPermanent filterShield = new FilterControlledArtifactPermanent();
public static final FilterControlledArtifactPermanent filterSword = new FilterControlledArtifactPermanent();
@ -82,7 +83,7 @@ public class HelmOfKaldra extends CardImpl {
effect.setText(", trample");
ability.addEffect(effect);
effect = new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT);
effect.setText(" and haste");
effect.setText("and haste");
ability.addEffect(effect);
this.addAbility(ability);
// {1}: If you control Equipment named Helm of Kaldra, Sword of Kaldra, and Shield of Kaldra, put a legendary 4/4 colorless Avatar creature token named Kaldra onto the battlefield and attach those Equipment to it.
@ -108,7 +109,6 @@ public class HelmOfKaldra extends CardImpl {
class HelmOfKaldraCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (game.getBattlefield().count(HelmOfKaldra.filterHelm, source.getSourceId(), source.getControllerId(), game) < 1) {
@ -150,17 +150,17 @@ class HelmOfKaldraEffect extends OneShotEffect {
Permanent kaldra = game.getPermanent(kaldraId);
if (kaldra != null) {
// Attach helm to the token
for (Permanent kaldrasHelm :game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterHelm, source.getControllerId(), game)) {
for (Permanent kaldrasHelm : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterHelm, source.getControllerId(), game)) {
kaldra.addAttachment(kaldrasHelm.getId(), game);
break;
}
// Attach shield to the token
for (Permanent kaldrasShield :game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterShield, source.getControllerId(), game)) {
for (Permanent kaldrasShield : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterShield, source.getControllerId(), game)) {
kaldra.addAttachment(kaldrasShield.getId(), game);
break;
}
// Attach sword to the token
for (Permanent kaldrasSword :game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterSword, source.getControllerId(), game)) {
for (Permanent kaldrasSword : game.getBattlefield().getAllActivePermanents(HelmOfKaldra.filterSword, source.getControllerId(), game)) {
kaldra.addAttachment(kaldrasSword.getId(), game);
break;
}

View file

@ -61,7 +61,7 @@ public class ChariotOfVictory extends CardImpl {
effect.setText(", trample");
ability.addEffect(effect);
effect = new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT);
effect.setText(" and haste");
effect.setText("and haste");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -51,7 +51,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class ZombieMaster extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("Zombies");
private static final FilterPermanent filter = new FilterPermanent("Zombie creatures");
static {
filter.add(new SubtypePredicate("Zombie"));
@ -66,9 +66,11 @@ public class ZombieMaster extends CardImpl {
this.toughness = new MageInt(3);
// Other Zombie creatures have swampwalk.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new SwampwalkAbility(), Duration.WhileOnBattlefield, filter, true)));
Effect effect = new GainAbilityAllEffect(new SwampwalkAbility(), Duration.WhileOnBattlefield, filter, true);
effect.setText("Other Zombie creatures have swampwalk. <i>(They can't be blocked as long as defending player controls a Swamp.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// Other Zombies have "{B}: Regenerate this permanent."
Effect effect = new GainAbilityAllEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")), Duration.WhileOnBattlefield, filter, true);
effect = new GainAbilityAllEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")), Duration.WhileOnBattlefield, filter, true);
effect.setText("Other Zombies have \"{B}: Regenerate this permanent.\"");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -25,19 +25,23 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.magic2012;
import java.util.UUID;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.HexproofAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
@ -45,17 +49,23 @@ import mage.cards.CardImpl;
*/
public class SwiftfootBoots extends CardImpl {
public SwiftfootBoots (UUID ownerId) {
public SwiftfootBoots(UUID ownerId) {
super(ownerId, 219, "Swiftfoot Boots", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "M12";
this.subtype.add("Equipment");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT)));
// Equipped creature has hexproof and haste.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.EQUIPMENT));
Effect effect = new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT);
effect.setText("and haste");
this.addAbility(ability);
// Equip {1}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}
public SwiftfootBoots (final SwiftfootBoots card) {
public SwiftfootBoots(final SwiftfootBoots card) {
super(card);
}

View file

@ -38,7 +38,6 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
/**
@ -51,14 +50,13 @@ public class TrompTheDomains extends CardImpl {
super(ownerId, 230, "Tromp the Domains", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{5}{G}");
this.expansionSetCode = "TSP";
// Domain - Until end of turn, creatures you control gain trample and get +1/+1 for each basic land type among lands you control.
Effect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setText("<i>Domain</i> - Until end of turn, creatures you control gain Trample");
this.getSpellAbility().addEffect(effect);
DynamicValue domain = new DomainValue();
effect = new BoostControlledEffect(domain, domain, Duration.EndOfTurn, new FilterCreaturePermanent(), false);
effect.setText(" and get +1/+1 for each basic land type among lands you control");
effect.setText("and get +1/+1 for each basic land type among lands you control");
this.getSpellAbility().addEffect(effect);
}

View file

@ -32,6 +32,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.SwampwalkAbility;
@ -55,9 +56,12 @@ public class ViscidLemures extends CardImpl {
this.toughness = new MageInt(3);
// {0}: Viscid Lemures gets -1/-0 and gains swampwalk until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainAbilitySourceEffect(new SwampwalkAbility(), Duration.EndOfTurn), new GenericManaCost(0));
ability.addEffect(new BoostSourceEffect(-1, 0, Duration.EndOfTurn));
Effect effect = new BoostSourceEffect(-1, 0, Duration.EndOfTurn);
effect.setText("{this} gets -1/-0");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new GenericManaCost(0));
effect = new GainAbilitySourceEffect(new SwampwalkAbility(), Duration.EndOfTurn);
effect.setText("and gains swampwalk until end of turn. <i>(It can't be blocked as long as defending player controls a Swamp.)</i>");
ability.addEffect(effect);
this.addAbility(ability);
}

View file

@ -53,7 +53,7 @@ import mage.target.common.TargetLandPermanent;
* @author fireshoes
*/
public class ZombieTrailblazer extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an untapped Zombie you control");
static {
@ -70,14 +70,14 @@ public class ZombieTrailblazer extends CardImpl {
this.toughness = new MageInt(2);
// Tap an untapped Zombie you control: Target land becomes a Swamp until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Swamp"), new TapTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetLandPermanent());
this.addAbility(ability);
// Tap an untapped Zombie you control: Target creature gains swampwalk until end of turn.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainAbilityTargetEffect(new SwampwalkAbility(), Duration.EndOfTurn), new TapTargetCost(new TargetControlledPermanent(filter)));
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainAbilityTargetEffect(new SwampwalkAbility(false), Duration.EndOfTurn), new TapTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -761,20 +761,24 @@ public abstract class AbilityImpl implements Ability {
if (abilityWord != null) {
sbRule.insert(0, new StringBuilder("<i>").append(abilityWord.toString()).append("</i> &mdash; "));
}
String ruleStart = sbRule.toString();
String text = modes.getText();
String rule;
if (!text.isEmpty()) {
if (sbRule.length() > 1) {
String end = sbRule.substring(sbRule.length() - 2).trim();
if (ruleStart.length() > 1) {
String end = ruleStart.substring(ruleStart.length() - 2).trim();
if (end.isEmpty() || end.equals(":") || end.equals(".")) {
sbRule.append(Character.toUpperCase(text.charAt(0))).append(text.substring(1));
rule = ruleStart + Character.toUpperCase(text.charAt(0)) + text.substring(1);
} else {
sbRule.append(text);
rule = ruleStart + text;
}
} else {
sbRule.append(text);
rule = ruleStart + text;
}
} else {
rule = ruleStart;
}
return sbRule.toString();
return rule;
}
@Override

View file

@ -170,11 +170,11 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
sb.append(target.getTargetName()).append(" gains ");
}
sb.append(ability.getRule());
if (durationPhaseStep != null) {
sb.append(" until your next ").append(durationPhaseStep.toString().toLowerCase(Locale.ENGLISH));
}
if (!duration.toString().isEmpty()) {
sb.append(ability.getRule()).append(" ").append(duration.toString());
} else if (!duration.toString().isEmpty()) {
sb.append(" ").append(duration.toString());
}
return sb.toString();
}

View file

@ -1,38 +1,36 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.constants.Zone;
import java.io.ObjectStreamException;
import mage.abilities.MageSingleton;
import mage.abilities.StaticAbility;
import java.io.ObjectStreamException;
import mage.constants.Zone;
/**
*
@ -40,7 +38,7 @@ import java.io.ObjectStreamException;
*/
public class FirstStrikeAbility extends StaticAbility implements MageSingleton {
private static final FirstStrikeAbility fINSTANCE = new FirstStrikeAbility();
private static final FirstStrikeAbility fINSTANCE = new FirstStrikeAbility();
private Object readResolve() throws ObjectStreamException {
return fINSTANCE;
@ -56,7 +54,7 @@ public class FirstStrikeAbility extends StaticAbility implements MageSingleton {
@Override
public String getRule() {
return "First strike";
return "first strike";
}
@Override
@ -64,4 +62,4 @@ public class FirstStrikeAbility extends StaticAbility implements MageSingleton {
return fINSTANCE;
}
}
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.filter.common.FilterLandPermanent;
@ -37,7 +36,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class ForestwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("Forest");
private static final FilterLandPermanent filter = new FilterLandPermanent("forest");
static {
filter.add(new SubtypePredicate("Forest"));
@ -55,4 +54,4 @@ public class ForestwalkAbility extends LandwalkAbility {
public ForestwalkAbility copy() {
return new ForestwalkAbility(this);
}
}
}

View file

@ -1,38 +1,36 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.constants.Zone;
import java.io.ObjectStreamException;
import mage.abilities.MageSingleton;
import mage.abilities.StaticAbility;
import java.io.ObjectStreamException;
import mage.constants.Zone;
/**
*
@ -40,7 +38,7 @@ import java.io.ObjectStreamException;
*/
public class HasteAbility extends StaticAbility implements MageSingleton {
private static final HasteAbility fINSTANCE = new HasteAbility();
private static final HasteAbility fINSTANCE = new HasteAbility();
private Object readResolve() throws ObjectStreamException {
return fINSTANCE;
@ -56,7 +54,7 @@ public class HasteAbility extends StaticAbility implements MageSingleton {
@Override
public String getRule() {
return "Haste";
return "haste";
}
@Override

View file

@ -1,14 +1,13 @@
package mage.abilities.keyword;
import java.io.ObjectStreamException;
import mage.abilities.MageSingleton;
import mage.abilities.common.SimpleStaticAbility;
import mage.constants.Zone;
/**
* Hexproof
* (This creature or player can't be the target of spells or abilities your opponents control.)
* Hexproof (This creature or player can't be the target of spells or abilities
* your opponents control.)
*
* @author loki
*/
@ -39,6 +38,6 @@ public class HexproofAbility extends SimpleStaticAbility implements MageSingleto
@Override
public String getRule() {
return "Hexproof";
return "hexproof";
}
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.filter.common.FilterLandPermanent;
@ -37,7 +36,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class IslandwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("Island");
private static final FilterLandPermanent filter = new FilterLandPermanent("island");
static {
filter.add(new SubtypePredicate("Island"));

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,18 +20,17 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -43,7 +42,11 @@ import mage.game.permanent.Permanent;
public class LandwalkAbility extends EvasionAbility {
public LandwalkAbility(FilterLandPermanent filter) {
this.addEffect(new LandwalkEffect(filter));
this(filter, true);
}
public LandwalkAbility(FilterLandPermanent filter, boolean withHintText) {
this.addEffect(new LandwalkEffect(filter, withHintText));
}
public LandwalkAbility(final LandwalkAbility ability) {
@ -55,16 +58,25 @@ public class LandwalkAbility extends EvasionAbility {
return new LandwalkAbility(this);
}
@Override
public String getRule() {
String ruleText = super.getRule();
if (!ruleText.isEmpty() && ruleText.endsWith(".")) {
return ruleText.substring(0, ruleText.length() - 1);
}
return ruleText;
}
}
class LandwalkEffect extends RestrictionEffect {
protected FilterLandPermanent filter;
public LandwalkEffect(FilterLandPermanent filter) {
public LandwalkEffect(FilterLandPermanent filter, boolean withHintText) {
super(Duration.WhileOnBattlefield);
this.filter = filter;
staticText = filter.getMessage() + "walk";
staticText = setText(withHintText);
}
public LandwalkEffect(final LandwalkEffect effect) {
@ -79,10 +91,7 @@ class LandwalkEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getSourceId())) {
return true;
}
return false;
return permanent.getId().equals(source.getSourceId());
}
@Override
@ -90,4 +99,34 @@ class LandwalkEffect extends RestrictionEffect {
return new LandwalkEffect(this);
}
}
private String setText(boolean withHintText) {
// Swampwalk (This creature can't be blocked as long as defending player controls a Swamp.)
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage()).append("walk");
if (withHintText) {
sb.append(" <i>(This creature can't be blocked as long as defending player controls a ");
switch (filter.getMessage()) {
case "swamp":
sb.append("Swamp");
break;
case "plains":
sb.append("Plains");
break;
case "mountain":
sb.append("Mountain");
break;
case "forest":
sb.append("Forest");
break;
case "island":
sb.append("Island");
break;
default:
sb.append(filter.getMessage());
}
sb.append(".)</i>");
}
return sb.toString();
}
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.filter.common.FilterLandPermanent;
@ -37,7 +36,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class MountainwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("Mountain");
private static final FilterLandPermanent filter = new FilterLandPermanent("mountain");
static {
filter.add(new SubtypePredicate("Mountain"));
@ -55,4 +54,4 @@ public class MountainwalkAbility extends LandwalkAbility {
public MountainwalkAbility copy() {
return new MountainwalkAbility(this);
}
}
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.filter.common.FilterLandPermanent;
@ -37,7 +36,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class PlainswalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("Plains");
private static final FilterLandPermanent filter = new FilterLandPermanent("plains");
static {
filter.add(new SubtypePredicate("Plains"));
@ -55,4 +54,4 @@ public class PlainswalkAbility extends LandwalkAbility {
public PlainswalkAbility copy() {
return new PlainswalkAbility(this);
}
}
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.filter.common.FilterLandPermanent;
@ -37,14 +36,18 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class SwampwalkAbility extends LandwalkAbility {
private static final FilterLandPermanent filter = new FilterLandPermanent("Swamp");
private static final FilterLandPermanent filter = new FilterLandPermanent("swamp");
static {
filter.add(new SubtypePredicate("Swamp"));
}
public SwampwalkAbility() {
super(filter);
this(true);
}
public SwampwalkAbility(boolean withHintText) {
super(filter, withHintText);
}
public SwampwalkAbility(final SwampwalkAbility ability) {
@ -55,4 +58,4 @@ public class SwampwalkAbility extends LandwalkAbility {
public SwampwalkAbility copy() {
return new SwampwalkAbility(this);
}
}
}

View file

@ -1,38 +1,36 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.constants.Zone;
import java.io.ObjectStreamException;
import mage.abilities.MageSingleton;
import mage.abilities.StaticAbility;
import java.io.ObjectStreamException;
import mage.constants.Zone;
/**
*
@ -40,7 +38,7 @@ import java.io.ObjectStreamException;
*/
public class TrampleAbility extends StaticAbility implements MageSingleton {
private static final TrampleAbility fINSTANCE = new TrampleAbility();
private static final TrampleAbility fINSTANCE = new TrampleAbility();
private Object readResolve() throws ObjectStreamException {
return fINSTANCE;
@ -56,7 +54,7 @@ public class TrampleAbility extends StaticAbility implements MageSingleton {
@Override
public String getRule() {
return "Trample";
return "trample";
}
@Override
@ -64,4 +62,4 @@ public class TrampleAbility extends StaticAbility implements MageSingleton {
return fINSTANCE;
}
}
}