forked from External/mage
[BLB] Implement Blacksmith's Talent
This commit is contained in:
parent
5ae583180d
commit
f3d5f6d06a
3 changed files with 151 additions and 0 deletions
119
Mage.Sets/src/mage/cards/b/BlacksmithsTalent.java
Normal file
119
Mage.Sets/src/mage/cards/b/BlacksmithsTalent.java
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.MyTurnCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.GainClassAbilitySourceEffect;
|
||||
import mage.abilities.keyword.ClassLevelAbility;
|
||||
import mage.abilities.keyword.ClassReminderAbility;
|
||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterEquipmentPermanent;
|
||||
import mage.filter.predicate.permanent.EquippedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.SwordToken;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BlacksmithsTalent extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterEquipmentPermanent("equipment you control");
|
||||
private static final FilterPermanent filter2 = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
filter2.add(EquippedPredicate.instance);
|
||||
}
|
||||
|
||||
public BlacksmithsTalent(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}");
|
||||
|
||||
this.subtype.add(SubType.CLASS);
|
||||
|
||||
// (Gain the next level as a sorcery to add its ability.)
|
||||
this.addAbility(new ClassReminderAbility());
|
||||
|
||||
// When Blacksmith's Talent enters, create a colorless Equipment artifact token named Sword with "Equipped creature gets +1/+1" and equip {2}.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new SwordToken())));
|
||||
|
||||
// {2}{R}: Level 2
|
||||
this.addAbility(new ClassLevelAbility(2, "{2}{R}"));
|
||||
|
||||
// At the beginning of combat on your turn, attach target Equipment you control to up to one target creature you control.
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(
|
||||
new BlacksmithsTalentEffect(), TargetController.YOU, false
|
||||
);
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.addTarget(new TargetControlledCreaturePermanent(0, 1));
|
||||
this.addAbility(new SimpleStaticAbility(new GainClassAbilitySourceEffect(ability, 2)));
|
||||
|
||||
// {3}{R}: Level 3
|
||||
this.addAbility(new ClassLevelAbility(3, "{3}{R}"));
|
||||
|
||||
// During your turn, equipped creatures you control have double strike and haste.
|
||||
ability = new SimpleStaticAbility(new ConditionalContinuousEffect(new GainAbilityControlledEffect(
|
||||
DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield, filter2
|
||||
), MyTurnCondition.instance, "during your turn, equipped creatures you control have double strike"));
|
||||
ability.addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(
|
||||
HasteAbility.getInstance(), Duration.WhileOnBattlefield
|
||||
), MyTurnCondition.instance, "and haste"));
|
||||
this.addAbility(new SimpleStaticAbility(new GainClassAbilitySourceEffect(ability, 3)));
|
||||
}
|
||||
|
||||
private BlacksmithsTalent(final BlacksmithsTalent card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacksmithsTalent copy() {
|
||||
return new BlacksmithsTalent(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BlacksmithsTalentEffect extends OneShotEffect {
|
||||
|
||||
BlacksmithsTalentEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.setTargetPointer(new EachTargetPointer());
|
||||
staticText = "attach target Equipment you control to up to one target creature you control";
|
||||
}
|
||||
|
||||
private BlacksmithsTalentEffect(final BlacksmithsTalentEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacksmithsTalentEffect copy() {
|
||||
return new BlacksmithsTalentEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<UUID> targets = this.getTargetPointer().getTargets(game, source);
|
||||
if (targets.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
Permanent equipment = game.getPermanent(targets.get(0));
|
||||
Permanent creature = game.getPermanent(targets.get(1));
|
||||
return equipment != null && creature != null && creature.addAttachment(equipment.getId(), source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ public final class Bloomburrow extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Barkform Harvester", 243, Rarity.COMMON, mage.cards.b.BarkformHarvester.class));
|
||||
cards.add(new SetCardInfo("Baylen, the Haymaker", 205, Rarity.RARE, mage.cards.b.BaylenTheHaymaker.class));
|
||||
cards.add(new SetCardInfo("Bellowing Crier", 42, Rarity.COMMON, mage.cards.b.BellowingCrier.class));
|
||||
cards.add(new SetCardInfo("Blacksmith's Talent", 125, Rarity.UNCOMMON, mage.cards.b.BlacksmithsTalent.class));
|
||||
cards.add(new SetCardInfo("Blooming Blast", 126, Rarity.UNCOMMON, mage.cards.b.BloomingBlast.class));
|
||||
cards.add(new SetCardInfo("Blossoming Sands", 396, Rarity.COMMON, mage.cards.b.BlossomingSands.class));
|
||||
cards.add(new SetCardInfo("Bonebind Orator", 84, Rarity.COMMON, mage.cards.b.BonebindOrator.class));
|
||||
|
|
|
|||
31
Mage/src/main/java/mage/game/permanent/token/SwordToken.java
Normal file
31
Mage/src/main/java/mage/game/permanent/token/SwordToken.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SwordToken extends TokenImpl {
|
||||
|
||||
public SwordToken() {
|
||||
super("Sword", "colorless Equipment artifact token named Sword with \"Equipped creature gets +1/+1\" and equip {2}");
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(1, 1)));
|
||||
|
||||
this.addAbility(new EquipAbility(2));
|
||||
}
|
||||
|
||||
private SwordToken(final SwordToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public SwordToken copy() {
|
||||
return new SwordToken(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue