Commit graph

314 commits

Author SHA1 Message Date
ebbit1q
7c20e9ab34
add move cards from top of library until dialog (#4648)
a bit of a hack, the client will use the play top card action and then
compare it with the propmpted expression, as if you were cascading
normally but really fast

the new keybind for this is ctrl shift y

I have ratelimited the action to 10 cards a second
2023-08-06 17:53:07 -04:00
Basile Clement
42e7a8b423
Better support Double-Faced Cards (#4753)
* Better support Double-Faced Cards

This patch allows cards to be (virtually) transformed into other cards
while preserving their state, essentially implemeting the MTG mechanic
of the same name.

On the server side, this is implemented by allowing cards to be "stashed
away". A card that is stashed away is not in any zone, but is instead
owned by another card. When a token is destroyed due to a zone change,
if it had a card stashed away, that card is placed in the target zone
instead of the token.

On the database side, `attach="transform"` is used on `<reverse>` and
`<reverse-related>` to indicate that the created token should be
transformed this way.

Old servers ignore the new field in `Command_CreateToken` and will
perform a regular attachment, as currently.

* Address review comments

* Prevent tokens from being stashed

* format.sh
2023-03-03 16:54:51 +01:00
Basile Clement
9a7b15d19b
Allow revealing specific cards from hand and library (#4743)
Currently Cockatrice allows revealing the whole hand, or one card at
random from the hand. Sometimes, a player needs to reveal a specific
card from their hand instead, which is not supported. To achieve a
similar effect, players usually move the corresponding card (or cards)
to a public zone, then back to their hand. While this works, it is
unsatisfactory (compared to a regular reveal, you can't keep the
"revealed" window around, for one) and somewhat unintuitive.

This patch adds a "Reveal to..." menu to cards and card selections in
the player's hand or in custom zones (this includes looking at the
player's library). This menu allows revealing a card or set of cards to
any given player, or to all players.

To implement this functionality at the protocol level, the existing
RevealCards command is extended to support revealing multiple specific
cards. This is done by making `card_id` a non-packed repeated field in
the `Command_RevealCards` and `Event_RevealCards` protobufs.  Using a
non-packed repeated fields allows maintaining backwards compatibility:
an empty optional field is encoded the same way as an empty non-packed
list, an optional field with a value is encoded the same way as a
one-element non-packed list, and when decoding a multi-elements
non-packed list as an optional, only the last item in the list is read.

Since the RevealCards command already exists, and due to the compatible
encodings, a new client connecting to an old server can reveal a single
specific card from their hand. When trying to reveal multiple cards at
once, the old server will only see the request for one of the cards to
be revealed, and the player will have to reveal each card separately.

On the other hand, `Event_RevealedCards` already has an explicit list of
cards revealed by the server, and the `card_id` field is only used when
exactly one card has been revealed: thus, old and new clients will
behave identically when receiving a new `Event_RevealedCards`. In
particular, if a player using a new client reveals multiple cards from
their hand on a new server, another player using an old client will
correctly see all the revealed cards.

The approach used to build the "Reveal to..." menu is slightly different
from the approach used to build other player selection menus. Because
the "Reveal to..." menu is specific to each card, but must also be
updated whenever a player is added to or removed from the game, I chose
to re-create it on the fly whenever a card is clicked, as that seemed
the safest way to avoid both memory leaks and inconsistent state given
my understanding of the code.
2023-02-07 17:12:04 -05:00
ebbit1q
3d4858b840
use qt6 in arch builds (#4691)
* use qt6 in arch builds

* fix 6.4.0 deprecations
2022-10-31 23:26:13 +01:00
Tobyclark
8e4ddf366c
Added hint when drawing 0 cards (#4697)
* Logging a player drawing 0 cards will now result in the message "player had no cards left to draw."

* Added hint when drawing when deck is empty

* Added hint when drawing when deck is empty

* Added hint when drawing when deck is empty

* Update cockatrice/src/messagelogwidget.cpp

update log message to present tense

Co-authored-by: ebbit1q <ebbit1q@gmail.com>

* added deckIsEmpty parameter to messagelogwidget::logDrawCards

* run format

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2022-10-29 15:46:29 +02:00
ebbit1q
527ac36129
update card menu immediately on card counter event (#4686)
fixes #4658
2022-10-17 16:37:32 -04:00
cajun
40c88fe385
Conjured tokens xml attribute (#4646)
* Conjured xml attr

Add conjured attribute to related xml tags that makes those cards not be destroyed when they leave the battlefield.

* fix build errors, add sarkhan to test

* update oracle importer to support spellbooks from json

* debugging

* fix weird spacing

* fix oracle spacing too

* simplify if/else

Co-authored-by: Zach H <zahalpern+github@gmail.com>

* rename, remove oracle update

* remove extra linebreak

* run format.sh again
2022-09-01 08:45:04 +02:00
cajun
b5305aa5e4
Attach and Unattach apply to entire selection (#4651)
* (un)attach applies to entire selection

* additional code formatting, just because it's nicer

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2022-08-25 21:26:29 -04:00
ZeldaZach
b02adccf87 Support Qt6, Min Qt5.8, Fix Win32, Fix Servatrice
Add lock around deleting arrows for commanding cards

Add support for Qt6 w/ Backwards Qt5

Handle Qt5/6 cross compilation better

Last cleanups

caps matter

Fix serv

Prevent crash on 6.3.0 Linux & bump to 5.8 min

Prevent out of bounds indexing

Delete shutdown timer if it exists

Fixup ticket comments, remove unneeded guards

Try to add support for missing OSes

Update .ci/release_template.md

Update PR based on comments

Update XML name after done and remove Hirsute

Address local game crash

Address comments from PR (again)
Tests don't work on mac, will see if a problem on other OSes

make soundengine more consistent across qt versions

disable tests on distros that are covered by others

Fix Oracle Crash due to bad memory access

Update Oracle to use new Qt6 way of adding translations

Add support for Qt5/Qt6 compiling of Cockatrice

Remove unneeded calls to QtMath/cmath/math.h

Update how we handle bitwise comparisons for enums with Tray Icon

Change header guards to not duplicate function

Leave comment & Fix Path for GHA Qt

Update common/server.h

Update cockatrice/src/window_main.cpp

Rollback change on cmake module path for NSIS

check docker image requirements

add size limit to ccache

put variables in quotes

properly set build type on mac

avoid names used in cmake

fix up cmake module path

cmake 3.10 does not recognize prepend

Support Tests in FindQtRuntime

set ccache size on non debug builds as well

immediately return when removing non existing client

handle incTxBytes with a signal instead

don't set common link libraries in cockatrice/CMakeLists.txt

add comments

set macos qt version to 6

Try upgrading XCode versions to latest they can be supported on

Ensure Qt gets linked

add tmate so i can see what's going on

Qt6 points two directories further down than Qt5 with regard to the top lib path, so we need to account for this

Establish Plugins directory for Qt6

Establish TLS plugins for Qt6 services

Minor change for release channel network manager

Let windows build in parallel cores

Wrong symbols

Qt6 patch up for signal

add missing qt6 package on deb builds

boolean expressions are hard

negative indexes should go to the end

Intentionally fail cache

move size checks to individual zone types

Hardcode libs needed for building on Windows, as the regex was annoying

Update wording

use the --parallel option in all builds

clean up the .ci scripts some more

tweak fedora build

add os parameter to compile.sh

I don't really like this but it seems the easiest way
I'd prefer if these types of quirks would live in the main configuration
file, the yml

fixup yml

readd appended cache key to vcpkg step

fix windows 32 quirk

the json hash is already added to the key as well

remove os parameter and clean up ci files

set name_build.sh to output relative paths

set backwards compatible version of xcode and qt on mac

set QTDIR for mac builds on qt5

has no effect for qt6

export BUILD_DIR to name_build.sh

merge mac build steps

merge homebrew steps, set package suffix

link qt5

remove brew link

set qtdir to qt5 only

compile.sh vars need to be empty not 0

fix sets manager search bar on qt 5.12/15

fix oracle subprocess errors being ignored on qt 5

clean up translation loading

move en@source translation file so it will not get included in packages
NOTE: this needs to be done at transifex as well!

Use generator platform over osname

Short circuit if not Win defined
2022-05-06 17:31:08 -04:00
ebbit1q
eb3ce1fd7e
hide revealed cards when they are shuffled (#4570) 2022-02-23 23:46:07 +01:00
ebbit1q
ae9b8b8f34
miscellaneous refactors (#4521) 2022-01-16 17:58:53 -05:00
ebbit1q
994704d353
implement max lengths for input dialogs that are sent to the server (#4522)
* implement max lengths for input dialogs that are sent to the server

* missed a double setMaxLength

* implement max string lengths server side

* add custom getText dialog with max length

* fix deck storage tab and miscellaneous server side

* add max size for deck uploads

* final pass on client side limits
2022-01-16 17:57:01 -05:00
ebbit1q
59d4e64a8d
use multiline input dialog for annotations (#4517) 2022-01-08 16:02:25 -05:00
ebbit1q
bbbf3e2a65
don't reset pt if there is nothing to reset (#4438)
* don't reset pt if there is nothing to reset

when the client resets the pt of a card it intentionally does not
include cards that already have the correct pt, this can lead to the
client sending an empty command to the server, which will be rejected

* clangify
2021-10-23 20:04:52 -04:00
Danny Piper
689f65b38a
Fix for poor performance with large decks (#4347)
* Fix for #4284

-> The menus have the update menu thing emitted when they get triggered.
| -> works surprising well https://youtu.be/KOOmhxvHA2c is a demo on a 10000ish card deck

* changed my comment to make sense

* fix to the issues that @ebbit1q found

what caued them idk

* Revert "fix to the issues that @ebbit1q found"

This reverts commit 20b1ad9f7a675fd3b0d1be7452f71160ce06de71.

* actual fix for the issues @ebbit1q found

* its dirty but works

* fix cards in zoneviews not having a menu

* deleted isempty check as it is updated after the check

* key binds should work now

-> menus updated on zone change/attach/retranslate UI if selected

* clangify

* remove updateCardMenu from carditem entirely

updateCardMenu is done by the player and having it in carditem led to it
often being run multiple times, I've opted to instead run it in the
player and remove the signal entirely

the new logic updates the cardMenu every time a card is set as the
activeCard in the game tab

additionally a cardmenu can change while selected if the selected card:
moves zone, is flipped, or is attached (it receives the unattach action)

this is done in the player instead now, checking if the card is the
activeCard

this however exposes a flaw in the selection management where if you
unselect a card the activeCard is set to nullptr, this was an existing
bug and causes the action on selected cards to suddenly disappear, even
if there are other cards selected!

* revert null test of aCardMenu

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2021-09-14 16:35:47 -04:00
marsnicholas
b858e36183
Closes all library views when shuffled (#4261) (#4324) 2021-06-01 21:53:43 -04:00
ebbit1q
ebe2c494aa
remove the stop dump zone command from the protocol (#4326)
the stop dump zone command was implemented as a courtesy to other
players in order to take into account when they would stop looking at
unknown information

however, this can be abused, a malicious client can send this command
whenever they would like

cockatrice is not a physical tabletop nor does it aim to be, if you can
take a screenshot of your deck and then close the view, you are not
cheating as you have been given this information

in order to prevent anyone from abusing this we should remove the
command from the protocol, this means servers will ignore this message
and clients will get a little invalid command reply in their debug log

the extension id will remain reserved

shuffling your deck will always invalidate any card view looking at
those cards

if players wish to signal that they stopped looking at their deck for
whatever reason they should just use the chat instead, optionally using
one of the chat macros
2021-06-01 21:52:20 -04:00
ebbit1q
1062894397
change number dialog defaults (#4318) 2021-04-18 14:50:24 -04:00
ebbit1q
ad0f313c9d
add menus for top and bottom actions (#4314)
* add menus for top and bottom actions

* style points

* github online editor is literally the worst

* add moving cards from bottom of deck to hand

fix getting multiple cards from the bottom
note that moving cards from the bottom of the deck does not get
remembered by or disrupt undoing draws

* Apply suggestions from code review

Co-authored-by: tooomm <tooomm@users.noreply.github.com>

Co-authored-by: tooomm <tooomm@users.noreply.github.com>
2021-04-16 11:23:28 -04:00
omegaula
073349fd05
Always look at top card (#4238)
* Add option to always look at top card of deck

Similar to "always reveal", but reveals card only to the owner,
not all players.

* Add option to always look at top card of deck

Similar to "always reveal", but reveals card only to the owner,
not all players.

* Update bug_report.md (#4246)

* Update bug_report.md

* reproduction steps

* Update to address review comments

* Clangify

* set playerId on dumpEvent

Co-authored-by: tooomm <tooomm@users.noreply.github.com>
Co-authored-by: ebbit1q <ebbit1q@gmail.com>
Co-authored-by: Zach H <zahalpern+github@gmail.com>
2021-03-13 14:54:13 -05:00
ebbit1q
8e1d7d12e0
allow multiple zoneviews (#4263) 2021-03-13 14:43:50 -05:00
ebbit1q
0d842b5a35
Resurrect 2655 (#4136)
* fix #2640

* clangify

Co-authored-by: Fabio Bas <ctrlaltca@gmail.com>
2020-11-22 20:23:18 -05:00
ebbit1q
ca5f1dd434
do some guesswork if cards can't be found (#4131)
modify up the simplifyCardName function to ignore right halves
add guessCard function that prioritises full card names the simple ones
fix imports for misformatted split cards or double faced cards
introduces a small concession: not completely formatted names with a
shared name on the left side will get mixed up, eg "bind" but not "Bind"
this should be fine considering how this would fix a lot more cards
2020-11-22 19:57:51 -05:00
fdipilla
1a94261490
Multiple background images on all zones (#4144) 2020-10-23 15:36:02 -04:00
ebbit1q
9cf7621102
rename selected card menu (#4132) 2020-10-06 16:49:29 -04:00
fdipilla
b0c7b9078d
Multiple bg images zone (#4005) 2020-08-23 15:55:53 -04:00
olegshtch
44297dcd1c
Fix release tests (#4063) 2020-08-13 10:18:01 -04:00
Zach H
9246c190fa
Enhance Shortcut Menu (#3987) 2020-05-08 15:10:36 -04:00
ebbit1q
18a07274d4
clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
ebbit1q
a3fc9b6ee5 add move top card to stack keybind (#3827) 2019-10-09 00:10:23 -04:00
ebbit1q
cd29e2f252 add disable tearoffmenu option (#3826) 2019-10-02 14:58:22 -04:00
ctrlaltca
b6df5a4ac3 Deal with recent Qt methods deprecation (#3801)
* Deal with recent Qt methods deprecation

 * Use std::sort, std::less instead of qSort/qLess
 * Use QFontMetrics::horizontalAdvance instead of ::width
 * Use qApp->primaryScreen() instead of QDesktopWidget
 * use lambas instead of QSignalMapper
 * Use QTreeWidgetItem::setForeground instead of ::setTextColor
 * Use QDir::setPath instead of operator=(QString)
 * Use QList::swapItemsAt instead of ::swap

* fix error
2019-08-27 20:06:54 -04:00
Rob Blanckaert
2ef3e6fc93 Enable tear-off on menus. (#3772) 2019-07-11 22:53:43 -04:00
ebbit1q
a3a1e20074 replace old mulligan with new behavior (#3773) 2019-07-11 22:53:09 -04:00
Rob Blanckaert
8682367b52 View hand window (#3731)
* Roar

* Add View Hand menu to player

* Add shortcut

* reorder right click menu
2019-05-31 16:53:24 +02:00
ebbit1q
c874f201c3 add a bunch of parents to dialogs (#3658)
* add a bunch of parents to dialogs

works on #3651

* use game as parent instead

* add more parents

* fix create token dialog modality

* add parent to game information window

* replace a bunch of nullptrs with the magic of sed

* add parent to tip of the day and counters

* reorder game ptr

* set parent for life counter

* clangify
2019-03-26 14:54:47 -04:00
ctrlaltca
2d8f01b2e9 Show current counter value on "set counter" dialog (#3650)
* fix point 10 of issue #655

* clanfigyism
2019-03-11 00:33:19 +01:00
ctrlaltca
6f95556632
Fix related cards menu in deck editor (#3649) 2019-03-10 23:15:24 +01:00
ctrlaltca
52cc725de4
Fix crash on card relation to inexistent card; fix #3637 (#3640)
* Fix crash on card relation to inexistent card; fix #3637

But that whole loop is a logic mess

* Check if related cards exists before creating the menu entry

* honor and glory to the hypnoclanfigier
2019-03-10 18:47:24 +01:00
Rob Blanckaert
55c4207182 Fix related cards popup (#3613) 2019-03-04 02:19:37 -05:00
ebbit1q
abe4f5ca60 don't remove pt! 🔥🔥🔥🔥 (#3606)
* don't remove pt! 🔥🔥🔥🔥

* apply water to burns

* clangify

* fix clientside

* clangify

* missed qdebug

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
2019-03-04 00:55:54 -05:00
ebbit1q
9411396b97 rework pt setting (#3584)
* rework pt setting

save pt as a string serverside
set the pt of cards that enter the battlefield to empty (was -1/0)
implement old behaviour as changePT clientside
display old pt to messagelog
add new keybind for new set behaviour (default ctrl+shift+p)
add flow pt actions and keybinds that increase while decreasing
put more braces everywhere
various refactors like adding consts and for loops
remove a single superfluous semicolon
does not change the way pt is displayed client side
does not fix 3455 fully

* fix drawing of pt

remove search for / in carditem's paint() (crash)
ptstring is now always orange unless it's a faceup card with a pt that
matches the cardinfo pt
set changept to remove the pt if the field is empty
set changept to keep the old value if one side is empty
return in changept for +0/+0
clean up some if statements

* return on change to +0/+0

* change log message for empty original pts

* typo

* remove changept

add parsept to unify reading pt strings
change setpt behavior to be an "upgraded" version of the old setpt
add arbitrary strings as anything that starts with /

* clangify

* remove debug lines

* add tip of the day

* add missing images

* clangify
2019-03-03 16:24:57 -05:00
Rob Blanckaert
e68305d7bf - CardItems have dummy CardInfos if they arent in the database (#3589)
- If a CardInfo has no sets, add a dummy one to try to download it by non-set specific templates.
2019-02-23 19:52:38 -05:00
Rob Blanckaert
ea8201af5c Judge mode (#3531)
* Judge mode

* Use seperate judge icon

* Fix clang init ordering complaint

* Create gavel.svg

* Add judge level

* Adjust judge permissions.

* - Tag events caused by judges
- Allow judges access to card right click menus.

* Allow judges to  change phase / turn.

* Remove gavel from pawn

* Make judge action text black.

* Create scales

* Rename scales to scales.svg

* Use scales

* remove gavel

* - Address PR feedback
- Fix sort order

* Zach

* add option to servatrice.ini
2019-02-21 14:00:00 -05:00
Rob Blanckaert
c32f2190bd - Mill cards in correct order
- Roll up shuffles into bottom message
- Remove unused variable
2019-02-11 02:12:56 -08:00
ctrlaltca
2703db75d0 Update card menu when its counters change (#3565) 2019-02-08 01:50:34 -05:00
Rob Blanckaert
d932581f4a Move to bottom of library in random order. (#3549)
* - Allow shuffling a subset of a zone
- When moving cards to the bottom of library, shuffle them after
- Process events in the correct order serverside

* Zach fixes

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Comments + additional guard
2019-02-07 14:08:44 -05:00
Rob Blanckaert
a719e3b306 Log number of cards revealed to other players. (#3555) 2019-02-05 02:33:11 -05:00
Fabio Bas
ec081b8b03 Fix active player game area highlightning 2019-02-03 19:15:30 +01:00
Rob Blanckaert
5e38214675 Playing a tableRow 3 card from the stack puts it to grave. (#3547)
* Playing a tableRow 3 card from the stack puts it to grave.

* move to top by resetting pos

* Zach touch

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
2019-02-03 11:33:38 +01:00