[DFT] Implement Cloudspire Captain

This commit is contained in:
theelk801 2025-01-24 12:25:50 -05:00
parent 59115c631e
commit 4b5bf3e1de
8 changed files with 140 additions and 20 deletions

View file

@ -0,0 +1,54 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.common.CrewSaddleIncreasedPowerAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CloudspireCaptain extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Mounts and Vehicles");
static {
filter.add(Predicates.or(
SubType.MOUNT.getPredicate(),
SubType.VEHICLE.getPredicate()
));
}
public CloudspireCaptain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.PILOT);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Mounts and Vehicles you control get +1/+1.
this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter)));
// This creature saddles Mounts and crews Vehicles as though its power were 2 greater.
this.addAbility(new CrewSaddleIncreasedPowerAbility());
}
private CloudspireCaptain(final CloudspireCaptain card) {
super(card);
}
@Override
public CloudspireCaptain copy() {
return new CloudspireCaptain(this);
}
}

View file

@ -39,6 +39,7 @@ public final class Aetherdrift extends ExpansionSet {
cards.add(new SetCardInfo("Brightfield Glider", 4, Rarity.COMMON, mage.cards.b.BrightfieldGlider.class));
cards.add(new SetCardInfo("Brightfield Mustang", 5, Rarity.COMMON, mage.cards.b.BrightfieldMustang.class));
cards.add(new SetCardInfo("Brightglass Gearhulk", 191, Rarity.MYTHIC, mage.cards.b.BrightglassGearhulk.class));
cards.add(new SetCardInfo("Cloudspire Captain", 9, Rarity.UNCOMMON, mage.cards.c.CloudspireCaptain.class));
cards.add(new SetCardInfo("Count on Luck", 118, Rarity.RARE, mage.cards.c.CountOnLuck.class));
cards.add(new SetCardInfo("Daretti, Rocketeer Engineer", 120, Rarity.RARE, mage.cards.d.DarettiRocketeerEngineer.class));
cards.add(new SetCardInfo("Dismal Backwater", 254, Rarity.COMMON, mage.cards.d.DismalBackwater.class));

View file

@ -10,11 +10,7 @@ import mage.constants.Zone;
public class CrewIncreasedPowerAbility extends StaticAbility {
public CrewIncreasedPowerAbility() {
this("{this}");
}
public CrewIncreasedPowerAbility(String selfName) {
super(Zone.BATTLEFIELD, new InfoEffect(selfName + " crews Vehicles as though its power were 2 greater."));
super(Zone.BATTLEFIELD, new InfoEffect("this creature crews Vehicles as though its power were 2 greater."));
}
private CrewIncreasedPowerAbility(final CrewIncreasedPowerAbility ability) {

View file

@ -0,0 +1,24 @@
package mage.abilities.common;
import mage.abilities.StaticAbility;
import mage.abilities.effects.common.InfoEffect;
import mage.constants.Zone;
/**
* @author TheElk801
*/
public class CrewSaddleIncreasedPowerAbility extends StaticAbility {
public CrewSaddleIncreasedPowerAbility() {
super(Zone.BATTLEFIELD, new InfoEffect("this creature saddles Mounts and crews Vehicles as though its power were 2 greater."));
}
private CrewSaddleIncreasedPowerAbility(final CrewSaddleIncreasedPowerAbility ability) {
super(ability);
}
@Override
public CrewSaddleIncreasedPowerAbility copy() {
return new CrewSaddleIncreasedPowerAbility(this);
}
}

View file

@ -0,0 +1,37 @@
package mage.abilities.common;
import mage.abilities.MageSingleton;
import mage.abilities.StaticAbility;
import mage.abilities.effects.common.InfoEffect;
import mage.constants.Zone;
import java.io.ObjectStreamException;
/**
* @author TheElk801
*/
public class CrewSaddleWithToughnessAbility extends StaticAbility implements MageSingleton {
private static final CrewSaddleWithToughnessAbility instance;
static {
instance = new CrewSaddleWithToughnessAbility();
}
private Object readResolve() throws ObjectStreamException {
return instance;
}
public static CrewSaddleWithToughnessAbility getInstance() {
return instance;
}
private CrewSaddleWithToughnessAbility() {
super(Zone.BATTLEFIELD, new InfoEffect("{this} saddles Mounts and crews Vehicles using its toughness rather than its power."));
}
@Override
public CrewSaddleWithToughnessAbility copy() {
return instance;
}
}

View file

@ -1,10 +1,7 @@
package mage.abilities.keyword;
import mage.abilities.Ability;
import mage.abilities.common.CrewIncreasedPowerAbility;
import mage.abilities.common.CrewWithToughnessAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.*;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.effects.OneShotEffect;
@ -156,7 +153,7 @@ class CrewCost extends CostImpl {
int selectedPower = this.targets.keySet().stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.mapToInt(p -> (getCrewPower(p, game)))
.mapToInt(p -> getCrewPower(p, game))
.sum();
String extraInfo = "(selected power " + selectedPower + " of " + value + ")";
if (selectedPower >= value) {
@ -215,10 +212,12 @@ class CrewCost extends CostImpl {
return new CrewCost(this);
}
private int getCrewPower(Permanent permanent, Game game) {
if (permanent.hasAbility(CrewWithToughnessAbility.getInstance(), game)) {
private static int getCrewPower(Permanent permanent, Game game) {
if (permanent.hasAbility(CrewWithToughnessAbility.getInstance(), game)
|| permanent.hasAbility(CrewSaddleWithToughnessAbility.getInstance(), game)) {
return permanent.getToughness().getValue();
} else if (permanent.getAbilities(game).containsClass(CrewIncreasedPowerAbility.class)) {
} else if (permanent.getAbilities(game).containsClass(CrewIncreasedPowerAbility.class)
|| permanent.getAbilities(game).containsClass(CrewSaddleIncreasedPowerAbility.class)) {
return permanent.getPower().getValue() + 2;
} else {
return permanent.getPower().getValue();

View file

@ -1,8 +1,8 @@
package mage.abilities.keyword;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.CrewSaddleIncreasedPowerAbility;
import mage.abilities.common.CrewSaddleWithToughnessAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.common.SaddledCondition;
import mage.abilities.costs.Cost;
@ -118,8 +118,7 @@ class SaddleCost extends CostImpl {
int selectedPower = this.targets.keySet().stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.mapToInt(p -> getSaddlePower(p, game))
.sum();
String extraInfo = "(selected power " + selectedPower + " of " + value + ")";
if (selectedPower >= value) {
@ -137,7 +136,7 @@ class SaddleCost extends CostImpl {
if (!game.replaceEvent(event)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null && permanent.tap(source, game)) {
sumPower += permanent.getPower().getValue();
sumPower += getSaddlePower(permanent, game);
}
}
}
@ -158,7 +157,7 @@ class SaddleCost extends CostImpl {
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
int sumPower = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) {
sumPower += Math.max(permanent.getPower().getValue(), 0);
sumPower += Math.max(getSaddlePower(permanent, game), 0);
if (sumPower >= value) {
return true;
}
@ -170,4 +169,14 @@ class SaddleCost extends CostImpl {
public SaddleCost copy() {
return new SaddleCost(this);
}
private static int getSaddlePower(Permanent permanent, Game game) {
if (permanent.hasAbility(CrewSaddleWithToughnessAbility.getInstance(), game)) {
return permanent.getToughness().getValue();
} else if (permanent.getAbilities(game).containsClass(CrewSaddleIncreasedPowerAbility.class)) {
return permanent.getPower().getValue() + 2;
} else {
return permanent.getPower().getValue();
}
}
}

View file

@ -16,7 +16,7 @@ public final class PilotToken extends TokenImpl {
subtype.add(SubType.PILOT);
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(new CrewIncreasedPowerAbility("this creature"));
addAbility(new CrewIncreasedPowerAbility());
}
private PilotToken(final PilotToken token) {