begin fix for multiple copies of Krark's Thumb

This commit is contained in:
Evan Kranzler 2019-01-16 15:11:14 -05:00
parent c34f611279
commit 74c1cbf6d9
4 changed files with 68 additions and 29 deletions

View file

@ -2418,6 +2418,16 @@ public class TestPlayer implements Player {
computerPlayer.setLoyaltyUsePerTurn(loyaltyUsePerTurn);
}
@Override
public int getExtraCoinFlips() {
return computerPlayer.getExtraCoinFlips();
}
@Override
public void setExtraCoinFlips(int extraCoinFlips) {
computerPlayer.setExtraCoinFlips(extraCoinFlips);
}
@Override
public int getMaxHandSize() {
return computerPlayer.getMaxHandSize();

View file

@ -262,6 +262,16 @@ public class PlayerStub implements Player {
}
@Override
public int getExtraCoinFlips() {
return 0;
}
@Override
public void setExtraCoinFlips(int extraCoinFlips) {
}
@Override
public int getMaxHandSize() {
return 0;

View file

@ -74,7 +74,7 @@ public interface Player extends MageItem, Copyable<Player> {
void setLife(int life, Game game, UUID sourceId);
/**
* @param amount amount of life loss
* @param amount amount of life loss
* @param game
* @param atCombat was the source combat damage
* @return
@ -141,6 +141,10 @@ public interface Player extends MageItem, Copyable<Player> {
void setLoyaltyUsePerTurn(int loyaltyUsePerTurn);
int getExtraCoinFlips();
void setExtraCoinFlips(int getExtraCoinFlips);
int getMaxHandSize();
void setMaxHandSize(int maxHandSize);
@ -347,7 +351,7 @@ public interface Player extends MageItem, Copyable<Player> {
* @param target
* @param game
* @param targetPlayerId player whose library will be searched
* @param triggerEvents whether searching will trigger any game events
* @param triggerEvents whether searching will trigger any game events
* @return true if search was successful
*/
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents);
@ -355,6 +359,7 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Reveals all players' libraries. Useful for abilities like Jace, Architect of Thought's -8
* that have effects that require information from all libraries.
*
* @param source
* @param game
* @return
@ -366,23 +371,23 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Plays a card if possible
*
* @param card the card that can be cast
* @param card the card that can be cast
* @param game
* @param noMana if it's a spell i can be cast without paying mana
* @param noMana if it's a spell i can be cast without paying mana
* @param ignoreTiming if it's cast during the resolution of another spell
* no sorcery or play land timing restriction are checked. For a land it has
* to be the turn of the player playing that card.
* @param reference mage object that allows to play the card
* no sorcery or play land timing restriction are checked. For a land it has
* to be the turn of the player playing that card.
* @param reference mage object that allows to play the card
* @return
*/
boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, MageObjectReference reference);
/**
* @param card the land card to play
* @param card the land card to play
* @param game
* @param ignoreTiming false - it won't be checked if the stack is empty and
* you are able to play a Sorcery. It's still checked, if you are able to
* play a land concerning the number of lands you already played.
* you are able to play a Sorcery. It's still checked, if you are able to
* play a land concerning the number of lands you already played.
* @return
*/
boolean playLand(Card card, Game game, boolean ignoreTiming);
@ -528,11 +533,11 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Moves the cards from cards to the bottom of the players library.
*
* @param cards - list of cards that have to be moved
* @param game - game
* @param cards - list of cards that have to be moved
* @param game - game
* @param anyOrder - true if player can determine the order of the cards
* else random order
* @param source - source ability
* else random order
* @param source - source ability
* @return
*/
boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
@ -553,10 +558,10 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Moves the cards from cards to the top of players library.
*
* @param cards - list of cards that have to be moved
* @param game - game
* @param cards - list of cards that have to be moved
* @param game - game
* @param anyOrder - true if player can determine the order of the cards
* @param source - source ability
* @param source - source ability
* @return
*/
boolean putCardsOnTopOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
@ -582,8 +587,8 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Choose the order in which blockers get damage assigned to
*
* @param blockers list of blockers where to choose the next one from
* @param combatGroup the concerning combat group
* @param blockers list of blockers where to choose the next one from
* @param combatGroup the concerning combat group
* @param blockerOrder the already set order of blockers
* @param game
* @return blocker next to add to the blocker order
@ -722,11 +727,11 @@ public interface Player extends MageItem, Copyable<Player> {
* @param toZone
* @param source
* @param game
* @param tapped the cards are tapped on the battlefield
* @param faceDown the cards are face down in the to zone
* @param byOwner the card is moved (or put onto battlefield) by the owner
* of the card and if target zone is battlefield controls the permanent
* (instead of the controller of the source)
* @param tapped the cards are tapped on the battlefield
* @param faceDown the cards are face down in the to zone
* @param byOwner the card is moved (or put onto battlefield) by the owner
* of the card and if target zone is battlefield controls the permanent
* (instead of the controller of the source)
* @param appliedEffects
* @return
*/
@ -762,7 +767,7 @@ public interface Player extends MageItem, Copyable<Player> {
* list of applied effects is not saved
*
* @param card
* @param exileId exile zone id (optional)
* @param exileId exile zone id (optional)
* @param exileName name of exile zone (optional)
* @param sourceId
* @param game
@ -804,7 +809,7 @@ public interface Player extends MageItem, Copyable<Player> {
* @param sourceId
* @param game
* @param fromZone if null, this info isn't postet
* @param toTop to the top of the library else to the bottom
* @param toTop to the top of the library else to the bottom
* @param withName show the card name in the log
* @return
*/
@ -829,10 +834,10 @@ public interface Player extends MageItem, Copyable<Player> {
* without mana (null) or the mana set to manaCosts instead of its normal
* mana costs.
*
* @param sourceId the source that can be cast without mana
* @param sourceId the source that can be cast without mana
* @param manaCosts alternate ManaCost, null if it can be cast without mana
* cost
* @param costs alternate other costs you need to pay
* cost
* @param costs alternate other costs you need to pay
*/
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, Costs<Cost> costs);

View file

@ -98,6 +98,7 @@ 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;
@ -223,6 +224,7 @@ 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();
@ -313,6 +315,7 @@ 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();
@ -433,6 +436,7 @@ 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;
@ -2079,6 +2083,16 @@ 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;