Re: Help implementing a card
Any hints as to why BoostOpponentsEffect isn't doing anything when Sickness wins the vote on Bite of the Black Rose?
- Code: Select all
public class BiteOfTheBlackRose extends CardImpl {
public BiteOfTheBlackRose(UUID ownerId) {
super(ownerId, 26, "Bite of the Black Rose", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{B}");
this.expansionSetCode = "CNS";
// Will of the council - Starting with you, each player votes for sickness or psychosis. If sickness gets more votes, creatures your opponents control get -2/-2 until end of turn. If psychosis gets more votes or the vote is tied, each opponent discards two cards.
this.getSpellAbility().addEffect(new BiteOfTheBlackRoseEffect());
}
public BiteOfTheBlackRose(final BiteOfTheBlackRose card) {
super(card);
}
@Override
public BiteOfTheBlackRose copy() {
return new BiteOfTheBlackRose(this);
}
}
class BiteOfTheBlackRoseEffect extends OneShotEffect {
BiteOfTheBlackRoseEffect() {
super(Outcome.Benefit);
this.staticText = "<i>Will of the council</i> - Starting with you, each player votes for sickness or psychosis. If sickness gets more votes, creatures your opponents control get -2/-2 until end of turn. If psychosis gets more votes or the vote is tied, each opponent discards two cards";
}
BiteOfTheBlackRoseEffect(final BiteOfTheBlackRoseEffect effect) {
super(effect);
}
@Override
public BiteOfTheBlackRoseEffect copy() {
return new BiteOfTheBlackRoseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int sicknessCount = 0;
int psychosisCount = 0;
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player.chooseUse(Outcome.ExtraTurn, "Choose sickness?", source, game)) {
sicknessCount++;
game.informPlayers(player.getLogName() + " has chosen: sickness");
} else {
psychosisCount++;
game.informPlayers(player.getLogName() + " has chosen: psychosis");
}
}
}
if (sicknessCount > psychosisCount) {
new BoostOpponentsEffect(-2, -2, Duration.EndOfTurn).apply(game, source);
} else {
new DiscardEachPlayerEffect(new StaticValue(2), false, TargetController.OPPONENT).apply(game, source);
}
return true;
}
return false;
}
}