mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
initial refactor
This commit is contained in:
parent
ed700e68cc
commit
f5fffcf417
62 changed files with 75 additions and 80 deletions
|
@ -67,7 +67,7 @@ class AleatoryEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.addEffect(new BoostTargetEffect(1, 1, Duration.EndOfTurn), source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class BottleOfSuleimanEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
if (you.flipCoin(game)) {
|
||||
if (you.flipCoin(game, true)) {
|
||||
DjinnToken token = new DjinnToken();
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
return true;
|
||||
|
|
|
@ -67,7 +67,7 @@ class ChaoticGooEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.informPlayers("Chaotic Goo: Won flip. Put a +1/+1 counter on Chaotic Goo.");
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)).apply(game, source);
|
||||
return true;
|
||||
|
|
|
@ -65,7 +65,7 @@ class ChaoticStrikeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.addEffect(new BoostTargetEffect(1, 1, Duration.EndOfTurn), source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class CrazedFirecatEffect extends OneShotEffect {
|
|||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
int flipsWon = 0;
|
||||
while (controller.flipCoin(game)) {
|
||||
while (controller.flipCoin(game, true)) {
|
||||
flipsWon++;
|
||||
}
|
||||
sourceObject.addCounters(CounterType.P1P1.createInstance(flipsWon), source, game);
|
||||
|
|
|
@ -100,7 +100,7 @@ class CreepyDollEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.flipCoin(game)) {
|
||||
if (player.flipCoin(game, true)) {
|
||||
UUID targetId = getTargetPointer().getFirst(game, source);
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class CrookedScalesEffect extends OneShotEffect {
|
|||
Cost cost;
|
||||
String message = "You lost the flip. Pay {3} to prevent your creature from being destroyed?";
|
||||
do {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
if (theirGuy != null) {
|
||||
theirGuy.destroy(controller.getId(), game, false);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.UUID;
|
|||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.PreventDamageBySourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -21,7 +20,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.filter.FilterObject;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetSource;
|
||||
import mage.util.CardUtil;
|
||||
|
@ -70,7 +68,7 @@ class DesperateGambitEffect extends PreventionEffectImpl {
|
|||
this.target.choose(Outcome.Benefit, source.getControllerId(), source.getSourceId(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if(you != null) {
|
||||
wonFlip = you.flipCoin(game);
|
||||
wonFlip = you.flipCoin(game, true);
|
||||
super.init(source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class FickleEfreetChangeControlEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null) {
|
||||
if (!controller.flipCoin(game)) {
|
||||
if (!controller.flipCoin(game, true)) {
|
||||
if (sourcePermanent != null) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
|
||||
|
|
|
@ -64,7 +64,7 @@ class FieryGambitEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
int flipsWon = 0;
|
||||
boolean controllerStopped = false;
|
||||
while (controller.flipCoin(game)) {
|
||||
while (controller.flipCoin(game, true)) {
|
||||
++flipsWon;
|
||||
if (!controller.chooseUse(outcome, "You won " + flipsWon + (flipsWon == 1 ? " flip." : " flips.") +
|
||||
" Flip another coin?", source, game)) {
|
||||
|
|
|
@ -61,7 +61,7 @@ class FightingChanceEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
for (UUID blocker : game.getCombat().getBlockers()) {
|
||||
if (player.flipCoin(game)) {
|
||||
if (player.flipCoin(game, true)) {
|
||||
PreventDamageByTargetEffect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);
|
||||
effect.setTargetPointer(new FixedTarget(blocker));
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -59,7 +59,7 @@ class FlockOfRabidSheepEffect extends OneShotEffect {
|
|||
int repeat = source.getManaCostsToPay().getX();
|
||||
int wonCount = 0;
|
||||
for (int i = 1; i <= repeat; i++) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
wonCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class FreneticEfreetEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
boolean flip = controller.flipCoin(game);
|
||||
boolean flip = controller.flipCoin(game, true);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class FreneticSliverEffect extends OneShotEffect {
|
|||
if (player == null || perm == null) {
|
||||
return false;
|
||||
}
|
||||
if (player.flipCoin(game)) {
|
||||
if (player.flipCoin(game, true)) {
|
||||
return new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true).apply(game, source);
|
||||
} else {
|
||||
return perm.sacrifice(source.getSourceId(), game);
|
||||
|
|
|
@ -63,7 +63,7 @@ class GameOfChaosEffect extends OneShotEffect {
|
|||
if (you != null && targetOpponent != null) {
|
||||
|
||||
boolean continueFlipping = true;
|
||||
boolean youWonFlip = you.flipCoin(game); // controller flips first
|
||||
boolean youWonFlip = you.flipCoin(game, true); // controller flips first
|
||||
boolean youWonLastFlip = false; // tracks if you won the flip last, negation of it means opponent won last
|
||||
int lifeAmount = 1; // starts stakes with 1 life
|
||||
|
||||
|
@ -88,7 +88,7 @@ class GameOfChaosEffect extends OneShotEffect {
|
|||
|
||||
if (continueFlipping) {
|
||||
lifeAmount *= 2; // double the life each time
|
||||
youWonFlip = youWonLastFlip ? you.flipCoin(game) : !targetOpponent.flipCoin(game); // negate the opponent's results for proper evaluation of if you won in next iteration
|
||||
youWonFlip = youWonLastFlip ? you.flipCoin(game, true) : !targetOpponent.flipCoin(game, true); // negate the opponent's results for proper evaluation of if you won in next iteration
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class GoblinArchaeologistEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}else{
|
||||
Permanent targetArtifact = game.getPermanent(source.getFirstTarget());
|
||||
|
|
|
@ -78,7 +78,7 @@ class GoblinArtisansEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
controller.drawCards(1, game);
|
||||
} else {
|
||||
List<Permanent> artifacts = game.getBattlefield().getActivePermanents(new FilterControlledArtifactPermanent(), source.getControllerId(), game);
|
||||
|
|
|
@ -99,7 +99,7 @@ class GoblinAssassinTriggeredEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && !player.flipCoin(game)) {
|
||||
if (player != null && !player.flipCoin(game, true)) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
target.setNotTarget(true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
|
|
|
@ -63,7 +63,7 @@ class GoblinBangchuckersEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
permanent.damage(2, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -72,7 +72,7 @@ class GoblinBombEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.informPlayers("Goblin Bomb: Won flip. Put a fuse counter on Goblin Bomb.");
|
||||
new AddCountersSourceEffect(CounterType.FUSE.createInstance(1)).apply(game, source);
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ class GoblinFestivalChangeControlEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null) {
|
||||
if (!controller.flipCoin(game)) {
|
||||
if (!controller.flipCoin(game, true)) {
|
||||
if (sourcePermanent != null) {
|
||||
Target target = new TargetOpponent(true);
|
||||
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
|
||||
|
|
|
@ -70,7 +70,7 @@ class GoblinKaboomistFlipCoinEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
String message = permanent.getLogName() + " deals 2 damage to itself";
|
||||
game.informPlayers(message);
|
||||
permanent.damage(2, source.getSourceId(), game, false, true);
|
||||
|
|
|
@ -69,7 +69,7 @@ class GoblinKitesEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
return true;
|
||||
} else {
|
||||
new SacrificeSourceEffect().apply(game, source);
|
||||
|
|
|
@ -65,7 +65,7 @@ class GoblinLyreEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayerOrPlaneswalkerController(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
int damage = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent()).calculate(game, source, this);
|
||||
if (opponent != null) {
|
||||
return game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), game, false, true) > 0;
|
||||
|
|
|
@ -60,7 +60,7 @@ class GoblinPsychopathEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
this.wonFlip = game.getPlayer(source.getControllerId()).flipCoin(game);
|
||||
this.wonFlip = game.getPlayer(source.getControllerId()).flipCoin(game, true);
|
||||
super.init(source, game);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAllTriggeredAbility;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.PreventDamageBySourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -16,9 +14,7 @@ import mage.constants.SetTargetPointer;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
@ -61,7 +57,7 @@ class ImpulsiveManeuversEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
this.wonFlip = game.getPlayer(source.getControllerId()).flipCoin(game);
|
||||
this.wonFlip = game.getPlayer(source.getControllerId()).flipCoin(game, true);
|
||||
super.init(source, game);
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ class KarplusanMinotaurCost extends CostImpl {
|
|||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null) {
|
||||
controller.flipCoin(game);
|
||||
controller.flipCoin(game, true);
|
||||
this.paid = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ class ManaClashEffect extends OneShotEffect {
|
|||
if (!targetOpponent.canRespond() || !controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
boolean controllerFlip = controller.flipCoin(game);
|
||||
boolean opponentFlip = targetOpponent.flipCoin(game);
|
||||
boolean controllerFlip = controller.flipCoin(game, true);
|
||||
boolean opponentFlip = targetOpponent.flipCoin(game, true);
|
||||
if (controllerFlip && opponentFlip) {
|
||||
bothHeads = true;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class ManaCryptEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
player.damage(3, source.getSourceId(), game, false, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -88,7 +88,7 @@ class ManaScrewEffect extends BasicManaEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null && player.flipCoin(game)) {
|
||||
if (player != null && player.flipCoin(game, true)) {
|
||||
player.getManaPool().addMana(getMana(game, source), game, source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -57,7 +57,7 @@ class MijaeDjinnEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && creature != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
return true;
|
||||
} else {
|
||||
creature.removeFromCombat(game);
|
||||
|
|
|
@ -77,7 +77,7 @@ class MirrorMarchEffect extends OneShotEffect {
|
|||
int counter = 0;
|
||||
boolean wonFlip = false;
|
||||
do {
|
||||
wonFlip = player.flipCoin(game);
|
||||
wonFlip = player.flipCoin(game, true);
|
||||
if (wonFlip) {
|
||||
counter++;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ class MoggAssassinEffect extends OneShotEffect {
|
|||
}
|
||||
Permanent chosenPermanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
|
||||
Permanent opponentsPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
if (chosenPermanent != null) {
|
||||
chosenPermanent.destroy(source.getSourceId(), game, false);
|
||||
return true;
|
||||
|
|
|
@ -59,7 +59,7 @@ class MoltenBirthEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
MoltenBirthElementalToken token = new MoltenBirthElementalToken();
|
||||
token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId());
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
Card molten = game.getCard(source.getSourceId());
|
||||
if (molten != null) {
|
||||
molten.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
|
|
|
@ -64,7 +64,7 @@ class MoltenSentryEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.informPlayers("Heads: " + permanent.getLogName() + " enters the battlefield as a 5/2 creature with haste");
|
||||
permanent.getPower().modifyBaseValue(5);
|
||||
permanent.getToughness().modifyBaseValue(2);
|
||||
|
|
|
@ -65,7 +65,7 @@ class OddsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.informPlayers("Odds: Spell countered");
|
||||
return game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class OrcishCaptainEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.informPlayers("Orcish Captain: Won flip. Target Orc creature gets +2/+0 until end of turn.");
|
||||
game.addEffect(new BoostTargetEffect(2, 0, Duration.EndOfTurn), source);
|
||||
return true;
|
||||
|
|
|
@ -61,7 +61,7 @@ class PlanarChaosUpkeepEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
Permanent perm = game.getPermanent(source.getSourceId());
|
||||
if (perm != null) {
|
||||
perm.sacrifice(source.getSourceId(), game);
|
||||
|
@ -104,7 +104,7 @@ class PlanarChaosCastAllEffect extends OneShotEffect {
|
|||
if (sourceObject != null && spell != null) {
|
||||
Player caster = game.getPlayer(spell.getControllerId());
|
||||
if (caster != null) {
|
||||
if (!caster.flipCoin(game)) {
|
||||
if (!caster.flipCoin(game, true)) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + spell.getLogName() + " countered");
|
||||
game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class PuppetsVerdictEffect extends OneShotEffect {
|
|||
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
|
||||
FilterCreaturePermanent filterPower2OrLess = new FilterCreaturePermanent("all creatures power 2 or less");
|
||||
filterPower2OrLess.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
|
||||
|
|
|
@ -80,7 +80,7 @@ class RakdosTheShowstopperEffect extends OneShotEffect {
|
|||
&& !permanent.hasSubtype(SubType.DEMON, game)
|
||||
&& !permanent.hasSubtype(SubType.DEVIL, game)
|
||||
&& !permanent.hasSubtype(SubType.IMP, game)
|
||||
&& !player.flipCoin(game)) {
|
||||
&& !player.flipCoin(game, true)) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class RalZarekExtraTurnsEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ class RiskyMoveFlipCoinEffect extends OneShotEffect {
|
|||
}
|
||||
Permanent permanent = game.getPermanent(target1.getFirstTarget());
|
||||
Player chosenOpponent = game.getPlayer(target2.getFirstTarget());
|
||||
if (!controller.flipCoin(game)) {
|
||||
if (!controller.flipCoin(game, true)) {
|
||||
if (permanent != null && chosenOpponent != null) {
|
||||
ContinuousEffect effect = new RiskyMoveCreatureGainControlEffect(Duration.Custom, chosenOpponent.getId());
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
|
|
|
@ -88,7 +88,7 @@ class SabaccGameEffect extends OneShotEffect {
|
|||
if (target.chooseTarget(outcome, opponent.getId(), source, game)) {
|
||||
chosenPermanent = game.getPermanent(target.getFirstTarget());
|
||||
}
|
||||
boolean flipWin = controller.flipCoin(game);
|
||||
boolean flipWin = controller.flipCoin(game, true);
|
||||
if (flipWin) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, controller.getId());
|
||||
effect.setTargetPointer(new FixedTarget(targetPermanent, game));
|
||||
|
|
|
@ -60,7 +60,7 @@ class ScoriaWurmEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
return true;
|
||||
} else {
|
||||
new ReturnToHandSourceEffect().apply(game, source);
|
||||
|
|
|
@ -63,7 +63,7 @@ class SkittishValeskEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null && !controller.flipCoin(game)) {
|
||||
if (controller != null && permanent != null && !controller.flipCoin(game, true)) {
|
||||
return permanent.turnFaceDown(game, source.getControllerId());
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -70,7 +70,7 @@ class SkyclawThrashEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller.flipCoin(game) && sourcePermanent != null) {
|
||||
if (controller.flipCoin(game, true) && sourcePermanent != null) {
|
||||
ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -56,7 +56,7 @@ class SqueesRevengeEffect extends OneShotEffect {
|
|||
int number = player.announceXMana(0, Integer.MAX_VALUE, "Choose how many times to flip a coin", game, source);
|
||||
game.informPlayers(player.getLogName() + " chooses " + number + '.');
|
||||
for(int i = 0; i < number; i++) {
|
||||
if(!player.flipCoin(game)) {
|
||||
if(!player.flipCoin(game, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class StitchInTimeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (player.flipCoin(game)) {
|
||||
if (player.flipCoin(game, true)) {
|
||||
game.getState().getTurnMods().add(new TurnMod(player.getId(), false));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class TavernSwindlerEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
game.informPlayers(controller.getLogName() + " got " + controller.gainLife(6, game, source)+ " live");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class TideOfWarEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Set<UUID> toSacrifice = new HashSet<>();
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
// each blocking creature is sacrificed by its controller
|
||||
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
|
||||
for (UUID blockerId: combatGroup.getBlockers()) {
|
||||
|
|
|
@ -69,8 +69,8 @@ class TwoHeadedGiantEffect extends OneShotEffect {
|
|||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
boolean head1 = player.flipCoin(game);
|
||||
boolean head2 = player.flipCoin(game);
|
||||
boolean head1 = player.flipCoin(game, true);
|
||||
boolean head2 = player.flipCoin(game, true);
|
||||
if (head1 == head2) {
|
||||
if (head1) {
|
||||
game.addEffect(new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn), source);
|
||||
|
|
|
@ -61,7 +61,7 @@ class ViashinoSandswimmerEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
new ReturnToHandSourceEffect().apply(game, source);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -130,7 +130,7 @@ class VolatileRigEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
return permanent.sacrifice(source.getSourceId(), game);
|
||||
|
@ -161,7 +161,7 @@ class VolatileRigEffect2 extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game);
|
||||
for (Permanent permanent : permanents) {
|
||||
|
|
|
@ -58,7 +58,7 @@ class WildWurmEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
return true;
|
||||
} else {
|
||||
new ReturnToHandSourceEffect().apply(game, source);
|
||||
|
|
|
@ -52,7 +52,7 @@ class WinterSkyEffect extends OneShotEffect {
|
|||
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.flipCoin(game)) {
|
||||
if (controller.flipCoin(game, true)) {
|
||||
new DamageEverythingEffect(1).apply(game, source);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -60,7 +60,7 @@ class YdwenEfreetEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent creature = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && creature != null) {
|
||||
if (!controller.flipCoin(game)) {
|
||||
if (!controller.flipCoin(game, true)) {
|
||||
creature.removeFromCombat(game);
|
||||
creature.setMaxBlocks(0);
|
||||
|
||||
|
|
|
@ -2609,13 +2609,13 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Game game) {
|
||||
return computerPlayer.flipCoin(game);
|
||||
public boolean flipCoin(Game game, boolean winnable) {
|
||||
return computerPlayer.flipCoin(game, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Game game, ArrayList<UUID> appliedEffects) {
|
||||
return computerPlayer.flipCoin(game, appliedEffects);
|
||||
public boolean flipCoin(Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
|
||||
return computerPlayer.flipCoin(game, true, appliedEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -642,12 +642,12 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Game game) {
|
||||
public boolean flipCoin(Game game, boolean winnable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Game game, ArrayList<UUID> appliedEffects) {
|
||||
public boolean flipCoin(Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class FlipCoinEffect extends OneShotEffect {
|
|||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
boolean result = true;
|
||||
for (Effect effect : controller.flipCoin(game) ? executingEffectsWon : executingEffectsLost) {
|
||||
for (Effect effect : controller.flipCoin(game, true) ? executingEffectsWon : executingEffectsLost) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
if (effect instanceof OneShotEffect) {
|
||||
result &= effect.apply(game, source);
|
||||
|
|
|
@ -34,7 +34,7 @@ public class FlipUntilLoseEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
while (true) {
|
||||
if (!player.flipCoin(game)) {
|
||||
if (!player.flipCoin(game, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -395,9 +395,9 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean hasProtectionFrom(MageObject source, Game game);
|
||||
|
||||
boolean flipCoin(Game game);
|
||||
boolean flipCoin(Game game, boolean winnable);
|
||||
|
||||
boolean flipCoin(Game game, ArrayList<UUID> appliedEffects);
|
||||
boolean flipCoin(Game game, boolean winnable, ArrayList<UUID> appliedEffects);
|
||||
|
||||
int rollDice(Game game, int numSides);
|
||||
|
||||
|
|
|
@ -2560,17 +2560,18 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Game game) {
|
||||
return this.flipCoin(game, null);
|
||||
public boolean flipCoin(Game game, boolean winnable) {
|
||||
return this.flipCoin(game, true, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param game
|
||||
* @param winnable
|
||||
* @param appliedEffects
|
||||
* @return true if player won the toss
|
||||
*/
|
||||
@Override
|
||||
public boolean flipCoin(Game game, ArrayList<UUID> appliedEffects) {
|
||||
public boolean flipCoin(Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
|
||||
boolean result = RandomUtil.nextBoolean();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("[Flip a coin] " + getLogName() + (result ? " won (head)." : " lost (tail)."));
|
||||
|
|
Loading…
Reference in a new issue