mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Implemented Pirate's Cutlass, changed text templating for creating token effects
This commit is contained in:
parent
1021ba2d61
commit
6fc78d1d78
5 changed files with 131 additions and 18 deletions
89
Mage.Sets/src/mage/cards/p/PiratesCutlass.java
Normal file
89
Mage.Sets/src/mage/cards/p/PiratesCutlass.java
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class PiratesCutlass extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Pirate you control");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.PIRATE));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public PiratesCutlass(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
this.subtype.add("Equipment");
|
||||
|
||||
// When Pirate's Cutlass enters the battlefield, attach it to target Pirate you control.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new AttachEffect(Outcome.BoostCreature, "attach it to target Pirate you control"), false);
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Equipped creature gets +2/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 1)));
|
||||
|
||||
// Equip 2
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
|
||||
|
||||
}
|
||||
|
||||
public PiratesCutlass(final PiratesCutlass card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PiratesCutlass copy() {
|
||||
return new PiratesCutlass(this);
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -45,14 +44,15 @@ import mage.constants.Zone;
|
|||
*/
|
||||
public class TrustyMachete extends CardImpl {
|
||||
|
||||
public TrustyMachete (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||
public TrustyMachete(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
this.subtype.add("Equipment");
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 1)));
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
|
||||
}
|
||||
|
||||
public TrustyMachete (final TrustyMachete card) {
|
||||
public TrustyMachete(final TrustyMachete card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public class Ixalan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Opt", 65, Rarity.COMMON, mage.cards.o.Opt.class));
|
||||
cards.add(new SetCardInfo("Overflowing Insight", 64, Rarity.MYTHIC, mage.cards.o.OverflowingInsight.class));
|
||||
cards.add(new SetCardInfo("Pillar of Origins", 241, Rarity.UNCOMMON, mage.cards.p.PillarOfOrigins.class));
|
||||
cards.add(new SetCardInfo("Pirate's Cutlass", 242, Rarity.COMMON, mage.cards.p.PiratesCutlass.class));
|
||||
cards.add(new SetCardInfo("Primal Amulet", 243, Rarity.RARE, mage.cards.p.PrimalAmulet.class));
|
||||
cards.add(new SetCardInfo("Primal Wellspring", 243, Rarity.RARE, mage.cards.p.PrimalWellspring.class));
|
||||
cards.add(new SetCardInfo("Prosperous Pirates", 69, Rarity.COMMON, mage.cards.p.ProsperousPirates.class));
|
||||
|
|
|
@ -113,7 +113,7 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
public ArrayList<UUID> getLastAddedTokenIds() {
|
||||
return lastAddedTokenIds;
|
||||
}
|
||||
|
||||
|
||||
public void exileTokensCreatedAtNextEndStep(Game game, Ability source) {
|
||||
for (UUID tokenId : this.getLastAddedTokenIds()) {
|
||||
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||
|
@ -122,7 +122,7 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exileTokensCreatedAtEndOfCombat(Game game, Ability source) {
|
||||
|
@ -133,9 +133,9 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder("create ");
|
||||
if (amount.toString().equals("1")) {
|
||||
|
@ -153,6 +153,10 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
if (token.getDescription().endsWith("token")) {
|
||||
sb.append("s ");
|
||||
}
|
||||
int tokenLocation = sb.indexOf("token ");
|
||||
if (tokenLocation != -1) {
|
||||
sb.replace(tokenLocation, tokenLocation + 6, "tokens ");
|
||||
}
|
||||
}
|
||||
if (attacking) {
|
||||
if (tapped) {
|
||||
|
|
|
@ -67,25 +67,44 @@ public class CreateTokenTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("put ");
|
||||
sb.append(CardUtil.numberToText(amount.toString(), "a"));
|
||||
sb.append(' ').append(token.getDescription()).append(" onto the battlefield");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
sb.append(" creates ");
|
||||
if (amount.toString().equals("1")) {
|
||||
sb.append("a ");
|
||||
if (tapped && !attacking) {
|
||||
sb.append("tapped ");
|
||||
}
|
||||
sb.append(token.getDescription());
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(amount.toString())).append(' ');
|
||||
if (tapped && !attacking) {
|
||||
sb.append("tapped ");
|
||||
}
|
||||
sb.append(token.getDescription());
|
||||
if (token.getDescription().endsWith("token")) {
|
||||
sb.append("s ");
|
||||
}
|
||||
int tokenLocation = sb.indexOf("token ");
|
||||
if (tokenLocation != -1) {
|
||||
sb.replace(tokenLocation, tokenLocation + 6, "tokens ");
|
||||
}
|
||||
}
|
||||
if (attacking) {
|
||||
if (tapped) {
|
||||
sb.append(" and");
|
||||
sb.append(" tapped and");
|
||||
}
|
||||
sb.append(" attacking");
|
||||
}
|
||||
String message = amount.getMessage();
|
||||
if (!message.isEmpty()) {
|
||||
sb.append(" for each ");
|
||||
if (amount.toString().equals("X")) {
|
||||
sb.append(", where X is ");
|
||||
} else {
|
||||
sb.append(" for each ");
|
||||
}
|
||||
}
|
||||
sb.append(message);
|
||||
sb.append(" under target ").append(mode.getTargets().get(0).getTargetName());
|
||||
sb.append("'s control");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue