This commit is contained in:
Loki 2012-07-05 10:54:38 +12:00
commit 663ec37b96
13 changed files with 520 additions and 109 deletions

View file

@ -86,7 +86,7 @@ public class CombatGroupSimulator implements Serializable {
}
private void assignDamage(boolean first) {
if (blockers.size() == 0) {
if (blockers.isEmpty()) {
if (canDamage(attacker, first))
unblockedDamage += attacker.power;
}

View file

@ -0,0 +1,52 @@
/*
* 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.mirrodin;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class SculptingSteel extends mage.sets.tenth.SculptingSteel {
public SculptingSteel(UUID ownerId) {
super(ownerId);
this.cardNumber = 238;
this.expansionSetCode = "MRD";
}
public SculptingSteel(final SculptingSteel card) {
super(card);
}
@Override
public SculptingSteel copy() {
return new SculptingSteel(this);
}
}

View file

@ -32,7 +32,9 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetBlockingCreature;
import mage.filter.common.FilterBlockedCreature;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
@ -40,6 +42,8 @@ import mage.target.common.TargetBlockingCreature;
*/
public class Smite extends CardImpl<Smite> {
private static final FilterCreaturePermanent filter = new FilterBlockedCreature();
public Smite(UUID ownerId) {
super(ownerId, 43, "Smite", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}");
this.expansionSetCode = "ROE";
@ -47,8 +51,8 @@ public class Smite extends CardImpl<Smite> {
this.color.setWhite(true);
// Destroy target blocked creature.
this.getSpellAbility().addTarget(new TargetBlockingCreature());
this.getSpellAbility().addEffect(new DestroyTargetEffect(false));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.getSpellAbility().addEffect(new DestroyTargetEffect(false));
}
public Smite(final Smite card) {

View file

@ -38,6 +38,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterBlockingCreature;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -47,12 +48,7 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class KithkinShielddare extends CardImpl<KithkinShielddare> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blocking creature");
static {
filter.setBlocking(true);
filter.setUseBlocking(true);
}
private static final FilterCreaturePermanent filter = new FilterBlockingCreature("blocking creature");
public KithkinShielddare(UUID ownerId) {
super(ownerId, 10, "Kithkin Shielddare", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");

View file

@ -0,0 +1,121 @@
/*
* 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.tempest;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author jeffwadsworth
*/
public class AltarOfDementia extends CardImpl<AltarOfDementia> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("creature");
static {
filter.getCardType().add(CardType.CREATURE);
}
public AltarOfDementia(UUID ownerId) {
super(ownerId, 266, "Altar of Dementia", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "TMP";
// Sacrifice a creature: Target player puts a number of cards equal to the sacrificed creature's power from the top of his or her library into his or her graveyard.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new AltarOfDementiaEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
public AltarOfDementia(final AltarOfDementia card) {
super(card);
}
@Override
public AltarOfDementia copy() {
return new AltarOfDementia(this);
}
}
class AltarOfDementiaEffect extends OneShotEffect<AltarOfDementiaEffect> {
public AltarOfDementiaEffect() {
super(Constants.Outcome.Damage);
staticText = "Target player puts a number of cards equal to the sacrificed creature's power from the top of his or her library into his or her graveyard";
}
public AltarOfDementiaEffect(final AltarOfDementiaEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 0;
for (Cost cost: source.getCosts()) {
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) {
amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
break;
}
}
if (amount > 0) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
for (int i = 0; i<amount ; i++) {
if (!player.getLibrary().getCardList().isEmpty()) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false);
}
}
}
return true;
}
}
return false;
}
@Override
public AltarOfDementiaEffect copy() {
return new AltarOfDementiaEffect(this);
}
}

View file

@ -29,12 +29,13 @@ package mage.sets.tempest;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterBlockingCreature;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -44,19 +45,17 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class Gallantry extends CardImpl<Gallantry> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("blocking creature");
static {
filter.setUseBlocking(true);
filter.setBlocking(true);
}
private final static FilterCreaturePermanent filter = new FilterBlockingCreature("blocking creature");
public Gallantry(UUID ownerId) {
super(ownerId, 232, "Gallantry", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{W}");
this.expansionSetCode = "TMP";
this.color.setWhite(true);
this.getSpellAbility().addEffect(new BoostTargetEffect(4, 4, Constants.Duration.EndOfTurn));
// Target blocking creature gets +4/+4 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(4, 4, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
}

View file

@ -33,6 +33,7 @@ import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterBlockingCreature;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -42,12 +43,7 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class Righteousness extends CardImpl<Righteousness> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blocking creature");
static {
filter.setBlocking(true);
filter.setUseBlocking(true);
}
private static final FilterCreaturePermanent filter = new FilterBlockingCreature("blocking creature");
public Righteousness(UUID ownerId) {
super(ownerId, 36, "Righteousness", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{W}");

View 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.tenth;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.common.CopyPermanentEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
/**
*
* @author jeffwadsworth
*/
public class SculptingSteel extends CardImpl<SculptingSteel> {
private static final FilterPermanent filter = new FilterPermanent("artifact");
static {
filter.getCardType().add(CardType.ARTIFACT);
}
public SculptingSteel(UUID ownerId) {
super(ownerId, 342, "Sculpting Steel", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "10E";
// You may have Sculpting Steel enter the battlefield as a copy of any artifact on the battlefield.
Ability ability = new EntersBattlefieldAbility(new EntersBattlefieldEffect(new CopyPermanentEffect(filter)), "You may have {this} enter the battlefield as a copy of any artifact on the battlefield");
this.addAbility(ability);
}
public SculptingSteel(final SculptingSteel card) {
super(card);
}
@Override
public SculptingSteel copy() {
return new SculptingSteel(this);
}
}

View file

@ -0,0 +1,109 @@
/*
* 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.tenth;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author jeffwadsworth
*/
public class SteelGolem extends CardImpl<SteelGolem> {
public SteelGolem(UUID ownerId) {
super(ownerId, 344, "Steel Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.expansionSetCode = "10E";
this.subtype.add("Golem");
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// You can't cast creature spells.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new SteelGolemEffect()));
}
public SteelGolem(final SteelGolem card) {
super(card);
}
@Override
public SteelGolem copy() {
return new SteelGolem(this);
}
}
class SteelGolemEffect extends ReplacementEffectImpl<SteelGolemEffect> {
public SteelGolemEffect() {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Detriment);
staticText = "You can't cast creature spells.";
}
public SteelGolemEffect(final SteelGolemEffect effect) {
super(effect);
}
@Override
public SteelGolemEffect copy() {
return new SteelGolemEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getPlayerId().equals(source.getControllerId())) {
MageObject object = game.getObject(event.getSourceId());
if (object.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.weatherlight;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class SteelGolem extends mage.sets.tenth.SteelGolem {
public SteelGolem(UUID ownerId) {
super(ownerId);
this.cardNumber = 157;
this.expansionSetCode = "WTH";
}
public SteelGolem(final SteelGolem card) {
super(card);
}
@Override
public SteelGolem copy() {
return new SteelGolem(this);
}
}

View file

@ -0,0 +1,71 @@
/*
* 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.filter.common;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class FilterBlockedCreature extends FilterCreaturePermanent<FilterBlockingCreature> {
public FilterBlockedCreature() {
this("blocked creature");
}
public FilterBlockedCreature(String name) {
super(name);
}
public FilterBlockedCreature(final FilterBlockedCreature filter) {
super(filter);
}
@Override
public FilterBlockedCreature copy() {
return new FilterBlockedCreature(this);
}
@Override
public boolean match(Permanent permanent, Game game) {
if (!super.match(permanent, game)) {
return notFilter;
}
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (!combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(permanent.getId())) {
return !notFilter;
}
}
return notFilter;
}
}

View file

@ -43,8 +43,8 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
protected boolean attacking;
protected boolean useBlocking;
protected boolean blocking;
protected boolean useDamageDealt;
protected boolean damageDealt;
protected boolean useDamageDealt;
protected boolean damageDealt;
public FilterCreaturePermanent() {
this("creature");
@ -61,8 +61,8 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
this.attacking = filter.attacking;
this.useBlocking = filter.useBlocking;
this.blocking = filter.blocking;
this.useDamageDealt = filter.useDamageDealt;
this.damageDealt = filter.damageDealt;
this.useDamageDealt = filter.useDamageDealt;
this.damageDealt = filter.damageDealt;
this.useTapped = filter.useTapped;
this.tapped = filter.tapped;
}
@ -85,17 +85,18 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
return notFilter;
}
}
return !notFilter;
}
return !notFilter;
}
if (useBlocking && (permanent.getBlocking() > 0) != blocking)
return notFilter;
if (useDamageDealt) {
// use this instead of getDamage() because damage is reset in case of regeneration
if (permanent.getDealtDamageByThisTurn().isEmpty())
return notFilter;
}
if (useDamageDealt) {
// use this instead of getDamage() because damage is reset in case of regeneration
if (permanent.getDealtDamageByThisTurn().isEmpty()) {
return notFilter;
}
}
return !notFilter;
}
@ -114,21 +115,23 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
public void setBlocking ( boolean blocking ) {
this.blocking = blocking;
}
/**
* Select creatures dependant if they already got damage
* during the current turn. Works also if the creature
* was meanwhile regenerated during the turn.
*
* @param useDamageDealt
*/
public void setUseDamageDealt ( boolean useDamageDealt ) {
/**
* Select creatures dependant if they already got damage during the current turn. Works also if the creature was
* meanwhile regenerated during the turn.
*
* @param useDamageDealt
*/
public void setUseDamageDealt(boolean useDamageDealt) {
this.useDamageDealt = useDamageDealt;
}
/**
* Select creatures that got damage dealt to this turn.
* @param damageDealt
*/
public void setDamageDealt ( boolean damageDealt ) {
/**
* Select creatures that got damage dealt to this turn.
*
* @param damageDealt
*/
public void setDamageDealt(boolean damageDealt) {
this.damageDealt = damageDealt;
}

View file

@ -1,61 +0,0 @@
/*
* 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.target.common;
import mage.filter.common.FilterBlockingCreature;
/**
*
* @author jeff
*/
public class TargetBlockingCreature extends TargetCreaturePermanent<TargetBlockingCreature> {
public TargetBlockingCreature() {
this(1, 1, new FilterBlockingCreature(), false);
}
public TargetBlockingCreature(int numTargets) {
this(numTargets, numTargets, new FilterBlockingCreature(), false);
}
public TargetBlockingCreature(int minNumTargets, int maxNumTargets, FilterBlockingCreature filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
}
public TargetBlockingCreature(final TargetBlockingCreature target) {
super(target);
}
@Override
public TargetBlockingCreature copy() {
return new TargetBlockingCreature(this);
}
}