mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Implemented Slippery Bogbonder
This commit is contained in:
parent
7055823117
commit
c8fa5b8819
2 changed files with 141 additions and 0 deletions
140
Mage.Sets/src/mage/cards/s/SlipperyBogbonder.java
Normal file
140
Mage.Sets/src/mage/cards/s/SlipperyBogbonder.java
Normal file
|
@ -0,0 +1,140 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.HexproofAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.filter.predicate.permanent.CounterAnyPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SlipperyBogbonder extends CardImpl {
|
||||
|
||||
public SlipperyBogbonder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// Hexproof
|
||||
this.addAbility(HexproofAbility.getInstance());
|
||||
|
||||
// When Slippery Bogbonder enters the battlefield, put a hexproof counter on target creature. Then move any number of counters from among creatures you control onto that creature.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new AddCountersTargetEffect(CounterType.HEXPROOF.createInstance())
|
||||
);
|
||||
ability.addEffect(new SlipperyBogbonderEffect());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private SlipperyBogbonder(final SlipperyBogbonder card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlipperyBogbonder copy() {
|
||||
return new SlipperyBogbonder(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SlipperyBogbonderEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("creatures to move counters from");
|
||||
|
||||
static {
|
||||
filter.add(CounterAnyPredicate.instance);
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
SlipperyBogbonderEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Then move any number of counters from among creatures you control onto that creature.";
|
||||
}
|
||||
|
||||
private SlipperyBogbonderEffect(final SlipperyBogbonderEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlipperyBogbonderEffect copy() {
|
||||
return new SlipperyBogbonderEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = game.getPermanent(source.getFirstTarget());
|
||||
if (player == null || creature == null || game.getBattlefield().count(
|
||||
filter, source.getSourceId(), source.getControllerId(), game
|
||||
) < 1) {
|
||||
return false;
|
||||
}
|
||||
TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
List<Permanent> permanents = target
|
||||
.getTargets()
|
||||
.stream()
|
||||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (permanents.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Map<UUID, Map<String, Integer>> counterMap = new HashMap<>();
|
||||
for (Permanent permanent : permanents) {
|
||||
permanent.getCounters(game)
|
||||
.entrySet()
|
||||
.stream()
|
||||
.forEach(entry -> {
|
||||
int num = player.getAmount(
|
||||
0, entry.getValue().getCount(),
|
||||
"Choose how many " + entry.getKey()
|
||||
+ " counters to remove from " + permanent.getLogName(), game
|
||||
);
|
||||
if (num != 0) {
|
||||
counterMap.computeIfAbsent(
|
||||
permanent.getId(), x -> new HashMap<>()
|
||||
).put(entry.getKey(), num);
|
||||
}
|
||||
});
|
||||
}
|
||||
for (Permanent permanent : permanents) {
|
||||
counterMap
|
||||
.get(permanent.getId())
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(entry -> CounterType.findByName(entry.getKey()).createInstance(entry.getValue()))
|
||||
.filter(counter -> creature.addCounters(counter, source, game))
|
||||
.forEach(counter -> permanent.removeCounters(counter, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -284,6 +284,7 @@ public final class Commander2020Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Skycloud Expanse", 312, Rarity.RARE, mage.cards.s.SkycloudExpanse.class));
|
||||
cards.add(new SetCardInfo("Slice and Dice", 159, Rarity.UNCOMMON, mage.cards.s.SliceAndDice.class));
|
||||
cards.add(new SetCardInfo("Slice in Twain", 190, Rarity.UNCOMMON, mage.cards.s.SliceInTwain.class));
|
||||
cards.add(new SetCardInfo("Slippery Bogbonder", 66, Rarity.RARE, mage.cards.s.SlipperyBogbonder.class));
|
||||
cards.add(new SetCardInfo("Smoldering Crater", 313, Rarity.COMMON, mage.cards.s.SmolderingCrater.class));
|
||||
cards.add(new SetCardInfo("Smoldering Marsh", 314, Rarity.RARE, mage.cards.s.SmolderingMarsh.class));
|
||||
cards.add(new SetCardInfo("Soaring Seacliff", 315, Rarity.COMMON, mage.cards.s.SoaringSeacliff.class));
|
||||
|
|
Loading…
Reference in a new issue