mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
parent
f987571a39
commit
4c55efb48e
3 changed files with 138 additions and 0 deletions
99
Mage.Sets/src/mage/cards/b/BleedingEffect.java
Normal file
99
Mage.Sets/src/mage/cards/b/BleedingEffect.java
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.*;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class BleedingEffect extends CardImpl {
|
||||
|
||||
public BleedingEffect(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{B}");
|
||||
|
||||
// At the beginning of combat on your turn, creatures you control gain flying until end of turn if a creature card in your graveyard has flying.
|
||||
// The same is true for first strike, double strike, deathtouch, hexproof, indestructible, lifelink, menace, reach, trample, and vigilance.
|
||||
this.addAbility(new BeginningOfCombatTriggeredAbility(new BleedingEffectEffect(), TargetController.YOU, false));
|
||||
}
|
||||
|
||||
private BleedingEffect(final BleedingEffect card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BleedingEffect copy() {
|
||||
return new BleedingEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BleedingEffectEffect extends OneShotEffect {
|
||||
|
||||
private static final List<Class<? extends Ability>> abilities = Arrays.asList(
|
||||
FlyingAbility.class,
|
||||
FirstStrikeAbility.class,
|
||||
DoubleStrikeAbility.class,
|
||||
DeathtouchAbility.class,
|
||||
HexproofBaseAbility.class,
|
||||
IndestructibleAbility.class,
|
||||
LifelinkAbility.class,
|
||||
MenaceAbility.class,
|
||||
ReachAbility.class,
|
||||
TrampleAbility.class,
|
||||
ReachAbility.class,
|
||||
TrampleAbility.class,
|
||||
VigilanceAbility.class
|
||||
);
|
||||
|
||||
BleedingEffectEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "creatures you control gain flying until end of turn if a creature card in your graveyard has flying." +
|
||||
" The same is true for first strike, double strike, deathtouch, hexproof, indestructible, lifelink, menace, reach, trample, and vigilance.";
|
||||
}
|
||||
|
||||
private BleedingEffectEffect(final BleedingEffectEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BleedingEffectEffect copy() {
|
||||
return new BleedingEffectEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Ability menaceAbility = new MenaceAbility(false);
|
||||
controller.getGraveyard().stream()
|
||||
.map(game::getCard)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(c -> c.getAbilities(game).stream())
|
||||
.filter(a -> abilities.stream().anyMatch(x -> x.isInstance(a)))
|
||||
.map(a -> a instanceof MenaceAbility ? menaceAbility : a.copy()) // since menace is not a singleton
|
||||
.distinct() // all others MageSingleton so this works to eliminate redundancy
|
||||
.forEach(a -> game.addEffect(new GainAbilityControlledEffect(
|
||||
a,
|
||||
Duration.EndOfTurn,
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURES), source));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ public final class AssassinsCreed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Battlefield Improvisation", 276, Rarity.COMMON, mage.cards.b.BattlefieldImprovisation.class));
|
||||
cards.add(new SetCardInfo("Bayek of Siwa", 50, Rarity.RARE, mage.cards.b.BayekOfSiwa.class));
|
||||
cards.add(new SetCardInfo("Black Market Connections", 87, Rarity.RARE, mage.cards.b.BlackMarketConnections.class));
|
||||
cards.add(new SetCardInfo("Bleeding Effect", 51, Rarity.UNCOMMON, mage.cards.b.BleedingEffect.class));
|
||||
cards.add(new SetCardInfo("Brotherhood Ambushers", 285, Rarity.UNCOMMON, mage.cards.b.BrotherhoodAmbushers.class));
|
||||
cards.add(new SetCardInfo("Brotherhood Patriarch", 286, Rarity.COMMON, mage.cards.b.BrotherhoodPatriarch.class));
|
||||
cards.add(new SetCardInfo("Brotherhood Regalia", 71, Rarity.UNCOMMON, mage.cards.b.BrotherhoodRegalia.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package org.mage.test.cards.single.acr;
|
||||
|
||||
import mage.abilities.keyword.*;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public class BleedingEffectTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String bleedingEffect = "Bleeding Effect";
|
||||
// At the beginning of combat on your turn, creatures you control gain flying until end of turn
|
||||
// if a creature card in your graveyard has flying. The same is true for first strike, double strike,
|
||||
// deathtouch, hexproof, indestructible, lifelink, menace, reach, trample, and vigilance.
|
||||
|
||||
@Test
|
||||
public void testAbilitiesGained() {
|
||||
String baloth = "Rumbling Baloth"; // 4/4 vanilla
|
||||
addCard(Zone.BATTLEFIELD, playerA, bleedingEffect);
|
||||
addCard(Zone.GRAVEYARD, playerA, "Knight of Malice"); // First strike, hexproof from white
|
||||
addCard(Zone.GRAVEYARD, playerA, "Boggart Brute"); // Menace
|
||||
addCard(Zone.BATTLEFIELD, playerA, baloth); // vanilla 4/4
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertAbility(playerA, baloth, FirstStrikeAbility.getInstance(), true);
|
||||
assertAbility(playerA, baloth, HexproofFromWhiteAbility.getInstance(), true);
|
||||
assertAbility(playerA, baloth, new MenaceAbility(false), true);
|
||||
assertAbility(playerA, baloth, FlyingAbility.getInstance(), false);
|
||||
assertAbility(playerA, baloth, HexproofFromBlueAbility.getInstance(), false);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue