Commit graph

355 commits

Author SHA1 Message Date
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
ef38a8bb2b
Re-add missing '/' separator in <pt> after b282df2e27 (#4747)
In b282df2e27 (#4728) the logic for
creating <pt> values was updated to avoid adding a final slash after an
existing power value and missing toughness value. This works by setting
the ptSeparator to an empty string when either the power or the
toughness is undefined. However, due to the ptSeparator variable being
scoped out of the `for` loop, this causes all remaining cards to have an
empty string as a separator, ending up with <pt> values of e.g. 21
instead of 2/1.

Moreover, the implementation from #4728 is ambiguous in the case of a
card having a toughness value but no power value: in that situation, it
creates a <pt> entry with the toughness value and no separator, which is
not a good idea since it is not possible to know if <pt>2</pt> means
power 2 and no toughness, or no power and toughness 2 (Cockatrice takes
the first interpretation).

To avoid ambiguities, the <pt> value is now one of:

 1. A regular P/T value when the card has power and toughness
 2. A simplified P value when the card has power but no toughness
 3. A simplified /T value when the card has toughness but no power
 4. Absent when the card has neither power nor toughness

Note that, as far as I can tell, Cockatrice seems to (incorrectly, IMO)
ignore the initial slash if present in Player::parsePT, and treat /T as
a power value. However that is a separate issue: this patch is concerned
with Oracle and ensuring proper values in cards.xml, not with how
Cockatrice interprets those values.
2023-02-08 19:59:14 +01:00
cajun
44d1ab348b
Add Oracle support for persistent & Fix persistent on reverse-related (#4742)
* fix persistent reverse-related

* create relations from spellbook property

* run format.sh
2023-02-06 07:00:54 -05:00
PakhomCh
b282df2e27
Fixed ptSeparation oracle issue (#4728)
* Fixed psTeparation oracle issue

* Update oracle/src/oracleimporter.cpp

Co-authored-by: PakhomCh <pakhomch@gmail.com>
2023-01-16 13:30:19 -05:00
ebbit1q
dec2a252fa
remove dependency on deprecated qt5 libraries for qt6 (#4692)
* remove dependency on deprecated qt5 libraries for qt6

removes the use of qt6-5compat for builds
replaces use of QRegExp with QRegularExpression
fixes incorrect usage of QRegExp
removes use of QTextCodec
fixes incorrect usage of QTextCodec
sets qtlinguist as a required component for qt6

* fix anchoredPattern not existing in qt 5.11
2022-10-31 23:24:11 +01:00
transifex-integration[bot]
a69d6ff1b4
Translate /oracle/oracle_en@source.ts in it (#4688)
translation completed for the source file '/oracle/oracle_en@source.ts'
on the 'it' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-10-17 16:43:31 -04:00
ebbit1q
90f187e885
fix 4679 (#4680) 2022-10-02 13:23:35 -04:00
ebbit1q
28aa473362
rework formatting with cmake-format (#4627)
* merge clangify and cmakify into format.sh

update desktop lint workflow to 22.04

print cmake-format version as well

um, rename things?

add extra examples to format.sh --help
add option to not run clang-format
fix version display in .ci/lint_cpp.sh
fix relative paths in format.sh

fix formatting dirs

* run ./format.sh --cmake --branch ""

* revert formatting of cmake comments
2022-06-08 21:14:26 -04:00
ebbit1q
3e5b7cd392
remove unused variables (#4636) 2022-06-08 00:32:11 +02:00
Zach H
a95b338c80
Add cmake format (#4618)
* Support CMakeify operation

* Run Cmakeify

* Update cmakeify.sh

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2022-05-08 21:22:43 +02: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
ZeldaZach
7aba404f2e Add i18n for Oracle and fix Transifex 2022-01-22 00:17:29 -05:00
Zach H
1b7e8f3a16
Re-add handling of i18n for Oracle (since it was manual before) (#4541)
Removes en@source from options menu intentionally
2022-01-21 23:35:04 -05:00
ZeldaZach
5cf93ad61c Remove empty languages 2022-01-21 22:59:47 -05:00
ZeldaZach
5a52e085a7 Translation Dump! 2022-01-21 22:28:07 -05:00
ebbit1q
5d31b70406
[WIP] add english translation (#4120)
* move en.ts to en@source.ts

* run lupdate

Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
2022-01-21 21:35:26 -05:00
ebbit1q
aa6a0313e9
don't sort split card halves alphabetically (#4244)
* don't sort split card halves alphabetically

fixes #4241
introduces new issue: aftermath cards are now switched upside down

* use list instead of multimap to enforce preservation of a given order
2021-03-08 12:14:43 -05:00
ebbit1q
df0b867d9e
fix my mistake in meld regex (#4266) 2021-02-24 18:45:09 -05:00
ctrlaltca
1bfcca91be
add window icons in wayland (#4232)
Co-authored-by: Fabio Bas <fabio.bas@officineinformatiche.net>
2021-01-28 15:21:11 -05:00
ZeldaZach
6fa5f4f9a5 Translations from Transifex 2021-01-26 14:50:05 -05:00
ebbit1q
f595a61d50
fix #4198 (#4209) 2020-12-09 02:08:00 -05:00
leiftw
b0239c11ab
Fix typo in #L135 to conform with #L138 (#4182) 2020-11-24 14:58:28 -05:00
Zach H
9f9581c2be
Support MTGJSONv5 format in Oracle downloader (#4162)
* Fix #4043, Support MTGJSONv5 format in Oracle downloader

* Auto redirect V4 downloads to V5, as we won't support V4 after this change

* clangify >_>

* Remove null values and account for IDs missing

* fix split cards and double faced cards somewhat

* do not consider double faced cards duplicates

* fix promo double sided cards

* typo

* fix alternative versions of cards with (letter)

* zach says this is more readable

* pre qt 5.10 compatibility

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2020-11-23 16:12:41 -05:00
rivten
2081639970
fix infinite loop when card file save fails, instead stop the execution just like the other errors in the call (#4143) 2020-10-21 10:31:57 -04:00
ebbit1q
48c6458766
remove nonfunctional mana artifact detection code (#4121)
mana artifacts will use the stack and be placed in the normal tablerow
if you want to put it with your lands you're free to do so, as long as
you promise to not say oh this should not be here three turns after
shatterstorm resolved
2020-10-02 12:14:44 -04:00
ebbit1q
be7b172e55
skip misprints marked with † (#4107) 2020-09-26 21:56:45 -04:00
ebbit1q
14fcb2e5d7
skip duplicate nonpromos (#4097)
* consider cards with frameEffects promos

* skip duplicates entirely

all cards that are not "promo" or something like it will only retain the first copy instead of parsing all of them and keeping the last
2020-09-22 16:09:59 -04:00
ZeldaZach
69f035f017 translation updates 2020-08-16 15:18:21 -04:00
olegshtch
44297dcd1c
Fix release tests (#4063) 2020-08-13 10:18:01 -04:00
ebbit1q
7fa1936d0f
qt 5.15 compatibility (#4027) 2020-06-19 10:50:09 -04:00
ebbit1q
53c6440cac
make sure no //es are added to maintypes (#4017) 2020-06-02 10:55:05 -04:00
ZeldaZach
3dff63069e translation updates 2020-05-17 18:25:55 -04:00
ebbit1q
45d62b6880
skip all duplicate promos instead of just stars (#3965) 2020-04-23 11:24:39 -04:00
ctrlaltca
27b7ebe208
Oracle / card xml improvements (#3934)
* fix #1610

* fix #2679; partially fix #3647

* Fix tests

* Remove debug code
2020-03-30 21:56:03 +02:00
ebbit1q
18a07274d4
clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
ZeldaZach
e84409c0cf Translation Updates 2020-03-16 22:01:57 -04:00
ebbit1q
1815094249
Keep stars but only sometimes, add scheme cards back (#3904)
* ignore stars and promos but only sometimes

this will correct #3706 and #3715 being a bit overzealous in removing
cards and thus fix scheme cards being removed in entirety
fix #3845
note that this causes a lot more cards to be added that are in promo
sets, if these promo sets should prove to be problematic they should be
disabled somehow as having them as an option is still nice.

* remove debug lines
2020-03-16 20:42:27 -04:00
tooomm
361833e023
clarify language setting (#3897) 2020-02-19 10:54:55 -05:00
ctrlaltca
632e44b0b7
Fix missing languages in oracle dropdown (#3896) 2020-02-18 22:33:41 +01:00
tooomm
eadcdc6f7c link to new AllPrintings file (#3851) 2019-11-02 23:51:10 -04:00
ZeldaZach
096a472ed0 translations 2019-10-21 19:09:28 -04:00
skwerlman
e8fd2ce2aa add support for adventures to oracle (#3836)
* add support for adventures to oracle

this causes cockatrice to correctly fetch the front of the card for the adventure portion rather than sending lots of bad requests to scryfall

* treat adventures more like split cards

* dont hardcode `maintype: creature`
2019-10-09 01:05:30 -04:00
ctrlaltca
bcf505c98b Oracle: fix crash on no card type; fix #3815 (#3816) 2019-10-02 14:54:51 -04:00
Zach H
53728598fe
translation updates (#3804) 2019-08-31 21:36:13 -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
ebbit1q
faf02100a5 add 4BB to nonenglish sets (#3786) 2019-07-17 10:04:19 -04:00
ebbit1q
f10f9ada3a properly capitalize set types like Duel Deck and From the Vault (#3770)
* properly capitalize set types like Duel Deck and From the Vault

* add more tiny words

* update macos for travis (slower build times)
2019-06-30 12:08:07 -04:00
Zach H
22e2e442f5
updated translations for 2.7.1 (#3750) 2019-06-08 12:38:59 -04:00
ctrlaltca
36ba9c2d94
fix #2786 (#3747) 2019-06-08 10:15:33 +02:00
Zach H
0380de9571
add trans strings for upstream (#3745) 2019-06-04 17:41:58 -04:00