1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-12 09:11:05 -09:00

[C13] Added Stormscape Battlemage, Serene Master and Act of Authority.

This commit is contained in:
LevelX2 2013-11-27 23:46:48 +01:00
parent 3a97c8f210
commit 7a540d1fda
5 changed files with 446 additions and 11 deletions
Mage.Sets/src/mage/sets
Mage/src/mage/abilities/effects/common/continious

View file

@ -0,0 +1,156 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander2013;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class ActOfAuthority extends CardImpl<ActOfAuthority> {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT)));
}
public ActOfAuthority(UUID ownerId) {
super(ownerId, 1, "Act of Authority", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
this.expansionSetCode = "C13";
this.color.setWhite(true);
// When Act of Authority enters the battlefield, you may exile target artifact or enchantment.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect(), true);
ability.addTarget(new TargetPermanent(filter, true));
this.addAbility(ability);
// At the beginning of your upkeep, you may exile target artifact or enchantment. If you do, its controller gains control of Act of Authority.
ability = new BeginningOfUpkeepTriggeredAbility(new ActOfAuthorityEffect(), TargetController.YOU, true);
ability.addTarget(new TargetPermanent(filter, true));
this.addAbility(ability);
}
public ActOfAuthority(final ActOfAuthority card) {
super(card);
}
@Override
public ActOfAuthority copy() {
return new ActOfAuthority(this);
}
}
class ActOfAuthorityEffect extends OneShotEffect<ActOfAuthorityEffect> {
public ActOfAuthorityEffect() {
super(Outcome.Exile);
this.staticText = "you may exile target artifact or enchantment. If you do, its controller gains control of {this}";
}
public ActOfAuthorityEffect(final ActOfAuthorityEffect effect) {
super(effect);
}
@Override
public ActOfAuthorityEffect copy() {
return new ActOfAuthorityEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent targetPermanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (targetPermanent != null && new ExileTargetEffect().apply(game, source)) {
ContinuousEffect effect = new ActOfAuthorityGainControlEffect(Duration.Custom, targetPermanent.getControllerId());
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
game.addEffect(effect, source);
return true;
}
return false;
}
}
class ActOfAuthorityGainControlEffect extends ContinuousEffectImpl<ActOfAuthorityGainControlEffect> {
UUID controller;
public ActOfAuthorityGainControlEffect(Duration duration, UUID controller) {
super(duration, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
this.controller = controller;
}
public ActOfAuthorityGainControlEffect(final ActOfAuthorityGainControlEffect effect) {
super(effect);
this.controller = effect.controller;
}
@Override
public ActOfAuthorityGainControlEffect copy() {
return new ActOfAuthorityGainControlEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (targetPointer != null) {
permanent = game.getPermanent(targetPointer.getFirst(game, source));
}
if (permanent != null) {
return permanent.changeControllerId(controller, game);
}
return false;
}
@Override
public String getText(Mode mode) {
return "Gain control of {this}";
}
}

View file

@ -0,0 +1,127 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.SetPowerToughnessTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.BlockedByIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class SereneMaster extends CardImpl<SereneMaster> {
public SereneMaster(UUID ownerId) {
super(ownerId, 20, "Serene Master", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "C13";
this.subtype.add("Human");
this.subtype.add("Monk");
this.color.setWhite(true);
this.power = new MageInt(0);
this.toughness = new MageInt(2);
// Whenever Serene Master blocks, exchange its power and the power of target creature it's blocking until end of combat.
this.addAbility(new BlocksTriggeredAbility(new SereneMasterEffect(), false));
}
public SereneMaster(final SereneMaster card) {
super(card);
}
@Override
public SereneMaster copy() {
return new SereneMaster(this);
}
}
class SereneMasterEffect extends OneShotEffect<SereneMasterEffect> {
public SereneMasterEffect() {
super(Outcome.Benefit);
this.staticText = "exchange its power and the power of target creature it's blocking until end of combat";
}
public SereneMasterEffect(final SereneMasterEffect effect) {
super(effect);
}
@Override
public SereneMasterEffect copy() {
return new SereneMasterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (controller != null && sourceCreature != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature it's blocking");
filter.add(new BlockedByIdPredicate((source.getSourceId())));
Target target = new TargetCreaturePermanent(filter, true);
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
if (controller.chooseTarget(outcome, target, source, game)) {
Permanent attackingCreature = game.getPermanent(target.getFirstTarget());
if (attackingCreature != null) {
int newSourcePower = attackingCreature.getPower().getValue();
int newAttackerPower = sourceCreature.getPower().getValue();
ContinuousEffect effect = new SetPowerToughnessTargetEffect(newSourcePower, sourceCreature.getToughness().getValue(), Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
game.addEffect(effect, source);
effect = new SetPowerToughnessTargetEffect(newAttackerPower, attackingCreature.getToughness().getValue(), Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(attackingCreature.getId()));
game.addEffect(effect, source);
return true;
}
}
}
}
return false;
}
}

View file

@ -0,0 +1,96 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCostCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class StormscapeBattlemage extends CardImpl<StormscapeBattlemage> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature");
static {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
}
public StormscapeBattlemage(UUID ownerId) {
super(ownerId, 58, "Stormscape Battlemage", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.expansionSetCode = "C13";
this.subtype.add("Metathran");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Kicker {W} and/or {2}{B}
KickerAbility kickerAbility = new KickerAbility("{W}");
kickerAbility.addKickerCost("{2}{B}");
this.addAbility(kickerAbility);
// When Stormscape Battlemage enters the battlefield, if it was kicked with its {W} kicker, you gain 3 life.
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3),false),
new KickedCostCondition("{W}"),
"When Stormscape Battlemage enters the battlefield, if it was kicked with its {W} kicker, you gain 3 life."));
// When Stormscape Battlemage enters the battlefield, if it was kicked with its {2}{B} kicker, destroy target nonblack creature. That creature can't be regenerated.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(true),false);
ability.addTarget(new TargetCreaturePermanent(filter, true));
this.addAbility(new ConditionalTriggeredAbility(
ability, new KickedCostCondition("{2}{B}"),
"When Stormscape Battlemage enters the battlefield, if it was kicked with its {2}{B} kicker, destroy target nonblack creature. That creature can't be regenerated."));
}
public StormscapeBattlemage(final StormscapeBattlemage card) {
super(card);
}
@Override
public StormscapeBattlemage copy() {
return new StormscapeBattlemage(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.planeshift;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class StormscapeBattlemage extends mage.sets.commander2013.StormscapeBattlemage {
public StormscapeBattlemage(UUID ownerId) {
super(ownerId);
this.cardNumber = 35;
this.expansionSetCode = "PLS";
}
public StormscapeBattlemage(final StormscapeBattlemage card) {
super(card);
}
@Override
public StormscapeBattlemage copy() {
return new StormscapeBattlemage(this);
}
}

View file

@ -28,15 +28,16 @@
package mage.abilities.effects.common.continious;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -72,13 +73,16 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl<SetPower
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(source.getFirstTarget());
if (target != null) {
target.getPower().setValue(power.calculate(game, source));
target.getToughness().setValue(toughness.calculate(game, source));
return true;
boolean result = false;
for (UUID targetId: this.getTargetPointer().getTargets(game, source)) {
Permanent target = game.getPermanent(targetId);
if (target != null) {
target.getPower().setValue(power.calculate(game, source));
target.getToughness().setValue(toughness.calculate(game, source));
result = true;
}
}
return false;
return result;
}
@Override
@ -90,4 +94,4 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl<SetPower
}
}
}