mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Fix Unlicensed Hearse (#8985)
Co-authored-by: DeepCrimson <deepcrimson@users.noreplyl.github.com>
This commit is contained in:
parent
c89f22ac52
commit
c1595b0358
1 changed files with 59 additions and 60 deletions
|
@ -19,81 +19,80 @@ import mage.constants.Duration;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInASingleGraveyard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class UnlicensedHearse extends CardImpl {
|
||||
enum UnlicensedHearseValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
private static final Hint hint = new ValueHint("Cards exiled", UnlicensedHearseValue.instance);
|
||||
|
||||
public UnlicensedHearse(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
this.subtype.add(SubType.VEHICLE);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
// {T}: Exile up to two target cards from a single graveyard.
|
||||
Ability ability = new SimpleActivatedAbility(new ExileTargetForSourceEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetCardInASingleGraveyard(
|
||||
0, 2, StaticFilters.FILTER_CARD_CARDS
|
||||
));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Unlicensed Hearse's power and toughness are each equal to the number of cards exiled with it.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL,
|
||||
new SetPowerToughnessSourceEffect(
|
||||
UnlicensedHearseValue.instance, Duration.Custom
|
||||
)
|
||||
).addHint(hint));
|
||||
|
||||
// Crew 2
|
||||
this.addAbility(new CrewAbility(2));
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
ExileZone cardsExiledWithUnlicensedHearse =
|
||||
game.getExile()
|
||||
.getExileZone(
|
||||
CardUtil.getExileZoneId(
|
||||
game,
|
||||
sourceAbility.getSourceId(),
|
||||
game.getState().getZoneChangeCounter(sourceAbility.getSourceId())));
|
||||
if (cardsExiledWithUnlicensedHearse == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private UnlicensedHearse(final UnlicensedHearse card) {
|
||||
super(card);
|
||||
}
|
||||
return cardsExiledWithUnlicensedHearse.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnlicensedHearse copy() {
|
||||
return new UnlicensedHearse(this);
|
||||
}
|
||||
@Override
|
||||
public UnlicensedHearseValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "cards exiled with it";
|
||||
}
|
||||
}
|
||||
|
||||
enum UnlicensedHearseValue implements DynamicValue {
|
||||
instance;
|
||||
public final class UnlicensedHearse extends CardImpl {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return Optional.of(game
|
||||
.getExile()
|
||||
.getExileZone(CardUtil.getExileZoneId(
|
||||
game, sourceAbility.getSourceId(),
|
||||
game.getState().getZoneChangeCounter(sourceAbility.getSourceId())
|
||||
)))
|
||||
.filter(Objects::nonNull)
|
||||
.map(HashSet::size)
|
||||
.orElse(0);
|
||||
}
|
||||
private static final Hint hint = new ValueHint("Cards exiled", UnlicensedHearseValue.instance);
|
||||
|
||||
@Override
|
||||
public UnlicensedHearseValue copy() {
|
||||
return this;
|
||||
}
|
||||
public UnlicensedHearse(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[] {CardType.ARTIFACT}, "{2}");
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "cards exiled with it";
|
||||
}
|
||||
}
|
||||
this.subtype.add(SubType.VEHICLE);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
// {T}: Exile up to two target cards from a single graveyard.
|
||||
Ability ability =
|
||||
new SimpleActivatedAbility(new ExileTargetForSourceEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetCardInASingleGraveyard(0, 2, StaticFilters.FILTER_CARD_CARDS));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Unlicensed Hearse's power and toughness are each equal to the number of cards exiled with it.
|
||||
this.addAbility(
|
||||
new SimpleStaticAbility(
|
||||
Zone.ALL,
|
||||
new SetPowerToughnessSourceEffect(UnlicensedHearseValue.instance, Duration.Custom))
|
||||
.addHint(hint));
|
||||
|
||||
// Crew 2
|
||||
this.addAbility(new CrewAbility(2));
|
||||
}
|
||||
|
||||
private UnlicensedHearse(final UnlicensedHearse card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnlicensedHearse copy() {
|
||||
return new UnlicensedHearse(this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue