mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
refactored Strata Scythe with Imprint api
This commit is contained in:
parent
0d85e99c3c
commit
bc6bcf44e8
1 changed files with 12 additions and 13 deletions
|
@ -47,6 +47,7 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.common.FilterLandCard;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
|
@ -96,6 +97,10 @@ class StrataScytheImprintEffect extends OneShotEffect<StrataScytheImprintEffect>
|
|||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
card.moveToExile(source.getSourceId(), "Strata Scythe", source.getId(), game);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.imprint(card.getId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
|
@ -123,18 +128,12 @@ class SameNameAsExiledCountValue implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
int value = 0;
|
||||
ExileZone exile = game.getExile().getExileZone(sourceAbility.getSourceId());
|
||||
if (exile != null) {
|
||||
UUID lastId = null;
|
||||
for (UUID cardId: exile) {
|
||||
lastId = cardId;
|
||||
}
|
||||
if (lastId != null) {
|
||||
Permanent permanent = game.getPermanent(sourceAbility.getSourceId());
|
||||
if (permanent != null && permanent.getImprinted().size() > 0) {
|
||||
FilterPermanent filterPermanent = new FilterPermanent();
|
||||
filterPermanent.getName().add(game.getCard(lastId).getName());
|
||||
filterPermanent.getName().add(game.getCard(permanent.getImprinted().get(0)).getName());
|
||||
value = game.getBattlefield().countAll(filterPermanent);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue