Small changes and fixes

This commit is contained in:
North 2012-09-03 20:44:56 +03:00
parent 0e632acbb1
commit 9c779595b3
8 changed files with 52 additions and 37 deletions

View file

@ -49,7 +49,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author anonymous
* @author Loki
*/
public class SkeletalVampire extends CardImpl<SkeletalVampire> {
@ -87,7 +87,7 @@ public class SkeletalVampire extends CardImpl<SkeletalVampire> {
class BatToken extends Token {
BatToken() {
super("Bat", "1/1 black Bat creature tokens with flying");
super("Bat", "1/1 black Bat creature token with flying");
cardType.add(CardType.CREATURE);
color = ObjectColor.BLACK;
subtype.add("Bat");

View file

@ -112,19 +112,19 @@ class VengefulArchonEffect extends PreventionEffectImpl<VengefulArchonEffect> {
if (!game.replaceEvent(preventEvent)) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
int damage = event.getAmount();
if (event.getAmount() >= this.amount) {
int damage = event.getAmount();
event.setAmount(event.getAmount() - amount);
player.damage(amount, source.getSourceId(), game, false, true);
event.setAmount(damage - this.amount);
damage = this.amount;
this.used = true;
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getControllerId(), source.getId(), source.getControllerId(), damage));
} else {
int damage = event.getAmount();
event.setAmount(0);
amount -= damage;
player.damage(damage, source.getSourceId(), game, false, true);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getControllerId(), source.getId(), source.getControllerId(), damage));
this.amount -= damage;
}
player.damage(damage, source.getSourceId(), game, false, true);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE,
source.getControllerId(), source.getId(), source.getControllerId(), damage));
}
}
return false;

View file

@ -90,17 +90,23 @@ class SpikeshotGoblinEffect extends OneShotEffect<SpikeshotGoblinEffect> {
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Constants.Zone.BATTLEFIELD);
}
if (sourcePermanent != null && permanent != null) {
permanent.damage(sourcePermanent.getPower().getValue(), source.getId(), game, true, false);
if (sourcePermanent == null) {
return false;
}
int damage = sourcePermanent.getPower().getValue();
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(damage, sourcePermanent.getId(), game, true, false);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());
if (sourcePermanent != null && player != null) {
player.damage(sourcePermanent.getPower().getValue(), source.getSourceId(), game, false, true);
if (player != null) {
player.damage(damage, sourcePermanent.getId(), game, false, true);
return true;
}
return false;

View file

@ -101,9 +101,9 @@ class ReinforcedBulwarkEffect extends PreventionEffectImpl<ReinforcedBulwarkEffe
if (damage > 0) {
event.setAmount(damage - 1);
this.used = true;
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE,
source.getControllerId(), source.getId(), source.getControllerId(), 1));
}
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE,
source.getControllerId(), source.getId(), source.getControllerId(), damage));
}
return false;
}

View file

@ -87,17 +87,23 @@ class SpikeshotElderEffect extends OneShotEffect<SpikeshotElderEffect> {
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Constants.Zone.BATTLEFIELD);
}
if (sourcePermanent != null && permanent != null) {
permanent.damage(sourcePermanent.getPower().getValue(), source.getId(), game, true, false);
if (sourcePermanent == null) {
return false;
}
int damage = sourcePermanent.getPower().getValue();
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(damage, sourcePermanent.getId(), game, true, false);
return true;
}
Player player = game.getPlayer(source.getFirstTarget());
if (sourcePermanent != null && player != null) {
player.damage(sourcePermanent.getPower().getValue(), source.getSourceId(), game, false, true);
if (player != null) {
player.damage(damage, sourcePermanent.getId(), game, false, true);
return true;
}
return false;

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
@ -88,11 +89,14 @@ class WingPunctureEffect extends OneShotEffect<WingPunctureEffect> {
@Override
public boolean apply(Game game, Ability source) {
Permanent sourceDamage = (Permanent) game.getPermanent(source.getFirstTarget());
Permanent target = (Permanent) game.getPermanent(source.getTargets().get(1).getFirstTarget());
Permanent sourcePermanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null) {
game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
}
if (sourceDamage != null && target != null) {
target.damage(sourceDamage.getPower().getValue(), sourceDamage.getId(), game, true, false);
Permanent targetPermanent = (Permanent) game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (sourcePermanent != null && targetPermanent != null) {
targetPermanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, true, false);
return true;
}
return false;

View file

@ -28,10 +28,9 @@
package mage.sets.shardsofalara;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -53,18 +52,16 @@ import mage.target.common.TargetControlledCreaturePermanent;
*/
public class AngelsHerald extends CardImpl<AngelsHerald> {
private static final FilterCard filter = new FilterCard("Empyrial Archangel");
private static final FilterCard filter = new FilterCard("card named Empyrial Archangel");
private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("a green creature");
private static final FilterControlledCreaturePermanent filterWhite = new FilterControlledCreaturePermanent("a white creature");
private static final FilterControlledCreaturePermanent filterBlue = new FilterControlledCreaturePermanent("a blue creature");
static {
filter.add(new NamePredicate("Empyrial Archangel"));
filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
filterWhite.add(new ColorPredicate(ObjectColor.WHITE));
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
filter.add(new NamePredicate("Empyrial Archangel"));
}
public AngelsHerald(UUID ownerId) {
@ -77,12 +74,14 @@ public class AngelsHerald extends CardImpl<AngelsHerald> {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {2}{W}, {tap}, Sacrifice a green creature, a white creature, and a blue creature: Search your library for a card named Empyrial Archangel and put it onto the battlefield. Then shuffle your library.
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, new FilterCard(filter));
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(target), new ManaCostsImpl("{2}{W}"));
// {2}{W}, {tap}, Sacrifice a green creature, a white creature, and a blue creature:
// Search your library for a card named Empyrial Archangel and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(1, 1, new FilterCard(filter))),
new ManaCostsImpl("{2}{W}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterGreen, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterWhite, false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterBlue, false)));
this.addAbility(ability);
}

View file

@ -42,7 +42,7 @@ import mage.target.TargetSpell;
*/
public class Dispel extends CardImpl<Dispel> {
private static FilterSpell filter = new FilterSpell("instant spell");
private static final FilterSpell filter = new FilterSpell("instant spell");
static {
filter.add(new CardTypePredicate(CardType.INSTANT));