diff --git a/Mage.Sets/src/mage/cards/a/AdmiralAckbar.java b/Mage.Sets/src/mage/cards/a/AdmiralAckbar.java index e3ddd0f6b6..723ffc7b91 100644 --- a/Mage.Sets/src/mage/cards/a/AdmiralAckbar.java +++ b/Mage.Sets/src/mage/cards/a/AdmiralAckbar.java @@ -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. 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)); // Whenever two or more Starship creatures you control attack, draw a card. diff --git a/Mage.Sets/src/mage/cards/l/Lightsaber.java b/Mage.Sets/src/mage/cards/l/Lightsaber.java index e280ef9ba8..13e6d39c51 100644 --- a/Mage.Sets/src/mage/cards/l/Lightsaber.java +++ b/Mage.Sets/src/mage/cards/l/Lightsaber.java @@ -1,11 +1,8 @@ package mage.cards.l; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.costs.CostAdjuster; 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.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; @@ -14,12 +11,13 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.AttachmentType; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.SubType; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.util.CardUtil; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.Predicates; +import mage.target.TargetPermanent; -import java.util.Objects; import java.util.UUID; /** @@ -27,23 +25,27 @@ import java.util.UUID; */ 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) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); 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 GainAbilityAttachedEffect( FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT ).setText("and has first strike"))); - // Equip 3 - Ability ability = new EquipAbility(3); - ability.setCostAdjuster(LightsaberAdjuster.instance); - this.addAbility(ability); + // Equip {3} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), false)); - // Lightsaber's equip ability costs {1} if it targets a Jedi or Sith. - this.addAbility(new SimpleStaticAbility(new InfoEffect("{this}'s equip ability costs {1} if it targets a Jedi or Sith"))); + // Equip Jedi or Sith {1} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1), new TargetPermanent(filter), false)); } private Lightsaber(final Lightsaber card) { @@ -54,31 +56,4 @@ public final class Lightsaber extends CardImpl { public Lightsaber copy() { 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)); - } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/n/N1Starfighter.java b/Mage.Sets/src/mage/cards/n/N1Starfighter.java index c0765cfb95..f39a4fe479 100644 --- a/Mage.Sets/src/mage/cards/n/N1Starfighter.java +++ b/Mage.Sets/src/mage/cards/n/N1Starfighter.java @@ -4,6 +4,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.ExileTargetForSourceEffect; 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, // 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) - Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid( - new ExileTargetForSourceEffect(), new ManaCostsImpl("{1}{W/U}")), false); - ability.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false).concatBy(", then")); + DoIfCostPaid doIfCostPaid = new DoIfCostPaid(new ExileTargetForSourceEffect(), new ManaCostsImpl<>("{1}{W/U}")); + doIfCostPaid.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false).concatBy(",")); + + Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(doIfCostPaid, false); ability.addTarget(new TargetControlledCreaturePermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TerentatekCub.java b/Mage.Sets/src/mage/cards/t/TerentatekCub.java index 56814d2727..7b71719c3c 100644 --- a/Mage.Sets/src/mage/cards/t/TerentatekCub.java +++ b/Mage.Sets/src/mage/cards/t/TerentatekCub.java @@ -25,7 +25,7 @@ import java.util.UUID; */ 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 { 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.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( - new BoostSourceEffect(1, 1, Duration.Custom), + new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), new OpponentControlsPermanentCondition(filter), "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"); ability.addEffect(effect); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/StarWars.java b/Mage.Sets/src/mage/sets/StarWars.java index 1df06d8e5f..df1d2f87b1 100644 --- a/Mage.Sets/src/mage/sets/StarWars.java +++ b/Mage.Sets/src/mage/sets/StarWars.java @@ -30,6 +30,7 @@ public final class StarWars extends ExpansionSet { this.numBoosterRare = 1; this.numBoosterDoubleFaced = 1; this.ratioBoosterMythic = 8; + this.maxCardNumberInBooster = 271; 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));