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.common.SimpleActivatedAbility;
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.LoseLifeTargetEffect;
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.
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);
}
@ -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() {
super(Duration.EndOfCombat, Outcome.Benefit);
staticText = ", and you choose how those creatures block";
public BrutalHordechiefChooseBlockersEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, false, false);
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);
}
@Override
public BrutalHordechiefReplacementEffect copy() {
return new BrutalHordechiefReplacementEffect(this);
public BrutalHordechiefChooseBlockersEffect copy() {
return new BrutalHordechiefChooseBlockersEffect(this);
}
@Override
@ -153,15 +153,7 @@ class BrutalHordechiefReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
Player blockController = game.getPlayer(source.getControllerId());
if (blockController != null) {
return true;
}
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player blockController = game.getPlayer(source.getControllerId());
if (blockController != null) {
game.informPlayers(source.getSourceObject(game).getIdName() + " applies");
game.getCombat().selectBlockers(blockController, game);
return true;
}