Commit graph

169 commits

Author SHA1 Message Date
Edoardo Lolletti
8e6eadb226 Add Effect.RestoreCountLimit 2024-05-19 14:23:57 +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
bde406b38b Fix indestructable effects not being sorted in a deterministic way 2024-04-01 00:07:30 +02: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
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
Edoardo Lolletti
5a696fb0ee Replace some begin/rbegin usage with front/back 2023-08-11 11:55:44 +02:00
Edoardo Lolletti
04d7833b50 Fix typo from importing 37faac259e 2023-04-02 16:11:38 +02:00
Edoardo Lolletti
f69460bd0e Improve handling of EFFECT_TRAP_ACT_IN_HAND, EFFECT_QP_ACT_IN_NTPHAND, EFFECT_TRAP_ACT_IN_SET_TURN and EFFECT_QP_ACT_IN_SET_TURN
If one of such effect has no side effects (no count limit and no value function to execute) glob it with all the other effects, as whichever is picked won't affect the internal lua state and make the player choose the effect only when there is one of such effects that has a count limit or a function to execute.
2023-03-09 10:55:54 +01:00
Edoardo Lolletti
747bbbf971 Attempt to fix issue where effects with range LOCATION_EMZONE would break if the card was moved from the emzone to the mmzone 2022-12-08 10:43:24 +01:00
Edoardo Lolletti
6086ae1679 Add EFFECT_FLAG2_CONTINUOUS_EQUIP
Allow continuous traps that were equipped to activate their effects
2022-07-20 13:25:50 +02:00
Edoardo Lolletti
81fb4c5aea Rename DUEL_RETURN_TO_EXTRA_DECK_TRIGGERS to DUEL_RETURN_TO_DECK_TRIGGERS
Reflect the correct updated behaviour
2022-06-22 12:59:56 +02:00
Edoardo Lolletti
adaca8c230 Fix main deck triggers with DUEL_RETURN_TO_EXTRA_DECK_TRIGGERS
If the flags is set, like extra deck triggers, their behaviour should reflect the pre mr5 one
2022-06-22 12:58:50 +02:00
Edoardo Lolletti
6cdec0cb86 Allow EFFECT_REVIVE_LIMIT to be usable even by xyz mats 2022-05-30 11:58:42 +02:00
Edoardo Lolletti
4da35cb7f1 Use preincrement operator instead of postincrement in the codebase
Semantically the proper operator to use for oneline increments is the preincrement one, the postincrement is the one to be used only in teh cases where the previous value is required.
2022-03-05 13:56:43 +01:00
Edoardo Lolletti
53da389070 Update interpreter::add_param
Make it a templated function taking the parameter type at compile time, this allows performing more sanity checks, and fixes the situations with ambiguity of 0 with nullptr, also fixing some isntances where such behaviour was present.
2022-03-05 00:20:05 +01:00
Edoardo Lolletti
e77ec04678 Return integer values as lua_Integer from the various get_value functions
Removes ambiguity when the core needs a full unsigned 32 bit integer that could be altered when returned as signed integer since lua_Integer is an int64.
2022-01-08 20:04:19 +01:00
Edoardo Lolletti
8fd5b97d04 Completely remove custom integer type typedefs
Directly use the standard's
2021-09-04 22:04:14 +02:00
Edoardo Lolletti
a7c90b43c0 Fix effect::count_hopt_index not being default initialized 2021-09-03 18:58:19 +02:00
Edoardo Lolletti
67068a5052 Add hopt index for effects' count limit
Update Effect.SetCountLimit to allow passing a table containing id and hopt index as 3rd parameter, used for when cards have multiple hopt effects that can be acivated.
Also updated Effect.GetCountLimit to reflect this change
2021-09-02 19:28:10 +02:00
Edoardo Lolletti
8dea711c47 Clone label object reference when cloning an effect 2021-06-27 17:01:45 +02:00
Edoardo Lolletti
fe10b1e27a Rename clone_function_ref to clone_lua_ref 2021-06-27 17:01:25 +02:00
Edoardo Lolletti
083d4ea99e Attempt workaround to allow triggered monsters to resolve even if equipped mid chain 2021-05-15 15:28:39 +02:00
Edoardo Lolletti
382752d573 [ci skip]Remove some unneded duel object retrieval from card objects in effect functions 2021-05-07 14:42:02 +02:00
Edoardo Lolletti
78134351b3 Sort grant effects by lua reference instead of effect id
Effect id can be updated mid duel, thus breaking the ordering of the map
2021-05-05 14:00:54 +02:00
Edoardo Lolletti
a9364b45dd Another attempt for 174ec18722
Now grant_effect_container is instead a struct containing both an ordered an unordered map, the unordered map is the primairy one, and it's the one that holds the actual values, the sorted map holds only pointers to those elements. This should avoid the crashes when iterating the map and erasing elements, while also allowing to have a sorted access to the elements.
2021-05-04 20:35:38 +02:00
Edoardo Lolletti
ed86d4aaed Revert "Make grant_effect_container map with effect_sort instead of unordered map"
This reverts commit 174ec18722.
2021-05-01 01:37:57 +02:00
Edoardo Lolletti
174ec18722 Make grant_effect_container map with effect_sort instead of unordered map
Being unordered, it didn't assure a costant ordering of the effects, possibly changing the order in which they were registered during the duel and making the replays non deterministic
2021-04-06 21:49:15 +02:00
Mercury233
56f9028665 fix continous card become equip (#358) 2021-02-27 17:00:26 +01:00
edo9300
da990800ac Pass nullptr instead of (void*)0 to solve function overloading ambiguity 2020-11-07 19:46:30 +01:00
edo9300
761862e485 Slightly update derived classes from lua_obj
Added templated helper class to interface with the constructor of the underlying lua_obj class to simplify object instantation
2020-10-18 16:47:07 +02:00
edo9300
3bcf8171f3 Make some loops for range 2020-07-21 16:41:40 +02:00
edo9300
ef61bc6a8f Merge branch 'goat' 2020-07-20 21:52:31 +02:00
edo9300
ded6eeb7ac Inherit group, card, effect form lua_object class, simplify userdata type handling
Have base class lua_obj also register the type of the parameter, so that we don't have to rely on calling lua functions, but the value of teh struct can be directly checked
2020-07-20 20:50:15 +02:00
DailyShana
2b9f9e49ae effect with EFFECT_FLAG_SPSUM_PARAM should'n check target_range
fix #332
2020-07-09 18:20:07 +02:00
edo9300
74e29fa8f0 Merge branch 'master' into goat 2020-07-01 13:04:37 +02:00
DailyShana
8896b269a1 update Card.CheckActivateEffect (#325) 2020-07-01 12:59:24 +02:00
salix5
0c5ac86266 update immune effects (#319)
* immune effect

Now card::filter_immune_effect() will collect all immune effect.
The condition check is moved to effect::is_immuned().

* format

* tweak

* remove unnecessary calling filter_immune_effect

Co-authored-by: DailyShana <8469304+DailyShana@users.noreply.github.com>
2020-06-22 20:22:53 +02:00
edo9300
95c4855d24 Explicitely allow EFFECT_ADD_SETCODE and EFFECT_ADD_CODE while xyz material 2020-06-09 12:11:14 +02:00
edo9300
df13e515e1 Revert "Allow cards with category atk/def change to be activated by default during dmage calculation"
This reverts commit 703adc5fdc.
2020-06-04 22:51:44 +02:00
edo9300
703adc5fdc Allow cards with category atk/def change to be activated by default during dmage calculation 2020-06-04 21:57:12 +02:00
edo9300
8318007694 Fix DUEL_TRIGGER_WHEN_PRIVATE_KNOWLEDGE 2020-05-30 17:54:13 +02:00
edo9300
8075b5c3ec Trigger even when facedown onfield/banished if DUEL_TRIGGER_WHEN_PRIVATE_KNOWLEDGE is set 2020-05-29 18:18:55 +02:00
edo9300
b0bd86d7cb Fix check for DUEL_TRIGGER_WHEN_PRIVATE_KNOWLEDGE 2020-05-29 17:55:58 +02:00
DailyShana
313f7667f8 remove FLIP_SET_AVAILABLE
face down card cannot activate effect generally
硫酸のたまった落とし穴  is not special now
2020-04-02 15:17:44 +02:00
edo9300
3c6165a977 Master Rule 2020 rulings update (Fluorohydride/ygopro-core#294)
59640dccb8855e9897ed2583dc76fc04027f72e6..384a56af0d6de372dc89959fe41a6786c1311623

Co-authored-by: DailyShana <p2357111317192329@gmail.com>
2020-03-29 23:10:11 -04:00
DailyShana
f9daf98fa5 allow all trigger effect of EFFECT_TYPE_SINGLE activate in damage step 2020-02-11 10:42:37 -05:00