more fixes

This commit is contained in:
BetaSteward 2010-11-13 04:41:30 +00:00
parent c61881e5df
commit 58c4ae1f38
12 changed files with 43 additions and 29 deletions

View file

@ -1,16 +1,16 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
@ -85,7 +85,7 @@ class BloodhallOozeTriggeredAbility1 extends TriggeredAbilityImpl<BloodhallOozeT
} }
public BloodhallOozeTriggeredAbility1() { public BloodhallOozeTriggeredAbility1() {
super(Zone.BATTLEFIELD, new AddPlusOneCountersSourceEffect(1)); super(Zone.BATTLEFIELD, new AddPlusOneCountersSourceEffect(1), true);
} }
public BloodhallOozeTriggeredAbility1(final BloodhallOozeTriggeredAbility1 ability) { public BloodhallOozeTriggeredAbility1(final BloodhallOozeTriggeredAbility1 ability) {
@ -127,7 +127,7 @@ class BloodhallOozeTriggeredAbility2 extends TriggeredAbilityImpl<BloodhallOozeT
} }
public BloodhallOozeTriggeredAbility2() { public BloodhallOozeTriggeredAbility2() {
super(Zone.BATTLEFIELD, new AddPlusOneCountersSourceEffect(1)); super(Zone.BATTLEFIELD, new AddPlusOneCountersSourceEffect(1), true);
} }
public BloodhallOozeTriggeredAbility2(final BloodhallOozeTriggeredAbility2 ability) { public BloodhallOozeTriggeredAbility2(final BloodhallOozeTriggeredAbility2 ability) {

View file

@ -41,7 +41,7 @@ import mage.filter.FilterPermanent;
*/ */
public class BackToNature extends CardImpl<BackToNature> { public class BackToNature extends CardImpl<BackToNature> {
private static FilterPermanent filter = new FilterPermanent(); private static FilterPermanent filter = new FilterPermanent("enchantments");
static { static {
filter.getCardType().add(CardType.ENCHANTMENT); filter.getCardType().add(CardType.ENCHANTMENT);

View file

@ -92,4 +92,9 @@ class BloodTitheEffect extends OneShotEffect<BloodTitheEffect> {
return new BloodTitheEffect(this); return new BloodTitheEffect(this);
} }
@Override
public String getText(Ability source) {
return "Each opponent loses 3 life. You gain life equal to the life lost this way";
}
} }

View file

@ -132,8 +132,8 @@ class BloodcrazedGoblinEffect extends ReplacementEffectImpl<BloodcrazedGoblinEff
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) { if (event.getType() == EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
Watcher watcher = game.getState().getWatchers().get(source.getControllerId(), "OpponentDamaged"); Watcher watcher = game.getState().getWatchers().get(source.getControllerId(), "OpponentDamaged");
if (watcher != null && watcher.conditionMet()) if (watcher != null)
return true; return !watcher.conditionMet();
} }
return false; return false;
} }

View file

@ -54,7 +54,7 @@ public class CallToMind extends CardImpl<CallToMind> {
} }
public CallToMind(UUID ownerId) { public CallToMind(UUID ownerId) {
super(ownerId, 47, "CallToMind", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{U}"); super(ownerId, 47, "Call to Mind", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{U}");
this.expansionSetCode = "M11"; this.expansionSetCode = "M11";
this.color.setBlue(true); this.color.setBlue(true);

View file

@ -61,7 +61,7 @@ import mage.target.common.TargetCreaturePermanent;
public class CaptivatingVampire extends CardImpl<CaptivatingVampire> { public class CaptivatingVampire extends CardImpl<CaptivatingVampire> {
private static FilterCreaturePermanent filter1 = new FilterCreaturePermanent("Vampire creatures"); private static FilterCreaturePermanent filter1 = new FilterCreaturePermanent("Vampire creatures");
private static FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("five untapped Vampires"); private static FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped Vampire");
static { static {
filter1.getSubtype().add("Vampire"); filter1.getSubtype().add("Vampire");

View file

@ -29,7 +29,6 @@
package mage.abilities.costs.common; package mage.abilities.costs.common;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost; import mage.abilities.costs.VariableCost;
import mage.game.Game; import mage.game.Game;
@ -45,7 +44,7 @@ public class PayVariableLoyaltyCost extends CostImpl<PayVariableLoyaltyCost> imp
protected int amountPaid = 0; protected int amountPaid = 0;
public PayVariableLoyaltyCost() { public PayVariableLoyaltyCost() {
this.text = "X loyalty"; this.text = "-X loyalty";
} }
public PayVariableLoyaltyCost(final PayVariableLoyaltyCost cost) { public PayVariableLoyaltyCost(final PayVariableLoyaltyCost cost) {

View file

@ -28,6 +28,7 @@
package mage.abilities.costs.common; package mage.abilities.costs.common;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.Constants.Outcome; import mage.Constants.Outcome;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
@ -41,19 +42,22 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class TapTargetCost extends CostImpl<TapTargetCost> { public class TapTargetCost extends CostImpl<TapTargetCost> {
TargetControlledPermanent target;
public TapTargetCost(TargetControlledPermanent target) { public TapTargetCost(TargetControlledPermanent target) {
this.addTarget(target); this.target = target;
this.text = "tap " + target.getTargetName() + " you control"; this.text = "tap " + target.getMaxNumberOfTargets() + " " + target.getTargetName() + " you control";
} }
public TapTargetCost(final TapTargetCost cost) { public TapTargetCost(final TapTargetCost cost) {
super(cost); super(cost);
this.target = cost.target.copy();
} }
@Override @Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) { public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
if (targets.choose(Outcome.Tap, controllerId, game)) { if (target.choose(Outcome.Tap, controllerId, game)) {
for (UUID targetId: targets.get(0).getTargets()) { for (UUID targetId: (List<UUID>)target.getTargets()) {
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);
if (permanent == null) if (permanent == null)
return false; return false;
@ -65,7 +69,7 @@ public class TapTargetCost extends CostImpl<TapTargetCost> {
@Override @Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) { public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return targets.canChoose(controllerId, controllerId, game); return target.canChoose(controllerId, controllerId, game);
} }
@Override @Override

View file

@ -94,7 +94,7 @@ public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTarget
if (filterSource == null) if (filterSource == null)
return true; return true;
else { else {
StackObject sourceObject = game.getStack().getStackObject(source.getSourceId()); StackObject sourceObject = game.getStack().getStackObject(event.getSourceId());
if (sourceObject != null && filterSource.match(sourceObject)) { if (sourceObject != null && filterSource.match(sourceObject)) {
return true; return true;
} }

View file

@ -358,11 +358,14 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
@Override @Override
public boolean addAttachment(UUID permanentId, Game game) { public boolean addAttachment(UUID permanentId, Game game) {
if (!this.attachments.contains(permanentId)) { if (!this.attachments.contains(permanentId)) {
if (!game.replaceEvent(new GameEvent(GameEvent.EventType.ATTACH, objectId, permanentId, controllerId, damage))) { if (!game.replaceEvent(new GameEvent(GameEvent.EventType.ATTACH, objectId, permanentId, controllerId))) {
this.attachments.add(permanentId); this.attachments.add(permanentId);
game.getPermanent(permanentId).attachTo(objectId); Permanent attachment = game.getPermanent(permanentId);
game.fireEvent(new GameEvent(GameEvent.EventType.ATTACHED, objectId, permanentId, controllerId, damage)); if (attachment != null) {
return true; attachment.attachTo(objectId);
game.fireEvent(new GameEvent(GameEvent.EventType.ATTACHED, objectId, permanentId, controllerId));
return true;
}
} }
} }
return false; return false;
@ -371,10 +374,13 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
@Override @Override
public boolean removeAttachment(UUID permanentId, Game game) { public boolean removeAttachment(UUID permanentId, Game game) {
if (this.attachments.contains(permanentId)) { if (this.attachments.contains(permanentId)) {
if (!game.replaceEvent(new GameEvent(GameEvent.EventType.UNATTACH, objectId, permanentId, controllerId, damage))) { if (!game.replaceEvent(new GameEvent(GameEvent.EventType.UNATTACH, objectId, permanentId, controllerId))) {
this.attachments.remove(permanentId); this.attachments.remove(permanentId);
game.getPermanent(permanentId).attachTo(null); Permanent attachment = game.getPermanent(permanentId);
game.fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, objectId, permanentId, controllerId, damage)); if (attachment != null) {
attachment.attachTo(null);
}
game.fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, objectId, permanentId, controllerId));
return true; return true;
} }
} }

View file

@ -45,7 +45,7 @@ public class TargetControlledCreaturePermanent extends TargetControlledPermanent
} }
public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets, FilterControlledCreaturePermanent filter, boolean notTarget) { public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets, FilterControlledCreaturePermanent filter, boolean notTarget) {
super(1, 1, filter, notTarget); super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage(); this.targetName = filter.getMessage();
} }

View file

@ -50,7 +50,7 @@ public class TargetControlledPermanent<T extends TargetControlledPermanent<T>> e
} }
public TargetControlledPermanent(int minNumTargets, int maxNumTargets, FilterControlledPermanent filter, boolean notTarget) { public TargetControlledPermanent(int minNumTargets, int maxNumTargets, FilterControlledPermanent filter, boolean notTarget) {
super(1, 1, filter, notTarget); super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage(); this.targetName = filter.getMessage();
} }