mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[EOE] Implement Tapestry Warden
This commit is contained in:
parent
ff17fb1125
commit
ce35717f1f
5 changed files with 152 additions and 11 deletions
109
Mage.Sets/src/mage/cards/t/TapestryWarden.java
Normal file
109
Mage.Sets/src/mage/cards/t/TapestryWarden.java
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
package mage.cards.t;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessControlledEffect;
|
||||||
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.mageobject.ToughnessGreaterThanPowerPredicate;
|
||||||
|
import mage.game.Controllable;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class TapestryWarden extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterCreaturePermanent filter
|
||||||
|
= new FilterCreaturePermanent("creature you control with toughness greater than its power");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(ToughnessGreaterThanPowerPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TapestryWarden(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}{G}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.ROBOT);
|
||||||
|
this.subtype.add(SubType.SOLDIER);
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Vigilance
|
||||||
|
this.addAbility(VigilanceAbility.getInstance());
|
||||||
|
|
||||||
|
// Each creature you control with toughness greater than its power assigns combat damage equal to its toughness rather than its power.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new CombatDamageByToughnessControlledEffect(filter)));
|
||||||
|
|
||||||
|
// Each creature you control with toughness greater than its power stations permanents using its toughness rather than its power.
|
||||||
|
this.addAbility(new SimpleStaticAbility(new TapestryWardenEffect()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private TapestryWarden(final TapestryWarden card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TapestryWarden copy() {
|
||||||
|
return new TapestryWarden(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TapestryWardenEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
|
TapestryWardenEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
|
staticText = "each creature you control with toughness greater than its power " +
|
||||||
|
"stations permanents using its toughness rather than its power";
|
||||||
|
}
|
||||||
|
|
||||||
|
private TapestryWardenEffect(final TapestryWardenEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TapestryWardenEffect copy() {
|
||||||
|
return new TapestryWardenEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.STATION_PERMANENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
Optional.ofNullable(event)
|
||||||
|
.map(GameEvent::getTargetId)
|
||||||
|
.map(game::getPermanent)
|
||||||
|
.map(MageObject::getToughness)
|
||||||
|
.map(MageInt::getValue)
|
||||||
|
.ifPresent(event::setAmount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return Optional
|
||||||
|
.ofNullable(event)
|
||||||
|
.map(GameEvent::getTargetId)
|
||||||
|
.map(game::getPermanent)
|
||||||
|
.filter(permanent -> permanent.getPower().getValue() < permanent.getToughness().getValue())
|
||||||
|
.map(Controllable::getControllerId)
|
||||||
|
.filter(source::isControlledBy)
|
||||||
|
.isPresent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -208,6 +208,7 @@ public final class EdgeOfEternities extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Syr Vondam, the Lucent", 232, Rarity.UNCOMMON, mage.cards.s.SyrVondamTheLucent.class));
|
cards.add(new SetCardInfo("Syr Vondam, the Lucent", 232, Rarity.UNCOMMON, mage.cards.s.SyrVondamTheLucent.class));
|
||||||
cards.add(new SetCardInfo("Systems Override", 161, Rarity.UNCOMMON, mage.cards.s.SystemsOverride.class));
|
cards.add(new SetCardInfo("Systems Override", 161, Rarity.UNCOMMON, mage.cards.s.SystemsOverride.class));
|
||||||
cards.add(new SetCardInfo("Tannuk, Memorial Ensign", 233, Rarity.UNCOMMON, mage.cards.t.TannukMemorialEnsign.class));
|
cards.add(new SetCardInfo("Tannuk, Memorial Ensign", 233, Rarity.UNCOMMON, mage.cards.t.TannukMemorialEnsign.class));
|
||||||
|
cards.add(new SetCardInfo("Tapestry Warden", 209, Rarity.UNCOMMON, mage.cards.t.TapestryWarden.class));
|
||||||
cards.add(new SetCardInfo("Temporal Intervention", 120, Rarity.COMMON, mage.cards.t.TemporalIntervention.class));
|
cards.add(new SetCardInfo("Temporal Intervention", 120, Rarity.COMMON, mage.cards.t.TemporalIntervention.class));
|
||||||
cards.add(new SetCardInfo("Terminal Velocity", 338, Rarity.RARE, mage.cards.t.TerminalVelocity.class));
|
cards.add(new SetCardInfo("Terminal Velocity", 338, Rarity.RARE, mage.cards.t.TerminalVelocity.class));
|
||||||
cards.add(new SetCardInfo("Terrapact Intimidator", 164, Rarity.UNCOMMON, mage.cards.t.TerrapactIntimidator.class));
|
cards.add(new SetCardInfo("Terrapact Intimidator", 164, Rarity.UNCOMMON, mage.cards.t.TerrapactIntimidator.class));
|
||||||
|
|
|
||||||
|
|
@ -75,4 +75,23 @@ public class StationTest extends CardTestPlayerBase {
|
||||||
assertTapped(giant, true);
|
assertTapped(giant, true);
|
||||||
checkSpacecraft(3);
|
checkSpacecraft(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String warden = "Tapestry Warden";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTapestryWarden() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, sawship);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, warden);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, devils);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "station");
|
||||||
|
setChoice(playerA, devils);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertTapped(devils, true);
|
||||||
|
checkSpacecraft(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import mage.MageInt;
|
|
||||||
import mage.MageObject;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapTargetCost;
|
import mage.abilities.costs.common.TapTargetCost;
|
||||||
|
|
@ -11,10 +9,10 @@ import mage.constants.Zone;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
|
@ -61,14 +59,21 @@ class StationAbilityEffect extends OneShotEffect {
|
||||||
if (permanent == null) {
|
if (permanent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int power = Optional
|
List<Permanent> creatures = (List<Permanent>) getValue("tappedPermanents");
|
||||||
.ofNullable((List<Permanent>) getValue("tappedPermanents"))
|
if (creatures == null) {
|
||||||
.map(permanents -> permanents
|
return false;
|
||||||
.stream()
|
}
|
||||||
.map(MageObject::getPower)
|
int power = 0;
|
||||||
.mapToInt(MageInt::getValue)
|
for (Permanent creature : creatures) {
|
||||||
.sum())
|
GameEvent event = GameEvent.getEvent(
|
||||||
.orElse(0);
|
GameEvent.EventType.STATION_PERMANENT, creature.getId(),
|
||||||
|
source, source.getControllerId(), creature.getPower().getValue()
|
||||||
|
);
|
||||||
|
if (game.replaceEvent(event)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
power += event.getAmount();
|
||||||
|
}
|
||||||
return power > 0 && permanent.addCounters(CounterType.CHARGE.createInstance(power), source, game);
|
return power > 0 && permanent.addCounters(CounterType.CHARGE.createInstance(power), source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,13 @@ public class GameEvent implements Serializable {
|
||||||
sourceId sourceId of the mount
|
sourceId sourceId of the mount
|
||||||
playerId the id of the controlling player
|
playerId the id of the controlling player
|
||||||
*/
|
*/
|
||||||
|
STATION_PERMANENT,
|
||||||
|
/* STATION_PERMANENT
|
||||||
|
targetId the id of the creature stationing
|
||||||
|
sourceId sourceId of the spaceship or planet
|
||||||
|
playerId the id of the controlling player
|
||||||
|
amount how many counters are being added
|
||||||
|
*/
|
||||||
CAST_SPELL,
|
CAST_SPELL,
|
||||||
CAST_SPELL_LATE,
|
CAST_SPELL_LATE,
|
||||||
/* SPELL_CAST, CAST_SPELL_LATE
|
/* SPELL_CAST, CAST_SPELL_LATE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue