mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Merge origin/master
This commit is contained in:
commit
d0f92ef64b
16 changed files with 248 additions and 148 deletions
|
@ -73,9 +73,9 @@ public class HistoricalStandard extends Constructed {
|
|||
// 18th Standard
|
||||
{"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
|
||||
// 19th Standard
|
||||
{"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "PLC", "FUT"},
|
||||
{"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
|
||||
// 20th Standard
|
||||
{"10E", "CSP", "TSP", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
|
||||
{"10E", "CSP", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
|
||||
// 21st Standard
|
||||
{"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
|
||||
};
|
||||
|
|
|
@ -49,9 +49,9 @@ public class SuperStandard extends Constructed {
|
|||
// 18th Standard
|
||||
{"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
|
||||
// 19th Standard
|
||||
{"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "PLC", "FUT"},
|
||||
{"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
|
||||
// 20th Standard
|
||||
{"10E", "CSP", "TSP", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
|
||||
{"10E", "CSP", "TSP", "TSB", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
|
||||
// 21st Standard
|
||||
{"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
|
||||
};
|
||||
|
|
|
@ -155,7 +155,7 @@ class AddCounterAbility extends TriggeredAbilityImpl {
|
|||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
filter.add(new SubtypePredicate(subtype));
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && filter.match(spell, controllerId, game)) {
|
||||
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,6 @@ class AddCounterAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class BoostCreatureEffectEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
@ -194,7 +193,7 @@ class BoostCreatureEffectEffect extends ContinuousEffectImpl {
|
|||
if (permanent != null) {
|
||||
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
|
||||
if (subtype != null) {
|
||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (perm.hasSubtype(subtype)) {
|
||||
int boost = permanent.getCounters().getCount(CounterType.CHARGE);
|
||||
perm.addPower(boost);
|
||||
|
|
|
@ -112,7 +112,7 @@ class PyromancersGogglesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getData().equals(abilityOriginalId)) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && filter.match(spell, getControllerId(), game)) {
|
||||
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class OpalineSliverTriggeredAbility extends TriggeredAbilityImpl {
|
|||
} else {
|
||||
return event.getTargetId().equals(this.getSourceId())
|
||||
&& game.getOpponents(this.controllerId).contains(event.getPlayerId())
|
||||
&& spellCard.match(spell, event.getPlayerId(), game);
|
||||
&& spellCard.match(spell, getSourceId(), getControllerId(), game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
115
Mage.Sets/src/mage/sets/torment/HydromorphGuardian.java
Normal file
115
Mage.Sets/src/mage/sets/torment/HydromorphGuardian.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* 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.torment;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.common.CounterTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetSpell;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TaVSt
|
||||
*/
|
||||
public class HydromorphGuardian extends CardImpl {
|
||||
|
||||
private final static FilterSpell filter = new FilterSpell("spell that targets one or more creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(new HydromorphGuardianPredicate());
|
||||
}
|
||||
|
||||
public HydromorphGuardian(UUID ownerId) {
|
||||
super(ownerId, 39, "Hydromorph Guardian", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
|
||||
this.expansionSetCode = "TOR";
|
||||
this.subtype.add("Elemental");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// {U}, Sacrifice Hydromorph Guardian: Counter target spell that targets one or more creatures you control.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ColoredManaCost(ColoredManaSymbol.U));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetSpell(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public HydromorphGuardian(final HydromorphGuardian card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HydromorphGuardian copy() {
|
||||
return new HydromorphGuardian(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HydromorphGuardianPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
|
||||
Spell spell = game.getStack().getSpell(input.getObject().getId());
|
||||
if (spell != null) {
|
||||
for (UUID modeId : spell.getSpellAbility().getModes().getSelectedModes()) {
|
||||
Mode mode = spell.getSpellAbility().getModes().get(modeId);
|
||||
for (Target target : mode.getTargets()) {
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent.getCardType().contains(CardType.CREATURE)
|
||||
&& permanent.getControllerId().equals(input.getPlayerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "that targets one or more creatures you control";
|
||||
}
|
||||
}
|
|
@ -28,16 +28,11 @@
|
|||
package mage.sets.urzassaga;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SpellCastAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.discard.DiscardTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -53,7 +48,6 @@ public class Oppression extends CardImpl {
|
|||
super(ownerId, 143, "Oppression", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}");
|
||||
this.expansionSetCode = "USG";
|
||||
|
||||
|
||||
// Whenever a player casts a spell, that player discards a card.
|
||||
this.addAbility(new OppressionTriggeredAbility());
|
||||
}
|
||||
|
@ -82,7 +76,7 @@ class OppressionTriggeredAbility extends SpellCastAllTriggeredAbility {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && filter.match(spell, getControllerId(), game)) {
|
||||
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
|
@ -94,4 +88,4 @@ class OppressionTriggeredAbility extends SpellCastAllTriggeredAbility {
|
|||
public OppressionTriggeredAbility copy() {
|
||||
return new OppressionTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ public class Desertion extends CardImpl {
|
|||
super(ownerId, 30, "Desertion", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{U}{U}");
|
||||
this.expansionSetCode = "VIS";
|
||||
|
||||
|
||||
// Counter target spell. If an artifact or creature spell is countered this way, put that card onto the battlefield under your control instead of into its owner's graveyard.
|
||||
this.getSpellAbility().addEffect(new DesertionEffect());
|
||||
this.getSpellAbility().addTarget(new TargetSpell());
|
||||
|
@ -81,7 +80,7 @@ class DesertionEffect extends OneShotEffect {
|
|||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE)));
|
||||
}
|
||||
|
||||
|
||||
public DesertionEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "Counter target spell. If an artifact or creature spell is countered this way, put that card onto the battlefield under your control instead of into its owner's graveyard.";
|
||||
|
@ -106,7 +105,7 @@ class DesertionEffect extends OneShotEffect {
|
|||
if (stackObject instanceof Spell) {
|
||||
game.rememberLKI(objectId, Zone.STACK, (Spell) stackObject);
|
||||
game.getStack().remove(stackObject);
|
||||
if (!((Spell) stackObject).isCopiedSpell() && filter.match(stackObject, source.getControllerId(), game)) {
|
||||
if (!((Spell) stackObject).isCopiedSpell() && filter.match(stackObject, source.getSourceId(), source.getControllerId(), game)) {
|
||||
MageObject card = game.getObject(stackObject.getSourceId());
|
||||
if (card instanceof Card) {
|
||||
((Card) card).putOntoBattlefield(game, Zone.STACK, source.getSourceId(), source.getControllerId());
|
||||
|
@ -120,5 +119,5 @@ class DesertionEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -86,10 +86,10 @@ public class SpellCastAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && filter.match(spell, getControllerId(), game)) {
|
||||
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
|
||||
if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
switch(setTargetPointer) {
|
||||
switch (setTargetPointer) {
|
||||
case SPELL:
|
||||
effect.setTargetPointer(new FixedTarget(spell.getId()));
|
||||
break;
|
||||
|
|
|
@ -47,7 +47,8 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
protected String rule;
|
||||
|
||||
/**
|
||||
* If true, the source that triggered the ability will be set as target to effect.
|
||||
* If true, the source that triggered the ability will be set as target to
|
||||
* effect.
|
||||
*/
|
||||
protected boolean rememberSource = false;
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public SpellCastControllerTriggeredAbility(Effect effect, FilterSpell filter, boolean optional) {
|
||||
this(effect, filter, optional, false);
|
||||
}
|
||||
|
||||
|
||||
public SpellCastControllerTriggeredAbility(Effect effect, FilterSpell filter, boolean optional, String rule) {
|
||||
this(effect, filter, optional, false);
|
||||
this.rule = rule;
|
||||
|
@ -90,7 +91,7 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && filter.match(spell, getControllerId(), game)) {
|
||||
if (spell != null && filter.match(spell, getSourceId(), getControllerId(), game)) {
|
||||
if (rememberSource) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
|
||||
}
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
* 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;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -89,7 +88,7 @@ public class CantBeCounteredControlledEffect extends ContinuousRuleModifyingEffe
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.getControllerId().equals(source.getControllerId())
|
||||
&& filterTarget.match(spell, source.getControllerId(), game)) {
|
||||
&& filterTarget.match(spell, source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (filterSource == null) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -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,12 +20,11 @@
|
|||
* 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;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -60,7 +59,6 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
setText();
|
||||
}
|
||||
|
||||
|
||||
public CantBeTargetedAllEffect(final CantBeTargetedAllEffect effect) {
|
||||
super(effect);
|
||||
if (effect.filterTarget != null) {
|
||||
|
@ -92,10 +90,9 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
if (permanent != null && filterTarget.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||
if (filterSource == null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
StackObject sourceObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (sourceObject != null && filterSource.match(sourceObject, sourceObject.getSourceId(), game)) {
|
||||
if (sourceObject != null && filterSource.match(sourceObject, source.getSourceId(), sourceObject.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -108,8 +105,7 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
sb.append(filterTarget.getMessage()).append(" can't be the targets of ");
|
||||
if (filterSource != null) {
|
||||
sb.append(filterSource.getMessage());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sb.append("spells");
|
||||
}
|
||||
if (!duration.toString().isEmpty()) {
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
* 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;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -50,13 +49,13 @@ public class FilterSpell extends FilterStackObject {
|
|||
public FilterSpell(final FilterSpell filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean match(StackObject stackObject, UUID playerId, Game game) {
|
||||
public boolean match(StackObject stackObject, UUID sourceId, UUID playerId, Game game) {
|
||||
if (!(stackObject instanceof Spell)) {
|
||||
return false;
|
||||
}
|
||||
return super.match(stackObject, playerId, game);
|
||||
return super.match(stackObject, sourceId, playerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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,12 +20,11 @@
|
|||
* 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -33,6 +32,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -59,12 +59,12 @@ public class FilterStackObject extends FilterObject<StackObject> {
|
|||
this.extraPredicates = new ArrayList<>(filter.extraPredicates);
|
||||
}
|
||||
|
||||
public boolean match(StackObject stackObject, UUID playerId, Game game) {
|
||||
public boolean match(StackObject stackObject, UUID sourceId, UUID playerId, Game game) {
|
||||
if (!this.match(stackObject, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Predicates.and(extraPredicates).apply(new ObjectPlayer(stackObject, playerId), game);
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(stackObject, sourceId, playerId), game);
|
||||
}
|
||||
|
||||
public void add(ObjectPlayerPredicate predicate) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
*
|
||||
*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
|
@ -25,10 +25,11 @@
|
|||
* 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 java.util.UUID;
|
||||
import mage.filter.FilterImpl;
|
||||
import mage.filter.FilterInPlay;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
@ -37,8 +38,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX
|
||||
|
@ -77,7 +76,7 @@ public class FilterSpellOrPermanent extends FilterImpl<Object> implements Filter
|
|||
@Override
|
||||
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) {
|
||||
if (o instanceof Spell) {
|
||||
return spellFilter.match((Spell) o, playerId, game);
|
||||
return spellFilter.match((Spell) o, sourceId, playerId, game);
|
||||
} else if (o instanceof Permanent) {
|
||||
return permanentFilter.match((Permanent) o, sourceId, playerId, game);
|
||||
}
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
* 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;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
@ -84,7 +83,7 @@ public class TargetSpell extends TargetObject {
|
|||
}
|
||||
Spell spell = game.getStack().getSpell(id);
|
||||
if (spell != null) {
|
||||
return filter.match(spell, source.getControllerId(), game);
|
||||
return filter.match(spell, source.getSourceId(), source.getControllerId(), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -92,12 +91,12 @@ public class TargetSpell extends TargetObject {
|
|||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
int count = 0;
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
// rule 114.4. A spell or ability on the stack is an illegal target for itself.
|
||||
if (sourceId != null && sourceId.equals(stackObject.getSourceId())) {
|
||||
continue;
|
||||
}
|
||||
if (canBeChosen(stackObject, sourceControllerId, game)) {
|
||||
if (canBeChosen(stackObject, sourceId, sourceControllerId, game)) {
|
||||
count++;
|
||||
if (count >= this.minNumberOfTargets) {
|
||||
return true;
|
||||
|
@ -114,28 +113,28 @@ public class TargetSpell extends TargetObject {
|
|||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
return possibleTargets(sourceControllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
if (canBeChosen(stackObject, sourceControllerId, game)) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
if (canBeChosen(stackObject, sourceId, sourceControllerId, game)) {
|
||||
possibleTargets.add(stackObject.getId());
|
||||
}
|
||||
}
|
||||
return possibleTargets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||
return this.possibleTargets(null, sourceControllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetSpell copy() {
|
||||
return new TargetSpell(this);
|
||||
}
|
||||
|
||||
private boolean canBeChosen(StackObject stackObject, UUID sourceControllerId, Game game) {
|
||||
private boolean canBeChosen(StackObject stackObject, UUID sourceID, UUID sourceControllerId, Game game) {
|
||||
return stackObject instanceof Spell
|
||||
&& game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId())
|
||||
&& filter.match((Spell) stackObject, sourceControllerId, game);
|
||||
&& filter.match((Spell) stackObject, sourceID, sourceControllerId, game);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue