[JOU] Added 2 cards and made some fixes to JOU cards.

This commit is contained in:
LevelX2 2014-04-16 01:41:41 +02:00
parent 5410e10581
commit fb145b2811
7 changed files with 189 additions and 20 deletions

View file

@ -0,0 +1,66 @@
/*
* 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.sets.journeyintonyx;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author LevelX2
*/
public class DictateOfHeliod extends CardImpl<DictateOfHeliod> {
public DictateOfHeliod(UUID ownerId) {
super(ownerId, 8, "Dictate of Heliod", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
this.expansionSetCode = "JOU";
this.color.setWhite(true);
// Flash
this.addAbility(FlashAbility.getInstance());
// Creatures you control get +2/+2.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2,2,Duration.WhileOnBattlefield)));
}
public DictateOfHeliod(final DictateOfHeliod card) {
super(card);
}
@Override
public DictateOfHeliod copy() {
return new DictateOfHeliod(this);
}
}

View file

@ -27,6 +27,8 @@
*/
package mage.sets.journeyintonyx;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
@ -42,6 +44,7 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.watchers.Watcher;
import mage.watchers.WatcherImpl;
@ -78,8 +81,10 @@ public class EidolonOfRhetoric extends CardImpl<EidolonOfRhetoric> {
class EidolonOfRhetoricWatcher extends WatcherImpl<EidolonOfRhetoricWatcher> {
private final Set<UUID> players = new HashSet<>();
public EidolonOfRhetoricWatcher() {
super("SpellCast", WatcherScope.PLAYER);
super("SpellCast", WatcherScope.GAME);
}
public EidolonOfRhetoricWatcher(final EidolonOfRhetoricWatcher watcher) {
@ -93,20 +98,24 @@ class EidolonOfRhetoricWatcher extends WatcherImpl<EidolonOfRhetoricWatcher> {
@Override
public void watch(GameEvent event, Game game) {
if (condition == true) {//no need to check - condition has already occured
return;
}
if (event.getType() == GameEvent.EventType.SPELL_CAST ) {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && event.getPlayerId().equals(player.getId())) {
condition = true;
}
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null) {
players.add(spell.getControllerId());
}
}
}
@Override
public void reset() {
super.reset();
players.clear();
}
public boolean playerCastSpellThisTurn(UUID playerId) {
return players.contains(playerId);
}
}
class EidolonOfRhetoricEffect extends ReplacementEffectImpl<EidolonOfRhetoricEffect> {
@ -138,8 +147,8 @@ class EidolonOfRhetoricEffect extends ReplacementEffectImpl<EidolonOfRhetoricEff
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
Watcher watcher = game.getState().getWatchers().get("SpellCast", event.getPlayerId());
if (watcher != null && watcher.conditionMet()) {
EidolonOfRhetoricWatcher watcher = (EidolonOfRhetoricWatcher) game.getState().getWatchers().get("SpellCast", event.getPlayerId());
if (watcher != null && watcher.playerCastSpellThisTurn(event.getPlayerId())) {
return true;
}
}

View file

@ -0,0 +1,78 @@
/*
* 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.sets.journeyintonyx;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.EnchantedPredicate;
/**
*
* @author LevelX2
*/
public class GodhunterOctopus extends CardImpl<GodhunterOctopus> {
private static final FilterPermanent filter = new FilterPermanent("an enchantment or an enchanted permanent");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ENCHANTMENT),
new EnchantedPredicate()));
}
public GodhunterOctopus(UUID ownerId) {
super(ownerId, 39, "Godhunter Octopus", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{U}");
this.expansionSetCode = "JOU";
this.subtype.add("Octopus");
this.color.setBlue(true);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Godhunter Octopus can't attack unless defending player controls an enchantment or an enchanted permanent.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(filter)));
}
public GodhunterOctopus(final GodhunterOctopus card) {
super(card);
}
@Override
public GodhunterOctopus copy() {
return new GodhunterOctopus(this);
}
}

View file

@ -33,6 +33,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ScryEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -86,9 +87,11 @@ class InterpretTheSignsEffect extends OneShotEffect<InterpretTheSignsEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card sourceCard = game.getCard(source.getSourceId());
if (controller != null && sourceCard != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.revealCards(sourceCard.getName(), new CardsImpl(card), game);
controller.drawCards(card.getManaCost().convertedManaCost(), game);
}
return true;

View file

@ -28,6 +28,7 @@
package mage.sets.journeyintonyx;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.abilityword.StriveAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -40,6 +41,8 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -48,6 +51,12 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class SetessanTactics extends CardImpl<SetessanTactics> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
static {
filter.add(new AnotherPredicate());
}
public SetessanTactics(UUID ownerId) {
super(ownerId, 140, "Setessan Tactics", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{G}");
this.expansionSetCode = "JOU";
@ -61,7 +70,9 @@ public class SetessanTactics extends CardImpl<SetessanTactics> {
Effect effect = new BoostTargetEffect(1,1, Duration.EndOfTurn);
effect.setText("Until end of turn, any number of target creatures each get +1/+1");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetSourceEffect(), new TapSourceCost()), Duration.EndOfTurn,
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetSourceEffect(), new TapSourceCost());
gainedAbility.addTarget(new TargetCreaturePermanent(filter, true));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(gainedAbility, Duration.EndOfTurn,
"and gain \"T: This creature fights another target creature"));
}

View file

@ -43,7 +43,11 @@ import mage.game.permanent.Permanent;
public abstract class RestrictionEffect<T extends RestrictionEffect<T>> extends ContinuousEffectImpl<T> {
public RestrictionEffect(Duration duration) {
super(duration, Outcome.Detriment);
this(duration, Outcome.Detriment);
}
public RestrictionEffect(Duration duration, Outcome outcome) {
super(duration, outcome);
this.effectType = EffectType.RESTRICTION;
}

View file

@ -31,6 +31,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
@ -43,7 +44,7 @@ import mage.target.Target;
public class CantBeBlockedTargetEffect extends RestrictionEffect<CantBeBlockedTargetEffect> {
public CantBeBlockedTargetEffect(Duration duration) {
super(duration);
super(duration, Outcome.Benefit);
}
public CantBeBlockedTargetEffect(final CantBeBlockedTargetEffect effect) {
@ -52,10 +53,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect<CantBeBlockedTa
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (this.getTargetPointer().getTargets(game, source).contains(permanent.getId())) {
return true;
}
return false;
return this.getTargetPointer().getTargets(game, source).contains(permanent.getId());
}
@Override