Implement cards: Opal Archangel, Opal Caryatid, Opal Champion, Opal Gargoyle, and Opal Guardian

This commit is contained in:
LoneFox 2015-06-22 20:08:31 +03:00
parent 35241d7805
commit 6ea6cc6656
7 changed files with 451 additions and 10 deletions

View file

@ -29,7 +29,7 @@ package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -41,9 +41,9 @@ import mage.game.permanent.Permanent;
*/
public class SourceMatchesFilterCondition implements Condition {
private FilterCreaturePermanent filter;
private FilterPermanent filter;
public SourceMatchesFilterCondition(FilterCreaturePermanent filter) {
public SourceMatchesFilterCondition(FilterPermanent filter) {
this.filter = filter;
}

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,7 +20,7 @@
* 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.
@ -49,25 +49,32 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
protected Token token;
protected String type;
protected boolean losePreviousTypes;
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
public BecomesCreatureSourceEffect(Token token, String type, Duration duration, boolean losePreviousTypes) {
super(duration, Outcome.BecomeCreature);
this.token = token;
this.type = type;
this.losePreviousTypes = losePreviousTypes;
setText();
}
public BecomesCreatureSourceEffect(Token token, String type, Duration duration) {
this(token, type, duration, false);
}
public BecomesCreatureSourceEffect(final BecomesCreatureSourceEffect effect) {
super(effect);
this.token = effect.token.copy();
this.type = effect.type;
this.losePreviousTypes = effect.losePreviousTypes;
}
@Override
public BecomesCreatureSourceEffect copy() {
return new BecomesCreatureSourceEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
@ -88,6 +95,9 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (losePreviousTypes) {
permanent.getCardType().clear();
}
if (token.getCardType().size() > 0) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {