mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[40K] Implemented Birth of the Imperium
This commit is contained in:
parent
ab27b54680
commit
3cc503b981
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/b/BirthOfTheImperium.java
Normal file
106
Mage.Sets/src/mage/cards/b/BirthOfTheImperium.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SagaAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.OpponentsCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.SacrificeOpponentsEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SagaChapter;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.AstartesWarriorToken;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BirthOfTheImperium extends CardImpl {
|
||||
|
||||
public BirthOfTheImperium(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{U}{B}");
|
||||
|
||||
this.subtype.add(SubType.SAGA);
|
||||
|
||||
// (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)
|
||||
SagaAbility sagaAbility = new SagaAbility(this);
|
||||
|
||||
// I -- Create a 2/2 white Astartes Warrior creature token with vigilance for each opponent you have.
|
||||
sagaAbility.addChapterEffect(
|
||||
this, SagaChapter.CHAPTER_I,
|
||||
new CreateTokenEffect(new AstartesWarriorToken(), OpponentsCount.instance)
|
||||
.setText("create a 2/2 white Astartes Warrior creature " +
|
||||
"token with vigilance for each opponent you have")
|
||||
);
|
||||
|
||||
// II -- Each opponent sacrifices a creature.
|
||||
sagaAbility.addChapterEffect(
|
||||
this, SagaChapter.CHAPTER_II,
|
||||
new SacrificeOpponentsEffect(StaticFilters.FILTER_PERMANENT_CREATURE)
|
||||
);
|
||||
|
||||
// III -- Draw two cards for each opponent who controls fewer creatures than you.
|
||||
sagaAbility.addChapterEffect(
|
||||
this, SagaChapter.CHAPTER_III,
|
||||
new DrawCardSourceControllerEffect(BirthOfTheImperiumValue.instance)
|
||||
);
|
||||
this.addAbility(sagaAbility);
|
||||
}
|
||||
|
||||
private BirthOfTheImperium(final BirthOfTheImperium card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BirthOfTheImperium copy() {
|
||||
return new BirthOfTheImperium(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum BirthOfTheImperiumValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Map<UUID, Integer> map = game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
sourceAbility.getControllerId(), sourceAbility, game
|
||||
).stream()
|
||||
.map(Controllable::getControllerId)
|
||||
.collect(Collectors.toMap(Function.identity(), x -> 1, Integer::sum));
|
||||
int yourCreatures = map.getOrDefault(sourceAbility.getControllerId(), 0);
|
||||
return yourCreatures > 0 ? game
|
||||
.getOpponents(sourceAbility.getControllerId())
|
||||
.stream().mapToInt(uuid -> map.getOrDefault(uuid, 0))
|
||||
.filter(x -> x < yourCreatures)
|
||||
.sum() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BirthOfTheImperiumValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "opponent who controls fewer creatures than you";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ public final class Warhammer40000 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Beacon of Unrest", 194, Rarity.RARE, mage.cards.b.BeaconOfUnrest.class));
|
||||
cards.add(new SetCardInfo("Bile Blight", 195, Rarity.UNCOMMON, mage.cards.b.BileBlight.class));
|
||||
cards.add(new SetCardInfo("Biotransference", 30, Rarity.RARE, mage.cards.b.Biotransference.class));
|
||||
cards.add(new SetCardInfo("Birth of the Imperium", 107, Rarity.RARE, mage.cards.b.BirthOfTheImperium.class));
|
||||
cards.add(new SetCardInfo("Bituminous Blast", 221, Rarity.UNCOMMON, mage.cards.b.BituminousBlast.class));
|
||||
cards.add(new SetCardInfo("Blasphemous Act", 204, Rarity.RARE, mage.cards.b.BlasphemousAct.class));
|
||||
cards.add(new SetCardInfo("Blight Grenade", 31, Rarity.RARE, mage.cards.b.BlightGrenade.class));
|
||||
|
|
Loading…
Reference in a new issue