diff --git a/c15590355.lua b/c15590355.lua index c31d8ef196..ab103959a8 100644 --- a/c15590355.lua +++ b/c15590355.lua @@ -21,10 +21,9 @@ function s.initial_effect(c) end function s.cfilter(c,tp) return c:IsSetCard(0x17c) and c:IsType(TYPE_MONSTER) and c:IsType(TYPE_RITUAL) and not c:IsPublic() - and Duel.IsPlayerCanSpecialSummonMonster(tp,id+o,0,TYPES_TOKEN_MONSTER,0,0,c:GetLevel(),RACE_CYBERSE,ATTRIBUTE_FIRE) + and aux.IsPlayerCanSpecialSummonMonster(tp,id+o,{level=c:GetLevel()}) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) - e:SetLabel(100) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local tc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil,tp):GetFirst() @@ -33,18 +32,14 @@ function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) Duel.ShuffleHand(tp) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then - local res=e:GetLabel()==100 - e:SetLabel(0) - return res and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - end + if chk==0 then return e:IsCostChecked() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) local lv=e:GetLabel() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsPlayerCanSpecialSummonMonster(tp,id+o,0,TYPES_TOKEN_MONSTER,0,0,lv,RACE_CYBERSE,ATTRIBUTE_FIRE) then + and aux.IsPlayerCanSpecialSummonMonster(tp,id+o,{level=lv}) then local tk=Duel.CreateToken(tp,id+o) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) diff --git a/c176392.lua b/c176392.lua index 8cc8deeb63..b14327cd0a 100644 --- a/c176392.lua +++ b/c176392.lua @@ -47,13 +47,13 @@ function c176392.spcon(e,tp,eg,ep,ev,re,r,rp) end function c176392.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsPlayerCanSpecialSummonMonster(tp,176393,0x1d,TYPES_TOKEN_MONSTER,1800,1800,4,RACE_ROCK,ATTRIBUTE_EARTH) end + and aux.IsPlayerCanSpecialSummonMonster(tp,176393) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function c176392.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - if not Duel.IsPlayerCanSpecialSummonMonster(tp,176393,0x1d,TYPES_TOKEN_MONSTER,1800,1800,4,RACE_ROCK,ATTRIBUTE_EARTH) then return end + if not aux.IsPlayerCanSpecialSummonMonster(tp,176393) then return end local token=Duel.CreateToken(tp,176393) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) end diff --git a/c23626223.lua b/c23626223.lua index c0bf0334da..b0487e4e7c 100644 --- a/c23626223.lua +++ b/c23626223.lua @@ -31,14 +31,15 @@ function c23626223.initial_effect(c) c:RegisterEffect(e3) end function c23626223.target(e,tp,eg,ep,ev,re,r,rp,chk) + local c=e:GetHandler() if chk==0 then return e:IsCostChecked() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsPlayerCanSpecialSummonMonster(tp,23626223,0,TYPES_EFFECT_TRAP_MONSTER,0,2500,7,RACE_ROCK,ATTRIBUTE_EARTH) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) + and aux.IsPlayerCanSpecialSummonMonster(tp,c,TYPES_EFFECT_TRAP_MONSTER) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c23626223.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - if not Duel.IsPlayerCanSpecialSummonMonster(tp,23626223,0,TYPES_EFFECT_TRAP_MONSTER,0,2500,7,RACE_ROCK,ATTRIBUTE_EARTH) then return end + if not aux.IsPlayerCanSpecialSummonMonster(tp,c,TYPES_EFFECT_TRAP_MONSTER) then return end c:AddMonsterAttribute(TYPE_EFFECT+TYPE_TRAP) Duel.SpecialSummon(c,SUMMON_VALUE_SELF,tp,tp,true,false,POS_FACEUP) end diff --git a/c9336190.lua b/c9336190.lua index 061a345502..3906990197 100644 --- a/c9336190.lua +++ b/c9336190.lua @@ -44,7 +44,7 @@ function c9336190.spcon(e,tp,eg,ep,ev,re,r,rp) end function c9336190.spfilter(c,e,tp) return c:IsSetCard(0x10db) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and Duel.IsPlayerCanSpecialSummonMonster(tp,9336190,0x10db,TYPES_NORMAL_TRAP_MONSTER,0,0,c:GetLevel(),RACE_WARRIOR,ATTRIBUTE_DARK) + and aux.IsPlayerCanSpecialSummonMonster(tp,9336190,{type=TYPES_NORMAL_TRAP_MONSTER,level=c:GetLevel()}) end function c9336190.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c9336190.spfilter(chkc,e,tp) end @@ -62,7 +62,7 @@ function c9336190.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToEffect(e) - and Duel.IsPlayerCanSpecialSummonMonster(tp,9336190,0x10db,TYPES_NORMAL_TRAP_MONSTER,0,0,tc:GetLevel(),RACE_WARRIOR,ATTRIBUTE_DARK) then + and aux.IsPlayerCanSpecialSummonMonster(tp,9336190,{type=TYPES_NORMAL_TRAP_MONSTER,level=tc:GetLevel()}) then c:AddMonsterAttribute(TYPE_NORMAL,0,0,tc:GetLevel(),0,0) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) local e1=Effect.CreateEffect(c) diff --git a/utility.lua b/utility.lua index a8d02ada90..f0969508f2 100644 --- a/utility.lua +++ b/utility.lua @@ -1598,3 +1598,39 @@ end function Auxiliary.BanishRedirectCondition(e) return e:GetHandler():IsFaceup() end +---Wrap of Duel.IsPlayerCanSpecialSummonMonster with more clear parameters +---@param tp integer +---@param v integer|Card +---@param data? integer|{ setcode:integer, type:integer, atk:integer, def:integer, level:integer, race:integer, attribute:integer, position:integer, target_player:integer, sumtype:integer } +function Auxiliary.IsPlayerCanSpecialSummonMonster(tp,v,data) + local id + if Auxiliary.GetValueType(v)=="Card" then id=v:GetCode() end + if Auxiliary.GetValueType(v)=="number" then id=v end + if data==nil then + return Duel.IsPlayerCanSpecialSummonMonster(tp,id) + end + if data==TYPES_NORMAL_TRAP_MONSTER or data==TYPES_EFFECT_TRAP_MONSTER then + return Duel.IsPlayerCanSpecialSummonMonster(tp,id,nil,data) + end + local setcode=nil + if data.setcode then setcode=data.setcode end + local type=nil + if data.type then type=data.type end + local atk=nil + if data.atk then atk=data.atk end + local def=nil + if data.def then def=data.def end + local level=nil + if data.level then level=data.level end + local race=nil + if data.race then race=data.race end + local attribute=nil + if data.attribute then attribute=data.attribute end + local position=POS_FACEUP + if data.position then pos=data.position end + local target_player=tp + if data.target_player then target_player=data.target_player end + local sumtype=0 + if data.sumtype then sumtype=data.sumtype end + return Duel.IsPlayerCanSpecialSummonMonster(tp,id,setcode,type,atk,def,level,race,attribute,position,target_player,sumtype) +end