mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[CLB] Implemented Trailblazer's Torch
This commit is contained in:
parent
23ed717c8c
commit
e3301a6485
3 changed files with 112 additions and 9 deletions
85
Mage.Sets/src/mage/cards/t/TrailblazersTorch.java
Normal file
85
Mage.Sets/src/mage/cards/t/TrailblazersTorch.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesBlockedAttachedTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TakeTheInitiativeEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.common.BlockingOrBlockedWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TrailblazersTorch extends CardImpl {
|
||||
|
||||
public TrailblazersTorch(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// When Trailblazer's Torch enters the battlefield, you take the initiative.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new TakeTheInitiativeEffect()));
|
||||
|
||||
// Whenever equipped creature becomes blocked, it deals 2 damage to each creature blocking it.
|
||||
this.addAbility(new BecomesBlockedAttachedTriggeredAbility(
|
||||
new TrailblazersTorchEffect(), false
|
||||
).setTriggerPhrase("Whenever equipped creature becomes blocked, "));
|
||||
|
||||
// Equip {1}
|
||||
this.addAbility(new EquipAbility(1));
|
||||
}
|
||||
|
||||
private TrailblazersTorch(final TrailblazersTorch card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrailblazersTorch copy() {
|
||||
return new TrailblazersTorch(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TrailblazersTorchEffect extends OneShotEffect {
|
||||
|
||||
TrailblazersTorchEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "it deals 2 damage to each creature blocking it";
|
||||
}
|
||||
|
||||
private TrailblazersTorchEffect(final TrailblazersTorchEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrailblazersTorchEffect copy() {
|
||||
return new TrailblazersTorchEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent attacker = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||
if (attacker == null) {
|
||||
return false;
|
||||
}
|
||||
for (Permanent blocker : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
source.getControllerId(), source, game
|
||||
)) {
|
||||
if (BlockingOrBlockedWatcher.check(attacker, blocker, game)) {
|
||||
blocker.damage(2, attacker.getId(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -553,6 +553,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Tiamat's Fanatics", 202, Rarity.COMMON, mage.cards.t.TiamatsFanatics.class));
|
||||
cards.add(new SetCardInfo("Tomb of Horrors Adventurer", 100, Rarity.RARE, mage.cards.t.TombOfHorrorsAdventurer.class));
|
||||
cards.add(new SetCardInfo("Topaz Dragon", 153, Rarity.UNCOMMON, mage.cards.t.TopazDragon.class));
|
||||
cards.add(new SetCardInfo("Trailblazer's Torch", 340, Rarity.COMMON, mage.cards.t.TrailblazersTorch.class));
|
||||
cards.add(new SetCardInfo("Traverse the Outlands", 258, Rarity.RARE, mage.cards.t.TraverseTheOutlands.class));
|
||||
cards.add(new SetCardInfo("Treasure Keeper", 341, Rarity.UNCOMMON, mage.cards.t.TreasureKeeper.class));
|
||||
cards.add(new SetCardInfo("Two-Handed Axe", 203, Rarity.UNCOMMON, mage.cards.t.TwoHandedAxe.class));
|
||||
|
|
|
@ -2,23 +2,35 @@ package mage.abilities.common;
|
|||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public class BecomesBlockedAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final SetTargetPointer setTargetPointer;
|
||||
|
||||
public BecomesBlockedAttachedTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, SetTargetPointer.NONE);
|
||||
}
|
||||
|
||||
public BecomesBlockedAttachedTriggeredAbility(Effect effect, boolean optional, SetTargetPointer setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public BecomesBlockedAttachedTriggeredAbility(final BecomesBlockedAttachedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,19 +40,24 @@ public class BecomesBlockedAttachedTriggeredAbility extends TriggeredAbilityImpl
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent equipment = game.getPermanent(sourceId);
|
||||
if (equipment != null
|
||||
&& equipment.getAttachedTo() != null) {
|
||||
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
|
||||
return (equipped != null
|
||||
&& equipped.getId().equals(event.getTargetId()));
|
||||
Permanent permanent = Optional
|
||||
.of(getSourcePermanentOrLKI(game))
|
||||
.filter(Objects::nonNull)
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(game::getPermanent)
|
||||
.orElse(null);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
if (setTargetPointer == SetTargetPointer.PERMANENT) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(permanent, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever enchanted creature becomes blocked, " ;
|
||||
return "Whenever enchanted creature becomes blocked, ";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue