RushDuel.CanSelectAndDoAction
Alias: RD.CanSelectAndDoAction. Requires the matching Rush Duel Lua bootstrap.
Signature
RushDuel.CanSelectAndDoAction(int desc, int hint, function filter, int tp, int s_range, int o_range, int min, int max, Card|Group|nil expect, function action) -> anyDescription
Optional resolution action: finds candidates, asks a yes/no question, then selects a Group and calls action(selected_group). Despite its name, this helper performs selection and the action; do not use it as a legality predicate or inside chk==0. Declining the yes/no question, having too few candidates, or selecting an empty Group returns numeric 0 without running action. Canceling card selection returns to the yes/no question through RD.CanSelect. Once the player completes a nonempty selection, every callback return value is forwarded unchanged, including no values. Like RD.SelectAndDoAction, it creates no activation target relation, passes no extra arguments to the filter/action, and emits a selection hint for public-location searches.
Parameters
descint: Yes/no question description identifier.hintint: Card-selection prompt identifier.filterfunction: Card predicate including required action-legality checks.tpint: Selecting player; 0 or 1.s_rangeint: Locations on tp's side.o_rangeint: Locations on the opponent's side.minint: Minimum selected count.maxint: Maximum selected count.expectCard|Group|nil: Card(s) excluded from matching; pass nil for none.actionfunction: Called as action(selected_group) after the player accepts and completes selection.
Returns
any: Exactly the callback's return values when invoked; otherwise numeric 0. A callback may return no values.
Source
Rush/Utilities/RDAction.lua:107
function RushDuel.CanSelectAndDoAction(desc, hint, filter, tp, s_range, o_range, min, max, expect, action)
local hint_selection = RushDuel._private_is_include_public(s_range, o_range)
return RushDuel._private_action_can_select_match(desc, hint, filter, tp, s_range, o_range, min, max, expect, hint_selection, false, action)
endGuided Examples
Learn how to use this function in context:
Used By
Generated from the local Rush/Scripts/ folder and rush_cards.cdb.
- Detected in 509 indexed script(s).
- Search this function in the Script Explorer with
RushDuel.CanSelectAndDoAction.
Script Examples
Lufer the Symbol of the Devils (120309059)
Source: Rush/Scripts/c120309059.lua
end)
if Duel.IsExistingMatchingCard(cm.exfilter,tp,LOCATION_GRAVE,0,1,nil) then
RD.CanSelectAndDoAction(aux.Stringid(m,5),HINTMSG_RTOHAND,cm.thfilter,tp,0,LOCATION_MZONE,1,1,nil,function(sg)
RD.SendToHandAndExists(sg,e,tp,REASON_EFFECT)
end)Moonforce Ziggy (120300014)
Source: Rush/Scripts/c120300014.lua
if not tc:IsImmuneToEffect(e) then
tc:RegisterFlagEffect(FLAG_CANNOT_ATTACK_NEXT_TURN,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,1)
RD.CanSelectAndDoAction(aux.Stringid(m,3),HINTMSG_TODECK,aux.NecroValleyFilter(cm.tdfilter),tp,LOCATION_GRAVE,0,1,1,nil,function(g)
local c=e:GetHandler()
if RD.SendToDeckBottom(g,e,tp,REASON_EFFECT)~=0Freshberry Collaboration (120301071)
Source: Rush/Scripts/c120301071.lua
RD.SelectAndDoAction(HINTMSG_POSCHANGE,filter,tp,LOCATION_MZONE,0,1,1,nil,function(g)
if RD.ChangePosition(g,e,tp,REASON_EFFECT,POS_FACEUP_DEFENSE)~=0 and e:GetLabel()==1 then
RD.CanSelectAndDoAction(aux.Stringid(m,1),HINTMSG_DESTROY,cm.desfilter,tp,0,LOCATION_MZONE,1,1,nil,function(sg)
Duel.Destroy(sg,REASON_EFFECT)
end)