mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 04:09:54 -08:00
Added test for Sepulchral Primordial.
This commit is contained in:
parent
f4718deae4
commit
e82ee26136
3 changed files with 99 additions and 24 deletions
|
|
@ -122,20 +122,25 @@ class DiluvianPrimordialEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (controller != null && targetCard != null) {
|
||||
if (controller.chooseUse(outcome, "Cast " + targetCard.getName() +"?", game)) {
|
||||
controller.cast(targetCard.getSpellAbility(), game, true);
|
||||
ContinuousEffect effect = new DiluvianPrimordialReplacementEffect();
|
||||
effect.setTargetPointer(new FixedTarget(targetCard.getId()));
|
||||
game.addEffect(effect, source);
|
||||
if (controller != null) {
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (targetCard != null) {
|
||||
if (controller.chooseUse(outcome, "Cast " + targetCard.getLogName() +"?", game)) {
|
||||
// TODO: Handle the case if the cast is not possible, so the replacement effect shouldn't be active
|
||||
ContinuousEffect effect = new DiluvianPrimordialReplacementEffect();
|
||||
effect.setTargetPointer(new FixedTarget(targetCard.getId()));
|
||||
game.addEffect(effect, source);
|
||||
|
||||
controller.cast(targetCard.getSpellAbility(), game, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,9 +169,9 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
Card card = game.getCard(((FixedTarget)getTargetPointer()).getTarget());
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true);
|
||||
controller.moveCards(card, Zone.STACK, Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -181,10 +186,7 @@ class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& ((ZoneChangeEvent) event).getTargetId().equals(getTargetPointer().getFirst(game, source))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& ((ZoneChangeEvent) event).getTargetId().equals(getTargetPointer().getFirst(game, source));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,15 +113,18 @@ class SepulchralPrimordialEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (player != null && targetCard != null) {
|
||||
targetCard.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (targetCard != null) {
|
||||
targetCard.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue