Commit bbda0f0d authored by mercury233's avatar mercury233 Committed by GitHub

add aux.IsCodeOrListed (#2667)

parent 22e9ac17
......@@ -30,7 +30,7 @@ function s.initial_effect(c)
c:RegisterEffect(e3)
end
function s.filter(c)
return (c:IsCode(10000010) or aux.IsCodeListed(c,10000010)) and not c:IsCode(id) and c:IsAbleToHand()
return aux.IsCodeOrListed(c,10000010) and not c:IsCode(id) and c:IsAbleToHand()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -31,7 +31,7 @@ function c12266229.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsPublic() end
end
function c12266229.thfilter(c)
return (c:IsCode(46986414) or aux.IsCodeListed(c,46986414)) and c:IsAbleToHand()
return aux.IsCodeOrListed(c,46986414) and c:IsAbleToHand()
and c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_RITUAL)
end
function c12266229.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -24,7 +24,7 @@ function c13650422.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c13650422.filter(c)
return (aux.IsCodeListed(c,94820406) or c:IsCode(94820406)) and not c:IsCode(13650422) and c:IsAbleToHand()
return aux.IsCodeOrListed(c,94820406) and not c:IsCode(13650422) and c:IsAbleToHand()
end
function c13650422.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c13650422.filter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -23,7 +23,7 @@ function c23020408.initial_effect(c)
c:RegisterEffect(e2)
end
function c23020408.filter(c)
return (aux.IsCodeListed(c,46986414) or aux.IsCodeListed(c,38033121) or c:IsCode(46986414)) and not c:IsCode(23020408)
return (aux.IsCodeOrListed(c,46986414) or aux.IsCodeOrListed(c,38033121)) and not c:IsCode(23020408)
and (c:IsAbleToDeck() or c:IsLocation(LOCATION_DECK))
end
function c23020408.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -29,8 +29,7 @@ function c23147658.initial_effect(c)
c:RegisterEffect(e2)
end
function c23147658.thfilter(c)
if not c:IsAbleToHand() or c:IsCode(23147658) then return false end
return c:IsCode(59419719) or aux.IsCodeListed(c,59419719)
return aux.IsCodeOrListed(c,59419719) and not c:IsCode(23147658) and c:IsAbleToHand()
end
function c23147658.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_EFFECT)
......
......@@ -33,7 +33,7 @@ function c34690953.initial_effect(c)
Duel.AddCustomActivityCounter(34690953,ACTIVITY_SPSUMMON,c34690953.counterfilter)
end
function c34690953.counterfilter(c)
return aux.IsCodeListed(c,3285552) or c:IsCode(3285552)
return aux.IsCodeOrListed(c,3285552)
end
function c34690953.tkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(34690953,tp,ACTIVITY_SPSUMMON)==0 end
......
......@@ -30,7 +30,7 @@ function c45883110.initial_effect(c)
c:RegisterEffect(e3)
end
function c45883110.tgfilter(c)
return (c:IsCode(68468459) or aux.IsCodeListed(c,68468459)) and c:IsAbleToGrave()
return aux.IsCodeOrListed(c,68468459) and c:IsAbleToGrave()
end
function c45883110.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c45883110.tgfilter,tp,LOCATION_DECK,0,1,nil) end
......@@ -47,7 +47,7 @@ function c45883110.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsPreviousLocation,1,nil,LOCATION_EXTRA)
end
function c45883110.spfilter(c,e,tp)
return (c:IsCode(68468459) or aux.IsCodeListed(c,68468459)) and not c:IsCode(45883110)
return aux.IsCodeOrListed(c,68468459) and not c:IsCode(45883110)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c45883110.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -35,7 +35,7 @@ function c48589580.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c48589580.thfilter(c,thchk)
return (c:IsCode(56433456) or aux.IsCodeListed(c,56433456) or (thchk and c:IsRace(RACE_FAIRY))) and c:IsAbleToHand()
return (aux.IsCodeOrListed(c,56433456) or thchk and c:IsRace(RACE_FAIRY)) and c:IsAbleToHand()
end
function c48589580.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local thchk=Duel.IsEnvironment(56433456)
......
......@@ -26,7 +26,7 @@ function c54092240.initial_effect(c)
Duel.AddCustomActivityCounter(54092240,ACTIVITY_SPSUMMON,c54092240.counterfilter)
end
function c54092240.counterfilter(c)
return aux.IsCodeListed(c,3285552) or c:IsCode(3285552)
return aux.IsCodeOrListed(c,3285552)
end
function c54092240.cfilter(c)
return c:IsFaceup() and c:IsCode(3285552)
......
......@@ -13,7 +13,7 @@ function c54878729.initial_effect(c)
c:RegisterEffect(e1)
end
function c54878729.filter(c,code)
return not c:IsCode(54878729) and (c:IsCode(code) or aux.IsCodeListed(c,code)) and c:IsAbleToGrave()
return not c:IsCode(54878729) and aux.IsCodeOrListed(c,code) and c:IsAbleToGrave()
end
function c54878729.chkfunc(g,attr,tp,code)
return g:IsExists(Card.IsAttribute,1,nil,attr) and Duel.IsExistingMatchingCard(c54878729.filter,tp,LOCATION_DECK,0,1,nil,code)
......
......@@ -38,7 +38,7 @@ function c6128460.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT+REASON_DISCARD)
end
function c6128460.thfilter(c)
return (aux.IsCodeListed(c,32274490) or c:IsCode(32274490)) and not c:IsCode(6128460) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
return aux.IsCodeOrListed(c,32274490) and not c:IsCode(6128460) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c6128460.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
......
......@@ -58,8 +58,7 @@ function s.repfilter(c,tp)
and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.confilter(c)
return c:IsType(TYPE_SYNCHRO) and c:IsFaceup()
and (c:IsCode(70902743) or aux.IsCodeListed(c,70902743))
return c:IsType(TYPE_SYNCHRO) and c:IsFaceup() and aux.IsCodeOrListed(c,70902743)
end
function s.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp)
......
......@@ -33,7 +33,7 @@ function c63542003.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.DiscardHand(tp,c63542003.cfilter,1,1,REASON_COST+REASON_DISCARD,e:GetHandler())
end
function c63542003.thfilter(c)
return (c:IsCode(17484499) or aux.IsCodeListed(c,17484499)) and c:IsAbleToHand()
return aux.IsCodeOrListed(c,17484499) and c:IsAbleToHand()
end
function c63542003.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false)
......
......@@ -28,7 +28,7 @@ function c64927055.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c64927055.filter(c)
return c:IsFaceup() and (c:IsCode(56433456) or aux.IsCodeListed(c,56433456)) and c:IsAbleToHand()
return c:IsFaceup() and aux.IsCodeOrListed(c,56433456) and c:IsAbleToHand()
end
function c64927055.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
......@@ -54,7 +54,7 @@ function c66961194.spop1(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
function c66961194.spcostfilter2(c)
return (c:IsCode(89631139) or aux.IsCodeListed(c,89631139)) and c:IsDiscardable()
return aux.IsCodeOrListed(c,89631139) and c:IsDiscardable()
end
function c66961194.spcost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c66961194.spcostfilter2,tp,LOCATION_HAND,0,1,nil) end
......
......@@ -43,7 +43,7 @@ function c69167267.spcon2(e,tp,eg,ep,ev,re,r,rp)
return c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEDOWN)
end
function c69167267.spfilter2(c,e,tp)
return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and (c:IsCode(73580471) or aux.IsCodeListed(c,73580471)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
return c:IsFaceupEx() and aux.IsCodeOrListed(c,73580471) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c69167267.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and c69167267.spfilter2(chkc,e,tp) end
......
......@@ -59,7 +59,7 @@ function c74431740.activate(e,tp,eg,ep,ev,re,r,rp)
end
end
function c74431740.tdfilter(c,e)
return not c:IsCode(74431740) and (aux.IsCodeListed(c,80280737) or c:IsCode(80280737)) and c:IsAbleToDeck()
return not c:IsCode(74431740) and aux.IsCodeOrListed(c,80280737) and c:IsAbleToDeck()
and (not e or c:IsCanBeEffectTarget(e))
end
function c74431740.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -29,8 +29,7 @@ function c74644400.initial_effect(c)
c:RegisterEffect(e3)
end
function c74644400.thfilter(c)
return (aux.IsCodeListed(c,80280737) or c:IsCode(80280737)) and not c:IsCode(74644400)
and c:IsAbleToHand()
return aux.IsCodeOrListed(c,80280737) and not c:IsCode(74644400) and c:IsAbleToHand()
end
function c74644400.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c74644400.thfilter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -45,7 +45,7 @@ function c80839052.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c80839052.thfilter(c)
return c:IsAbleToHand() and (not c:IsCode(80839052)) and (aux.IsCodeListed(c,36623431) or c:IsCode(36623431))
return c:IsAbleToHand() and not c:IsCode(80839052) and aux.IsCodeOrListed(c,36623431)
end
function c80839052.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c80839052.thfilter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -51,7 +51,7 @@ function c84778110.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)
end
function c84778110.rfilter(c)
return (aux.IsCodeListed(c,59419719) or c:IsCode(59419719)) and c:IsFaceup()
return aux.IsCodeOrListed(c,59419719) and c:IsFaceup()
end
function c84778110.cfilter(c)
return c:IsCode(59419719)
......
......@@ -33,7 +33,7 @@ function c90290572.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function c90290572.tgfilter(c)
return (c:IsCode(56433456) or aux.IsCodeListed(c,56433456)) and c:IsAbleToGrave()
return aux.IsCodeOrListed(c,56433456) and c:IsAbleToGrave()
end
function c90290572.thfilter(c)
return c:IsCode(91188343) and c:IsAbleToHand()
......
......@@ -25,7 +25,7 @@ function c90312154.initial_effect(c)
c:RegisterEffect(e2)
end
function c90312154.filter(c,ft)
return (c:IsCode(56433456) or aux.IsCodeListed(c,56433456)) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable()
return aux.IsCodeOrListed(c,56433456) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable()
and (ft==nil or ft>0 or c:IsType(TYPE_FIELD))
end
function c90312154.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -21,7 +21,7 @@ function c91500017.initial_effect(c)
c:RegisterEffect(e2)
end
function c91500017.filter(c)
return (aux.IsCodeListed(c,15259703) or c:IsCode(15259703)) and not c:IsCode(91500017) and c:IsAbleToHand()
return aux.IsCodeOrListed(c,15259703) and not c:IsCode(91500017) and c:IsAbleToHand()
end
function c91500017.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c91500017.filter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -44,7 +44,7 @@ function s.initial_effect(c)
c:RegisterEffect(e4)
end
function s.filter(c)
return (c:IsCode(70902743) or aux.IsCodeListed(c,70902743)) and c:IsAbleToHand() and not c:IsCode(id)
return aux.IsCodeOrListed(c,70902743) and c:IsAbleToHand() and not c:IsCode(id)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
......
......@@ -502,6 +502,9 @@ end
function Auxiliary.IsCodeListed(c,code)
return c.card_code_list and c.card_code_list[code]
end
function Auxiliary.IsCodeOrListed(c,code)
return c:IsCode(code) or Auxiliary.IsCodeListed(c,code)
end
function Auxiliary.AddSetNameMonsterList(c,...)
if c:IsStatus(STATUS_COPYING_EFFECT) then return end
if c.setcode_monster_list==nil then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment