Fixed SacrificeEffect (text and case when available targets < amount)

Removed unnecesarry triggered ability for Bludgeon Brawl
Added missing subtype for Kor Soldier token (Conquerors Pledge)
removed unused import
javadoc fix
This commit is contained in:
North 2011-10-15 00:02:26 +03:00
parent 9fb1312af9
commit 2cfa6927a8
5 changed files with 14 additions and 75 deletions

View file

@ -29,15 +29,16 @@ package mage.sets.innistrad;
import java.util.UUID;
import mage.Constants;
import mage.Constants.AttachmentType;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
/**
@ -51,11 +52,11 @@ public class CobbledWings extends CardImpl<CobbledWings> {
this.expansionSetCode = "ISD";
this.subtype.add("Equipment");
// Equip {1}
this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(1)));
// Equipped creature has flying.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), Constants.AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.EQUIPMENT)));
// Equip {1}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}
public CobbledWings(final CobbledWings card) {

View file

@ -39,19 +39,14 @@ import mage.Constants.SubLayer;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
@ -66,8 +61,8 @@ public class BludgeonBrawl extends CardImpl<BludgeonBrawl> {
this.color.setRed(true);
// Each noncreature, non-Equipment artifact is an Equipment with equip {X} and "Equipped creature gets +X/+0," where X is that artifact's converted mana cost.
this.addAbility(new BludgeonBrawlAbility());
this.addAbility(new BludgeonBrawlTriggeredAbility());
}
public BludgeonBrawl(final BludgeonBrawl card) {
@ -170,58 +165,3 @@ class BludgeonBrawlGainAbilityEffect extends ContinuousEffectImpl<BludgeonBrawlG
return false;
}
}
class BludgeonBrawlTriggeredAbility<T extends BludgeonBrawlTriggeredAbility<T>> extends TriggeredAbilityImpl<T> {
public BludgeonBrawlTriggeredAbility() {
super(Zone.BATTLEFIELD, new BludgeonBrawlExitEffect(), false);
}
public BludgeonBrawlTriggeredAbility(BludgeonBrawlTriggeredAbility ability) {
super(ability);
}
@Override
public T copy() {
return (T) new BludgeonBrawlTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
return true;
}
return false;
}
}
class BludgeonBrawlExitEffect extends OneShotEffect<BludgeonBrawlExitEffect> {
public BludgeonBrawlExitEffect() {
super(Outcome.Neutral);
}
public BludgeonBrawlExitEffect(final BludgeonBrawlExitEffect effect) {
super(effect);
}
@Override
public BludgeonBrawlExitEffect copy() {
return new BludgeonBrawlExitEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game);
for (Permanent permanent : permanents) {
if (permanent != null && permanent.getAttachedTo() != null) {
Permanent other = game.getPermanent(permanent.getAttachedTo());
if (other != null && !other.hasSubtype("Equipment") && !other.hasSubtype("Aura")) {
other.getAttachments().remove(permanent.getId());
}
}
}
return true;
}
}

View file

@ -33,11 +33,9 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.KickerManaCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.game.permanent.token.Token;
@ -74,6 +72,7 @@ class KorSoldierToken extends Token {
super("Kor Soldier", "1/1 white Kor Soldier creature token");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Kor");
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);

View file

@ -75,11 +75,12 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
Player player = game.getPlayer(targetPointer.getFirst(source));
filter.setTargetController(TargetController.YOU);
int amount = count.calculate(game, source);
amount = Math.min(amount, game.getBattlefield().countAll(filter, source.getControllerId()));
Target target = new TargetControlledPermanent(amount, amount, filter, false);
//A spell or ability could have removed the only legal target this player
//had, if thats the case this ability should fizzle.
if (target.canChoose(player.getId(), game)) {
if (amount > 0 && target.canChoose(player.getId(), game)) {
boolean abilityApplied = false;
while (!target.isChosen() && target.canChoose(player.getId(), game)) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
@ -109,9 +110,7 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(preText)
.append(" sacrifices ")
.append(filter.getMessage());
sb.append(preText).append(" sacrifices ").append(count).append(" ").append(filter.getMessage());
staticText = sb.toString();
}
}

View file

@ -159,7 +159,7 @@ public class Battlefield implements Serializable {
}
/**
* Returns true if the battlefield contains num {@link Permanent}
* Returns true if the battlefield contains num or more {@link Permanent}
* that matches the filter and is controlled by controllerId.
* This method ignores the range of influence.
*
@ -180,7 +180,7 @@ public class Battlefield implements Serializable {
}
/**
* Returns true if the battlefield contains num {@link Permanent}
* Returns true if the battlefield contains num or more {@link Permanent}
* that is within the range of influence of the specified player id
* and that matches the supplied filter.
*