Implemented Legion Warboss

This commit is contained in:
Evan Kranzler 2018-09-03 23:18:13 -04:00
parent 6cfa5b6c45
commit 9ba023ce66
3 changed files with 123 additions and 1 deletions

View file

@ -0,0 +1,121 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.combat.AttacksIfAbleSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.constants.SubType;
import mage.abilities.keyword.MentorAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.token.GoblinToken;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class LegionWarboss extends CardImpl {
public LegionWarboss(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Mentor
this.addAbility(new MentorAbility());
// At the beginning of combat on your turn, create a 1/1 red Goblin creature token. That token gains haste until end of turn and attacks this combat if able.
this.addAbility(new BeginningOfCombatTriggeredAbility(
new LegionWarbossEffect(),
TargetController.YOU, false
));
}
public LegionWarboss(final LegionWarboss card) {
super(card);
}
@Override
public LegionWarboss copy() {
return new LegionWarboss(this);
}
}
class LegionWarbossEffect extends OneShotEffect {
public LegionWarbossEffect() {
super(Outcome.Benefit);
staticText = "create a 1/1 red Goblin creature token. "
+ "That token gains haste until end of turn "
+ "and attacks this combat if able";
}
public LegionWarbossEffect(final LegionWarbossEffect effect) {
super(effect);
}
@Override
public LegionWarbossEffect copy() {
return new LegionWarbossEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
CreateTokenEffect effect = new CreateTokenEffect(new GoblinToken());
effect.apply(game, source);
effect.getLastAddedTokenIds().stream().map((tokenId) -> {
ContinuousEffect continuousEffect = new GainAbilityTargetEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
);
continuousEffect.setTargetPointer(new FixedTarget(tokenId, game));
return continuousEffect;
}).forEachOrdered((continuousEffect) -> {
game.addEffect(continuousEffect, source);
});
effect.getLastAddedTokenIds().stream().map((tokenId) -> {
ContinuousEffect continuousEffect = new GainAbilityTargetEffect(
new LegionWarbossAbility(), Duration.EndOfCombat
);
continuousEffect.setTargetPointer(new FixedTarget(tokenId, game));
return continuousEffect;
}).forEachOrdered((continuousEffect) -> {
game.addEffect(continuousEffect, source);
});
return true;
}
}
class LegionWarbossAbility extends StaticAbility {
public LegionWarbossAbility() {
super(Zone.BATTLEFIELD, new AttacksIfAbleSourceEffect(
Duration.WhileOnBattlefield, false
));
}
public LegionWarbossAbility(LegionWarbossAbility ability) {
super(ability);
}
@Override
public LegionWarbossAbility copy() {
return new LegionWarbossAbility(this);
}
}

View file

@ -27,6 +27,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class));
cards.add(new SetCardInfo("Firemind's Research", 171, Rarity.RARE, mage.cards.f.FiremindsResearch.class));
cards.add(new SetCardInfo("Impervious Greatwurm", 273, Rarity.MYTHIC, mage.cards.i.ImperviousGreatwurm.class));
cards.add(new SetCardInfo("Legion Warboss", 109, Rarity.RARE, mage.cards.l.LegionWarboss.class));
cards.add(new SetCardInfo("Narcomoeba", 47, Rarity.RARE, mage.cards.n.Narcomoeba.class));
cards.add(new SetCardInfo("Necrotic Wound", 79, Rarity.UNCOMMON, mage.cards.n.NecroticWound.class));
cards.add(new SetCardInfo("Overgrown Tomb", 253, Rarity.RARE, mage.cards.o.OvergrownTomb.class));

View file

@ -25,7 +25,7 @@ public class AttacksIfAbleSourceEffect extends RequirementEffect {
super(duration);
this.eachCombat = eachCombat;
if (this.duration == Duration.EndOfTurn) {
staticText = "{this} attacks " + (eachCombat ? "each combat" : "this turn") + " if able";
staticText = "{this} attacks " + (eachCombat ? "each combat" : "this combat") + " if able";
} else {
staticText = "{this} attacks each " + (eachCombat ? "combat" : "turn") + " if able";
}