mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
fixed Yidaro, Wandering Monster
This commit is contained in:
parent
74a81c6f18
commit
599c5cf742
2 changed files with 16 additions and 10 deletions
|
@ -4,6 +4,8 @@ import mage.MageInt;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.CycleTriggeredAbility;
|
import mage.abilities.common.CycleTriggeredAbility;
|
||||||
|
import mage.abilities.costs.Cost;
|
||||||
|
import mage.abilities.costs.Costs;
|
||||||
import mage.abilities.costs.common.CyclingDiscardCost;
|
import mage.abilities.costs.common.CyclingDiscardCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -48,7 +50,7 @@ public final class YidaroWanderingMonster extends CardImpl {
|
||||||
this.addAbility(new CyclingAbility(new ManaCostsImpl("{1}{R}")));
|
this.addAbility(new CyclingAbility(new ManaCostsImpl("{1}{R}")));
|
||||||
|
|
||||||
// When you cycle Yidaro, Wandering Monster, shuffle it into your library from your graveyard. If you've cycled a card named Yidaro, Wandering Monster four or more times this game, put it onto the battlefield from your graveyard instead.
|
// When you cycle Yidaro, Wandering Monster, shuffle it into your library from your graveyard. If you've cycled a card named Yidaro, Wandering Monster four or more times this game, put it onto the battlefield from your graveyard instead.
|
||||||
this.addAbility(new CycleTriggeredAbility(new YidaroWanderingMonsterEffect()));
|
this.addAbility(new CycleTriggeredAbility(new YidaroWanderingMonsterEffect()), new YidaroWanderingMonsterWatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
private YidaroWanderingMonster(final YidaroWanderingMonster card) {
|
private YidaroWanderingMonster(final YidaroWanderingMonster card) {
|
||||||
|
@ -85,8 +87,11 @@ class YidaroWanderingMonsterEffect extends OneShotEffect {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MageObjectReference cycledCard = source
|
Costs<Cost> costs = (Costs) this.getValue("cycleCosts");
|
||||||
.getCosts()
|
if (costs == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MageObjectReference cycledCard = costs
|
||||||
.stream()
|
.stream()
|
||||||
.filter(CyclingDiscardCost.class::isInstance)
|
.filter(CyclingDiscardCost.class::isInstance)
|
||||||
.map(CyclingDiscardCost.class::cast)
|
.map(CyclingDiscardCost.class::cast)
|
||||||
|
@ -122,6 +127,9 @@ class YidaroWanderingMonsterWatcher extends Watcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
|
if (event.getType() != GameEvent.EventType.ACTIVATED_ABILITY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
StackObject object = game.getStack().getStackObject(event.getSourceId());
|
StackObject object = game.getStack().getStackObject(event.getSourceId());
|
||||||
if (object == null || !(object.getStackAbility() instanceof CyclingAbility)) {
|
if (object == null || !(object.getStackAbility() instanceof CyclingAbility)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
@ -10,7 +8,6 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Plopman
|
* @author Plopman
|
||||||
*/
|
*/
|
||||||
public class CycleTriggeredAbility extends ZoneChangeTriggeredAbility {
|
public class CycleTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||||
|
@ -37,6 +34,7 @@ public class CycleTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||||
if (event.getSourceId().equals(this.getSourceId())) {
|
if (event.getSourceId().equals(this.getSourceId())) {
|
||||||
StackObject object = game.getStack().getStackObject(event.getSourceId());
|
StackObject object = game.getStack().getStackObject(event.getSourceId());
|
||||||
if (object != null && object.getStackAbility() instanceof CyclingAbility) {
|
if (object != null && object.getStackAbility() instanceof CyclingAbility) {
|
||||||
|
this.getEffects().setValue("cycleCosts", object.getStackAbility().getCosts());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue