mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[PIP] Implement Overencumbered
This commit is contained in:
parent
dcc721cc68
commit
6c2e7a3fd3
3 changed files with 125 additions and 0 deletions
122
Mage.Sets/src/mage/cards/o/Overencumbered.java
Normal file
122
Mage.Sets/src/mage/cards/o/Overencumbered.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.combat.CantAttackAllEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.ClueArtifactToken;
|
||||
import mage.game.permanent.token.FoodToken;
|
||||
import mage.game.permanent.token.JunkToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ciaccona007
|
||||
*/
|
||||
public final class Overencumbered extends CardImpl {
|
||||
|
||||
public Overencumbered(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant opponent
|
||||
TargetPlayer auraTarget = new TargetOpponent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// When Overencumbered enters the battlefield, enchanted opponent creates a Clue token, a Food token, and a Junk token.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new OverencumberedTokenEffect()));
|
||||
|
||||
// At the beginning of combat on enchanted opponent's turn, that player may pay {1} for each artifact they control. If they don't, creatures can't attack this combat.
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(
|
||||
TargetController.ENCHANTED, new OverencumberedEffect(), false
|
||||
);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private Overencumbered(final Overencumbered card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overencumbered copy() {
|
||||
return new Overencumbered(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OverencumberedTokenEffect extends OneShotEffect {
|
||||
|
||||
OverencumberedTokenEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "enchanted opponent creates a Clue token, a Food token, and a Junk token.";
|
||||
}
|
||||
|
||||
private OverencumberedTokenEffect(final OverencumberedTokenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OverencumberedTokenEffect copy() {
|
||||
return new OverencumberedTokenEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent overencumbered = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
new ClueArtifactToken().putOntoBattlefield(1, game, source, overencumbered.getAttachedTo());
|
||||
new FoodToken().putOntoBattlefield(1, game, source, overencumbered.getAttachedTo());
|
||||
new JunkToken().putOntoBattlefield(1, game, source, overencumbered.getAttachedTo());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class OverencumberedEffect extends OneShotEffect {
|
||||
|
||||
OverencumberedEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "that player may pay {1} for each artifact they control. "
|
||||
+ "If they don't, creatures can't attack this combat.";
|
||||
}
|
||||
|
||||
private OverencumberedEffect(final OverencumberedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OverencumberedEffect copy() {
|
||||
return new OverencumberedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player enchantedPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (enchantedPlayer == null || controller == null) {
|
||||
return false;
|
||||
}
|
||||
int amount = game.getBattlefield().countAll(
|
||||
StaticFilters.FILTER_PERMANENT_ARTIFACT, enchantedPlayer.getId(), game
|
||||
);
|
||||
if (!new GenericManaCost(amount).pay(source, game, source, enchantedPlayer.getId(), false)) {
|
||||
game.addEffect(new CantAttackAllEffect(Duration.EndOfCombat, StaticFilters.FILTER_PERMANENT_CREATURES), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -250,6 +250,7 @@ public final class Fallout extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("One with the Machine", 179, Rarity.RARE, mage.cards.o.OneWithTheMachine.class));
|
||||
cards.add(new SetCardInfo("Open the Vaults", 168, Rarity.RARE, mage.cards.o.OpenTheVaults.class));
|
||||
cards.add(new SetCardInfo("Opulent Palace", 278, Rarity.UNCOMMON, mage.cards.o.OpulentPalace.class));
|
||||
cards.add(new SetCardInfo("Overencumbered", 18, Rarity.RARE, mage.cards.o.Overencumbered.class));
|
||||
cards.add(new SetCardInfo("Overflowing Basin", 152, Rarity.RARE, mage.cards.o.OverflowingBasin.class));
|
||||
cards.add(new SetCardInfo("Overseer of Vault 76", 19, Rarity.RARE, mage.cards.o.OverseerOfVault76.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Overseer of Vault 76", 368, Rarity.RARE, mage.cards.o.OverseerOfVault76.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public class BeginningOfCombatTriggeredAbility extends AtStepTriggeredAbility {
|
|||
return "At the beginning of combat on each player's turn, ";
|
||||
case ANY:
|
||||
return "At the beginning of each combat, ";
|
||||
case ENCHANTED:
|
||||
return "At the beginning of combat on enchanted player's turn, ";
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unsupported TargetController in BeginningOfCombatTriggeredAbility: " + targetController);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue