-
Notifications
You must be signed in to change notification settings - Fork 909
DanDan Variant #10232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
agylesox
wants to merge
52
commits into
Card-Forge:master
Choose a base branch
from
agylesox:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
DanDan Variant #10232
Changes from 43 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
1481a65
Create DanDan game and deck types
agylesox 7fe42b3
Create DanDan game and deck types
agylesox 6ec7f68
create folder for dandan decks and link to gui
agylesox 6bf621c
selecting the variant dandan in the constructed game menu defaults th…
agylesox 236a847
Added deck type drop down list to deck editor, so each format's rules…
agylesox 30c5237
Deck Editor enforces deck construction rules based on format
agylesox 21ed9bf
Added Secret Lair version of DanDan.dck
agylesox fcaee89
Added deck description to deck editor
agylesox 43e4a1d
Increase size of deck description field in the deck editor
agylesox f70e1b2
DanDan players share a library
agylesox 832309b
Update metadata for DanDan decks
agylesox 3e799fb
added verbose logging for simulation runs
agylesox 244e7b8
added a verbose logging config file
agylesox 189281c
added beginning hand logging as verbose config
agylesox 32ebdd0
updated verbose config file locations search
agylesox 7279756
updated verbose config file for showing first n cards of library at b…
agylesox 12d8309
updated verbose config file for showing first n cards of library at b…
agylesox 45e7363
verbose logging now uses card name and id instead of just card name
agylesox fb47f71
updated view all cards dev mode to flip the cards face up when viewin…
agylesox d4a054b
atttempt to fix gui showing correct library state
agylesox ebe372f
added verbose graveyard logging
agylesox 7e32280
added dandantest deck that scries and discards cards so shared librar…
agylesox 17e13cc
update sim verbose exmaple properties to include graveyard logging
agylesox 990c822
Shared library is working, drawer of card becomes owner of card so AI…
agylesox 5382dcf
add dandanviewzones
agylesox 4ca8029
fixed shared graveyard
agylesox 7f3148f
fixed shared graveyard for controller
agylesox eca0933
fixed shared graveyard for controller
agylesox d366ebe
added more dandan decks
agylesox 324f651
add separate default layout for dandan
agylesox a53ae34
fix match_dandan.xml
agylesox 1a9207c
hand_1 now available to UI on dandan match start and small dandan xml…
agylesox 19c5aa6
remove verbose logger
agylesox 8bbb723
update gitignore
agylesox a206eae
go back to using .dck comment field instead of description. updates t…
agylesox f98f5a1
use GameRules to enforce dandan like how commander is enforced
agylesox c6febd5
simplify dandan case for random deck generator
agylesox 08d7948
updated deck comment for two dandan decks
agylesox 5b35c5b
hover over name in deck selector now displays comment from .dck. also…
agylesox 267ceb9
hover over name in deck selector now displays comment from .dck. also…
agylesox 4016e6c
Merge remote-tracking branch 'upstream/master'
agylesox 5b6f8e9
update gitignore for branch refactor
agylesox 734be2b
Merge remote-tracking branch 'upstream/master'
agylesox 7880766
Merge branch 'Card-Forge:master' into master
agylesox 48f4fc5
refactor dandan and clean up
agylesox 0abb4b1
Merge branch 'master' of github.com:agylesox/forge
agylesox a4fa403
Merge remote-tracking branch 'upstream/master'
agylesox 519b4d9
Merge remote-tracking branch 'upstream/master'
agylesox 51b6110
dandan change zone fixes
agylesox d463f3a
fixed dandan fetch lands entering correct players battlefield
agylesox b3242e0
disable bad fetch test
agylesox 8f7d0ef
Merge remote-tracking branch 'upstream/master'
agylesox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
.m2repo/org/apache/maven/wagon/wagon-ftp/3.5.3/wagon-ftp-3.5.3.pom.lastUpdated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. | ||
| #Mon Mar 23 05:40:04 EDT 2026 | ||
| @default-central-https\://repo.maven.apache.org/maven2/.lastUpdated=1774258804369 | ||
| https\://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.apache.maven.wagon\:wagon-ftp\:pom\:3.5.3 from/to central (https\://repo.maven.apache.org/maven2)\: repo.maven.apache.org\: nodename nor servname provided, or not known | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
forge-game/src/main/java/forge/game/DanDanViewZones.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| package forge.game; | ||
|
|
||
| import java.util.HashSet; | ||
|
|
||
| import forge.card.CardType; | ||
| import forge.game.card.Card; | ||
| import forge.game.card.CardView; | ||
| import forge.game.player.Player; | ||
| import forge.game.player.PlayerView; | ||
| import forge.game.zone.PlayerZone; | ||
| import forge.game.zone.ZoneType; | ||
| import forge.trackable.TrackableProperty; | ||
| import forge.util.collect.FCollectionView; | ||
| import org.tinylog.Logger; | ||
|
|
||
| /** | ||
| * Canonical {@link PlayerView} source for DanDan shared {@link ZoneType#Library} and | ||
| * {@link ZoneType#Graveyard}: each seat may carry its own trackable copy, but UI and verbose tooling | ||
| * should use the first registered player's lists so order and counts match the engine and sim. | ||
| */ | ||
| public final class DanDanViewZones { | ||
|
|
||
| private static final boolean DEBUG_SYNC = Boolean.getBoolean("forge.debug.dandan.sync"); | ||
|
|
||
| private DanDanViewZones() { | ||
| } | ||
|
|
||
| /** Prefer live {@link Game} rules when present so UI matches sim even if trackable {@link GameType} lags. */ | ||
| public static boolean isDanDan(final GameView gameView) { | ||
| if (gameView == null) { | ||
| return false; | ||
| } | ||
| final Game g = gameView.getGame(); | ||
| if (g != null) { | ||
| final GameRules rules = g.getRules(); | ||
| if (rules != null && rules.isDanDan()) { | ||
| return true; | ||
| } | ||
| } | ||
| final Match match = gameView.getMatch(); | ||
| if (match != null) { | ||
| final GameRules rules = match.getRules(); | ||
| if (rules != null && rules.isDanDan()) { | ||
| return true; | ||
| } | ||
| } | ||
| return gameView.getGameType() == GameType.DanDan; | ||
| } | ||
|
|
||
| /** | ||
| * Card list to show for {@code player} in {@code zone}. For DanDan library/graveyard, returns the | ||
| * first player's list. | ||
| */ | ||
| public static FCollectionView<CardView> cardsForZoneDisplay(final GameView gameView, final PlayerView player, | ||
| final ZoneType zone) { | ||
| if (gameView != null && isDanDan(gameView) | ||
| && (zone == ZoneType.Library || zone == ZoneType.Graveyard)) { | ||
| // Prefer live model zone order when available (desktop local games). | ||
| final Game g = gameView.getGame(); | ||
| if (g != null && !g.getPlayers().isEmpty()) { | ||
| final Player canonical = g.getPlayers().get(0); | ||
| final PlayerZone sharedZone = canonical.getZone(zone); | ||
| if (sharedZone != null) { | ||
| final Iterable<Card> liveCards = sharedZone.getCards(false); | ||
| return CardView.getCollection(liveCards); | ||
| } | ||
| } | ||
|
|
||
| final FCollectionView<PlayerView> players = gameView.getPlayers(); | ||
| if (players != null && !players.isEmpty()) { | ||
| final FCollectionView<CardView> shared = players.get(0).getCards(zone); | ||
| if (DEBUG_SYNC) { | ||
| final FCollectionView<CardView> local = player.getCards(zone); | ||
| final String sharedHash = shortIdHash(shared); | ||
| final String localHash = shortIdHash(local); | ||
| if (!sharedHash.equals(localHash)) { | ||
| Logger.debug("DanDan view mismatch {} {} shared={} local={} player={}", | ||
| zone, gameView.getTurn(), sharedHash, localHash, player.getName()); | ||
| } | ||
| } | ||
| if (shared != null) { | ||
| return shared; | ||
| } | ||
| } | ||
| } | ||
| return player == null ? null : player.getCards(zone); | ||
| } | ||
|
|
||
| /** Count aligned with {@link #cardsForZoneDisplay}. */ | ||
| public static int zoneCountForDisplay(final GameView gameView, final PlayerView player, final ZoneType zone) { | ||
| final FCollectionView<CardView> cards = cardsForZoneDisplay(gameView, player, zone); | ||
| return cards == null ? 0 : cards.size(); | ||
| } | ||
|
|
||
| /** | ||
| * Distinct card types in graveyard for UI (e.g. tooltips, delirium tint); uses canonical list in DanDan. | ||
| */ | ||
| public static int graveyardTypeCountForDisplay(final GameView gameView, final PlayerView player) { | ||
| if (gameView != null && isDanDan(gameView)) { | ||
| final FCollectionView<CardView> cards = cardsForZoneDisplay(gameView, player, ZoneType.Graveyard); | ||
| if (cards == null) { | ||
| return 0; | ||
| } | ||
| final HashSet<CardType.CoreType> types = new HashSet<>(); | ||
| for (final CardView c : cards) { | ||
| types.addAll(c.getCurrentState().getType().getCoreTypes()); | ||
| } | ||
| return types.size(); | ||
| } | ||
| return player == null ? 0 : player.getZoneTypes(TrackableProperty.Graveyard); | ||
| } | ||
|
|
||
| /** Delirium highlight in zone tabs; uses canonical graveyard in DanDan. */ | ||
| public static boolean hasDeliriumForDisplay(final GameView gameView, final PlayerView player) { | ||
| if (player == null) { | ||
| return false; | ||
| } | ||
| return graveyardTypeCountForDisplay(gameView, player) >= 4; | ||
| } | ||
|
|
||
| private static String shortIdHash(final Iterable<CardView> cards) { | ||
| if (cards == null) { | ||
| return "null"; | ||
| } | ||
| int count = 0; | ||
| int hash = 1; | ||
| for (final CardView c : cards) { | ||
| count++; | ||
| hash = 31 * hash + (c == null ? 0 : c.getId()); | ||
| } | ||
| return count + ":" + Integer.toHexString(hash); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.