mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Added AttachedToCounterCondition and some minor changes.
This commit is contained in:
parent
857da3a08a
commit
9f1fb3581c
4 changed files with 99 additions and 10 deletions
|
@ -28,8 +28,6 @@
|
|||
package mage.sets.eventide;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -37,6 +35,11 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continious.BoostControlledEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
@ -64,8 +67,12 @@ public class CreakwoodLiege extends CardImpl<CreakwoodLiege> {
|
|||
this.color.setBlack(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Other black creatures you control get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterBlackCreature, true)));
|
||||
// Other green creatures you control get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterGreenCreature, true)));
|
||||
// At the beginning of your upkeep, you may put a 1/1 black and green Worm creature token onto the battlefield.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new CreakwoodLiegeToken(), 1), TargetController.YOU, true));
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class FaerieMacabre extends CardImpl<FaerieMacabre> {
|
|||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Discard Faerie Macabre: Exile up to two target cards from graveyards.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.HAND, new ExileTargetEffect(), new DiscardSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(Zone.HAND, new FaerieMacabreExileTargetEffect(), new DiscardSourceCost());
|
||||
ability.addTarget(new TargetCardInGraveyard(0, 2, new FilterCard("cards from graveyards")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -80,19 +80,19 @@ public class FaerieMacabre extends CardImpl<FaerieMacabre> {
|
|||
}
|
||||
}
|
||||
|
||||
class ExileTargetEffect extends OneShotEffect<ExileTargetEffect> {
|
||||
class FaerieMacabreExileTargetEffect extends OneShotEffect<FaerieMacabreExileTargetEffect> {
|
||||
|
||||
public ExileTargetEffect() {
|
||||
public FaerieMacabreExileTargetEffect() {
|
||||
super(Outcome.Exile);
|
||||
}
|
||||
|
||||
public ExileTargetEffect(final ExileTargetEffect effect) {
|
||||
public FaerieMacabreExileTargetEffect(final FaerieMacabreExileTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExileTargetEffect copy() {
|
||||
return new ExileTargetEffect(this);
|
||||
public FaerieMacabreExileTargetEffect copy() {
|
||||
return new FaerieMacabreExileTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class AttachedToCounterCondition implements Condition {
|
||||
|
||||
private CounterType counterType;
|
||||
private int amount = 1;
|
||||
private int from = -1;
|
||||
private int to;
|
||||
|
||||
public AttachedToCounterCondition(CounterType type) {
|
||||
this.counterType = type;
|
||||
}
|
||||
|
||||
public AttachedToCounterCondition(CounterType type, int amount) {
|
||||
this.counterType = type;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public AttachedToCounterCondition(CounterType type, int from, int to) {
|
||||
this.counterType = type;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null || permanent.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
|
||||
if (attachedTo == null) {
|
||||
return false;
|
||||
}
|
||||
if (from != -1) { //range compare
|
||||
int count = attachedTo.getCounters().getCount(counterType);
|
||||
if (to == Integer.MAX_VALUE) {
|
||||
return count >= from;
|
||||
}
|
||||
return count >= from && count <= to;
|
||||
} else { // single compare (lte)
|
||||
return attachedTo.getCounters().getCount(counterType) >= amount;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -60,11 +60,11 @@ public class DevotionCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder("devotion to ").append(devotionColor.toString()).toString();
|
||||
return "put a number of";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return toString();
|
||||
return new StringBuilder("devotion to ").append(devotionColor.toString()).toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue