mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Some minor changes and added framework functions.
This commit is contained in:
parent
05382f5bda
commit
08f48b4164
7 changed files with 120 additions and 45 deletions
|
@ -129,10 +129,14 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if ((event.getType() == GameEvent.EventType.CAST_SPELL)
|
||||
&& event.getPlayerId() == source.getControllerId()) {
|
||||
if (event.getPlayerId() == source.getControllerId()) {
|
||||
MageObject spellObject = game.getObject(event.getSourceId());
|
||||
if (spellObject != null) {
|
||||
return spellObject.getCardType().contains(CardType.CREATURE);
|
||||
|
|
|
@ -28,19 +28,17 @@
|
|||
package mage.sets.darkascension;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedByOneEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedByOneAllEffect;
|
||||
import mage.abilities.keyword.UndyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,18 +46,26 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class PyreheartWolf extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public PyreheartWolf(UUID ownerId) {
|
||||
super(ownerId, 101, "Pyreheart Wolf", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||
this.expansionSetCode = "DKA";
|
||||
this.subtype.add("Wolf");
|
||||
|
||||
this.color.setRed(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Pyreheart Wolf attacks, each creature you control can't be blocked this turn except by two or more creatures.
|
||||
this.addAbility(new AttacksTriggeredAbility(new CantBeBlockedByOneAllEffect(2, filter, Duration.EndOfTurn), false));
|
||||
|
||||
// Undying (When this creature dies, if it had no +1/+1 counters on it, return it to the battlefield under its owner's control with a +1/+1 counter on it.)
|
||||
this.addAbility(new UndyingAbility());
|
||||
this.addAbility(new AttacksTriggeredAbility(new PyreheartWolfEffect(), false));
|
||||
|
||||
}
|
||||
|
||||
public PyreheartWolf(final PyreheartWolf card) {
|
||||
|
@ -71,32 +77,3 @@ public class PyreheartWolf extends CardImpl {
|
|||
return new PyreheartWolf(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PyreheartWolfEffect extends OneShotEffect {
|
||||
|
||||
public PyreheartWolfEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "creatures you control can't be blocked except by two or more creatures until end of turn";
|
||||
}
|
||||
|
||||
public PyreheartWolfEffect(final PyreheartWolfEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PyreheartWolfEffect copy() {
|
||||
return new PyreheartWolfEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
CantBeBlockedByOneEffect effect = new CantBeBlockedByOneEffect(2, Duration.EndOfTurn);
|
||||
SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
||||
perm.addAbility(ability, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class CraterElemental extends CardImpl {
|
|||
ability = new ActivateIfConditionActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new SetPowerSourceEffect(new StaticValue(8), Duration.EndOfTurn),
|
||||
new ManaCostsImpl("{4}{R}{R}"),
|
||||
new ManaCostsImpl("{2}{R}"),
|
||||
FormidableCondition.getInstance());
|
||||
ability.setAbilityWord(AbilityWord.FORMIDABLE);
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -90,7 +90,7 @@ class IreShamanExileEffect extends OneShotEffect {
|
|||
|
||||
public IreShamanExileEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "Exile the top card of your library. Until end of turn, you may play that card";
|
||||
this.staticText = "exile the top card of your library. Until end of turn, you may play that card";
|
||||
}
|
||||
|
||||
public IreShamanExileEffect(final IreShamanExileEffect effect) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class RevealTargetFromHandCost extends CostImpl {
|
|||
|
||||
public RevealTargetFromHandCost(TargetCardInHand target) {
|
||||
this.addTarget(target);
|
||||
this.text = "reveal " + target.getTargetName();
|
||||
this.text = (target.getNumberOfTargets() == 0 ?"you may ":"") + "reveal " + target.getTargetName();
|
||||
}
|
||||
|
||||
public RevealTargetFromHandCost(RevealTargetFromHandCost cost) {
|
||||
|
|
|
@ -55,7 +55,12 @@ public class CantBeBlockedByOneAllEffect extends ContinuousEffectImpl {
|
|||
super(duration, Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
this.filter = filter;
|
||||
staticText = new StringBuilder("Each ").append(filter.getMessage()).append(" can't be blocked except by ").append(CardUtil.numberToText(amount)).append(" or more creatures").toString();
|
||||
StringBuilder sb = new StringBuilder("Each ").append(filter.getMessage()).append(" can't be blocked ");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append("this turn ");
|
||||
}
|
||||
sb.append("except by ").append(CardUtil.numberToText(amount)).append(" or more creatures").toString();
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
public CantBeBlockedByOneAllEffect(final CantBeBlockedByOneAllEffect effect) {
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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.abilities.effects.common.combat;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CantBeBlockedByOneTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected int amount;
|
||||
|
||||
public CantBeBlockedByOneTargetEffect(int amount) {
|
||||
this(amount, Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
public CantBeBlockedByOneTargetEffect(int amount, Duration duration) {
|
||||
super(duration, Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
staticText = "Target creature can't be blocked except by " + amount + " or more creatures";
|
||||
}
|
||||
|
||||
public CantBeBlockedByOneTargetEffect(final CantBeBlockedByOneTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantBeBlockedByOneTargetEffect copy() {
|
||||
return new CantBeBlockedByOneTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
for(UUID targetId: getTargetPointer().getTargets(game, source)) {
|
||||
Permanent perm = game.getPermanent(targetId);
|
||||
if (perm != null) {
|
||||
perm.setMinBlockedBy(amount);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.RulesEffects;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue