Implement Seedtime

This commit is contained in:
ciaccona007 2017-07-17 23:22:29 -04:00
parent b9f4d9523c
commit db0d394798

View file

@ -27,9 +27,6 @@
*/
package mage.cards.s;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
@ -37,13 +34,18 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID;
/**
*
* @author ciaccona007
@ -56,8 +58,10 @@ public class Seedtime extends CardImpl {
// Cast Seedtime only during your turn.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastOnlyDuringYourTurnEffect()));
// Take an extra turn after this one if an opponent cast a blue spell this turn.
this.getSpellAbility().addEffect(new SeedtimeEffect());
this.getSpellAbility().addWatcher(new SpellsCastWatcher());
}
public Seedtime(final Seedtime card) {
@ -128,10 +132,8 @@ class CastOnlyDuringYourTurnEffect extends ContinuousRuleModifyingEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
// has to return true, if the spell cannot be cast in the current phase / step
UUID activePlayerId = game.getActivePlayerId();
if (activePlayerId != null && event.getPlayerId().equals(source.getControllerId())) {
if(source.getControllerId().equals(activePlayerId)) {
if(activePlayerId != null && event.getSourceId().equals(source.getSourceId()) && !event.getPlayerId().equals(activePlayerId)) {
return true;
}
}
return false; // cast not prevented by this effect
}