mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Some rework of Keeper of the Light.
This commit is contained in:
parent
458b207d2f
commit
d66d8d47fb
3 changed files with 45 additions and 61 deletions
|
@ -83,7 +83,7 @@ public class KeeperOfTheDead extends CardImpl {
|
|||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// {B}, {tap}: Choose target opponent who had at least two fewer creature cards in his or her graveyard than you did as you activated this ability. Destroy target nonblack creature he or she controls.
|
||||
// {B}, {T}: Choose target opponent who had at least two fewer creature cards in his or her graveyard than you did as you activated this ability. Destroy target nonblack creature he or she controls.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new KeeperOfTheDeadEffect(), new TapSourceCost());
|
||||
ability.addCost(new ManaCostsImpl("{B}"));
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
|
@ -136,10 +136,10 @@ class KeeperOfDeadPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|
|||
|
||||
class KeeperOfTheDeadCreatureTarget extends TargetPermanent {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature");
|
||||
private static final FilterCreaturePermanent nonblackCreaturefilter = new FilterCreaturePermanent("nonblack creature");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
nonblackCreaturefilter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
}
|
||||
|
||||
public KeeperOfTheDeadCreatureTarget() {
|
||||
|
@ -179,7 +179,7 @@ class KeeperOfTheDeadCreatureTarget extends TargetPermanent {
|
|||
UUID playerId = ((StackObject) object).getStackAbility().getFirstTarget();
|
||||
for (UUID targetId : availablePossibleTargets) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null && filter.match(permanent, game) && permanent.getControllerId().equals(playerId)) {
|
||||
if (permanent != null && nonblackCreaturefilter.match(permanent, game) && permanent.getControllerId().equals(playerId)) {
|
||||
possibleTargets.add(targetId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,28 +27,24 @@
|
|||
*/
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.constants.SubType;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.filter.FilterOpponent;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.filter.FilterOpponent;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
|
@ -65,11 +61,11 @@ public class KeeperOfTheLight extends CardImpl {
|
|||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// {W}, {tap}: Choose target opponent who had more life than you did as you activated this ability. You gain 3 life.
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD,
|
||||
new GainLifeEffect(new StaticValue(3), "Choose target opponent who had more life than you did as you activated this ability. You gain 3 life."),
|
||||
new TapSourceCost(), KeeperOfTheLightCondition.instance);
|
||||
ability.addCost(new ManaCostsImpl("{W}"));
|
||||
// {W}, {T}: Choose target opponent who had more life than you did as you activated this ability. You gain 3 life.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new GainLifeEffect(3).setText("Choose target opponent who had more life than you did as you activated this ability. You gain 3 life."),
|
||||
new ManaCostsImpl("{W}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new KeeperOfTheLightTarget());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -88,15 +84,7 @@ public class KeeperOfTheLight extends CardImpl {
|
|||
class KeeperOfTheLightTarget extends TargetPlayer {
|
||||
|
||||
public KeeperOfTheLightTarget() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public KeeperOfTheLightTarget(boolean notTarget) {
|
||||
this(new FilterOpponent("opponent who had more life than you did as you activated this ability"), notTarget);
|
||||
}
|
||||
|
||||
public KeeperOfTheLightTarget(FilterOpponent filter, boolean notTarget) {
|
||||
super(1, 1, notTarget, filter);
|
||||
super(1, 1, false, new FilterOpponent("opponent that has more life than you"));
|
||||
}
|
||||
|
||||
public KeeperOfTheLightTarget(final KeeperOfTheLightTarget target) {
|
||||
|
@ -111,9 +99,9 @@ class KeeperOfTheLightTarget extends TargetPlayer {
|
|||
|
||||
for (UUID targetId : availablePossibleTargets) {
|
||||
Player opponent = game.getPlayer(targetId);
|
||||
if (opponent != null){
|
||||
if (opponent != null) {
|
||||
int lifeOpponent = opponent.getLife();
|
||||
if (lifeOpponent > lifeController){
|
||||
if (lifeOpponent > lifeController) {
|
||||
possibleTargets.add(targetId);
|
||||
}
|
||||
}
|
||||
|
@ -122,39 +110,30 @@ class KeeperOfTheLightTarget extends TargetPlayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public KeeperOfTheLightTarget copy() {
|
||||
return new KeeperOfTheLightTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "opponent who had more life than you did as you activated this ability";
|
||||
}
|
||||
}
|
||||
|
||||
enum KeeperOfTheLightCondition implements Condition {
|
||||
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int count = 0;
|
||||
MageObject targetSource = game.getObject(sourceId);
|
||||
Player controller = game.getPlayer(sourceControllerId);
|
||||
if (controller != null) {
|
||||
int controllerLife = controller.getLife();
|
||||
|
||||
for (UUID playerId : game.getPlayerList()){
|
||||
if (controllerLife < game.getPlayer(playerId).getLife()){
|
||||
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null
|
||||
&& controller.getLife() < player.getLife()
|
||||
&& !player.hasLeft()
|
||||
&& filter.match(player, sourceId, sourceControllerId, game)
|
||||
&& player.canBeTargetedBy(targetSource, sourceControllerId, game)) {
|
||||
count++;
|
||||
if (count >= this.minNumberOfTargets) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you have less life than an opponent";
|
||||
public KeeperOfTheLightTarget copy() {
|
||||
return new KeeperOfTheLightTarget(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2272,6 +2272,11 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
return state.getPlayers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all players ignoring the range of visible players
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PlayerList getPlayerList() {
|
||||
return state.getPlayerList();
|
||||
|
|
Loading…
Reference in a new issue