mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Implement Heraldic Banner
This commit is contained in:
parent
9346f3ec83
commit
100f623df9
1 changed files with 83 additions and 0 deletions
83
Mage.Sets/src/mage/cards/h/HeraldicBanner.java
Normal file
83
Mage.Sets/src/mage/cards/h/HeraldicBanner.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.abilities.effects.mana.AddManaChosenColorEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author jmharmon
|
||||
*/
|
||||
|
||||
public final class HeraldicBanner extends CardImpl {
|
||||
|
||||
public HeraldicBanner(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// As Heraldic Banner enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit)));
|
||||
|
||||
// Creatures you control of the chosen color get +1/+0.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HeraldicBannerEffect()));
|
||||
|
||||
// {T}: Add one mana of the chosen color.
|
||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaChosenColorEffect(), new TapSourceCost()));
|
||||
}
|
||||
|
||||
public HeraldicBanner(final HeraldicBanner card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeraldicBanner copy() {
|
||||
return new HeraldicBanner(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HeraldicBannerEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
public HeraldicBannerEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||
staticText = "Creatures you control of the chosen color get +1/+0";
|
||||
}
|
||||
|
||||
public HeraldicBannerEffect(final HeraldicBannerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HeraldicBannerEffect copy() {
|
||||
return new HeraldicBannerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
|
||||
if (color != null) {
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (perm.getColor(game).contains(color)) {
|
||||
perm.addPower(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue