Some minor formatting and some changes to framework classes.

This commit is contained in:
LevelX2 2013-11-03 20:59:52 +01:00
parent 47e8bd24cc
commit 53d2098f74
9 changed files with 84 additions and 47 deletions

View file

@ -29,20 +29,13 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.ConditionalMana;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.mana.AnyColorManaAbility;
import mage.abilities.mana.ConditionalAnyColorManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.abilities.mana.conditional.CreatureCastManaCondition;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
/**
*

View file

@ -47,7 +47,6 @@ import mage.target.common.TargetCardInYourGraveyard;
public class CarrionThrash extends CardImpl<CarrionThrash> {
private static final FilterCreatureCard filter = new FilterCreatureCard("another creature card from your graveyard");
static {
filter.add(new AnotherPredicate());
}

View file

@ -27,6 +27,10 @@
*/
package mage;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.mana.conditional.ManaCondition;
@ -34,10 +38,6 @@ import mage.filter.Filter;
import mage.filter.FilterMana;
import mage.game.Game;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author nantuko
@ -85,7 +85,7 @@ public class ConditionalMana extends Mana implements Serializable {
}
public boolean apply(Ability ability, Game game, UUID manaProducerId) {
if (conditions.size() == 0) {
if (conditions.isEmpty()) {
throw new IllegalStateException("Conditional mana should contain at least one Condition");
}
for (Condition condition : conditions) {
@ -125,12 +125,24 @@ public class ConditionalMana extends Mana implements Serializable {
if (filter == null) {
return;
}
if (filter.isBlack()) black = 0;
if (filter.isBlue()) blue = 0;
if (filter.isWhite()) white = 0;
if (filter.isGreen()) green = 0;
if (filter.isRed()) red = 0;
if (filter.isColorless()) colorless = 0;
if (filter.isBlack()) {
black = 0;
}
if (filter.isBlue()) {
blue = 0;
}
if (filter.isWhite()) {
white = 0;
}
if (filter.isGreen()) {
green = 0;
}
if (filter.isRed()) {
red = 0;
}
if (filter.isColorless()) {
colorless = 0;
}
}
public UUID getManaProducerId() {

View file

@ -60,8 +60,9 @@ public class ConditionalManaEffect extends ManaEffect {
public ConditionalManaEffect(ConditionalManaEffect effect) {
super(effect);
this.effect = (ManaEffect) effect.effect.copy();
if (effect.otherwiseEffect != null)
if (effect.otherwiseEffect != null) {
this.otherwiseEffect = (ManaEffect) effect.otherwiseEffect.copy();
}
this.condition = effect.condition;
}

View file

@ -12,9 +12,12 @@ import mage.game.permanent.token.Token;
/**
* @author Loki
*/
public class CreateTokenTargetEffect extends OneShotEffect<CreateTokenTargetEffect> {
private Token token;
private DynamicValue amount;
private boolean tapped;
private boolean attacking;
public CreateTokenTargetEffect(Token token) {
this(token, new StaticValue(1));
@ -25,15 +28,23 @@ public class CreateTokenTargetEffect extends OneShotEffect<CreateTokenTargetEffe
}
public CreateTokenTargetEffect(Token token, DynamicValue amount) {
this(token, amount, false, false);
}
public CreateTokenTargetEffect(Token token, DynamicValue amount, boolean tapped, boolean attacking) {
super(Outcome.PutCreatureInPlay);
this.token = token;
this.amount = amount.copy();
this.tapped = tapped;
this.attacking = attacking;
}
public CreateTokenTargetEffect(final CreateTokenTargetEffect effect) {
super(effect);
this.amount = effect.amount;
this.token = effect.token.copy();
this.tapped = effect.tapped;
this.attacking = effect.attacking;
}
@Override
@ -57,6 +68,15 @@ public class CreateTokenTargetEffect extends OneShotEffect<CreateTokenTargetEffe
sb.append(amount.toString());
}
sb.append(" ").append(token.getDescription()).append(" onto the battlefield");
if (tapped) {
sb.append(" tapped");
}
if (attacking) {
if (tapped) {
sb.append(" and");
}
sb.append(" attacking");
}
String message = amount.getMessage();
if (message.length() > 0) {
sb.append(" for each ");

View file

@ -54,7 +54,6 @@ public class GainLifeTargetEffect extends OneShotEffect<GainLifeTargetEffect> {
public GainLifeTargetEffect(DynamicValue life) {
super(Outcome.GainLife);
this.life = life;
setText();
}
public GainLifeTargetEffect(final GainLifeTargetEffect effect) {
@ -80,6 +79,9 @@ public class GainLifeTargetEffect extends OneShotEffect<GainLifeTargetEffect> {
@Override
public String getText(Mode mode) {
if (!staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
String message = life.getMessage();
@ -100,20 +102,4 @@ public class GainLifeTargetEffect extends OneShotEffect<GainLifeTargetEffect> {
return sb.toString();
}
private void setText() {
StringBuilder sb = new StringBuilder();
String message = life.getMessage();
sb.append("target players each gain ");
if (message.isEmpty() || !message.equals("1")) {
sb.append(life).append(" ");
}
sb.append("life");
if (message.length() > 0) {
sb.append(message.equals("1") ? " equal to the number of " : " for each ");
sb.append(message);
}
staticText = sb.toString();
}
}

View file

@ -28,9 +28,13 @@
package mage.abilities.effects.common.continious;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
@ -43,10 +47,16 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl<BecomesC
protected Token token;
protected String type;
protected boolean loseOther; // loses all other abilities, card types, and creature types
public BecomesCreatureAttachedEffect(Token token, String text, Duration duration) {
this(token, text, duration, false);
}
public BecomesCreatureAttachedEffect(Token token, String text, Duration duration, boolean loseOther) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.BecomeCreature);
this.token = token;
this.loseOther = loseOther;
staticText = text;
}
@ -54,6 +64,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl<BecomesC
super(effect);
this.token = effect.token.copy();
this.type = effect.type;
this.loseOther = effect.loseOther;
}
@Override
@ -77,6 +88,10 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl<BecomesC
}
}
}
// card type
if (loseOther) {
permanent.getCardType().clear();
}
if (token.getCardType().size() > 0) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
@ -84,6 +99,10 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl<BecomesC
}
}
}
// sub type
if (loseOther) {
permanent.getSubtype().clear();
}
if (token.getSubtype().size() > 0) {
for (String t : token.getSubtype()) {
if (!permanent.getSubtype().contains(t)) {
@ -95,6 +114,13 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl<BecomesC
break;
case ColorChangingEffects_5:
if (sublayer == SubLayer.NA) {
if (loseOther) {
permanent.getColor().setBlack(false);
permanent.getColor().setGreen(false);
permanent.getColor().setBlue(false);
permanent.getColor().setWhite(false);
permanent.getColor().setRed(false);
}
if (token.getColor().hasColor()) {
permanent.getColor().setColor(token.getColor());
}
@ -102,21 +128,20 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl<BecomesC
break;
case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) {
if (loseOther) {
permanent.removeAllAbilities(source.getSourceId(), game);
}
if (token.getAbilities().size() > 0) {
for (Ability ability: token.getAbilities()) {
permanent.addAbility(ability, game);
permanent.addAbility(ability, source.getSourceId(), game);
}
}
}
break;
case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) {
int power = token.getPower().getValue();
int toughness = token.getToughness().getValue();
if (power != 0 && toughness != 0) {
permanent.getPower().setValue(power);
permanent.getToughness().setValue(toughness);
}
permanent.getPower().setValue(token.getPower().getValue());
permanent.getToughness().setValue(token.getToughness().getValue());
}
}
}

View file

@ -93,7 +93,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect<SearchLibraryPutI
for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId(), tapped);
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId(), tapped);
}
}
}

View file

@ -16,7 +16,8 @@ git log 7ba3d451da95183b8c1cfb732b332f640963cc4a..HEAD --diff-filter=A --name-st
git log 68333a2eff6b643b2028d18dad16d1f228be7a2c..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
20130901
git log 10902581140fe4268fc12408f099ad82347d7cd0..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
since 1.1.0-release:
git log d6c1075125e657d4dd2e7bb120e108bb4c4536ff..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
3. Copy added_cards.txt to trunk\Utils folder
4. Run script: