mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Some rule text changes and some improvements to BeginningOfCombatTriggeredAbility. Use it for Desecration Demon.
This commit is contained in:
parent
9fb66bd065
commit
efccd682b6
3 changed files with 17 additions and 45 deletions
|
@ -32,10 +32,9 @@ import mage.Constants;
|
|||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -44,7 +43,6 @@ import mage.filter.common.FilterControlledPermanent;
|
|||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
@ -68,8 +66,7 @@ public class DesecrationDemon extends CardImpl<DesecrationDemon> {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// At the beginning of each combat, any opponent may sacrifice a creature. If a player does, tap Desecration Demon and put a +1/+1 counter on it.
|
||||
this.addAbility(new DesecrationDemonTriggeredAbility());
|
||||
|
||||
this.addAbility(new BeginningOfCombatTriggeredAbility(new DesecrationDemonEffect(), Constants.TargetController.ANY, false));
|
||||
}
|
||||
|
||||
public DesecrationDemon(final DesecrationDemon card) {
|
||||
|
@ -82,39 +79,10 @@ public class DesecrationDemon extends CardImpl<DesecrationDemon> {
|
|||
}
|
||||
}
|
||||
|
||||
class DesecrationDemonTriggeredAbility extends TriggeredAbilityImpl<DesecrationDemonTriggeredAbility> {
|
||||
|
||||
public DesecrationDemonTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DesecrationDemonEffect());
|
||||
}
|
||||
|
||||
public DesecrationDemonTriggeredAbility(final DesecrationDemonTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesecrationDemonTriggeredAbility copy() {
|
||||
return new DesecrationDemonTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.COMBAT_PHASE_PRE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of each combat, any opponent may sacrifice a creature. If a player does, tap Desecration Demon and put a +1/+1 counter on it";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DesecrationDemonEffect extends OneShotEffect<DesecrationDemonEffect> {
|
||||
DesecrationDemonEffect() {
|
||||
super(Constants.Outcome.BoostCreature);
|
||||
staticText = "any opponent may sacrifice a creature. If a player does, tap {this} and put a +1/+1 counter on it";
|
||||
}
|
||||
|
||||
DesecrationDemonEffect(final DesecrationDemonEffect effect) {
|
||||
|
@ -134,13 +102,13 @@ class DesecrationDemonEffect extends OneShotEffect<DesecrationDemonEffect> {
|
|||
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
|
||||
if (target.canChoose(opponent.getId(), game)) {
|
||||
if (opponent.chooseUse(Outcome.Detriment, "Sacrifice a creature to tap Desecration Demon and put a +1/+1 counter on it?", game))
|
||||
if (opponent.chooseUse(Outcome.Detriment, new StringBuilder("Sacrifice a creature to tap ").append(descrationDemon.getName()).append("and put a +1/+1 counter on it?").toString(), game))
|
||||
{
|
||||
opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getId(), game);
|
||||
game.informPlayers(opponent.getName() + " sacrifices " + permanent.getName() + " to tap Desecration Demon and put a +1/+1 counter on it");
|
||||
game.informPlayers(new StringBuilder(opponent.getName()).append(" sacrifices ").append(permanent.getName()).append(" to tap ").append(descrationDemon.getName()).append(". A +1/+1 counter was put on it").toString());
|
||||
if (descrationDemon != null) {
|
||||
descrationDemon.tap(game);
|
||||
descrationDemon.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class BattleRattleShaman extends CardImpl<BattleRattleShaman> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// At the beginning of combat on your turn, you may have target creature get +2/+0 until end of turn.
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Constants.Duration.EndOfTurn), Constants.TargetController.YOU, true);
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Constants.Duration.EndOfTurn), Constants.TargetController.YOU, true, false);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -8,20 +8,24 @@ import mage.game.events.GameEvent;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl<BeginningOfCombatTriggeredAbility> {
|
||||
|
||||
private Constants.TargetController targetController;
|
||||
private boolean setTargetPointer;
|
||||
|
||||
public BeginningOfCombatTriggeredAbility(Effect effect, Constants.TargetController targetController, boolean isOptional) {
|
||||
this(Constants.Zone.BATTLEFIELD, effect, targetController, isOptional);
|
||||
this(Constants.Zone.BATTLEFIELD, effect, targetController, isOptional, false);
|
||||
}
|
||||
|
||||
public BeginningOfCombatTriggeredAbility(Constants.Zone zone, Effect effect, Constants.TargetController targetController, boolean isOptional) {
|
||||
public BeginningOfCombatTriggeredAbility(Constants.Zone zone, Effect effect, Constants.TargetController targetController, boolean isOptional, boolean setTargetPointer) {
|
||||
super(zone, effect, isOptional);
|
||||
this.targetController = targetController;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public BeginningOfCombatTriggeredAbility(final BeginningOfCombatTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.targetController = ability.targetController;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +39,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl<Begi
|
|||
switch (targetController) {
|
||||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours) {
|
||||
if (yours && setTargetPointer) {
|
||||
if (getTargets().size() == 0) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
|
@ -45,7 +49,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl<Begi
|
|||
return yours;
|
||||
case OPPONENT:
|
||||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
if (getTargets().size() == 0) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -54,7 +58,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl<Begi
|
|||
}
|
||||
break;
|
||||
case ANY:
|
||||
if (getTargets().size() == 0) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
@ -73,7 +77,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl<Begi
|
|||
case OPPONENT:
|
||||
return "At the beginning of each opponent's combat step, " + generateZoneString() + getEffects().getText(modes.getMode());
|
||||
case ANY:
|
||||
return "At the beginning of each player's combat step, " + generateZoneString() + getEffects().getText(modes.getMode());
|
||||
return "At the beginning of each combat, " + generateZoneString() + getEffects().getText(modes.getMode());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue