mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Implemented Mobilized District
This commit is contained in:
parent
17023e72f5
commit
d415e2a00f
3 changed files with 127 additions and 1 deletions
125
Mage.Sets/src/mage/cards/m/MobilizedDistrict.java
Normal file
125
Mage.Sets/src/mage/cards/m/MobilizedDistrict.java
Normal file
|
@ -0,0 +1,125 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.mageobject.SupertypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MobilizedDistrict extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new SupertypePredicate(SuperType.LEGENDARY));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
static final DynamicValue cardsCount = new PermanentsOnBattlefieldCount(filter);
|
||||
|
||||
public MobilizedDistrict(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
|
||||
// {T}: Add {C}.
|
||||
this.addAbility(new ColorlessManaAbility());
|
||||
|
||||
// {4}: Mobilized District becomes a 3/3 Citizen creature with vigilance until end of turn. It's still a land. This ability costs {1} less to activate for each legendary creature and planeswalker you control.
|
||||
// TODO: Make ability properly copiable
|
||||
Ability ability = new SimpleActivatedAbility(new BecomesCreatureSourceEffect(
|
||||
new MobilizedDistrictToken(), "land", Duration.EndOfTurn
|
||||
).setText("{this} becomes a 3/3 Citizen creature with vigilance until end of turn. " +
|
||||
"It's still a land. This ability costs {1} less to activate " +
|
||||
"for each legendary creature and planeswalker you control."
|
||||
), new GenericManaCost(4));
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL, new MobilizedDistrictCostIncreasingEffect(ability.getOriginalId())
|
||||
).addHint(new ValueHint("legendary creatures and planeswalkers you control", cardsCount)));
|
||||
}
|
||||
|
||||
private MobilizedDistrict(final MobilizedDistrict card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobilizedDistrict copy() {
|
||||
return new MobilizedDistrict(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MobilizedDistrictToken extends TokenImpl {
|
||||
|
||||
MobilizedDistrictToken() {
|
||||
super("", "3/3 Citizen creature with vigilance");
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.CITIZEN);
|
||||
power = new MageInt(3);
|
||||
toughness = new MageInt(3);
|
||||
addAbility(VigilanceAbility.getInstance());
|
||||
}
|
||||
|
||||
private MobilizedDistrictToken(final MobilizedDistrictToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public MobilizedDistrictToken copy() {
|
||||
return new MobilizedDistrictToken(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MobilizedDistrictCostIncreasingEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
MobilizedDistrictCostIncreasingEffect(UUID originalId) {
|
||||
super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
this.originalId = originalId;
|
||||
}
|
||||
|
||||
private MobilizedDistrictCostIncreasingEffect(final MobilizedDistrictCostIncreasingEffect effect) {
|
||||
super(effect);
|
||||
this.originalId = effect.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int count = MobilizedDistrict.cardsCount.calculate(game, source, this);
|
||||
CardUtil.reduceCost(abilityToModify, count);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify.getOriginalId().equals(originalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobilizedDistrictCostIncreasingEffect copy() {
|
||||
return new MobilizedDistrictCostIncreasingEffect(this);
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ public final class Pteramander extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(new AdaptEffect(4).setText("Adapt 4. This ability costs {1} less to activate for each instant and sorcery card in your graveyard."), new ManaCostsImpl("{7}{U}"));
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new PteramanderCostIncreasingEffect(ability.getOriginalId()))
|
||||
.addHint(new ValueHint("Instant and sorcery card in your graveyard", cardsCount)));
|
||||
.addHint(new ValueHint("Instant and sorcery cards in your graveyard", cardsCount)));
|
||||
}
|
||||
|
||||
private Pteramander(final Pteramander card) {
|
||||
|
|
|
@ -142,6 +142,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mayhem Devil", 204, Rarity.UNCOMMON, mage.cards.m.MayhemDevil.class));
|
||||
cards.add(new SetCardInfo("Merfolk Skydiver", 205, Rarity.UNCOMMON, mage.cards.m.MerfolkSkydiver.class));
|
||||
cards.add(new SetCardInfo("Mizzium Tank", 138, Rarity.RARE, mage.cards.m.MizziumTank.class));
|
||||
cards.add(new SetCardInfo("Mobilized District", 249, Rarity.RARE, mage.cards.m.MobilizedDistrict.class));
|
||||
cards.add(new SetCardInfo("Mountain", 259, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Mountain", 260, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Mountain", 261, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
Loading…
Reference in a new issue