Add Cruel Entertainment

This commit is contained in:
Lyu Zong-Hong
2021-06-20 12:00:28 +09:00
parent 8a96bbb3d4
commit 6e5d79a8e0
2 changed files with 17 additions and 6 deletions

View File

@@ -4,13 +4,14 @@ import java.util.List;
import forge.GameCommand;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.util.Lang;
import forge.util.TextUtil;
/**
/**
* TODO: Write javadoc for this type.
*
*/
@@ -18,16 +19,18 @@ public class ControlPlayerEffect extends SpellAbilityEffect {
@Override
protected String getStackDescription(SpellAbility sa) {
List<Player> tgtPlayers = getTargetPlayers(sa);
return TextUtil.concatWithSpace(sa.getActivatingPlayer().toString(),"controls", Lang.joinHomogenous(tgtPlayers),"during their next turn");
}
@SuppressWarnings("serial")
@Override
public void resolve(SpellAbility sa) {
final Player activator = sa.getActivatingPlayer();
final Game game = activator.getGame();
final Player controller = sa.hasParam("Controller") ? AbilityUtils.getDefinedPlayers(
sa.getHostCard(), sa.getParam("Controller"), sa).get(0) : activator;
List<Player> tgtPlayers = getTargetPlayers(sa);
@@ -37,13 +40,13 @@ public class ControlPlayerEffect extends SpellAbilityEffect {
@Override
public void run() {
// CR 800.4b
if (activator.hasLost()) {
if (controller.hasLost()) {
return;
}
long ts = game.getNextTimestamp();
pTarget.addController(ts, activator);
pTarget.addController(ts, controller);
// on following cleanup release control
game.getEndOfTurn().addUntil(new GameCommand() {
@Override

View File

@@ -0,0 +1,8 @@
Name:Cruel Entertainment
ManaCost:6 B
Types:Sorcery
# Turn targeted player into chosen
A:SP$ ChoosePlayer | ValidTgts$ Player | TargetUnique$ True | Choices$ ThisTargetedPlayer | Defined$ You | SubAbility$ DBControlPlayer1 | StackDescription$ SpellDescription | SpellDescription$ Choose target player and another target player. The first player controls the second player during the second player's next turn, and the second player controls the first player during the first player's next turn.
SVar:DBControlPlayer1:DB$ ControlPlayer | ValidTgts$ Player | TargetUnique$ True | TgtPrompt$ Choose another target player | Controller$ Player.Chosen | SubAbility$ DBControlPlayer2 | StackDescription$ None
SVar:DBControlPlayer2:DB$ ControlPlayer | Defined$ Player.Chosen | Controller$ ParentTarget | StackDescription$ None
Oracle:Choose target player and another target player. The first player controls the second player during the second player's next turn, and the second player controls the first player during the first player's next turn.