Commit graph

526 commits

Author SHA1 Message Date
Edoardo Lolletti
4505fa604a
Add DUEL_EXTRA_DECK_RITUAL flag (#164)
Allows ritual monsters to be treated as extra deck monsters, to account for the change in RUSH duels. For this implementation, if the flag is used with the extra monster zones enabled, the monster will be summonable to both EMZone and MMZone like other non link cards
2025-03-29 13:02:46 +01:00
Edoardo Lolletti
ab928a5ed2 Refresh disable status when a single effect related to negation is reset
Currently, if a SINGLE_EFFECT of type DISABLE/FORBIDDEN is registered as single effect, when that effect is reset via a phase event or by other means that don't make the card move, if the card isn't on the field, the disabled status won't be updated.
Remove the explicit check in card::remove_effect preventing this
2025-03-02 16:08:35 +01:00
Edoardo Lolletti
76ac85d3c0 Update copyright year on changed files and LICENSE 2025-02-23 13:56:35 +01:00
Naim
06bc2188b3
Update interactions with EFFECT_SYNCHRO_LEVEL (#162)
Now it allows Link monsters affected by EFFECT_SYNCHRO_LEVEL to be used as Synchro Materials
2025-02-12 19:13:42 +01:00
Edoardo Lolletti
c3b5a199b4 Pass the real "reason effect" when checking EFFECT_FUSION_MATERIAL
The effect will match the effect that is/will perform the summon
2024-12-23 17:56:51 +01:00
Naim
86013b6e97
Update card::IsSSetable (#159)
Now it allows checking for a zone available in a certain player's field instead of only the player calling the function
2024-12-15 12:15:21 +01:00
Edoardo Lolletti
0266090f98 Automatically enable GLOBALFLAG_DETACH_EVENT and GLOBALFLAG_BRAINWASHING_CHECK 2024-11-04 22:36:54 +01:00
Edoardo Lolletti
f05dc470bd Automatically enable GLOBALFLAG_SELF_TOGRAVE
Check if an effect of type EFFECT_SELF_TOGRAVE is registered, in which case enable the flag
2024-11-04 22:36:53 +01:00
Edoardo Lolletti
7d79b281d8 Add Card.GetOwnEffects
Returns all the effects that are registered on a given card (including effects gained via EFFECT_TYPE_GRANT)
2024-07-09 20:54:03 +02:00
Edoardo Lolletti
3a3d3593ba Variable signedness update 2024-05-20 20:21:36 +02:00
Edoardo Lolletti
537d451a23 Address warning and fix compilation with mingw (not w64) 2024-05-20 20:15:02 +02:00
Edoardo Lolletti
b769f3a1f9 Update the way grant effects are sorted
Sort them by "initial id", since lua references could diverge across different runs, thus leading to possibly non reproducible behaviour
2024-04-01 20:04:32 +02:00
Edoardo Lolletti
c2093bdc61 Pass the reason in the value of the various REDIRECT effects 2024-03-07 16:19:52 +01:00
Edoardo Lolletti
ff1a8a7066 Fix EFFECT_COUNTER_LIMIT handling
In case of multiple of those effects being applied, the value of the latest applied was being used, rather than the smallest of them all
2024-02-15 00:43:00 +01:00
Edoardo Lolletti
acaa99beb9 Use clang-tidy to update instances where 0 was used instead of nullptr 2024-01-13 16:30:50 +01:00
Edoardo Lolletti
9790b552a0 Address various warnings raised by clang's -Weverything
They were mostly extra breaks/extra semicolons
2024-01-05 15:50:25 +01:00
Edoardo Lolletti
ff41aec90a Update header inclusion 2024-01-05 13:03:46 +01:00
Edoardo Lolletti
8b4bd4ac53 Update field functions to properly take bool and not uint8_t 2024-01-03 14:29:48 +01:00
Edoardo Lolletti
da45f91460 Update copyright for 2024 2024-01-03 01:21:08 +01:00
Edoardo Lolletti
8b5c5d9a92 Always return a valid handler for EFFECT_TYPE_XMATERIAL
Attempt to fix a crash caused by an effect of type EFFECT_TYPE_XMATERIAL no longer having an associated handler if the material granting the effect was detached in the same chain in which its effect was activated
2023-12-17 20:17:40 +01:00
Edoardo Lolletti
6dc321de75 Make LuaParamType an enum class 2023-12-08 19:55:50 +01:00
Naim
12c9bdc3af
Update/Import new utilities from the lua scripting library (#151)
Added Duel.IsMainPhase, Duel.IsBatlePhase, Duel.IsPhase and Duel.IsTurnPlayer.

Update Card.IsCanBeEffectTarget: Prevent tokens that are no longer on the field from being valid cards for this function
2023-12-02 11:08:36 +01:00
Edoardo Lolletti
f89c5da422 Update get_card_or_group to return a pair group/card
To then be unpacked with c++ 17's structured binding
2023-11-26 17:47:46 +01:00
Naim
7ac33a959f
Update tribute related functions to support "Ritual Beast Ulti-Reirautari" (#150)
* Update Card.IsReleasable to accept a second, optional parameter for the reason. Update GetReleaseGroup, GetReleaseGroupCount the same way as well, with the new parameter being the 4th. Defaulting it to REASON_COST will prevent massive script changes (cards that tribute by effect already use Card.IsReleasableByEffect).

* Update EFFECT_CANNOT_RELEASE to pass the reason and the reason effect a 4th and 5th parameters to its target function

* Pass the reason down the line until get_release_list, check_release_list,is_player_can_release and card::is_releasable_by_nonsummon, updating internal function calls accordingly

---------

Co-authored-by: Edoardo Lolletti <edoardo762@gmail.com>
2023-11-12 17:04:20 +01:00
Edoardo Lolletti
dd9f84e592 Spsummon procedure: pass the proc effect to player's EFFECT_CANNOT_SPECIAL_SUMMON 2023-10-14 14:49:49 +02:00
Edoardo Lolletti
76020da04a Minor function signatures updates and ocgapi cleanup 2023-07-24 13:57:39 +02:00
Edoardo Lolletti
1e704d5061 Minor declarations update for is_removeable and is_removeable_as_cost 2023-07-22 16:49:39 +02:00
Edoardo Lolletti
01bcef3515 Update some function signatures with proper types 2023-07-16 10:46:02 +02:00
Edoardo Lolletti
d5e6766cb1 Minor updates in duel class 2023-06-30 12:24:24 +02:00
Naim
1c1c684d5f
Fix Card.IsCanBeDisabledByEffect (#140)
Importing the changes from: https://github.com/Fluorohydride/ygopro-core/pull/490
2023-05-31 17:45:00 +02:00
Naim
e9fde3b95b
Fix Card.IsAbleToGraveAsCost (#143)
Importing 775fd42c31.

The is_capable_send_to_extra function already checks internally by is_affected_by_effect(EFFECT_CANNOT_TO_DECK)
2023-05-31 17:38:13 +02:00
Edoardo Lolletti
b43ee438ba Minor cleanup in some functions 2023-03-04 19:48:07 +01:00
Edoardo Lolletti
e73fb449a8 Silence downcast warnings 2023-02-07 16:43:27 +01:00
Edoardo Lolletti
93f77ab64e Import Card.IsCanBeDisabledByEffect
https://github.com/Fluorohydride/ygopro-core/pull/469
2023-02-05 11:19:45 +01:00
Edoardo Lolletti
4f4e783766 Duel.Overlay add parameter to automatically send xyz materials of the monsters to be attached to the grave
Implement it natively rather than via lua, correctly handle the scenario where one of the xyz monsters to be overlaid has an effect to banish any card sent to the grave and it would be still applying if duel.sendtograve was called manually from the script
2022-11-05 16:48:29 +01:00
Edoardo Lolletti
29a7a057f1 Minor update to the way the summon info are stored
Decouple the summon location from the summon type, also keep track of the sequence and if the card was in a pzone, this allows to use symbolic locations in Card.IsSummonLocation as wel
2022-10-30 11:08:18 +01:00
Edoardo Lolletti
7b5a52c6cc Add new symbolic locations
LOCATION_STZONE (the Spell & Trap zone, so excluding mr3 pzones and field zone), LOCATION_MMZONE and LOCATION_EMZONE. Usable in GetMatchingCard, GetFieldGroup, etc
2022-10-28 13:00:48 +02:00
Edoardo Lolletti
151a5b7f71
Add support for table arguments in function already accepting a variable number of parameters (#131)
Also update the IsSetCard function family to work with a table as parameter as well
2022-10-26 18:13:11 +02:00
Edoardo Lolletti
e6b758e08c Fix card::get_set_card and card::get_pre_set_card overwriting the passet set 2022-10-26 17:31:47 +02:00
Edoardo Lolletti
d54b12c68c Fix regression in card::get_summon_set_card and minor cleanup in card::is_summon_set_card 2022-10-25 13:11:04 +02:00
Edoardo Lolletti
da59b442fa Typo in function name 2022-10-25 12:24:31 +02:00
Edoardo Lolletti
97c67af752 Unused variable
[ci skip]
2022-10-13 15:42:57 +02:00
Edoardo Lolletti
457bc55b5c Use luaL_checkstack on all the library function that return an arbitrary number of values
The given lua stack to a c function has enough room to push few return values without issues, so all the functions that return a fixed amount of values (usually 1 or 2) weren't touched, all the others that return an unknown amount are now properly calling checkstack to make the lua api allocate the space needed for all the return values.
2022-10-06 13:11:11 +02:00
Edoardo Lolletti
65f99b748f GetCardEffect and GetPlayerEffect: Fix lua assertion becuse the return stack size was not checked 2022-10-06 12:24:16 +02:00
Edoardo Lolletti
eb82fa3c57 Minor syntax/readibility updates 2022-09-17 12:46:51 +02:00
Edoardo Lolletti
0de9a3e1e4
Update internal race value to 64 bit (#127)
Bump the race value size from 32 to 64 bit, giving us 32 new race values.
This is needed to futureproof the new upcoming rush card types, that could end up making the card types become more than 32.
This change breaks both the core abi and the messages.
For the abi now the race field in the OCG_CardData struct changed from uint32_t to uint64_t.
For the messages, QUERY_RACE will now be an uint64_t instead of uint32_t, MSG_ANNOUNCE_RACE will send an uint64_t for the races that can be declared, and also will now expect an uint64_t as answer, also, the HINT_RACE property associated with MSG_HINT will be using the full uint64_t data field as well.
2022-09-03 22:45:49 +02:00
Edoardo Lolletti
7709b61ed6 Minor updates 2022-06-29 20:07:26 +02:00
Edoardo Lolletti
43af453cfa Update card::get_race
Return 0 even if there's sumtype passed.
All the other functions don't have this special handling, probably it was a typo introduced when updating those functions, rn it will cause issues with skills and trap monsters that would be treated as cards having a race if used as materials.
2022-06-23 11:57:53 +02:00
Edoardo Lolletti
e9cbfd2415 Minor update to setcode checking functions 2022-05-31 20:13:02 +02:00
Edoardo Lolletti
5aa71a9d97 Fix regression introduced in https://github.com/edo9300/ygopro-core/pull/122
The above change made ALL xyz materials be checked for being properly summoned when checking is_can_be_special_summoned instead of only materials with a revive limit effect, thus returning false for all the cards that didn't have such effect
2022-05-30 11:09:38 +02:00