mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Merge
This commit is contained in:
commit
dd559d73cb
6 changed files with 225 additions and 7 deletions
69
Mage.Sets/src/mage/sets/magic2012/TurnToFrog.java
Normal file
69
Mage.Sets/src/mage/sets/magic2012/TurnToFrog.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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.magic2012;
|
||||
|
||||
import java.beans.beancontext.BeanContextProxy;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect;
|
||||
import mage.abilities.effects.common.continious.LoseAllAbilitiesTargetEffect;
|
||||
import mage.abilities.effects.common.continious.SetPowerToughnessTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.permanent.token.FrogToken;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class TurnToFrog extends CardImpl<TurnToFrog> {
|
||||
|
||||
public TurnToFrog(UUID ownerId) {
|
||||
super(ownerId, 78, "Turn to Frog", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
this.expansionSetCode = "M12";
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Target creature loses all abilities and becomes a 1/1 blue Frog until end of turn.
|
||||
this.getSpellAbility().addEffect(new LoseAllAbilitiesTargetEffect(Duration.EndOfTurn));
|
||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new FrogToken(), null, Duration.EndOfTurn));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
public TurnToFrog(final TurnToFrog card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TurnToFrog copy() {
|
||||
return new TurnToFrog(this);
|
||||
}
|
||||
}
|
|
@ -303,6 +303,7 @@ public final class Constants {
|
|||
BoostCreature(true),
|
||||
UnboostCreature(false),
|
||||
AddAbility(true),
|
||||
LoseAbility(false),
|
||||
GainLife(true),
|
||||
ExtraTurn(true),
|
||||
BecomeCreature(true),
|
||||
|
|
|
@ -74,13 +74,19 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getCardType().size() > 0)
|
||||
if (token.getCardType().size() > 0) {
|
||||
for (Constants.CardType t : token.getCardType()) {
|
||||
if (!permanent.getCardType().contains(t))
|
||||
if (!permanent.getCardType().contains(t)) {
|
||||
permanent.getCardType().add(t);
|
||||
}
|
||||
}
|
||||
if (token.getSubtype().size() > 0)
|
||||
}
|
||||
if (type == null) {
|
||||
permanent.getSubtype().clear();
|
||||
}
|
||||
if (token.getSubtype().size() > 0) {
|
||||
permanent.getSubtype().addAll(token.getSubtype());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColorChangingEffects_5:
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Layer;
|
||||
import mage.Constants.Outcome;
|
||||
|
@ -72,10 +73,19 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl<BecomesCre
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (token.getCardType().size() > 0)
|
||||
permanent.getCardType().addAll(token.getCardType());
|
||||
if (token.getSubtype().size() > 0)
|
||||
if (token.getCardType().size() > 0) {
|
||||
for (Constants.CardType t : token.getCardType()) {
|
||||
if (!permanent.getCardType().contains(t)) {
|
||||
permanent.getCardType().add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type == null) {
|
||||
permanent.getSubtype().clear();
|
||||
}
|
||||
if (token.getSubtype().size() > 0) {
|
||||
permanent.getSubtype().addAll(token.getSubtype());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColorChangingEffects_5:
|
||||
|
@ -120,7 +130,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl<BecomesCre
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(duration.toString());
|
||||
sb.append(" target ").append(mode.getTargets().get(0).getTargetName()).append(" becomes a ").append(token.getDescription());
|
||||
if (type.length() > 0)
|
||||
if (type != null && type.length() > 0)
|
||||
sb.append(" that's still a ").append(type);
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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.abilities.effects.common.continious;
|
||||
|
||||
import mage.Constants.Duration;
|
||||
import mage.Constants.Layer;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class LoseAllAbilitiesTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
public LoseAllAbilitiesTargetEffect(Duration duration) {
|
||||
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
}
|
||||
|
||||
public LoseAllAbilitiesTargetEffect(final LoseAllAbilitiesTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoseAllAbilitiesTargetEffect copy() {
|
||||
return new LoseAllAbilitiesTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
for (UUID permanentId : source.getTargets().get(0).getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
permanent.getAbilities().clear();
|
||||
affectedTargets++;
|
||||
}
|
||||
}
|
||||
return affectedTargets > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" loses all abilities").append(duration.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
50
Mage/src/mage/game/permanent/token/FrogToken.java
Normal file
50
Mage/src/mage/game/permanent/token/FrogToken.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.game.permanent.token;
|
||||
|
||||
import mage.Constants.CardType;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class FrogToken extends Token {
|
||||
|
||||
public FrogToken() {
|
||||
super("Frog", "1/1 blue Frog creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color = ObjectColor.BLUE;
|
||||
subtype.add("Frog");
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue