mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
[TDM] Implement Mobilize keyword ability and Dragonback Lancer and Voice of Victory (#13461)
* [TDM] Implement Mobilize keyword ability * [TDM] Implement Dragonback Lancer * [TDM] Implement Voice of Victory * Add Mobilize to keywords.txt --------- Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
parent
e8719caa83
commit
8e6c16de55
7 changed files with 189 additions and 0 deletions
|
|
@ -121,6 +121,17 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
return lastAddedTokenIds;
|
||||
}
|
||||
|
||||
public void sacrificeTokensCreatedAtNextEndStep(Game game, Ability source) {
|
||||
for (UUID tokenId : this.getLastAddedTokenIds()) {
|
||||
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||
if (tokenPermanent != null) {
|
||||
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect();
|
||||
sacrificeEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exileTokensCreatedAtNextEndStep(Game game, Ability source) {
|
||||
for (UUID tokenId : this.getLastAddedTokenIds()) {
|
||||
Permanent tokenPermanent = game.getPermanent(tokenId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.RedWarriorToken;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author balazskristof
|
||||
*/
|
||||
public class MobilizeAbility extends AttacksTriggeredAbility {
|
||||
|
||||
public MobilizeAbility(int count) {
|
||||
super(new MobilizeEffect(count), false, "Mobilize " + count + " <i>(Whenever this creature attacks, create "
|
||||
+ (count == 1 ? "a" : CardUtil.numberToText(count)) + " tapped and attacking 1/1 red Warrior creature "
|
||||
+ (count == 1 ? "token" : "tokens") + ". Sacrifice " + (count == 1 ? "it" : "them")
|
||||
+ " at the beginning of the next end step.)");
|
||||
}
|
||||
|
||||
protected MobilizeAbility(final MobilizeAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobilizeAbility copy() {
|
||||
return new MobilizeAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MobilizeEffect extends OneShotEffect {
|
||||
|
||||
private final int count;
|
||||
|
||||
MobilizeEffect(int count) {
|
||||
super(Outcome.Benefit);
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
private MobilizeEffect(final MobilizeEffect effect) {
|
||||
super(effect);
|
||||
this.count = effect.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobilizeEffect copy() {
|
||||
return new MobilizeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
CreateTokenEffect effect = new CreateTokenEffect(new RedWarriorToken(), this.count, true, true);
|
||||
effect.apply(game, source);
|
||||
effect.sacrificeTokensCreatedAtNextEndStep(game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
* @author balazskristof
|
||||
*/
|
||||
public final class RedWarriorToken extends TokenImpl {
|
||||
|
||||
public RedWarriorToken() {
|
||||
super("Warrior Token", "1/1 red Warrior creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setRed(true);
|
||||
subtype.add(SubType.WARRIOR);
|
||||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
}
|
||||
|
||||
private RedWarriorToken(final RedWarriorToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedWarriorToken copy() {
|
||||
return new RedWarriorToken(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue