mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Fix #9441
This commit is contained in:
parent
2cef7dd597
commit
e0ade383f2
13 changed files with 77 additions and 202 deletions
|
@ -8,7 +8,7 @@ import mage.abilities.common.AttacksTriggeredAbility;
|
|||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.condition.common.HateCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
|
@ -30,18 +30,16 @@ public final class AsajjVentress extends CardImpl {
|
|||
public AsajjVentress(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{B}{R}");
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.DATHOMIRIAN);
|
||||
this.subtype.add(SubType.SITH);
|
||||
this.subtype.add(SubType.DATHOMIRIAN, SubType.SITH);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Double Strike
|
||||
this.addAbility(DoubleStrikeAbility.getInstance());
|
||||
|
||||
// When Asajj Ventress becomes blocked, she gets +1/+1 for each creature blocking her until end of turn.
|
||||
BlockedCreatureCount value = BlockedCreatureCount.ALL;
|
||||
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
|
||||
effect.setText("she gets +1/+1 for each creature blocking her until end of turn");
|
||||
// When Asajj Ventress becomes blocked, she gets +1/+1 until end of turn for each creature blocking her.
|
||||
Effect effect = new BoostSourceEffect(BlockingCreatureCount.SOURCE, BlockingCreatureCount.SOURCE, Duration.EndOfTurn, true);
|
||||
effect.setText("she gets +1/+1 until end of turn for each creature blocking her");
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(effect, false));
|
||||
|
||||
// <i>Hate</i> — Whenever Asajj Ventress attacks, if an opponent lost life from a source other than combat damage this turn, target creature blocks this turn if able.
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -21,15 +19,18 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Markedagain
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class BeastmastersMagemark extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted");
|
||||
private static final FilterCreaturePermanent filterCreatures = new FilterCreaturePermanent("creatures you control that are enchanted");
|
||||
private static final FilterCreaturePermanent filterACreature = new FilterCreaturePermanent("a creature you control that's enchanted");
|
||||
|
||||
static {
|
||||
filter.add(EnchantedPredicate.instance);
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
filterCreatures.add(EnchantedPredicate.instance);
|
||||
filterACreature.add(EnchantedPredicate.instance);
|
||||
filterCreatures.add(TargetController.YOU.getControllerPredicate());
|
||||
filterACreature.add(TargetController.YOU.getControllerPredicate());
|
||||
}
|
||||
|
||||
public BeastmastersMagemark(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
@ -42,14 +43,16 @@ public final class BeastmastersMagemark extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Creatures you control that are enchanted get +1/+1.
|
||||
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false));
|
||||
ability = new SimpleStaticAbility(new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filterCreatures, false));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever a creature you control that's enchanted becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
|
||||
BlockedCreatureCount value = BlockedCreatureCount.ALL;
|
||||
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
|
||||
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
|
||||
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false, filter, false));
|
||||
this.addAbility(new BecomesBlockedAllTriggeredAbility(
|
||||
new BoostTargetEffect(BlockingCreatureCount.TARGET, BlockingCreatureCount.TARGET, Duration.EndOfTurn),
|
||||
false, filterACreature, true
|
||||
));
|
||||
}
|
||||
|
||||
private BeastmastersMagemark(final BeastmastersMagemark card) {
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class BerserkMurlodont extends CardImpl {
|
||||
|
||||
|
@ -35,7 +29,8 @@ public final class BerserkMurlodont extends CardImpl {
|
|||
|
||||
// Whenever a Beast becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
|
||||
this.addAbility(new BecomesBlockedAllTriggeredAbility(
|
||||
new BerserkMurlodontEffect(), false, filter, false
|
||||
new BoostTargetEffect(BlockingCreatureCount.TARGET, BlockingCreatureCount.TARGET, Duration.EndOfTurn),
|
||||
false, filter, true
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -48,40 +43,3 @@ public final class BerserkMurlodont extends CardImpl {
|
|||
return new BerserkMurlodont(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BerserkMurlodontEffect extends OneShotEffect {
|
||||
|
||||
BerserkMurlodontEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "it gets +1/+1 until end of turn for each creature blocking it";
|
||||
}
|
||||
|
||||
private BerserkMurlodontEffect(final BerserkMurlodontEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BerserkMurlodontEffect copy() {
|
||||
return new BerserkMurlodontEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int blockers = game
|
||||
.getCombat()
|
||||
.getGroups()
|
||||
.stream()
|
||||
.filter(combatGroup -> combatGroup.getAttackers().contains(permanent.getId()))
|
||||
.map(CombatGroup::getBlockers)
|
||||
.mapToInt(List::size)
|
||||
.sum();
|
||||
game.addEffect(new BoostTargetEffect(
|
||||
blockers, blockers, Duration.EndOfTurn
|
||||
).setTargetPointer(new FixedTarget(permanent, game)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -21,16 +19,15 @@ public final class ElvishBerserker extends CardImpl {
|
|||
|
||||
public ElvishBerserker(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
|
||||
this.subtype.add(SubType.ELF);
|
||||
this.subtype.add(SubType.BERSERKER);
|
||||
this.subtype.add(SubType.ELF, SubType.BERSERKER);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Elvish Berserker becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
|
||||
BlockedCreatureCount value = BlockedCreatureCount.ALL;
|
||||
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
|
||||
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(effect, false));
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(
|
||||
new BoostSourceEffect(BlockingCreatureCount.SOURCE, BlockingCreatureCount.SOURCE, Duration.EndOfTurn, true, "it"),
|
||||
false
|
||||
));
|
||||
}
|
||||
|
||||
private ElvishBerserker(final ElvishBerserker card) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -6,8 +5,7 @@ import mage.MageInt;
|
|||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -21,19 +19,17 @@ import mage.constants.Duration;
|
|||
*/
|
||||
public final class GangOfElk extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new MultipliedValue(BlockingCreatureCount.SOURCE, 2);
|
||||
|
||||
public GangOfElk(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}");
|
||||
this.subtype.add(SubType.ELK);
|
||||
this.subtype.add(SubType.BEAST);
|
||||
this.subtype.add(SubType.ELK, SubType.BEAST);
|
||||
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever Gang of Elk becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.
|
||||
DynamicValue value = new MultipliedValue(BlockedCreatureCount.ALL, 2);
|
||||
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
|
||||
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(effect, false));
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(xValue, xValue, Duration.EndOfTurn, true, "it"), false));
|
||||
}
|
||||
|
||||
private GangOfElk(final GangOfElk card) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import mage.MageInt;
|
|||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -19,8 +19,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class JohtullWurm extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue1 = new MultipliedValue(BlockedCreatureCount.BEYOND_FIRST, -2);
|
||||
private static final DynamicValue xValue2 = new MultipliedValue(BlockedCreatureCount.BEYOND_FIRST, -1);
|
||||
private static final DynamicValue xValue1 = new MultipliedValue(BlockingCreatureCount.BEYOND_FIRST, -1);
|
||||
private static final DynamicValue xValue2 = new MultipliedValue(BlockingCreatureCount.BEYOND_FIRST, -2);
|
||||
|
||||
public JohtullWurm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}");
|
||||
|
@ -29,9 +29,7 @@ public final class JohtullWurm extends CardImpl {
|
|||
this.toughness = new MageInt(6);
|
||||
|
||||
// Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first.
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(
|
||||
xValue2, xValue1, Duration.EndOfTurn, true
|
||||
).setText("it gets -2/-1 until end of turn for each creature blocking it beyond the first"), false));
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(xValue2, xValue1, Duration.EndOfTurn, true, "it"), false));
|
||||
}
|
||||
|
||||
private JohtullWurm(final JohtullWurm card) {
|
||||
|
|
|
@ -3,8 +3,8 @@ package mage.cards.j;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.dynamicvalue.common.SignInversionDynamicValue;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -19,9 +19,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class JungleWurm extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new MultipliedValue(
|
||||
BlockedCreatureCount.BEYOND_FIRST, -1
|
||||
);
|
||||
private static final DynamicValue xValue = new SignInversionDynamicValue(BlockingCreatureCount.BEYOND_FIRST);
|
||||
|
||||
public JungleWurm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
|
||||
|
@ -30,9 +28,7 @@ public final class JungleWurm extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first.
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(
|
||||
xValue, xValue, Duration.EndOfTurn, true
|
||||
).setText("it gets -1/-1 until end of turn for each creature blocking it beyond the first"), false));
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(xValue, xValue, Duration.EndOfTurn, true, "it"), false));
|
||||
}
|
||||
|
||||
private JungleWurm(final JungleWurm card) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -6,8 +5,7 @@ import mage.MageInt;
|
|||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -21,6 +19,8 @@ import mage.constants.Duration;
|
|||
*/
|
||||
public final class RabidElephant extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new MultipliedValue(BlockingCreatureCount.SOURCE, 2);
|
||||
|
||||
public RabidElephant(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}");
|
||||
this.subtype.add(SubType.ELEPHANT);
|
||||
|
@ -29,10 +29,7 @@ public final class RabidElephant extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever Rabid Elephant becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.
|
||||
DynamicValue value = new MultipliedValue(BlockedCreatureCount.ALL, 2);
|
||||
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
|
||||
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(effect, false));
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(xValue, xValue, Duration.EndOfTurn, true), false));
|
||||
}
|
||||
|
||||
private RabidElephant(final RabidElephant card) {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -26,10 +24,10 @@ public final class SparringGolem extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
|
||||
BlockedCreatureCount value = BlockedCreatureCount.ALL;
|
||||
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn, true);
|
||||
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(effect, false));
|
||||
this.addAbility(new BecomesBlockedSourceTriggeredAbility(
|
||||
new BoostSourceEffect(BlockingCreatureCount.SOURCE, BlockingCreatureCount.SOURCE, Duration.EndOfTurn, true, "it"),
|
||||
false
|
||||
));
|
||||
}
|
||||
|
||||
private SparringGolem(final SparringGolem card) {
|
||||
|
|
|
@ -3,8 +3,7 @@ package mage.cards.s;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -12,13 +11,11 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author KholdFuzion
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class SpinedSliver extends CardImpl {
|
||||
|
||||
|
@ -33,7 +30,7 @@ public final class SpinedSliver extends CardImpl {
|
|||
|
||||
// Whenever a Sliver becomes blocked, that Sliver gets +1/+1 until end of turn for each creature blocking it.
|
||||
this.addAbility(new BecomesBlockedAllTriggeredAbility(
|
||||
new BoostTargetEffect(BlockersCount.instance, BlockersCount.instance, Duration.EndOfTurn)
|
||||
new BoostTargetEffect(BlockingCreatureCount.TARGET, BlockingCreatureCount.TARGET, Duration.EndOfTurn)
|
||||
.setText("that Sliver gets +1/+1 until end of turn for each creature blocking it"),
|
||||
false, filter, true
|
||||
));
|
||||
|
@ -48,33 +45,3 @@ public final class SpinedSliver extends CardImpl {
|
|||
return new SpinedSliver(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BlockersCount implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
UUID attackerId = effect.getTargetPointer().getFirst(game, sourceAbility);
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getAttackers().contains(attackerId)) {
|
||||
return combatGroup.getBlockers().size();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockersCount copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "creature blocking it";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.dynamicvalue;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -36,6 +35,9 @@ public class MultipliedValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (value.toString().equals("1")) {
|
||||
return Integer.toString(multiplier);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (multiplier == 2) {
|
||||
sb.append("twice ");
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -7,30 +6,32 @@ import mage.abilities.effects.Effect;
|
|||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Markedagain
|
||||
* @author awjackson
|
||||
*/
|
||||
public enum BlockedCreatureCount implements DynamicValue {
|
||||
ALL("each creature blocking it", false),
|
||||
BEYOND_FIRST("each creature blocking it beyond the first", true);
|
||||
public enum BlockingCreatureCount implements DynamicValue {
|
||||
SOURCE("creature blocking it"),
|
||||
TARGET("creature blocking it"),
|
||||
BEYOND_FIRST("creature blocking it beyond the first");
|
||||
|
||||
private final String message;
|
||||
private final boolean beyondTheFirst;
|
||||
|
||||
BlockedCreatureCount(String message, boolean beyondTheFirst) {
|
||||
BlockingCreatureCount(String message) {
|
||||
this.message = message;
|
||||
this.beyondTheFirst = beyondTheFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
UUID attackerId = (this == TARGET ? effect.getTargetPointer().getFirst(game, sourceAbility) : sourceAbility.getSourceId());
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (!combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
if (!combatGroup.getAttackers().contains(attackerId)) {
|
||||
continue;
|
||||
}
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
if (beyondTheFirst) {
|
||||
blockers = blockers > 0 ? blockers - 1 : 0;
|
||||
if (this == BEYOND_FIRST) {
|
||||
blockers = Math.max(blockers - 1, 0);
|
||||
}
|
||||
return blockers;
|
||||
}
|
||||
|
@ -38,7 +39,7 @@ public enum BlockedCreatureCount implements DynamicValue {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockedCreatureCount copy() {
|
||||
public BlockingCreatureCount copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -49,6 +50,6 @@ public enum BlockedCreatureCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
return "1";
|
||||
}
|
||||
}
|
|
@ -3,11 +3,10 @@ package mage.abilities.keyword;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -27,7 +26,7 @@ public class RampageAbility extends BecomesBlockedSourceTriggeredAbility {
|
|||
+ (shortRuleText ? ""
|
||||
: " <i>(Whenever this creature becomes blocked, it gets +"
|
||||
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)</i>");
|
||||
RampageValue rv = new RampageValue(amount);
|
||||
DynamicValue rv = (amount == 1 ? BlockingCreatureCount.BEYOND_FIRST : new MultipliedValue(BlockingCreatureCount.BEYOND_FIRST, amount));
|
||||
this.addEffect(new BoostSourceEffect(rv, rv, Duration.EndOfTurn, true));
|
||||
}
|
||||
|
||||
|
@ -46,38 +45,3 @@ public class RampageAbility extends BecomesBlockedSourceTriggeredAbility {
|
|||
return rule;
|
||||
}
|
||||
}
|
||||
|
||||
class RampageValue implements DynamicValue {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public RampageValue(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public RampageValue(final RampageValue value) {
|
||||
this.amount = value.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RampageValue copy() {
|
||||
return new RampageValue(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
|
||||
int blockers = combatGroup.getBlockers().size();
|
||||
return blockers > 1 ? (blockers - 1) * amount : 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "rampage " + amount + "(Whenever this creature becomes blocked, it gets +"
|
||||
+ amount + "/+" + amount + " until end of turn for each creature blocking it beyond the first.)";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue