Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion forge-core/src/main/java/forge/deck/DeckBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

public abstract class DeckBase implements Serializable, Comparable<DeckBase>, InventoryItem {
private static final long serialVersionUID = -7538150536939660052L;
// gameType is from Constant.GameType, like GameType.Regular

private String name;
private transient String directory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public enum AbilityKey {
Exploited("Exploited"),
Explored("Explored"),
Explorer("Explorer"),
ExtraDraws("ExtraDraws"),
ExtraTurn("ExtraTurn"),
ETB("ETB"),
Fighter("Fighter"),
Expand Down
9 changes: 8 additions & 1 deletion forge-game/src/main/java/forge/game/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class Player extends GameEntity implements Comparable<Player> {
private boolean unlimitedHandSize = false;
private Card lastDrawnCard;
private int numDrawnThisTurn;
private int numExtraDrawnThisTurn;
private int numDrawnLastTurn;
private int numDrawnThisDrawStep;
private int numCardsInHandStartedThisTurnWith;
Expand Down Expand Up @@ -1194,6 +1195,7 @@ private CardCollectionView doDraw(Map<Player, CardCollection> revealed, SpellAbi
if (gameStarted) {
Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(this);
repParams.put(AbilityKey.Cause, cause);
repParams.put(AbilityKey.ExtraDraws, numExtraDrawnThisTurn);
if (params != null) {
repParams.putAll(params);
}
Expand Down Expand Up @@ -1223,7 +1225,7 @@ private CardCollectionView doDraw(Map<Player, CardCollection> revealed, SpellAbi

// CR 121.6c additional actions can't be performed when draw gets replaced
// but "drawn this way" effects should still count them
if (cause != null && cause.hasParam("RememberDrawn") && cause.getParam("RememberDrawn").equals("AllReplaced")) {
if (cause != null && "AllReplaced".equals(cause.getParam("RememberDrawn"))) {
cause.getHostCard().addRemembered(drawn);
}

Expand All @@ -1238,8 +1240,12 @@ private CardCollectionView doDraw(Map<Player, CardCollection> revealed, SpellAbi
setLastDrawnCard(c);
c.setDrawnThisTurn(true);
numDrawnThisTurn++;
numExtraDrawnThisTurn++;
if (game.getPhaseHandler().is(PhaseType.DRAW)) {
numDrawnThisDrawStep++;
if (numDrawnThisDrawStep == 1) {
numExtraDrawnThisTurn--;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong. What if you draw during a different players draw step?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if you skip your "normal" draw to Pursuit of Knowledge, but then extra draw during your draw step. @tool4ever

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why I'm checking for it in ReplaceDraw again
not sure if that can be consolidated differently

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats wrong with checking sa == null like I originally had?

}
}
view.updateNumDrawnThisTurn(this);

Expand Down Expand Up @@ -1273,6 +1279,7 @@ public final void resetNumDrawnThisDrawStep() {

public final void resetNumDrawnThisTurn() {
numDrawnThisTurn = 0;
numExtraDrawnThisTurn = 0;
view.updateNumDrawnThisTurn(this);
}

Expand Down
16 changes: 11 additions & 5 deletions forge-game/src/main/java/forge/game/replacement/ReplaceDraw.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.Map;

import forge.game.Game;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
import forge.game.phase.PhaseType;
Expand Down Expand Up @@ -47,18 +46,25 @@ public ReplaceDraw(final Map<String, String> params, final Card host, final bool
*/
@Override
public boolean canReplace(Map<AbilityKey, Object> runParams) {
if (!matchesValidParam("ValidPlayer", runParams.get(AbilityKey.Affected))) {
final Player p = (Player) runParams.get(AbilityKey.Affected);

if (!matchesValidParam("ValidPlayer", p)) {
return false;
}
if (!matchesValidParam("ValidCause", runParams.get(AbilityKey.Cause))) {
return false;
}

final boolean ownDraw = getHostCard().getGame().getPhaseHandler().is(PhaseType.DRAW, p);

if (hasParam("NotFirstCardInDrawStep")) {
final Game game = getHostCard().getGame();
if (p.numDrawnThisDrawStep() == 0 && ownDraw) {
return false;
}
}

final Player p = (Player)runParams.get(AbilityKey.Affected);
if (p.numDrawnThisDrawStep() == 0 && game.getPhaseHandler().is(PhaseType.DRAW, p)) {
if (hasParam("FirstExtraCardDrawnThisTurn")) {
if ((int) runParams.get(AbilityKey.ExtraDraws) != (ownDraw ? 1 : 0)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what ownDraw has to do with extra draws at all?

return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Name:Reed Richards, Smartest Man
ManaCost:5 U
Types:Legendary Creature Human Scientist Hero
PT:2/4
K:Reach
S:Mode$ Continuous | Affected$ You | SetMaxHandSize$ Unlimited | Description$ You have no maximum hand size.
R:Event$ Draw | ActiveZones$ Battlefield | ValidPlayer$ You | FirstExtraCardDrawnThisTurn$ True | ReplaceWith$ DrawFour | Description$ The first time you would draw a card each turn except the first card you draw during each of your draw steps, you draw four cards instead.
SVar:DrawFour:DB$ Draw | Defined$ You | NumCards$ 4
Oracle:Reach\nYou have no maximum hand size.\nThe first time you would draw a card each turn except the first card you draw during each of your draw steps, you draw four cards instead.
2 changes: 1 addition & 1 deletion forge-gui/src/main/java/forge/gui/card/CardDetailUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public static String composeCardText(final CardStateView state, final GameView g
for (final Entry<String, String> e : Sets.union(changedColorWords.entrySet(), changedTypes.entrySet())) {
area.append("Text changed: all instances of ");
if (e.getKey().equals("Any")) {
if (changedColorWords.containsKey(e.getValue())) {
if (changedColorWords.containsValue(e.getValue())) {
area.append("color words");
} else if (forge.card.CardType.getBasicTypes().contains(e.getValue())) {
area.append("basic land types");
Expand Down
Loading