mirror of
https://github.com/correl/mage.git
synced 2024-12-27 11:07:39 +00:00
* Shifting Sky - Fixed not working color set effect.
This commit is contained in:
parent
408d45d15e
commit
223dd16d04
1 changed files with 22 additions and 53 deletions
|
@ -32,12 +32,15 @@ import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.common.ChooseColorEffect;
|
import mage.abilities.effects.common.ChooseColorEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.SubLayer;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
|
@ -48,7 +51,7 @@ import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author anonymous
|
* @author Luna Skyrise
|
||||||
*/
|
*/
|
||||||
public class ShiftingSky extends CardImpl {
|
public class ShiftingSky extends CardImpl {
|
||||||
|
|
||||||
|
@ -57,11 +60,10 @@ public class ShiftingSky extends CardImpl {
|
||||||
this.expansionSetCode = "PLS";
|
this.expansionSetCode = "PLS";
|
||||||
|
|
||||||
// As Shifting Sky enters the battlefield, choose a color.
|
// As Shifting Sky enters the battlefield, choose a color.
|
||||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ChooseColorEffect(Outcome.Benefit));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new ChooseColorEffect(Outcome.Detriment)));
|
||||||
this.addAbility(ability);
|
|
||||||
// All nonland permanents are the chosen color.
|
// All nonland permanents are the chosen color.
|
||||||
Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new ShiftingSkyEffect());
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ShiftingSkyEffect()));
|
||||||
this.addAbility(ability2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShiftingSky(final ShiftingSky card) {
|
public ShiftingSky(final ShiftingSky card) {
|
||||||
|
@ -74,47 +76,29 @@ public class ShiftingSky extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShiftingSkyEffect extends OneShotEffect {
|
class ShiftingSkyEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private static final FilterPermanent filter = new FilterPermanent("All nonland permanents");
|
private static final FilterPermanent filter = new FilterPermanent("All nonland permanents");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(
|
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||||
Predicates.not(
|
|
||||||
new CardTypePredicate(CardType.LAND)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShiftingSkyEffect() {
|
public ShiftingSkyEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||||
staticText = "All nonland permanents are the chosen color";
|
staticText = "All nonland permanents are the chosen color";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShiftingSkyEffect(final ShiftingSkyEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
if (controller != null) {
|
||||||
|
|
||||||
if (player != null && permanent != null) {
|
|
||||||
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
|
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
|
||||||
|
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
String colorString = color.toString();
|
perm.getColor(game).setColor(color);
|
||||||
|
|
||||||
for (UUID playerId : player.getInRange()) {
|
|
||||||
Player p = game.getPlayer(playerId);
|
|
||||||
if (p != null) {
|
|
||||||
for (Permanent chosen : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) {
|
|
||||||
setObject(chosen, colorString, game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -126,23 +110,8 @@ class ShiftingSkyEffect extends OneShotEffect {
|
||||||
return new ShiftingSkyEffect(this);
|
return new ShiftingSkyEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setObject(Permanent chosen, String colorString, Game game) {
|
private ShiftingSkyEffect(ShiftingSkyEffect effect) {
|
||||||
switch (colorString) {
|
super(effect);
|
||||||
case "W":
|
|
||||||
chosen.getColor(game).setWhite(true);
|
|
||||||
break;
|
|
||||||
case "B":
|
|
||||||
chosen.getColor(game).setBlack(true);
|
|
||||||
break;
|
|
||||||
case "U":
|
|
||||||
chosen.getColor(game).setBlue(true);
|
|
||||||
break;
|
|
||||||
case "G":
|
|
||||||
chosen.getColor(game).setGreen(true);
|
|
||||||
break;
|
|
||||||
case "R":
|
|
||||||
chosen.getColor(game).setRed(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue