[MIR] Implement Barreling Attack (#11529)

This commit is contained in:
Cameron Merkel 2023-12-09 15:04:08 -06:00 committed by GitHub
parent f7f72036b2
commit ab69653cd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,75 @@
package mage.cards.b;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.dynamicvalue.common.BlockingCreatureCount;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author Cguy7777
*/
public final class BarrelingAttack extends CardImpl {
public BarrelingAttack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}{R}");
// Target creature gains trample until end of turn.
// When that creature becomes blocked this turn, it gets +1/+1 until end of turn for each creature blocking it.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new BarrelingAttackTriggeredAbility()));
}
private BarrelingAttack(final BarrelingAttack card) {
super(card);
}
@Override
public BarrelingAttack copy() {
return new BarrelingAttack(this);
}
}
class BarrelingAttackTriggeredAbility extends DelayedTriggeredAbility {
BarrelingAttackTriggeredAbility() {
super(new BoostTargetEffect(BlockingCreatureCount.TARGET, BlockingCreatureCount.TARGET, Duration.EndOfTurn),
Duration.EndOfTurn, false);
setTriggerPhrase("When that creature becomes blocked this turn, ");
}
private BarrelingAttackTriggeredAbility(final BarrelingAttackTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CREATURE_BLOCKED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getFirstTarget())) {
Permanent attackingCreature = game.getPermanentOrLKIBattlefield(event.getTargetId());
return attackingCreature != null;
}
return false;
}
@Override
public BarrelingAttackTriggeredAbility copy() {
return new BarrelingAttackTriggeredAbility(this);
}
}

View file

@ -43,6 +43,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Bad River", 324, Rarity.UNCOMMON, mage.cards.b.BadRiver.class));
cards.add(new SetCardInfo("Barbed Foliage", 207, Rarity.UNCOMMON, mage.cards.b.BarbedFoliage.class));
cards.add(new SetCardInfo("Barbed-Back Wurm", 105, Rarity.UNCOMMON, mage.cards.b.BarbedBackWurm.class));
cards.add(new SetCardInfo("Barreling Attack", 157, Rarity.RARE, mage.cards.b.BarrelingAttack.class));
cards.add(new SetCardInfo("Basalt Golem", 294, Rarity.UNCOMMON, mage.cards.b.BasaltGolem.class));
cards.add(new SetCardInfo("Bay Falcon", 54, Rarity.COMMON, mage.cards.b.BayFalcon.class));
cards.add(new SetCardInfo("Bazaar of Wonders", 55, Rarity.RARE, mage.cards.b.BazaarOfWonders.class));