mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
[LTC] Implement Banquet Guests (#10706)
* make a StaticFilter for "a food" * [LTC] Implement Banquet Guests Made a Static Filters for controlled food, with the next eldraine set we'll certaintly see more of that. * future proof static text for mulitplier > 2
This commit is contained in:
parent
53b270fc36
commit
fbc0cd61dd
14 changed files with 122 additions and 47 deletions
|
|
@ -9,6 +9,7 @@ import mage.constants.Outcome;
|
|||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -22,16 +23,31 @@ import java.util.UUID;
|
|||
public class EntersBattlefieldWithXCountersEffect extends OneShotEffect {
|
||||
|
||||
protected final Counter counter;
|
||||
private final int multiplier;
|
||||
|
||||
public EntersBattlefieldWithXCountersEffect(Counter counter) {
|
||||
this(counter, 1);
|
||||
}
|
||||
|
||||
public EntersBattlefieldWithXCountersEffect(Counter counter, int multiplier) {
|
||||
super(Outcome.BoostCreature);
|
||||
this.counter = counter;
|
||||
staticText = "with X " + counter.getName() + " counters on it";
|
||||
this.multiplier = multiplier;
|
||||
|
||||
String countText = "X";
|
||||
if (multiplier == 2) {
|
||||
countText = "twice " + countText;
|
||||
}
|
||||
if (multiplier > 2) {
|
||||
countText = CardUtil.numberToText(multiplier) + " times " + countText;
|
||||
}
|
||||
staticText = "with " + countText + " " + counter.getName() + " counters on it";
|
||||
}
|
||||
|
||||
public EntersBattlefieldWithXCountersEffect(final EntersBattlefieldWithXCountersEffect effect) {
|
||||
super(effect);
|
||||
this.counter = effect.counter.copy();
|
||||
this.multiplier = effect.multiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,7 +64,7 @@ public class EntersBattlefieldWithXCountersEffect extends OneShotEffect {
|
|||
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||
&& permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
||||
int amount = spellAbility.getManaCostsToPay().getX();
|
||||
int amount = spellAbility.getManaCostsToPay().getX() * this.multiplier;
|
||||
if (amount > 0) {
|
||||
Counter counterToAdd = counter.copy();
|
||||
counterToAdd.add(amount - counter.getCount());
|
||||
|
|
|
|||
|
|
@ -1202,4 +1202,10 @@ public final class StaticFilters {
|
|||
FILTER_PLAYER_CONTROLLER.add(TargetController.YOU.getPlayerPredicate());
|
||||
FILTER_PLAYER_CONTROLLER.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_FOOD = new FilterControlledPermanent(SubType.FOOD, "Food");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_FOOD.setLockedFilter(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue