mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
reworked coin doubling again for some reason
This commit is contained in:
parent
191e9903ba
commit
837503d8f4
6 changed files with 34 additions and 52 deletions
|
|
@ -11,6 +11,7 @@ public class FlipCoinEvent extends GameEvent {
|
|||
private boolean result;
|
||||
private final boolean chosen;
|
||||
private final boolean winnable;
|
||||
private int flipCount = 1;
|
||||
|
||||
public FlipCoinEvent(UUID playerId, UUID sourceId, boolean result, boolean chosen, boolean winnable) {
|
||||
super(EventType.FLIP_COIN, playerId, sourceId, playerId);
|
||||
|
|
@ -43,6 +44,14 @@ public class FlipCoinEvent extends GameEvent {
|
|||
return winnable;
|
||||
}
|
||||
|
||||
public int getFlipCount() {
|
||||
return flipCount;
|
||||
}
|
||||
|
||||
public void setFlipCount(int flipCount) {
|
||||
this.flipCount = flipCount;
|
||||
}
|
||||
|
||||
public CoinFlippedEvent getFlippedEvent() {
|
||||
return new CoinFlippedEvent(playerId, sourceId, result, chosen, winnable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,10 +141,6 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
void setLoyaltyUsePerTurn(int loyaltyUsePerTurn);
|
||||
|
||||
int getExtraCoinFlips();
|
||||
|
||||
void setExtraCoinFlips(int getExtraCoinFlips);
|
||||
|
||||
int getMaxHandSize();
|
||||
|
||||
void setMaxHandSize(int maxHandSize);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
protected int landsPlayed;
|
||||
protected int landsPerTurn = 1;
|
||||
protected int loyaltyUsePerTurn = 1;
|
||||
protected int extraCoinFlips = 1;
|
||||
protected int maxHandSize = 7;
|
||||
protected int maxAttackedBy = Integer.MAX_VALUE;
|
||||
protected ManaPool manaPool;
|
||||
|
|
@ -224,7 +223,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.landsPlayed = player.landsPlayed;
|
||||
this.landsPerTurn = player.landsPerTurn;
|
||||
this.loyaltyUsePerTurn = player.loyaltyUsePerTurn;
|
||||
this.extraCoinFlips = player.extraCoinFlips;
|
||||
this.maxHandSize = player.maxHandSize;
|
||||
this.maxAttackedBy = player.maxAttackedBy;
|
||||
this.manaPool = player.manaPool.copy();
|
||||
|
|
@ -315,7 +313,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.landsPlayed = player.getLandsPlayed();
|
||||
this.landsPerTurn = player.getLandsPerTurn();
|
||||
this.loyaltyUsePerTurn = player.getLoyaltyUsePerTurn();
|
||||
this.extraCoinFlips = player.getExtraCoinFlips();
|
||||
this.maxHandSize = player.getMaxHandSize();
|
||||
this.maxAttackedBy = player.getMaxAttackedBy();
|
||||
this.manaPool = player.getManaPool().copy();
|
||||
|
|
@ -436,7 +433,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.abilities.clear();
|
||||
this.landsPerTurn = 1;
|
||||
this.loyaltyUsePerTurn = 1;
|
||||
this.extraCoinFlips = 1;
|
||||
this.maxHandSize = 7;
|
||||
this.maxAttackedBy = Integer.MAX_VALUE;
|
||||
this.canGainLife = true;
|
||||
|
|
@ -2083,16 +2079,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.loyaltyUsePerTurn = loyaltyUsePerTurn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExtraCoinFlips() {
|
||||
return extraCoinFlips;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraCoinFlips(int extraCoinFlips) {
|
||||
this.extraCoinFlips = extraCoinFlips;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHandSize() {
|
||||
return maxHandSize;
|
||||
|
|
@ -2593,12 +2579,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
FlipCoinEvent event = new FlipCoinEvent(playerId, source.getSourceId(), result, chosen, winnable);
|
||||
event.addAppliedEffects(appliedEffects);
|
||||
game.replaceEvent(event);
|
||||
if (extraCoinFlips > 1) {
|
||||
if (event.getFlipCount() > 1) {
|
||||
boolean canChooseHeads = event.getResult();
|
||||
boolean canChooseTails = !event.getResult();
|
||||
boolean tempFlip;
|
||||
for (int i = 0; i < extraCoinFlips; i++) {
|
||||
tempFlip = RandomUtil.nextBoolean();
|
||||
for (int i = 1; i < event.getFlipCount(); i++) {
|
||||
boolean tempFlip = RandomUtil.nextBoolean();
|
||||
canChooseHeads = canChooseHeads || tempFlip;
|
||||
canChooseTails = canChooseTails || !tempFlip;
|
||||
game.informPlayers(getLogName() + " flipped " + CardUtil.booleanToFlipName(tempFlip));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue