* Elves vs. Goblins - Added missing cards and exmple decks.

This commit is contained in:
LevelX2 2014-03-01 16:17:49 +01:00
parent 6456e937d6
commit 3cf7fd33ed
70 changed files with 3841 additions and 134 deletions

View file

@ -0,0 +1,93 @@
/*
* 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.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class BecomesBlockedAllTriggeredAbility extends TriggeredAbilityImpl<BecomesBlockedAllTriggeredAbility> {
private FilterCreaturePermanent filter;
private boolean setTargetPointer;
public BecomesBlockedAllTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, new FilterCreaturePermanent("a creature"), false);
}
public BecomesBlockedAllTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter, boolean setTargetPointer) {
super(Zone.BATTLEFIELD, effect, optional);
this.filter = filter;
this.setTargetPointer = setTargetPointer;
}
public BecomesBlockedAllTriggeredAbility(final BecomesBlockedAllTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.setTargetPointer = ability.setTargetPointer;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.CREATURE_BLOCKED) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
if (setTargetPointer) {
for(Effect effect :this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
}
return true;
}
}
return false;
}
@Override
public String getRule() {
StringBuilder sb = new StringBuilder("Whenever ").append(filter.getMessage());
sb.append(" becomes blocked, ").append(super.getRule());
return sb.toString();
}
@Override
public BecomesBlockedAllTriggeredAbility copy() {
return new BecomesBlockedAllTriggeredAbility(this);
}
}

View file

@ -0,0 +1,59 @@
/*
* 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.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class IsStepCondition implements Condition {
protected PhaseStep phaseStep;
public IsStepCondition(PhaseStep phaseStep) {
this.phaseStep = phaseStep;
}
@Override
public boolean apply(Game game, Ability source) {
return game.getActivePlayerId().equals(source.getSourceId()) && game.getStep().getType().equals(phaseStep);
}
@Override
public String toString() {
return new StringBuilder("during your ").append(phaseStep.toString()).toString();
}
}

View file

@ -0,0 +1,79 @@
/*
* 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.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class DiscardHandCost extends CostImpl<DiscardHandCost> {
public DiscardHandCost() {
}
public DiscardHandCost(final DiscardHandCost cost) {
super(cost);
}
@Override
public DiscardHandCost copy() {
return new DiscardHandCost(this);
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return true;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Player player = game.getPlayer(controllerId);
if (player != null) {
for (Card card : player.getHand().getCards(game)) {
player.discard(card, ability, game);
}
paid = true;
}
return paid;
}
@Override
public String getText() {
return "Discard your hand";
}
}

View file

@ -45,7 +45,7 @@ import java.util.UUID;
*/
public class SacrificeTargetCost extends CostImpl<SacrificeTargetCost> {
List<Permanent> permanents = new ArrayList<Permanent>();
List<Permanent> permanents = new ArrayList<>();
public SacrificeTargetCost(TargetControlledPermanent target) {
this.addTarget(target);

View file

@ -28,15 +28,15 @@
package mage.abilities.costs.common;
import mage.constants.Outcome;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledPermanent;
import java.util.List;
import java.util.UUID;
import mage.util.CardUtil;
/**
*
@ -50,7 +50,7 @@ public class TapTargetCost extends CostImpl<TapTargetCost> {
this.target = target;
this.text =
new StringBuilder("Tap ")
.append(target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") ? "":target.getMaxNumberOfTargets())
.append(target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") ? "":CardUtil.numberToText(target.getMaxNumberOfTargets()))
.append(" ")
.append(target.getTargetName()).toString();
}

View file

@ -0,0 +1,74 @@
/*
* 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.dynamicvalue;
import mage.abilities.Ability;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class IntPlusDynamicValue implements DynamicValue {
private final DynamicValue value;
private final int baseValue;
public IntPlusDynamicValue(int baseValue, DynamicValue value) {
this.value = value;
this.baseValue = baseValue;
}
IntPlusDynamicValue(final IntPlusDynamicValue dynamicValue) {
this.value = dynamicValue.value;
this.baseValue = dynamicValue.baseValue;
}
@Override
public int calculate(Game game, Ability sourceAbility) {
return baseValue + value.calculate(game, sourceAbility);
}
@Override
public DynamicValue copy() {
return new IntPlusDynamicValue(this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(baseValue);
sb.append(baseValue).append(" plus ");
return sb.append(value.toString()).toString();
}
@Override
public String getMessage() {
return value.getMessage();
}
}

View file

@ -37,8 +37,8 @@ import mage.game.Game;
*/
public class MultipliedValue implements DynamicValue {
private DynamicValue value;
private int multplier;
private final DynamicValue value;
private final int multplier;
public MultipliedValue(DynamicValue value, int multiplier) {
this.value = value.copy();

View file

@ -0,0 +1,75 @@
/*
* 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.combat;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantBeBlockedByCreaturesAllEffect extends RestrictionEffect<CantBeBlockedByCreaturesAllEffect> {
private final FilterCreaturePermanent filterBlockedBy;
private final FilterCreaturePermanent filterCreatures;
public CantBeBlockedByCreaturesAllEffect(FilterCreaturePermanent filterCreatures, FilterCreaturePermanent filterBlockedBy, Duration duration) {
super(Duration.WhileOnBattlefield);
this.filterCreatures = filterCreatures;
this.filterBlockedBy = filterBlockedBy;
staticText = new StringBuilder(filterCreatures.getMessage()).append(" can't be blocked ")
.append(filterBlockedBy.getMessage().startsWith("except by") ? "":"by ").append(filterBlockedBy.getMessage()).toString();
}
public CantBeBlockedByCreaturesAllEffect(final CantBeBlockedByCreaturesAllEffect effect) {
super(effect);
this.filterCreatures = effect.filterCreatures;
this.filterBlockedBy = effect.filterBlockedBy;
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return filterCreatures.match(permanent, source.getSourceId(), source.getControllerId(), game);
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return !filterBlockedBy.match(blocker, source.getSourceId(), source.getControllerId(), game);
}
@Override
public CantBeBlockedByCreaturesAllEffect copy() {
return new CantBeBlockedByCreaturesAllEffect(this);
}
}

View file

@ -41,12 +41,13 @@ import mage.game.permanent.Permanent;
public class CantBeBlockedByCreaturesSourceEffect extends RestrictionEffect<CantBeBlockedByCreaturesSourceEffect> {
private FilterCreaturePermanent filter;
private final FilterCreaturePermanent filter;
public CantBeBlockedByCreaturesSourceEffect(FilterCreaturePermanent filter, Duration duration) {
super(Duration.WhileOnBattlefield);
this.filter = filter;
staticText = new StringBuilder("{this} can't be blocked by ").append(filter.getMessage()).toString();
staticText = new StringBuilder("{this} can't be blocked ")
.append(filter.getMessage().startsWith("except by") ? "":"by ").append(filter.getMessage()).toString();
}
public CantBeBlockedByCreaturesSourceEffect(final CantBeBlockedByCreaturesSourceEffect effect) {

View file

@ -38,10 +38,11 @@ import mage.game.Game;
*
* @author BetaSteward_at_googlemail.com
* @author North
* @param <E>
*/
public abstract class FilterImpl<E> implements Filter<E> {
protected List<Predicate<Object>> predicates = new ArrayList<Predicate<Object>>();
protected List<Predicate<Object>> predicates = new ArrayList<>();
protected String message;
@Override
@ -53,7 +54,7 @@ public abstract class FilterImpl<E> implements Filter<E> {
public FilterImpl(FilterImpl filter) {
this.message = filter.message;
this.predicates = new ArrayList<Predicate<Object>>(filter.predicates);
this.predicates = new ArrayList<>(filter.predicates);
}
@Override

View file

@ -27,9 +27,9 @@
*/
package mage.game.permanent.token;
import mage.constants.CardType;
import mage.MageInt;
import mage.ObjectColor;
import mage.constants.CardType;
/**
*
@ -38,7 +38,11 @@ import mage.ObjectColor;
public class GoblinToken extends Token {
public GoblinToken() {
this("M10");
}
public GoblinToken(String originalExpansionSetCode) {
super("Goblin", "1/1 red Goblin creature token");
this.setOriginalExpansionSetCode(originalExpansionSetCode);
cardType.add(CardType.CREATURE);
subtype.add("Goblin");