Rewrote Choose Blockers effect to ContinuousRuleModifyingEffectImpl

This commit is contained in:
Zzooouhh 2017-10-18 22:18:32 +02:00 committed by GitHub
parent c5399460b9
commit 5d126afc18

View file

@ -33,7 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.combat.BlocksIfAbleAllEffect; import mage.abilities.effects.common.combat.BlocksIfAbleAllEffect;
@ -71,7 +71,7 @@ public class BrutalHordechief extends CardImpl {
// {3}{R/W}{R/W}: Creatures your opponents control block this turn if able, and you choose how those creatures block. // {3}{R/W}{R/W}: Creatures your opponents control block this turn if able, and you choose how those creatures block.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BlocksIfAbleAllEffect(filter, Duration.EndOfTurn), new ManaCostsImpl("{3}{R/W}{R/W}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BlocksIfAbleAllEffect(filter, Duration.EndOfTurn), new ManaCostsImpl("{3}{R/W}{R/W}"));
ability.addEffect(new BrutalHordechiefReplacementEffect()); ability.addEffect(new BrutalHordechiefChooseBlockersEffect());
this.addAbility(ability); this.addAbility(ability);
} }
@ -123,20 +123,20 @@ class BrutalHordechiefTriggeredAbility extends TriggeredAbilityImpl {
} }
} }
class BrutalHordechiefReplacementEffect extends ReplacementEffectImpl { class BrutalHordechiefChooseBlockersEffect extends ContinuousRuleModifyingEffectImpl { // TODO: reverse the resolution order in case of effect multiples
public BrutalHordechiefReplacementEffect() { public BrutalHordechiefChooseBlockersEffect() {
super(Duration.EndOfCombat, Outcome.Benefit); super(Duration.EndOfTurn, Outcome.Benefit, false, false);
staticText = ", and you choose how those creatures block"; staticText = "You choose which creatures block this turn and how those creatures block";
} }
public BrutalHordechiefReplacementEffect(final BrutalHordechiefReplacementEffect effect) { public BrutalHordechiefChooseBlockersEffect(final BrutalHordechiefChooseBlockersEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public BrutalHordechiefReplacementEffect copy() { public BrutalHordechiefChooseBlockersEffect copy() {
return new BrutalHordechiefReplacementEffect(this); return new BrutalHordechiefChooseBlockersEffect(this);
} }
@Override @Override
@ -153,15 +153,7 @@ class BrutalHordechiefReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Player blockController = game.getPlayer(source.getControllerId()); Player blockController = game.getPlayer(source.getControllerId());
if (blockController != null) { if (blockController != null) {
return true; game.informPlayers(source.getSourceObject(game).getIdName() + " applies");
}
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player blockController = game.getPlayer(source.getControllerId());
if (blockController != null) {
game.getCombat().selectBlockers(blockController, game); game.getCombat().selectBlockers(blockController, game);
return true; return true;
} }