implement [MH3] Shadow of the Second Sun

This commit is contained in:
Susucre 2024-06-05 22:30:53 +02:00
parent 66a1dcd707
commit 98f910a892
3 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,75 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfPostCombatMainTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.turn.TurnMod;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
* @author Susucr
*/
public final class ShadowOfTheSecondSun extends CardImpl {
public ShadowOfTheSecondSun(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}{U}");
this.subtype.add(SubType.AURA);
// Enchant player
TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
this.addAbility(new EnchantAbility(auraTarget));
// At the beginning of enchanted player's postcombat main phase, there is an additional beginning phase after this phase.
this.addAbility(new BeginningOfPostCombatMainTriggeredAbility(
new ShadowOfTheSecondSunTargetEffect(),
TargetController.ENCHANTED, false
));
}
private ShadowOfTheSecondSun(final ShadowOfTheSecondSun card) {
super(card);
}
@Override
public ShadowOfTheSecondSun copy() {
return new ShadowOfTheSecondSun(this);
}
}
class ShadowOfTheSecondSunTargetEffect extends OneShotEffect {
ShadowOfTheSecondSunTargetEffect() {
super(Outcome.Benefit);
this.staticText = "there is an additional beginning phase after this phase";
}
private ShadowOfTheSecondSunTargetEffect(final ShadowOfTheSecondSunTargetEffect effect) {
super(effect);
}
@Override
public ShadowOfTheSecondSunTargetEffect copy() {
return new ShadowOfTheSecondSunTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
UUID playerId = this.getTargetPointer().getFirst(game, source);
if (playerId == null) {
return false;
}
game.getState().getTurnMods().add(new TurnMod(playerId).withExtraPhase(TurnPhase.BEGINNING));
return true;
}
}

View file

@ -240,6 +240,7 @@ public final class ModernHorizons3 extends ExpansionSet {
cards.add(new SetCardInfo("Seething Landscape", 225, Rarity.COMMON, mage.cards.s.SeethingLandscape.class));
cards.add(new SetCardInfo("Serum Visionary", 69, Rarity.COMMON, mage.cards.s.SerumVisionary.class));
cards.add(new SetCardInfo("Sevinne's Reclamation", 267, Rarity.RARE, mage.cards.s.SevinnesReclamation.class));
cards.add(new SetCardInfo("Shadow of the Second Sun", 70, Rarity.MYTHIC, mage.cards.s.ShadowOfTheSecondSun.class));
cards.add(new SetCardInfo("Shattered Landscape", 226, Rarity.COMMON, mage.cards.s.ShatteredLandscape.class));
cards.add(new SetCardInfo("Sheltering Landscape", 227, Rarity.COMMON, mage.cards.s.ShelteringLandscape.class));
cards.add(new SetCardInfo("Shifting Woodland", 228, Rarity.RARE, mage.cards.s.ShiftingWoodland.class));

View file

@ -6,6 +6,7 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
@ -73,6 +74,15 @@ public class BeginningOfPostCombatMainTriggeredAbility extends TriggeredAbilityI
}
}
return true;
case ENCHANTED:
Permanent permanent = getSourcePermanentIfItStillExists(game);
if (permanent == null || !game.isActivePlayer(permanent.getAttachedTo())) {
break;
}
if (getTargets().isEmpty()) {
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
return false;
}
@ -85,6 +95,8 @@ public class BeginningOfPostCombatMainTriggeredAbility extends TriggeredAbilityI
return "At the beginning of each opponent's postcombat main phase, " + generateZoneString();
case ANY:
return "At the beginning of each player's postcombat main phase, " + generateZoneString();
case ENCHANTED:
return "At the beginning of enchanted player's postcombat main phase, " + generateZoneString();
}
return "";
}