mirror of
https://github.com/correl/mage.git
synced 2025-01-14 03:00:10 +00:00
Corrected bugs.
This commit is contained in:
parent
8afc24ae15
commit
2c553dc2d4
3 changed files with 5 additions and 90 deletions
|
@ -36,6 +36,7 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
@ -70,7 +71,7 @@ public class FodderLaunch extends CardImpl {
|
||||||
//Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller.
|
//Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller.
|
||||||
this.getSpellAbility().addEffect(new BoostTargetEffect(-5, -5, Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new BoostTargetEffect(-5, -5, Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
this.getSpellAbility().addEffect(new FodderLaunchEffect());
|
this.getSpellAbility().addEffect(new DamageTargetControllerEffect(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FodderLaunch(final FodderLaunch card) {
|
public FodderLaunch(final FodderLaunch card) {
|
||||||
|
@ -83,35 +84,3 @@ public class FodderLaunch extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FodderLaunchEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public FodderLaunchEffect() {
|
|
||||||
super(Outcome.Damage);
|
|
||||||
this.staticText = "Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public FodderLaunchEffect(final FodderLaunchEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FodderLaunchEffect copy() {
|
|
||||||
return new FodderLaunchEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
|
||||||
if (controller != null && sourceObject != null) {
|
|
||||||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
|
||||||
if (targetCreature != null) {
|
|
||||||
Player controllerOfTargetCreature = game.getPlayer(targetCreature.getControllerId());
|
|
||||||
controllerOfTargetCreature.damage(5, source.getSourceId(), game, false, true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -61,7 +61,7 @@ public class QuillSlingerBoggart extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// Whenever a player casts a Kithkin spell, you may have target player lose 1 life.
|
// Whenever a player casts a Kithkin spell, you may have target player lose 1 life.
|
||||||
Ability ability = new SpellCastAllTriggeredAbility(new LoseLifeTargetEffect(2), filter, true);
|
Ability ability = new SpellCastAllTriggeredAbility(new LoseLifeTargetEffect(1), filter, true);
|
||||||
ability.addTarget(new TargetPlayer());
|
ability.addTarget(new TargetPlayer());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,24 +29,18 @@ package mage.sets.planeshift;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.common.combat.CantAttackIfDefenderControlsPermanent;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.FilterPermanent;
|
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
import mage.filter.predicate.permanent.TappedPredicate;
|
import mage.filter.predicate.permanent.TappedPredicate;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -59,7 +53,6 @@ public class MoggJailer extends CardImpl {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(Predicates.and(new PowerPredicate(Filter.ComparisonType.LessThan, 2), Predicates.not(new TappedPredicate())));
|
filter.add(Predicates.and(new PowerPredicate(Filter.ComparisonType.LessThan, 2), Predicates.not(new TappedPredicate())));
|
||||||
//filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 3));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MoggJailer(UUID ownerId) {
|
public MoggJailer(UUID ownerId) {
|
||||||
|
@ -70,7 +63,7 @@ public class MoggJailer extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less.
|
// Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less.
|
||||||
Effect effect = new CantAttackIfDefenderControllsPermanent(filter);
|
Effect effect = new CantAttackIfDefenderControlsPermanent(filter);
|
||||||
effect.setText("Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less.");
|
effect.setText("Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less.");
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||||
}
|
}
|
||||||
|
@ -84,50 +77,3 @@ public class MoggJailer extends CardImpl {
|
||||||
return new MoggJailer(this);
|
return new MoggJailer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CantAttackIfDefenderControllsPermanent extends RestrictionEffect {
|
|
||||||
|
|
||||||
private final FilterPermanent filter;
|
|
||||||
|
|
||||||
public CantAttackIfDefenderControllsPermanent(FilterPermanent filter) {
|
|
||||||
super(Duration.WhileOnBattlefield);
|
|
||||||
this.filter = filter;
|
|
||||||
staticText = new StringBuilder("{this} can't attack if defending player controls ").append(filter.getMessage()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CantAttackIfDefenderControllsPermanent(final CantAttackIfDefenderControllsPermanent effect) {
|
|
||||||
super(effect);
|
|
||||||
this.filter = effect.filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
|
||||||
return permanent.getId().equals(source.getSourceId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAttack(UUID defenderId, Ability source, Game game) {
|
|
||||||
UUID defendingPlayerId;
|
|
||||||
Player player = game.getPlayer(defenderId);
|
|
||||||
if (player == null) {
|
|
||||||
Permanent permanent = game.getPermanent(defenderId);
|
|
||||||
if (permanent != null) {
|
|
||||||
defendingPlayerId = permanent.getControllerId();
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
defendingPlayerId = defenderId;
|
|
||||||
}
|
|
||||||
if (defendingPlayerId != null && game.getBattlefield().countAll(filter, defendingPlayerId, game) > 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CantAttackIfDefenderControllsPermanent copy() {
|
|
||||||
return new CantAttackIfDefenderControllsPermanent(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue