Closed salix5 closed 10 months ago
https://github.com/Fluorohydride/ygopro-core/pull/516/files#diff-9c303fc29f7374041f51201c6208b8672f77cf296e89986d7ae02da80c451f86R1730 Might be better to change as follows (ref: https://github.com/Fluorohydride/ygopro-core/pull/357).
effect* peffect = pcard->is_affected_by_effect(EFFECT_EXTRA_RELEASE_NONSUM);
if(!peffect || (peffect->is_flag(EFFECT_FLAG_COUNT_LIMIT) && peffect->count_limit == 0))
continue;
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(reason, PARAM_TYPE_INT);
pduel->lua->add_param(core.reason_player, PARAM_TYPE_INT);
if(!peffect->check_value_condition(3))
continue;
https://github.com/Fluorohydride/ygopro-core/pull/516/files#diff-9c303fc29f7374041f51201c6208b8672f77cf296e89986d7ae02da80c451f86R1730 Might be better to change as follows (ref: #357).
effect* peffect = pcard->is_affected_by_effect(EFFECT_EXTRA_RELEASE_NONSUM); if(!peffect || (peffect->is_flag(EFFECT_FLAG_COUNT_LIMIT) && peffect->count_limit == 0)) continue; pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT); pduel->lua->add_param(reason, PARAM_TYPE_INT); pduel->lua->add_param(core.reason_player, PARAM_TYPE_INT); if(!peffect->check_value_condition(3)) continue;
field.cpp
in #357 is merged in 289f4df2514ec848f155b5de94539309a86c4e82
Thank you!
Tyrant Dragon, Insect Queen and The Unfriendly Amazon are not activate effect.
ref: https://www.db.yugioh-card.com/yugiohdb/faq_search.action?ope=4&cid=5194 ■『自分のスタンバイフェイズ毎に、このカードを除く自分のフィールド上モンスター1体を生け贄に捧げなければ、このカードを破壊する』は効果として扱いません。「味方殺しの女騎士」をフィールドに維持するためのコストになります。(チェーンブロックが作られる事はありません。)
so, EFFECT_CANNOT_RELEASE
need reason_effect
check.
@465uytrewq
About https://github.com/Fluorohydride/ygopro-scripts/pull/2242
This branch is done by replacing: Duel.CheckReleaseGroup(
->Duel.CheckReleaseGroup(REASON_COST
It is just the first draft because some functions are not released by card effect.
We will try our best to check each script.
味方殺しの女騎士 The cost of maintaining the card will use another constant. If you find any problem, please leave a comment here. Thank you!
Edit: Release for Maintenance Cost will use REASON_MAINTENANCE
would we replace REASON_COST
to REASON_MAINTENANCE
in Duel.Destroy
/Duel.SendToGrave
? (e.g. Koa'ki Meiru, Aerial Recharge)
@465uytrewq I would hope so. But I am afraid that we need to change a lot of scripts for that. I only change the reason of Duel.Release for now.
@salix5
ok, i understood.
i'll check other cards to need REASON_ACTION
or REASON_MAINTENANCE
after these commit merge.
Adding more arguments should be fine, but it should prob not be the very first argument as that missalign all rest for cards that are already coded using those in an specific order, or at least, make so it can identify if the arguments being passed matches the old or new alignment and automatically use it accordingly, for card scripts not yet up-to-date to not break.
@HKunogi https://github.com/Fluorohydride/ygopro-core/pull/534 https://github.com/Fluorohydride/ygopro-scripts/pull/2346 mercury233 has restored some of the release-related functions in order to keep the old script files working. The replacement RegEx patterns are in the pull request.
Current version:
---fixed reason: REASON_COST
---@return boolean
---@param player integer
---@param f function|nil
---@param count integer
---@param ex Card|Group|nil
---@param ... any
function Duel.CheckReleaseGroup(player,f,count,ex,...) end
---fixed reason: REASON_COST
---@return Group
---@param sel_player integer
---@param f function|nil
---@param min integer
---@param max integer
---@param ex Card|Group|nil
---@param ... any
function Duel.SelectReleaseGroup(sel_player,f,min,max,ex,...) end
---add parameters: reason, use_hand
---@return boolean
---@param player integer
---@param f function|nil
---@param count integer
---@param reason integer
---@param use_hand boolean
---@param ex Card|Group|nil
---@param ... any
function Duel.CheckReleaseGroupEx(player,f,count,reason,use_hand,ex,...) end
---add parameters: reason, use_hand
---@return Group
---@param player integer
---@param f function|nil
---@param min integer
---@param max integer
---@param reason integer
---@param use_hand boolean
---@param ex Card|Group|nil
---@param ... any
function Duel.SelectReleaseGroupEx(player,f,min,max,reason,use_hand,ex,...) end
As a conclusion: (Suppose that accepting #534)
If the scripts are updated for #516
Replace the scipts by regex in https://github.com/Fluorohydride/ygopro-scripts/pull/2346
Manually fix ReleaseGroup(Ex)?\(REASON
If the scripts are not updated:
scripts with Duel.CheckReleaseGroup, Duel.SelectReleaseGroup Now the reason is fixed to REASON_COST. If the release reason is REASON_COST, no changes are needed. If the release reason is not, it has to use Ex version:
--before
Duel.CheckReleaseGroup(player,f,count,ex,...)
--after Duel.CheckReleaseGroupEx(player,f,count,reason,false,ex,...)
```lua
--before
Duel.SelectReleaseGroup(sel_player,f,min,max,ex,...)
--after
Duel.SelectReleaseGroupEx(player,f,min,max,reason,false,ex,...)
--before
Duel.CheckReleaseGroupEx(player,f,count,ex,...)
--after Duel.CheckReleaseGroupEx(player,f,count,reason,true,ex,...)
```lua
--before
Duel.SelectReleaseGroupEx(player,f,min,max,ex,...)
--after
Duel.SelectReleaseGroupEx(player,f,min,max,reason,true,ex,...)
EFFECT_CANNOT_RELEASE
Now the signature of target function is:
Lua functions
The definitions of following functions have changed.
The following functions have more optional arguments.
Card.IsReleasable add 2nd param: reason (optional, default: REASON_COST)
Duel.GetReleaseGroup Including: Duel.GetReleaseGroup Duel.GetReleaseGroupCount add 3rd param: reason (optional, default: REASON_COST)
---@return integer ---@param player integer ---@param use_hand? boolean default: false ---@param reason? integer default: REASON_COST function Duel.GetReleaseGroupCount(player,use_hand,reason) end
Release Reason
Now the reasons of release are:
REASON_ACTION
"This card cannot declare an attack unless"... (Panther Warrior)REASON_COST
The card is released by the cost of effect activation. Prohibited byRitual Beast Ulti-Reirautari
.REASON_EFFECT
The card is released by effect. (Ritual Summon)REASON_MAINTENANCE
The maintenance cost. (Aerial Recharge)REASON_SPSUMMON
The card is released by the Special Summon procedure. (Blue-Eyes Toon Dragon)REASON_SUMMON
The card is released by Tribute Summon.REASON_RULE
The card is is released by non-effect actions. (痛み分け/Share the Pain)Test
test_cannot_release.zip
test_cannot_release.lua Single mode script Add test card with id=1 Level 1/Earth/Warrior/ATK 1/DEF 1
c1.lua The script of 1 EFFECT_CANNOT_RELEASE with reason
インフェルノイド・アシュメダイ Infernoid Piaty From https://github.com/Fluorohydride/ygopro-scripts/pull/2222
When
1
is on the field: The 2nd effect ofInfernoid Piaty
cannot be activated.Black Illusion Ritual
can be activated.