Star Wars: The gathering - Bug and format fixes (#8932)

Closes #8918
This commit is contained in:
Hidde vb 2022-05-13 23:07:30 +02:00 committed by GitHub
parent ac2eb9056d
commit 35f52ecf99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 50 deletions

View file

@ -42,7 +42,7 @@ public final class AdmiralAckbar extends CardImpl {
// When you cast Admiral Ackbar, create two 2/3 blue Rebel Starship artifact creature tokens with spaceflight name B-Wing. // When you cast Admiral Ackbar, create two 2/3 blue Rebel Starship artifact creature tokens with spaceflight name B-Wing.
this.addAbility(new CastSourceTriggeredAbility(new CreateTokenEffect(new RebelStarshipToken(), 2), false)); this.addAbility(new CastSourceTriggeredAbility(new CreateTokenEffect(new RebelStarshipToken(), 2), false));
// At the beggining of each upkeep, untap all starships you control. // At the beginning of each upkeep, untap all starships you control.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new UntapAllControllerEffect(filter), TargetController.ANY, false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new UntapAllControllerEffect(filter), TargetController.ANY, false));
// Whenever two or more Starship creatures you control attack, draw a card. // Whenever two or more Starship creatures you control attack, draw a card.

View file

@ -1,11 +1,8 @@
package mage.cards.l; package mage.cards.l;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.CostAdjuster;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.EquipAbility;
@ -14,12 +11,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AttachmentType; import mage.constants.AttachmentType;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game; import mage.filter.FilterPermanent;
import mage.game.permanent.Permanent; import mage.filter.common.FilterControlledPermanent;
import mage.util.CardUtil; import mage.filter.predicate.Predicates;
import mage.target.TargetPermanent;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
/** /**
@ -27,23 +25,27 @@ import java.util.UUID;
*/ */
public final class Lightsaber extends CardImpl { public final class Lightsaber extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent("Jedi or Sith");
static {
filter.add(Predicates.or(SubType.JEDI.getPredicate(), SubType.SITH.getPredicate()));
}
public Lightsaber(UUID ownerId, CardSetInfo setInfo) { public Lightsaber(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
this.subtype.add(SubType.EQUIPMENT); this.subtype.add(SubType.EQUIPMENT);
// Equiped creature gets +1/+0 and has firsttrike // Equipped creature gets +1/+0 and has first strike.
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(1, 0))); this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(1, 0)));
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect( this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(
FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT
).setText("and has first strike"))); ).setText("and has first strike")));
// Equip 3 // Equip {3}
Ability ability = new EquipAbility(3); this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), false));
ability.setCostAdjuster(LightsaberAdjuster.instance);
this.addAbility(ability);
// Lightsaber's equip ability costs {1} if it targets a Jedi or Sith. // Equip Jedi or Sith {1}
this.addAbility(new SimpleStaticAbility(new InfoEffect("{this}'s equip ability costs {1} if it targets a Jedi or Sith"))); this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1), new TargetPermanent(filter), false));
} }
private Lightsaber(final Lightsaber card) { private Lightsaber(final Lightsaber card) {
@ -55,30 +57,3 @@ public final class Lightsaber extends CardImpl {
return new Lightsaber(this); return new Lightsaber(this);
} }
} }
enum LightsaberAdjuster implements CostAdjuster {
instance;
@Override
public void adjustCosts(Ability ability, Game game) {
if (game.inCheckPlayableState()) {
if (CardUtil
.getAllPossibleTargets(ability, game)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.noneMatch(permanent -> permanent.hasSubtype(SubType.SITH, game)
|| permanent.hasSubtype(SubType.JEDI, game))) {
return;
}
} else {
Permanent permanent = game.getPermanent(ability.getFirstTarget());
if (permanent == null || !(permanent.hasSubtype(SubType.SITH, game)
|| permanent.hasSubtype(SubType.JEDI, game))) {
return;
}
}
ability.getCosts().clear();
ability.addCost(new GenericManaCost(1));
}
}

View file

@ -4,6 +4,7 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileTargetForSourceEffect; import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
@ -40,10 +41,10 @@ public final class N1Starfighter extends CardImpl {
// Whenever N-1 Starfighter deals combat damage to a player, you may pay {1}{W/U}. If you do, // Whenever N-1 Starfighter deals combat damage to a player, you may pay {1}{W/U}. If you do,
// exile another target creature you control, then return that card to the battlefield under its owner's control. // exile another target creature you control, then return that card to the battlefield under its owner's control.
// P.S. original card have error with missing target word (another target creature) DoIfCostPaid doIfCostPaid = new DoIfCostPaid(new ExileTargetForSourceEffect(), new ManaCostsImpl<>("{1}{W/U}"));
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid( doIfCostPaid.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false).concatBy(","));
new ExileTargetForSourceEffect(), new ManaCostsImpl("{1}{W/U}")), false);
ability.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false).concatBy(", then")); Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(doIfCostPaid, false);
ability.addTarget(new TargetControlledCreaturePermanent(filter)); ability.addTarget(new TargetControlledCreaturePermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -25,7 +25,7 @@ import java.util.UUID;
*/ */
public final class TerentatekCub extends CardImpl { public final class TerentatekCub extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Hunter or Rogue card"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Jedi or Sith");
static { static {
filter.add(Predicates.or(SubType.JEDI.getPredicate(), SubType.SITH.getPredicate())); filter.add(Predicates.or(SubType.JEDI.getPredicate(), SubType.SITH.getPredicate()));
@ -37,12 +37,12 @@ public final class TerentatekCub extends CardImpl {
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// As long as an opponent controls a Jedi or Sith, {this} gets +1/+1 and attacks each turn if able // As long as an opponent controls a Jedi or Sith, {this} gets +1/+1 and attacks each turn if able.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostSourceEffect(1, 1, Duration.Custom), new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield),
new OpponentControlsPermanentCondition(filter), new OpponentControlsPermanentCondition(filter),
"As long as an opponent controls a Jedi or Sith, {this} gets +1/+1")); "As long as an opponent controls a Jedi or Sith, {this} gets +1/+1"));
Effect effect = new ConditionalRequirementEffect(new AttacksIfAbleSourceEffect(Duration.Custom), new OpponentControlsPermanentCondition(filter)); Effect effect = new ConditionalRequirementEffect(new AttacksIfAbleSourceEffect(Duration.WhileOnBattlefield), new OpponentControlsPermanentCondition(filter));
effect.setText("and attacks each combat if able"); effect.setText("and attacks each combat if able");
ability.addEffect(effect); ability.addEffect(effect);
this.addAbility(ability); this.addAbility(ability);

View file

@ -30,6 +30,7 @@ public final class StarWars extends ExpansionSet {
this.numBoosterRare = 1; this.numBoosterRare = 1;
this.numBoosterDoubleFaced = 1; this.numBoosterDoubleFaced = 1;
this.ratioBoosterMythic = 8; this.ratioBoosterMythic = 8;
this.maxCardNumberInBooster = 271;
cards.add(new SetCardInfo("A-Wing", 96, Rarity.UNCOMMON, mage.cards.a.AWing.class)); cards.add(new SetCardInfo("A-Wing", 96, Rarity.UNCOMMON, mage.cards.a.AWing.class));
cards.add(new SetCardInfo("AAT-1", 160, Rarity.UNCOMMON, mage.cards.a.AAT1.class)); cards.add(new SetCardInfo("AAT-1", 160, Rarity.UNCOMMON, mage.cards.a.AAT1.class));