[CLB] Implemented Balor

This commit is contained in:
Evan Kranzler 2022-06-06 19:49:42 -04:00
parent a6f977c0e4
commit 1899fa0def
10 changed files with 191 additions and 122 deletions

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
@ -10,34 +8,40 @@ import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class DrawDiscardTargetEffect extends OneShotEffect {
private int cardsToDraw;
private int cardsToDiscard;
public DrawDiscardTargetEffect() {
this(1,1);
}
private final int cardsToDraw;
private final int cardsToDiscard;
private final boolean random;
public DrawDiscardTargetEffect(int cardsToDraw, int cardsToDiscard) {
this(cardsToDraw, cardsToDiscard, false);
}
public DrawDiscardTargetEffect(int cardsToDraw, int cardsToDiscard, boolean random) {
super(Outcome.DrawCard);
this.cardsToDraw = cardsToDraw;
this.cardsToDiscard = cardsToDiscard;
staticText = new StringBuilder("Target player draws ")
.append(cardsToDraw == 1?"a": CardUtil.numberToText(cardsToDraw))
.append(" card").append(cardsToDraw == 1?"": "s")
this.random = random;
staticText = new StringBuilder("target player draws ")
.append(CardUtil.numberToText(cardsToDraw, "a"))
.append(" card")
.append(cardsToDraw > 1 ? "s" : "")
.append(", then discards ")
.append(cardsToDiscard == 1?"a": CardUtil.numberToText(cardsToDiscard))
.append(" card").append(cardsToDiscard == 1?"": "s").toString();
.append(CardUtil.numberToText(cardsToDiscard, "a"))
.append(" card")
.append(cardsToDiscard > 1 ? "s" : "")
.append(random ? "at random" : "")
.toString();
}
public DrawDiscardTargetEffect(final DrawDiscardTargetEffect effect) {
private DrawDiscardTargetEffect(final DrawDiscardTargetEffect effect) {
super(effect);
this.cardsToDraw = effect.cardsToDraw;
this.cardsToDiscard = effect.cardsToDiscard;
this.random = effect.random;
}
@Override
@ -50,10 +54,9 @@ public class DrawDiscardTargetEffect extends OneShotEffect {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
player.drawCards(cardsToDraw, source, game);
player.discard(cardsToDiscard, false, false, source, game);
player.discard(cardsToDiscard, random, false, source, game);
return true;
}
return false;
}
}

View file

@ -39,10 +39,10 @@ public interface Target extends Serializable {
/**
* Returns a set of all possible targets that match the criteria of the implemented Target class.
*
* @param sourceControllerId UUID of the ability's controller
* @param source Ability which requires the targets
* @param game Current game
* @return Set of the UUIDs of possible targets
* @param sourceControllerId UUID of the ability's controller
* @param source Ability which requires the targets
* @param game Current game
* @return Set of the UUIDs of possible targets
*/
Set<UUID> possibleTargets(UUID sourceControllerId, Ability source, Game game);
@ -143,7 +143,7 @@ public interface Target extends Serializable {
int getTargetTag();
void setTargetTag(int tag);
Target setTargetTag(int tag);
Target getOriginalTarget();

View file

@ -554,8 +554,9 @@ public abstract class TargetImpl implements Target {
* @param targetTag
*/
@Override
public void setTargetTag(int targetTag) {
public TargetImpl setTargetTag(int targetTag) {
this.targetTag = targetTag;
return this;
}
@Override

View file

@ -1,29 +1,25 @@
package mage.target.common;
import mage.filter.FilterOpponent;
import mage.target.TargetPlayer;
/**
*
* @author BetaSteward_at_googlemail.com
* @author North
*/
public class TargetOpponent extends TargetPlayer {
private static final FilterOpponent filter = new FilterOpponent();
public TargetOpponent() {
this(false);
}
public TargetOpponent(boolean notTarget) {
this(new FilterOpponent(), notTarget);
}
public TargetOpponent(FilterOpponent filter, boolean notTarget) {
super(1, 1, notTarget, filter);
}
public TargetOpponent(final TargetOpponent target) {
private TargetOpponent(final TargetOpponent target) {
super(target);
}