mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
[PIP] Implement Three Dog, Galaxy News DJ
This commit is contained in:
parent
4bbd5db74b
commit
2d74f18a40
2 changed files with 174 additions and 4 deletions
170
Mage.Sets/src/mage/cards/t/ThreeDogGalaxyNewsDJ.java
Normal file
170
Mage.Sets/src/mage/cards/t/ThreeDogGalaxyNewsDJ.java
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||
import mage.abilities.costs.CompositeCost;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ThreeDogGalaxyNewsDJ extends CardImpl {
|
||||
|
||||
public ThreeDogGalaxyNewsDJ(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{W}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.BARD);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// Whenever you attack, you may pay {2} and sacrifice an Aura attached to Three Dog, Galaxy News DJ. When you sacrifice an Aura this way, for each other attacking creature you control, create a token that's a copy of that Aura attached to that creature.
|
||||
this.addAbility(new AttacksWithCreaturesTriggeredAbility(new ThreeDogGalaxyNewsDJEffect(), 1));
|
||||
}
|
||||
|
||||
private ThreeDogGalaxyNewsDJ(final ThreeDogGalaxyNewsDJ card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreeDogGalaxyNewsDJ copy() {
|
||||
return new ThreeDogGalaxyNewsDJ(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ThreeDogGalaxyNewsDJEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.AURA, "Aura attached to this creature");
|
||||
|
||||
static {
|
||||
filter.add(ThreeDogGalaxyNewsDJPredicate.instance);
|
||||
}
|
||||
|
||||
enum ThreeDogGalaxyNewsDJPredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return input
|
||||
.getSource()
|
||||
.getSourceObjectIfItStillExists(game) != null
|
||||
&& Optional
|
||||
.ofNullable(input)
|
||||
.map(ObjectSourcePlayer::getObject)
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(input.getSourceId()::equals)
|
||||
.orElse(false);
|
||||
}
|
||||
}
|
||||
|
||||
ThreeDogGalaxyNewsDJEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "you may pay {2} and sacrifice an Aura attached to {this}. " +
|
||||
"When you sacrifice an Aura this way, for each other attacking creature you control, " +
|
||||
"create a token that's a copy of that Aura attached to that creature";
|
||||
}
|
||||
|
||||
private ThreeDogGalaxyNewsDJEffect(final ThreeDogGalaxyNewsDJEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreeDogGalaxyNewsDJEffect copy() {
|
||||
return new ThreeDogGalaxyNewsDJEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
SacrificeTargetCost sacCost = new SacrificeTargetCost(filter);
|
||||
Cost cost = new CompositeCost(
|
||||
new GenericManaCost(2), sacCost,
|
||||
"Pay {2} and sacrifice an Aura attached to this creature"
|
||||
);
|
||||
if (!cost.canPay(source, source, source.getControllerId(), game)
|
||||
|| !player.chooseUse(outcome, "Pay {2} and sacrifice an Aura?", source, game)
|
||||
|| !cost.pay(source, game, source, source.getControllerId(), false)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = sacCost
|
||||
.getPermanents()
|
||||
.stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility(
|
||||
new ThreeDogGalaxyNewsDJTokenEffect(permanent), false
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class ThreeDogGalaxyNewsDJTokenEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterAttackingCreature();
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
private final Permanent permanent;
|
||||
|
||||
ThreeDogGalaxyNewsDJTokenEffect(Permanent permanent) {
|
||||
super(Outcome.Benefit);
|
||||
this.permanent = permanent != null ? permanent.copy() : null;
|
||||
staticText = "for each other attacking creature you control, " +
|
||||
"create a token that's a copy of that Aura attached to that creature";
|
||||
}
|
||||
|
||||
private ThreeDogGalaxyNewsDJTokenEffect(final ThreeDogGalaxyNewsDJTokenEffect effect) {
|
||||
super(effect);
|
||||
this.permanent = effect.permanent != null ? effect.permanent.copy() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThreeDogGalaxyNewsDJTokenEffect copy() {
|
||||
return new ThreeDogGalaxyNewsDJTokenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
filter, source.getControllerId(), source, game
|
||||
)) {
|
||||
new CreateTokenCopyTargetEffect()
|
||||
.setSavedPermanent(permanent)
|
||||
.setAttachedTo(permanent.getId())
|
||||
.apply(game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -986,10 +986,10 @@ public final class Fallout extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Thirst for Knowledge", 708, Rarity.UNCOMMON, mage.cards.t.ThirstForKnowledge.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thought Vessel", 251, Rarity.COMMON, mage.cards.t.ThoughtVessel.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thought Vessel", 779, Rarity.COMMON, mage.cards.t.ThoughtVessel.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 120, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 430, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 648, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 958, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 120, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 430, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 648, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Three Dog, Galaxy News DJ", 958, Rarity.RARE, mage.cards.t.ThreeDogGalaxyNewsDJ.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thrill-Kill Disciple", 394, Rarity.RARE, mage.cards.t.ThrillKillDisciple.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thrill-Kill Disciple", 596, Rarity.RARE, mage.cards.t.ThrillKillDisciple.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thrill-Kill Disciple", 68, Rarity.RARE, mage.cards.t.ThrillKillDisciple.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue