mirror of
https://github.com/correl/mage.git
synced 2025-01-12 11:08:01 +00:00
Implemented Myth Unbound
This commit is contained in:
parent
3407a3e742
commit
3278139da3
2 changed files with 114 additions and 0 deletions
113
Mage.Sets/src/mage/cards/m/MythUnbound.java
Normal file
113
Mage.Sets/src/mage/cards/m/MythUnbound.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.ZoneChangeAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.CostModificationType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.other.OwnerPredicate;
|
||||
import mage.filter.predicate.permanent.CommanderPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MythUnbound extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new CommanderPredicate());
|
||||
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public MythUnbound(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||
|
||||
// Your commander costs {1} less to cast for each time it's been cast from the command zone this game.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new MythUnboundCostReductionEffect()
|
||||
));
|
||||
|
||||
// Whenever your commander is put into the command zone from anywhere, draw a card.
|
||||
this.addAbility(new ZoneChangeAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, Zone.ALL, Zone.COMMAND,
|
||||
new DrawCardSourceControllerEffect(1), filter,
|
||||
"Whenever your commander is put into "
|
||||
+ "the command zone from anywhere, ", false
|
||||
));
|
||||
}
|
||||
|
||||
public MythUnbound(final MythUnbound card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MythUnbound copy() {
|
||||
return new MythUnbound(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MythUnboundCostReductionEffect extends CostModificationEffectImpl {
|
||||
|
||||
MythUnboundCostReductionEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "your commander costs {1} less to cast for each time "
|
||||
+ "it's been cast from the command zone this game";
|
||||
}
|
||||
|
||||
MythUnboundCostReductionEffect(MythUnboundCostReductionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
Ability spellAbility = (SpellAbility) abilityToModify;
|
||||
if (spellAbility != null) {
|
||||
Integer amount = (Integer) game.getState().getValue(abilityToModify.getControllerId() + "_castCount");
|
||||
if (amount != null && amount > 0) {
|
||||
CardUtil.reduceCost(spellAbility, amount);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (abilityToModify instanceof SpellAbility) {
|
||||
if (abilityToModify.isControlledBy(source.getControllerId())) {
|
||||
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
|
||||
if (spell != null) {
|
||||
return player.getCommandersIds().contains(spell.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MythUnboundCostReductionEffect copy() {
|
||||
return new MythUnboundCostReductionEffect(this);
|
||||
}
|
||||
}
|
|
@ -195,6 +195,7 @@ public final class Commander2018 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mulldrifter", 94, Rarity.UNCOMMON, mage.cards.m.Mulldrifter.class));
|
||||
cards.add(new SetCardInfo("Myr Battlesphere", 212, Rarity.RARE, mage.cards.m.MyrBattlesphere.class));
|
||||
cards.add(new SetCardInfo("Myriad Landscape", 269, Rarity.UNCOMMON, mage.cards.m.MyriadLandscape.class));
|
||||
cards.add(new SetCardInfo("Myth Unbound", 32, Rarity.RARE, mage.cards.m.MythUnbound.class));
|
||||
cards.add(new SetCardInfo("Nesting Dragon", 24, Rarity.RARE, mage.cards.n.NestingDragon.class));
|
||||
cards.add(new SetCardInfo("New Benalia", 270, Rarity.UNCOMMON, mage.cards.n.NewBenalia.class));
|
||||
cards.add(new SetCardInfo("Night Incarnate", 17, Rarity.RARE, mage.cards.n.NightIncarnate.class));
|
||||
|
|
Loading…
Reference in a new issue