mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
[LTR] Implement Dunland Crebain
This commit is contained in:
parent
82073bba73
commit
b9f31eb937
27 changed files with 213 additions and 72 deletions
|
|
@ -1,10 +1,9 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -12,14 +11,15 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.OrcArmyToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.ZombieArmyToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
|
@ -31,28 +31,23 @@ public class AmassEffect extends OneShotEffect {
|
|||
filter.add(SubType.ARMY.getPredicate());
|
||||
}
|
||||
|
||||
private final DynamicValue amassNumber;
|
||||
private UUID amassedCreatureId = null;
|
||||
private final int amount;
|
||||
private final SubType subType;
|
||||
|
||||
public AmassEffect(int amassNumber) {
|
||||
this(StaticValue.get(amassNumber));
|
||||
staticText = "amass " + amassNumber + ". <i>(Put " + CardUtil.numberToText(amassNumber)
|
||||
+ " +1/+1 counter" + (amassNumber > 1 ? "s " : " ")
|
||||
+ "on an Army you control. If you don't control one, "
|
||||
+ "create a 0/0 black Zombie Army creature token first.)</i>";
|
||||
}
|
||||
|
||||
public AmassEffect(DynamicValue amassNumber) {
|
||||
public AmassEffect(int amount, SubType subType) {
|
||||
super(Outcome.BoostCreature);
|
||||
this.amassNumber = amassNumber;
|
||||
staticText = "amass X, where X is the number of " + amassNumber.getMessage() + ". <i>(Put X +1/+1 counters"
|
||||
+ "on an Army you control. If you don't control one, "
|
||||
+ "create a 0/0 black Zombie Army creature token first.)</i>";
|
||||
this.amount = amount;
|
||||
this.subType = subType;
|
||||
staticText = "amass " + subType + "s " + amount + ". <i>(Put " + CardUtil.numberToText(amount) +
|
||||
" +1/+1 counter" + (amount > 1 ? "s " : " ") + "on an Army you control. It's also " +
|
||||
subType.getIndefiniteArticle() + ' ' + subType + ". If you don't control an Army, " +
|
||||
"create a 0/0 black " + subType + " Army creature token first.)</i>";
|
||||
}
|
||||
|
||||
private AmassEffect(final AmassEffect effect) {
|
||||
super(effect);
|
||||
this.amassNumber = effect.amassNumber;
|
||||
this.amount = effect.amount;
|
||||
this.subType = effect.subType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -62,29 +57,42 @@ public class AmassEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int xValue = amassNumber.calculate(game, source, this);
|
||||
return doAmass(amount, subType, game, source) != null;
|
||||
}
|
||||
|
||||
private static Token makeToken(SubType subType) {
|
||||
switch (subType) {
|
||||
case ORC:
|
||||
return new OrcArmyToken();
|
||||
default:
|
||||
case ZOMBIE:
|
||||
return new ZombieArmyToken();
|
||||
}
|
||||
}
|
||||
|
||||
public static Permanent doAmass(int xValue, SubType subType, Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
if (!game.getBattlefield().containsControlled(filter, source, game, 1)) {
|
||||
new CreateTokenEffect(new ZombieArmyToken()).apply(game, source);
|
||||
if (!game.getBattlefield().contains(filter, source, game, 1)) {
|
||||
makeToken(subType).putOntoBattlefield(1, game, source);
|
||||
}
|
||||
Target target = new TargetPermanent(filter);
|
||||
target.setNotTarget(true);
|
||||
if (!player.choose(outcome, target, source, game)) {
|
||||
return false;
|
||||
}
|
||||
player.choose(Outcome.BoostCreature, target, source, game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(xValue), source.getControllerId(), source, game);
|
||||
this.amassedCreatureId = permanent.getId();
|
||||
return true;
|
||||
}
|
||||
|
||||
public UUID getAmassedCreatureId() {
|
||||
return amassedCreatureId;
|
||||
game.addEffect(new AddCardSubTypeTargetEffect(subType, Duration.Custom)
|
||||
.setTargetPointer(new FixedTarget(permanent, game)), source);
|
||||
if (xValue > 0) {
|
||||
permanent.addCounters(
|
||||
CounterType.P1P1.createInstance(xValue),
|
||||
source.getControllerId(), source, game
|
||||
);
|
||||
}
|
||||
return permanent;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class OrcArmyToken extends TokenImpl {
|
||||
|
||||
public OrcArmyToken() {
|
||||
super("Orc Army Token", "0/0 black Orc Army creature token");
|
||||
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setBlack(true);
|
||||
subtype.add(SubType.ORC);
|
||||
subtype.add(SubType.ARMY);
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
}
|
||||
|
||||
private OrcArmyToken(final OrcArmyToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrcArmyToken copy() {
|
||||
return new OrcArmyToken(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue