Commit 8a8a6708 authored by nanahira's avatar nanahira

bitcal

parent a75f6e07
...@@ -21,7 +21,7 @@ function cm.initial_effect(c) ...@@ -21,7 +21,7 @@ function cm.initial_effect(c)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,m) e1:SetCountLimit(1,m)
e1:SetCondition(function(e) e1:SetCondition(function(e)
return bit.band(e:GetHandler():GetSummonType(),0x24)~=0x24 return (e:GetHandler():GetSummonType() & 0x24)~=0x24
end) end)
e1:SetCost(Senya.SelfReleaseCost) e1:SetCost(Senya.SelfReleaseCost)
e1:SetTarget(cm.target) e1:SetTarget(cm.target)
......
...@@ -78,7 +78,7 @@ function cm.xmfilter(c) ...@@ -78,7 +78,7 @@ function cm.xmfilter(c)
return Senya.check_set_elem(c) and c:IsType(TYPE_XYZ) and c:GetRank()==4 return Senya.check_set_elem(c) and c:IsType(TYPE_XYZ) and c:GetRank()==4
end end
function cm.rcon(e,tp,eg,ep,ev,re,r,rp) function cm.rcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_COST)~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ) and Senya.check_set_elem(re:GetHandler()) and e:GetHandler():GetOverlayGroup():IsExists(cm.xmfilter,1,nil) return (r & REASON_COST)~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ) and Senya.check_set_elem(re:GetHandler()) and e:GetHandler():GetOverlayGroup():IsExists(cm.xmfilter,1,nil)
and re:GetHandler()~=e:GetHandler() and re:GetHandler()~=e:GetHandler()
end end
......
...@@ -56,7 +56,7 @@ end ...@@ -56,7 +56,7 @@ end
function cm.atcon(e,tp,eg,ep,ev,re,r,rp) function cm.atcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local bc=c:GetBattleTarget() local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsType(TYPE_MONSTER) and bit.band(bc:GetBattlePosition(),POS_DEFENSE)~=0 return c:IsRelateToBattle() and bc:IsType(TYPE_MONSTER) and (bc:GetBattlePosition() & POS_DEFENSE)~=0
end end
function cm.atop(e,tp,eg,ep,ev,re,r,rp) function cm.atop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
...@@ -34,7 +34,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp) ...@@ -34,7 +34,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local ar=cm.list[dt] local ar=cm.list[dt]
local g=Group.CreateGroup() local g=Group.CreateGroup()
if not (ar and cm.dtchk(tp) and c:IsRelateToEffect(e)) then return end if not (ar and cm.dtchk(tp) and c:IsRelateToEffect(e)) then return end
if bit.band(ar,LOCATION_HAND+LOCATION_DECK+LOCATION_EXTRA)~=0 then if (ar & LOCATION_HAND+LOCATION_DECK+LOCATION_EXTRA)~=0 then
local g1=Duel.GetMatchingGroup(cm.filter,tp,0,ar,nil) local g1=Duel.GetMatchingGroup(cm.filter,tp,0,ar,nil)
if g1:GetCount()>0 then if g1:GetCount()>0 then
if ar==LOCATION_HAND then if ar==LOCATION_HAND then
......
...@@ -95,7 +95,7 @@ function cm.valcheck(e,c) ...@@ -95,7 +95,7 @@ function cm.valcheck(e,c)
local ct=0 local ct=0
local tc=g:GetFirst() local tc=g:GetFirst()
while tc do while tc do
ct=bit.bor(tc:GetAttribute(),ct) ct=(tc:GetAttribute() | ct)
tc=g:GetNext() tc=g:GetNext()
end end
e:GetLabelObject():SetLabel(ct) e:GetLabelObject():SetLabel(ct)
...@@ -111,7 +111,7 @@ end ...@@ -111,7 +111,7 @@ end
function cm.mcon(at) function cm.mcon(at)
return function(e) return function(e)
local mt=e:GetHandler():GetFlagEffectLabel(m) local mt=e:GetHandler():GetFlagEffectLabel(m)
return mt and bit.band(at,mt)==at return mt and (at & mt)==at
end end
end end
function cm.descon(e,tp,eg,ep,ev,re,r,rp) function cm.descon(e,tp,eg,ep,ev,re,r,rp)
...@@ -201,10 +201,10 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -201,10 +201,10 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.SelectTarget(tp,cm.dfilter,tp,0,LOCATION_ONFIELD,1,1,e:GetHandler()) local g=Duel.SelectTarget(tp,cm.dfilter,tp,0,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
local cat=e:GetCategory() local cat=e:GetCategory()
if bit.band(g:GetFirst():GetOriginalType(),TYPE_MONSTER)~=0 then if (g:GetFirst():GetOriginalType() & TYPE_MONSTER)~=0 then
e:SetCategory(bit.bor(cat,CATEGORY_SPECIAL_SUMMON)) e:SetCategory((cat | CATEGORY_SPECIAL_SUMMON))
else else
e:SetCategory(bit.band(cat,bit.bnot(CATEGORY_SPECIAL_SUMMON))) e:SetCategory((cat & bit.bnot(CATEGORY_SPECIAL_SUMMON)))
end end
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -84,7 +84,7 @@ function cm.replace_register_effect(f,p) ...@@ -84,7 +84,7 @@ function cm.replace_register_effect(f,p)
end) end)
end end
local pr=e:GetProperty() local pr=e:GetProperty()
e:SetProperty(bit.bor(pr,EFFECT_FLAG_BOTH_SIDE)) e:SetProperty((pr | EFFECT_FLAG_BOTH_SIDE))
local con=e:GetCondition() local con=e:GetCondition()
e:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) e:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return (not con or con(e,tp,eg,ep,ev,re,r,rp)) and tp==p return (not con or con(e,tp,eg,ep,ev,re,r,rp)) and tp==p
......
...@@ -49,7 +49,7 @@ function cm.seqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -49,7 +49,7 @@ function cm.seqop(e,tp,eg,ep,ev,re,r,rp)
local flag=0 local flag=0
if seq>0 and Duel.CheckLocation(tp,LOCATION_MZONE,seq-1) then flag=bit.replace(flag,0x1,seq-1) end if seq>0 and Duel.CheckLocation(tp,LOCATION_MZONE,seq-1) then flag=bit.replace(flag,0x1,seq-1) end
if seq<4 and Duel.CheckLocation(tp,LOCATION_MZONE,seq+1) then flag=bit.replace(flag,0x1,seq+1) end if seq<4 and Duel.CheckLocation(tp,LOCATION_MZONE,seq+1) then flag=bit.replace(flag,0x1,seq+1) end
flag=bit.bxor(flag,0xff) flag=(flag ^ 0xff)
Duel.Hint(HINT_SELECTMSG,tp,571) Duel.Hint(HINT_SELECTMSG,tp,571)
local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,flag) local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,flag)
local nseq=0 local nseq=0
......
...@@ -51,7 +51,7 @@ function cm.cfilter(c,tp) ...@@ -51,7 +51,7 @@ function cm.cfilter(c,tp)
local ty=c:GetSummonType() local ty=c:GetSummonType()
if c:GetSummonPlayer()==tp or c:GetMaterialCount()<=0 then return false end if c:GetSummonPlayer()==tp or c:GetMaterialCount()<=0 then return false end
for i,tty in pairs({SUMMON_TYPE_FUSION+SUMMON_TYPE_SYNCHRO+SUMMON_TYPE_XYZ+SUMMON_TYPE_LINK}) do for i,tty in pairs({SUMMON_TYPE_FUSION+SUMMON_TYPE_SYNCHRO+SUMMON_TYPE_XYZ+SUMMON_TYPE_LINK}) do
if bit.band(ty,tty)==tty then return true end if (ty & tty)==tty then return true end
end end
return false return false
end end
......
...@@ -50,7 +50,7 @@ function cm.initial_effect(c) ...@@ -50,7 +50,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e7) c:RegisterEffect(e7)
end end
function cm.splimit(e,se,sp,st) function cm.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)~=SUMMON_TYPE_FUSION return (st & SUMMON_TYPE_FUSION)~=SUMMON_TYPE_FUSION
end end
function cm.ffilter(c) function cm.ffilter(c)
return c:GetSummonLocation()==LOCATION_EXTRA and c:IsOnField() return c:GetSummonLocation()==LOCATION_EXTRA and c:IsOnField()
...@@ -141,7 +141,7 @@ function cm.spptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -141,7 +141,7 @@ function cm.spptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local mg=c:GetMaterial() local mg=c:GetMaterial()
local sumtype=c:GetSummonType() local sumtype=c:GetSummonType()
if chk==0 then if chk==0 then
return not (bit.band(sumtype,SUMMON_TYPE_FUSION)~=SUMMON_TYPE_FUSION or mg:GetCount()==0 return not ((sumtype & SUMMON_TYPE_FUSION)~=SUMMON_TYPE_FUSION or mg:GetCount()==0
or mg:GetCount()>Duel.GetMZoneCount(tp) or mg:GetCount()>Duel.GetMZoneCount(tp)
or mg:IsExists(cm.mgfilter,1,nil,e,tp,c)) or mg:IsExists(cm.mgfilter,1,nil,e,tp,c))
end end
...@@ -152,7 +152,7 @@ function cm.spptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -152,7 +152,7 @@ function cm.spptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end end
function cm.mgfilter(c,e,tp,fusc) function cm.mgfilter(c,e,tp,fusc)
return not c:IsControler(tp) or not c:IsLocation(LOCATION_GRAVE) return not c:IsControler(tp) or not c:IsLocation(LOCATION_GRAVE)
or bit.band(c:GetReason(),0x40008)~=0x40008 or c:GetReasonCard()~=fusc or (c:GetReason() & 0x40008)~=0x40008 or c:GetReasonCard()~=fusc
or not c:IsCanBeSpecialSummoned(e,0,tp,true,true) or c:IsHasEffect(EFFECT_NECRO_VALLEY) or not c:IsCanBeSpecialSummoned(e,0,tp,true,true) or c:IsHasEffect(EFFECT_NECRO_VALLEY)
end end
function cm.mgfilterx(c,e,tp,fusc) function cm.mgfilterx(c,e,tp,fusc)
......
...@@ -42,7 +42,7 @@ function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -42,7 +42,7 @@ function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF)
local s1=Duel.SelectMatchingCard(tp,cm.f1,tp,LOCATION_HAND,0,1,1,nil):GetFirst() local s1=Duel.SelectMatchingCard(tp,cm.f1,tp,LOCATION_HAND,0,1,1,nil):GetFirst()
sg:AddCard(s1) sg:AddCard(s1)
local tpe=bit.band(s1:GetType(),0x7) local tpe=(s1:GetType() & 0x7)
if Duel.IsExistingMatchingCard(cm.f2,tp,LOCATION_HAND,0,1,s1,tpe) and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then if Duel.IsExistingMatchingCard(cm.f2,tp,LOCATION_HAND,0,1,s1,tpe) and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF)
local g=Duel.SelectMatchingCard(tp,cm.f2,tp,LOCATION_HAND,0,1,99,s1,tpe) local g=Duel.SelectMatchingCard(tp,cm.f2,tp,LOCATION_HAND,0,1,99,s1,tpe)
...@@ -129,5 +129,5 @@ end ...@@ -129,5 +129,5 @@ end
function cm.dfilter(c,tc) function cm.dfilter(c,tc)
local lv1=c:GetLevel() local lv1=c:GetLevel()
local lv2=tc:GetLevel() local lv2=tc:GetLevel()
return bit.band(c:GetAttribute(),tc:GetAttribute())~=0 and bit.band(c:GetRace(),tc:GetRace())~=0 and c:GetLevel()>0 and lv1==lv2 and lv1~=0 and c:IsAbleToGrave() and c:IsType(TYPE_MONSTER) return (c:GetAttribute() & tc:GetAttribute())~=0 and (c:GetRace() & tc:GetRace())~=0 and c:GetLevel()>0 and lv1==lv2 and lv1~=0 and c:IsAbleToGrave() and c:IsType(TYPE_MONSTER)
end end
\ No newline at end of file
...@@ -34,7 +34,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp) ...@@ -34,7 +34,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetDecktopGroup(tp,4) local g=Duel.GetDecktopGroup(tp,4)
local att=0 local att=0
g:ForEach(function(tc) g:ForEach(function(tc)
att=bit.bor(att,bit.band(tc:GetType(),0x7)) att=(att | (tc:GetType() & 0x7))
end) end)
if att~=0x7 then return end if att~=0x7 then return end
Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode()) Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode())
......
...@@ -23,7 +23,7 @@ function cm.initial_effect(c) ...@@ -23,7 +23,7 @@ function cm.initial_effect(c)
local g=Senya.get_all_cards:Clone() local g=Senya.get_all_cards:Clone()
local rg=Group.CreateGroup() local rg=Group.CreateGroup()
g:ForEach(function(c) g:ForEach(function(c)
if bit.band(c:GetOriginalType(),0x81)==0x81 and not cm.gg:IsExists(cm.ctfilter,1,nil,c:GetOriginalCode()) then if (c:GetOriginalType() & 0x81)==0x81 and not cm.gg:IsExists(cm.ctfilter,1,nil,c:GetOriginalCode()) then
rg:AddCard(c) rg:AddCard(c)
cm.gg:AddCard(c) cm.gg:AddCard(c)
end end
...@@ -39,7 +39,7 @@ function cm.ctfilter(c,code) ...@@ -39,7 +39,7 @@ function cm.ctfilter(c,code)
return c:GetOriginalCode()==code return c:GetOriginalCode()==code
end end
function cm.filter(c,e,tp,m,ft) function cm.filter(c,e,tp,m,ft)
if bit.band(c:GetType(),0x81)~=0x81 if (c:GetType() & 0x81)~=0x81
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
if c.ritual_custom_condition then return c:ritual_custom_condition(mg,ft) end if c.ritual_custom_condition then return c:ritual_custom_condition(mg,ft) end
......
...@@ -85,10 +85,10 @@ function cm.FConditionCode2(e,g,gc,chkfnf) ...@@ -85,10 +85,10 @@ function cm.FConditionCode2(e,g,gc,chkfnf)
if g==nil then return true end if g==nil then return true end
if not cm.material then return false end if not cm.material then return false end
local funs=cm.GenerateList(cm.material) local funs=cm.GenerateList(cm.material)
local chkf=bit.band(chkfnf,0xff) local chkf=(chkfnf & 0xff)
local c=e:GetHandler() local c=e:GetHandler()
local tp=c:GetControler() local tp=c:GetControler()
local notfusion=bit.rshift(chkfnf,8)~=0 local notfusion=(chkfnf >> 8)~=0
local sub=sub or notfusion local sub=sub or notfusion
local mg=g:Filter(Auxiliary.FConditionFilterMix,c,c,sub,table.unpack(funs)) local mg=g:Filter(Auxiliary.FConditionFilterMix,c,c,sub,table.unpack(funs))
if gc then if gc then
...@@ -101,10 +101,10 @@ function cm.FConditionCode2(e,g,gc,chkfnf) ...@@ -101,10 +101,10 @@ function cm.FConditionCode2(e,g,gc,chkfnf)
end end
function cm.FOperationCode2(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf) function cm.FOperationCode2(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
local funs=cm.GenerateList(cm.material) local funs=cm.GenerateList(cm.material)
local chkf=bit.band(chkfnf,0xff) local chkf=(chkfnf & 0xff)
local c=e:GetHandler() local c=e:GetHandler()
local tp=c:GetControler() local tp=c:GetControler()
local notfusion=bit.rshift(chkfnf,8)~=0 local notfusion=(chkfnf >> 8)~=0
local sub=sub or notfusion local sub=sub or notfusion
local mg=eg:Filter(Auxiliary.FConditionFilterMix,c,c,sub,table.unpack(funs)) local mg=eg:Filter(Auxiliary.FConditionFilterMix,c,c,sub,table.unpack(funs))
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
......
...@@ -82,7 +82,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp) ...@@ -82,7 +82,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.afilter(c) function cm.afilter(c)
return bit.band(c:GetOriginalType(),TYPE_MONSTER)~=0 and c:GetFlagEffect(m)>0 return (c:GetOriginalType() & TYPE_MONSTER)~=0 and c:GetFlagEffect(m)>0
end end
function cm.adcon(e,tp,eg,ep,ev,re,r,rp) function cm.adcon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject():GetLabelObject() local g=e:GetLabelObject():GetLabelObject()
......
...@@ -47,7 +47,7 @@ function cm.initial_effect(c) ...@@ -47,7 +47,7 @@ function cm.initial_effect(c)
end end
function cm.rcon(e,tp,eg,ep,ev,re,r,rp) function cm.rcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(m)==0 return e:GetHandler():GetFlagEffect(m)==0
and bit.band(r,REASON_COST)~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ) and (r & REASON_COST)~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ)
end end
function cm.rop(e,tp,eg,ep,ev,re,r,rp) function cm.rop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode()) Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode())
......
...@@ -48,22 +48,22 @@ function cm.disop(e,tp,eg,ep,ev,re,r,rp) ...@@ -48,22 +48,22 @@ function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local t=re:GetType() local t=re:GetType()
local cd=re:GetCode() local cd=re:GetCode()
local pr1,pr2=re:GetProperty() local pr1,pr2=re:GetProperty()
pr1=bit.bor(pr1,EFFECT_FLAG_NO_TURN_RESET) pr1=(pr1 | EFFECT_FLAG_NO_TURN_RESET)
if bit.band(t,EFFECT_TYPE_ACTIVATE)~=0 then if (t & EFFECT_TYPE_ACTIVATE)~=0 then
t=bit.bor(t-EFFECT_TYPE_ACTIVATE,EFFECT_TYPE_QUICK_O) t=(t-EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_QUICK_O)
end end
if bit.band(t,EFFECT_TYPE_XMATERIAL)~=0 then if (t & EFFECT_TYPE_XMATERIAL)~=0 then
t=t-EFFECT_TYPE_XMATERIAL t=t-EFFECT_TYPE_XMATERIAL
end end
if bit.band(t,EFFECT_TYPE_QUICK_F)~=0 then if (t & EFFECT_TYPE_QUICK_F)~=0 then
t=bit.bor(t-EFFECT_TYPE_QUICK_F,EFFECT_TYPE_QUICK_O) t=(t-EFFECT_TYPE_QUICK_F | EFFECT_TYPE_QUICK_O)
end end
if bit.band(t,EFFECT_TYPE_TRIGGER_F)~=0 then if (t & EFFECT_TYPE_TRIGGER_F)~=0 then
t=bit.bor(t-EFFECT_TYPE_TRIGGER_F,EFFECT_TYPE_TRIGGER_O) t=(t-EFFECT_TYPE_TRIGGER_F | EFFECT_TYPE_TRIGGER_O)
pr1=bit.bor(pr1,EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) pr1=(pr1 | EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
end end
if bit.band(t,EFFECT_TYPE_IGNITION)~=0 then if (t & EFFECT_TYPE_IGNITION)~=0 then
t=bit.bor(t-EFFECT_TYPE_IGNITION,EFFECT_TYPE_QUICK_O) t=(t-EFFECT_TYPE_IGNITION | EFFECT_TYPE_QUICK_O)
cd=EVENT_FREE_CHAIN cd=EVENT_FREE_CHAIN
end end
e1:SetType(t) e1:SetType(t)
......
...@@ -71,7 +71,7 @@ function cm.cop(te) ...@@ -71,7 +71,7 @@ function cm.cop(te)
if not te then return end if not te then return end
local c=e:GetHandler() local c=e:GetHandler()
local tg=te:GetTarget() local tg=te:GetTarget()
if bit.band(c:GetType(),TYPE_FIELD+TYPE_CONTINUOUS+TYPE_PENDULUM)==0 then if (c:GetType() & TYPE_FIELD+TYPE_CONTINUOUS+TYPE_PENDULUM)==0 then
c:CancelToGrave(false) c:CancelToGrave(false)
end end
local code=te:GetCode() local code=te:GetCode()
......
...@@ -129,7 +129,7 @@ function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -129,7 +129,7 @@ function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
return false return false
end end
function cm.spcon2(e,tp,eg,ep,ev,re,r,rp) function cm.spcon2(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 and e:GetHandler():IsPreviousLocation(LOCATION_MZONE) return (r & REASON_EFFECT+REASON_BATTLE)~=0 and e:GetHandler():IsPreviousLocation(LOCATION_MZONE)
end end
function cm.ffilter(c,e,tp,m,f,chkf) function cm.ffilter(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c)) return c:IsType(TYPE_FUSION) and (not f or f(c))
......
...@@ -36,7 +36,7 @@ function cm.rmop(e,tp,eg,ep,ev,re,r,rp) ...@@ -36,7 +36,7 @@ function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
local flag=0 local flag=0
if seq>0 and Duel.CheckLocation(tp,LOCATION_MZONE,seq-1) then flag=bit.replace(flag,0x1,seq-1) end if seq>0 and Duel.CheckLocation(tp,LOCATION_MZONE,seq-1) then flag=bit.replace(flag,0x1,seq-1) end
if seq<4 and Duel.CheckLocation(tp,LOCATION_MZONE,seq+1) then flag=bit.replace(flag,0x1,seq+1) end if seq<4 and Duel.CheckLocation(tp,LOCATION_MZONE,seq+1) then flag=bit.replace(flag,0x1,seq+1) end
flag=bit.bxor(flag,0xff) flag=(flag ^ 0xff)
Duel.Hint(HINT_SELECTMSG,tp,571) Duel.Hint(HINT_SELECTMSG,tp,571)
local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,flag) local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,flag)
local nseq=0 local nseq=0
......
...@@ -29,7 +29,7 @@ function cm.cfilter(c,ori) ...@@ -29,7 +29,7 @@ function cm.cfilter(c,ori)
if c:IsFacedown() then return false end if c:IsFacedown() then return false end
if ori then return c:GetOriginalCode()==37564765 and c:IsLocation(LOCATION_MZONE) end if ori then return c:GetOriginalCode()==37564765 and c:IsLocation(LOCATION_MZONE) end
if c:IsCode(37564765) then return true end if c:IsCode(37564765) then return true end
return (Senya.check_set_sawawa(c) or (Senya.check_set_3L(c) and c:IsType(TYPE_FUSION)) or (Senya.check_set_sayuri(c) and bit.band(c:GetType(),0x81)==0x81)) and c:IsLocation(LOCATION_MZONE) return (Senya.check_set_sawawa(c) or (Senya.check_set_3L(c) and c:IsType(TYPE_FUSION)) or (Senya.check_set_sayuri(c) and (c:GetType() & 0x81)==0x81)) and c:IsLocation(LOCATION_MZONE)
end end
function cm.condition2(e,tp,eg,ep,ev,re,r,rp) function cm.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_ONFIELD,0,1,nil,false) return Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_ONFIELD,0,1,nil,false)
......
...@@ -17,7 +17,7 @@ function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -17,7 +17,7 @@ function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc~=e:GetHandler() end if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc~=e:GetHandler() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,e:GetHandler()) and Senya.NanahiraExistingCondition(false)(e,tp,eg,ep,ev,re,r,rp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,e:GetHandler()) and Senya.NanahiraExistingCondition(false)(e,tp,eg,ep,ev,re,r,rp) end
local pr1,pr2=e:GetProperty() local pr1,pr2=e:GetProperty()
e:SetProperty(bit.bor(pr1,EFFECT_FLAG_CARD_TARGET),pr2) e:SetProperty((pr1 | EFFECT_FLAG_CARD_TARGET),pr2)
e:SetCategory(CATEGORY_DESTROY) e:SetCategory(CATEGORY_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,e:GetHandler()) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,e:GetHandler())
...@@ -26,7 +26,7 @@ end ...@@ -26,7 +26,7 @@ end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk) function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) and Senya.NanahiraExistingCondition(true)(e,tp,eg,ep,ev,re,r,rp) and Duel.IsPlayerCanDraw(tp,1) end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) and Senya.NanahiraExistingCondition(true)(e,tp,eg,ep,ev,re,r,rp) and Duel.IsPlayerCanDraw(tp,1) end
local pr1,pr2=e:GetProperty() local pr1,pr2=e:GetProperty()
e:SetProperty(pr1-bit.band(pr1,EFFECT_FLAG_CARD_TARGET),pr2) e:SetProperty(pr1-(pr1 & EFFECT_FLAG_CARD_TARGET),pr2)
e:SetCategory(CATEGORY_REMOVE+CATEGORY_DRAW) e:SetCategory(CATEGORY_REMOVE+CATEGORY_DRAW)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,nil) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
......
...@@ -24,7 +24,7 @@ function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -24,7 +24,7 @@ function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and cm.filter(chkc,e,tp) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and cm.filter(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetMZoneCount(tp)>0 end if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetMZoneCount(tp)>0 end
local pr1,pr2=e:GetProperty() local pr1,pr2=e:GetProperty()
e:SetProperty(bit.bor(pr1,EFFECT_FLAG_CARD_TARGET),pr2) e:SetProperty((pr1 | EFFECT_FLAG_CARD_TARGET),pr2)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
...@@ -32,7 +32,7 @@ end ...@@ -32,7 +32,7 @@ end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk) function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetMZoneCount(tp)>0 end if chk==0 then return Duel.IsExistingMatchingCard(cm.filter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetMZoneCount(tp)>0 end
local pr1,pr2=e:GetProperty() local pr1,pr2=e:GetProperty()
e:SetProperty(pr1-bit.band(pr1,EFFECT_FLAG_CARD_TARGET),pr2) e:SetProperty(pr1-(pr1 & EFFECT_FLAG_CARD_TARGET),pr2)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end end
function cm.op1(e,tp,eg,ep,ev,re,r,rp) function cm.op1(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -38,7 +38,7 @@ function cm.hcon(e,c) ...@@ -38,7 +38,7 @@ function cm.hcon(e,c)
return Duel.GetMZoneCount(c:GetControler())>0 and Duel.IsExistingMatchingCard(cm.ssfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) and c:IsFaceup() and not c:IsDisabled() return Duel.GetMZoneCount(c:GetControler())>0 and Duel.IsExistingMatchingCard(cm.ssfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) and c:IsFaceup() and not c:IsDisabled()
end end
function cm.spcon2(e,tp,eg,ep,ev,re,r,rp) function cm.spcon2(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 return (r & REASON_EFFECT+REASON_BATTLE)~=0
end end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return c:IsCode(37564765) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsCode(37564765) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
...@@ -18,7 +18,7 @@ function cm.initial_effect(c) ...@@ -18,7 +18,7 @@ function cm.initial_effect(c)
end end
function cm.filter(c,e,tp) function cm.filter(c,e,tp)
return c:IsFaceup() and c:IsCode(37564765) and c:IsAbleToGrave() return c:IsFaceup() and c:IsCode(37564765) and c:IsAbleToGrave()
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp,c:GetOriginalCode()) and bit.band(c:GetType(),0x8020d0+TYPE_LINK)~=0 and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil,e,tp,c:GetOriginalCode()) and (c:GetType() & 0x8020d0+TYPE_LINK)~=0
end end
function cm.spfilter(c,e,tp,code) function cm.spfilter(c,e,tp,code)
return c.Senya_desc_with_nanahira and c:GetOriginalCode()~=code and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Senya.CheckSummonLocation(c,tp) return c.Senya_desc_with_nanahira and c:GetOriginalCode()~=code and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Senya.CheckSummonLocation(c,tp)
......
...@@ -23,7 +23,7 @@ end ...@@ -23,7 +23,7 @@ end
function cm.cf(c,rc) function cm.cf(c,rc)
if not c:IsAbleToGraveAsCost() then return false end if not c:IsAbleToGraveAsCost() then return false end
if c:IsCode(37564517) then return true end if c:IsCode(37564517) then return true end
return bit.band(c:GetAttribute(),rc:GetAttribute())~=0 or bit.band(c:GetRace(),rc:GetRace())~=0 return (c:GetAttribute() & rc:GetAttribute())~=0 or (c:GetRace() & rc:GetRace())~=0
end end
function cm.DiscardHandCost(e,tp,eg,ep,ev,re,r,rp) function cm.DiscardHandCost(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
...@@ -43,8 +43,8 @@ function cm.add(rg) ...@@ -43,8 +43,8 @@ function cm.add(rg)
local te=tc:GetActivateEffect() local te=tc:GetActivateEffect()
if not te then return end if not te then return end
local pr1,pr2=te:GetProperty() local pr1,pr2=te:GetProperty()
if bit.band(pr2,EFFECT_FLAG2_COF)~=0 then return end if (pr2 & EFFECT_FLAG2_COF)~=0 then return end
pr2=bit.bor(pr2,EFFECT_FLAG2_COF) pr2=(pr2 | EFFECT_FLAG2_COF)
te:SetHintTiming(0,0x1e0) te:SetHintTiming(0,0x1e0)
te:SetProperty(pr1,pr2) te:SetProperty(pr1,pr2)
rg:AddCard(tc) rg:AddCard(tc)
...@@ -55,7 +55,7 @@ function cm.rmv(rg) ...@@ -55,7 +55,7 @@ function cm.rmv(rg)
local te=tc:GetActivateEffect() local te=tc:GetActivateEffect()
if not te then return end if not te then return end
local pr1,pr2=te:GetProperty() local pr1,pr2=te:GetProperty()
pr2=pr2-bit.band(pr2,EFFECT_FLAG2_COF) pr2=pr2-(pr2 & EFFECT_FLAG2_COF)
te:SetProperty(pr1,pr2) te:SetProperty(pr1,pr2)
te:SetHintTiming(0,0) te:SetHintTiming(0,0)
rg:RemoveCard(tc) rg:RemoveCard(tc)
......
...@@ -38,7 +38,7 @@ function cm.initial_effect(c) ...@@ -38,7 +38,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function cm.rgcon(e) function cm.rgcon(e)
return bit.band(e:GetHandler():GetSummonType(),0x534)==0x534 return (e:GetHandler():GetSummonType() & 0x534)==0x534
end end
function cm.spcon(e,c) function cm.spcon(e,c)
if c==nil then return true end if c==nil then return true end
...@@ -51,7 +51,7 @@ end ...@@ -51,7 +51,7 @@ end
function cm.rdcon(e,tp,eg,ep,ev,re,r,rp) function cm.rdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
return ep~=tp and Duel.GetAttackTarget()==nil return ep~=tp and Duel.GetAttackTarget()==nil
and c:GetEffectCount(EFFECT_DIRECT_ATTACK)<2 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and bit.band(e:GetHandler():GetSummonType(),0x534)==0x534 and c:GetEffectCount(EFFECT_DIRECT_ATTACK)<2 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and (e:GetHandler():GetSummonType() & 0x534)==0x534
end end
function cm.rdop(e,tp,eg,ep,ev,re,r,rp) function cm.rdop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeBattleDamage(ep,ev/2) Duel.ChangeBattleDamage(ep,ev/2)
...@@ -66,7 +66,7 @@ function cm.f3(c,e,tp) ...@@ -66,7 +66,7 @@ function cm.f3(c,e,tp)
return c:IsCode(37564765) and c:IsAbleToGrave() and not c:IsImmuneToEffect(e) and c:IsFaceup() and Duel.IsExistingMatchingCard(cm.f2,tp,LOCATION_EXTRA,0,1,nil,e,tp,Group.FromCards(e:GetHandler(),nc)) return c:IsCode(37564765) and c:IsAbleToGrave() and not c:IsImmuneToEffect(e) and c:IsFaceup() and Duel.IsExistingMatchingCard(cm.f2,tp,LOCATION_EXTRA,0,1,nil,e,tp,Group.FromCards(e:GetHandler(),nc))
end end
function cm.filter(c) function cm.filter(c)
return c.Senya_desc_with_nanahira and bit.band(c:GetType(),TYPE_TRAP+TYPE_COUNTER)==TYPE_TRAP+TYPE_COUNTER and c:IsAbleToHand() return c.Senya_desc_with_nanahira and (c:GetType() & TYPE_TRAP+TYPE_COUNTER)==TYPE_TRAP+TYPE_COUNTER and c:IsAbleToHand()
end end
function cm.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGrave() and Duel.IsExistingMatchingCard(cm.f1,tp,LOCATION_MZONE,0,1,e:GetHandler(),e,tp) end if chk==0 then return e:GetHandler():IsAbleToGrave() and Duel.IsExistingMatchingCard(cm.f1,tp,LOCATION_MZONE,0,1,e:GetHandler(),e,tp) end
......
...@@ -50,7 +50,7 @@ function cm.initial_effect(c) ...@@ -50,7 +50,7 @@ function cm.initial_effect(c)
end end
function cm.bmrlfilter(c,ft) function cm.bmrlfilter(c,ft)
if ft==0 and c:GetSequence()>4 then return false end if ft==0 and c:GetSequence()>4 then return false end
return c:IsCode(37564765) and bit.band(c:GetType(),0x8020d0+TYPE_LINK)~=0 return c:IsCode(37564765) and (c:GetType() & 0x8020d0+TYPE_LINK)~=0
end end
function cm.bmrlcon(e,c) function cm.bmrlcon(e,c)
if c==nil then return true end if c==nil then return true end
......
...@@ -64,7 +64,7 @@ function cm.f(c) ...@@ -64,7 +64,7 @@ function cm.f(c)
end end
function cm.add(tc) function cm.add(tc)
local p2=0 local p2=0
if bit.band(tc:GetOriginalType(),TYPE_QUICKPLAY+TYPE_TRAP)==0 then p2=EFFECT_TYPE_QUICK_O end if (tc:GetOriginalType() & TYPE_QUICKPLAY+TYPE_TRAP)==0 then p2=EFFECT_TYPE_QUICK_O end
local e2=Effect.CreateEffect(tc) local e2=Effect.CreateEffect(tc)
e2:SetDescription(m*16) e2:SetDescription(m*16)
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
...@@ -112,10 +112,10 @@ function cm.reg(e,tp,eg,ep,ev,re,r,rp) ...@@ -112,10 +112,10 @@ function cm.reg(e,tp,eg,ep,ev,re,r,rp)
end end
function cm.condition2(e,tp,eg,ep,ev,re,r,rp) function cm.condition2(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsChainNegatable(ev) then return false end if not Duel.IsChainNegatable(ev) then return false end
if e:GetHandler():GetTurnID()==Duel.GetTurnCount() and bit.band(e:GetHandler():GetOriginalType(),TYPE_QUICKPLAY+TYPE_TRAP)==0 then return false end if e:GetHandler():GetTurnID()==Duel.GetTurnCount() and (e:GetHandler():GetOriginalType() & TYPE_QUICKPLAY+TYPE_TRAP)==0 then return false end
local t1=bit.band(e:GetHandler():GetOriginalType(),0x7) local t1=(e:GetHandler():GetOriginalType() & 0x7)
local t2=bit.band(re:GetHandler():GetOriginalType(),0x7) local t2=(re:GetHandler():GetOriginalType() & 0x7)
return bit.band(t1,t2)~=0 return (t1 & t2)~=0
end end
function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
......
...@@ -60,7 +60,7 @@ function cm.disop(e,tp,eg,ep,ev,re,r,rp) ...@@ -60,7 +60,7 @@ function cm.disop(e,tp,eg,ep,ev,re,r,rp)
end end
function cm.repop(e,tp,eg,ep,ev,re,r,rp) function cm.repop(e,tp,eg,ep,ev,re,r,rp)
local t=e:GetActiveType() local t=e:GetActiveType()
if (bit.band(t,TYPE_CONTINUOUS+TYPE_FIELD)~=0 or bit.band(t,TYPE_SPELL+TYPE_PENDULUM)==TYPE_SPELL+TYPE_PENDULUM) and not e:GetHandler():IsRelateToEffect(e) then return end if ((t & TYPE_CONTINUOUS+TYPE_FIELD)~=0 or (t & TYPE_SPELL+TYPE_PENDULUM)==TYPE_SPELL+TYPE_PENDULUM) and not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
......
...@@ -65,7 +65,7 @@ function cm.matfilter3(c,syncard) ...@@ -65,7 +65,7 @@ function cm.matfilter3(c,syncard)
return c:IsFaceup() and c:IsSynchroType(TYPE_TUNER) and c:IsCode(37564765) and c:IsCanBeSynchroMaterial(syncard) return c:IsFaceup() and c:IsSynchroType(TYPE_TUNER) and c:IsCode(37564765) and c:IsCanBeSynchroMaterial(syncard)
end end
function cm.matfilter4(c,syncard) function cm.matfilter4(c,syncard)
return c:IsFaceup() and bit.band(c:GetOriginalType(),TYPE_TUNER)==0 and bit.band(c:GetOriginalRace(),RACE_FAIRY)~=0 and c:IsCode(37564765) and c:IsCanBeSynchroMaterial(syncard) return c:IsFaceup() and (c:GetOriginalType() & TYPE_TUNER)==0 and (c:GetOriginalRace() & RACE_FAIRY)~=0 and c:IsCode(37564765) and c:IsCanBeSynchroMaterial(syncard)
end end
function cm.val(c,syncard) function cm.val(c,syncard)
if c:IsLocation(LOCATION_SZONE) then if c:IsLocation(LOCATION_SZONE) then
......
...@@ -37,7 +37,7 @@ function cm.initial_effect(c) ...@@ -37,7 +37,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function cm.splimit(e,se,sp,st) function cm.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK return (st & SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK
end end
function cm.desfilter(c,g) function cm.desfilter(c,g)
return g:IsContains(c) return g:IsContains(c)
......
...@@ -50,20 +50,20 @@ end ...@@ -50,20 +50,20 @@ end
function cm.location_check(p,tp,z) function cm.location_check(p,tp,z)
local tz=0 local tz=0
if p~=tp then if p~=tp then
tz=bit.rshift(bit.band(z,0x1f0000),16) tz=((z & 0x1f0000) >> 16)
else else
tz=bit.band(z,0x1f) tz=(z & 0x1f)
end end
local ct=0 local ct=0
local res=0 local res=0
for i=0,4 do for i=0,4 do
local cz=bit.lshift(1,i) local cz=(1 << i)
if bit.band(tz,cz)==cz and Duel.CheckLocation(p,LOCATION_MZONE,i) then if (tz & cz)==cz and Duel.CheckLocation(p,LOCATION_MZONE,i) then
ct=ct+1 ct=ct+1
res=bit.bor(cz,res) res=(cz | res)
end end
end end
if p~=tp then res=bit.lshift(res,16) end if p~=tp then res=(res << 16) end
return ct,res return ct,res
end end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
...@@ -87,6 +87,6 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -87,6 +87,6 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local ct,res=cm.location_check(p,tp,z) local ct,res=cm.location_check(p,tp,z)
Duel.Hint(HINT_SELECTMSG,tp,571) Duel.Hint(HINT_SELECTMSG,tp,571)
local sz=Duel.SelectDisableField(tp,1,LOCATION_MZONE,LOCATION_MZONE,0x1f001f-res) local sz=Duel.SelectDisableField(tp,1,LOCATION_MZONE,LOCATION_MZONE,0x1f001f-res)
if bit.band(sz,0x1f0000)~=0 then sz=bit.rshift(sz,16) end if (sz & 0x1f0000)~=0 then sz=(sz >> 16) end
Duel.MoveSequence(rc,math.log(sz,2)) Duel.MoveSequence(rc,math.log(sz,2))
end end
\ No newline at end of file
...@@ -16,5 +16,5 @@ function cm.initial_effect(c) ...@@ -16,5 +16,5 @@ function cm.initial_effect(c)
Senya.NegateEffectModule(c,1) Senya.NegateEffectModule(c,1)
end end
function cm.splimit(e,se,sp,st) function cm.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK return (st & SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK
end end
\ No newline at end of file
...@@ -63,7 +63,7 @@ function cm.spop1(e,tp,eg,ep,ev,re,r,rp) ...@@ -63,7 +63,7 @@ function cm.spop1(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp) function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 return (r & REASON_EFFECT)~=0
and Senya.check_set_prim(re:GetHandler()) and not e:GetHandler():IsReason(REASON_RETURN) and Senya.check_set_prim(re:GetHandler()) and not e:GetHandler():IsReason(REASON_RETURN)
end end
function cm.thfilter(c) function cm.thfilter(c)
......
...@@ -31,7 +31,7 @@ function cm.initial_effect(c) ...@@ -31,7 +31,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function cm.condition(e,tp,eg,ep,ev,re,r,rp) function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 return (r & REASON_EFFECT)~=0
and Senya.check_set_prim(re:GetHandler()) and Senya.check_set_prim(re:GetHandler())
end end
function cm.thfilter(c) function cm.thfilter(c)
......
...@@ -498,7 +498,7 @@ end ...@@ -498,7 +498,7 @@ end
function cm.MokouRebornCondition(eff,con) function cm.MokouRebornCondition(eff,con)
if eff then if eff then
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
return bit.band(e:GetHandler():GetReason(),0x41)==0x41 and (not con or con(e,tp,eg,ep,ev,re,r,rp)) return (e:GetHandler():GetReason() & 0x41)==0x41 and (not con or con(e,tp,eg,ep,ev,re,r,rp))
end end
else else
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
...@@ -972,7 +972,7 @@ function cm.PrismXyzCheck(min,max) ...@@ -972,7 +972,7 @@ function cm.PrismXyzCheck(min,max)
end end
function cm.PrismXyzValue(c) function cm.PrismXyzValue(c)
local v=1 local v=1
if c:IsHasEffect(37564499) then v=bit.bor(v,0x20000) end if c:IsHasEffect(37564499) then v=(v | 0x20000) end
return v return v
end end
--xyz monster atk drain effect --xyz monster atk drain effect
...@@ -1074,8 +1074,8 @@ function cm.NanahiraExtraPendulum(c,scon) ...@@ -1074,8 +1074,8 @@ function cm.NanahiraExtraPendulum(c,scon)
e2:SetValue(function(e,se,sp,st) e2:SetValue(function(e,se,sp,st)
if scon and not scon(e,se,sp,st) then return false end if scon and not scon(e,se,sp,st) then return false end
local c=e:GetHandler() local c=e:GetHandler()
if c:IsFaceup() and c:IsLocation(LOCATION_EXTRA) and c:IsType(TYPE_FUSION) and bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION then return false end if c:IsFaceup() and c:IsLocation(LOCATION_EXTRA) and c:IsType(TYPE_FUSION) and (st & SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION then return false end
return c:IsHasEffect(EFFECT_REVIVE_LIMIT) or c:IsStatus(STATUS_PROC_COMPLETE) or bit.band(st,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM return c:IsHasEffect(EFFECT_REVIVE_LIMIT) or c:IsStatus(STATUS_PROC_COMPLETE) or (st & SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
end) end)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
...@@ -1315,7 +1315,7 @@ function cm.NanahiraTrap(c,...) ...@@ -1315,7 +1315,7 @@ function cm.NanahiraTrap(c,...)
e1:SetCost(cm.SelfReleaseCost) e1:SetCost(cm.SelfReleaseCost)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end
return bit.band(e:GetHandler():GetSummonType(),0x553)==0x553 return (e:GetHandler():GetSummonType() & 0x553)==0x553
end) end)
local op=te:GetOperation() local op=te:GetOperation()
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
...@@ -1409,7 +1409,7 @@ end ...@@ -1409,7 +1409,7 @@ end
--counter summon effect universals --counter summon effect universals
--n=normal f=flip s=special o=opponent only --n=normal f=flip s=special o=opponent only
function cm.NegateSummonModule(c,tpcode,ctlm,ctlmid,con,cost) function cm.NegateSummonModule(c,tpcode,ctlm,ctlmid,con,cost)
if not tpcode or bit.band(tpcode,7)==0 then return end if not tpcode or (tpcode & 7)==0 then return end
ctlmid=ctlmid or 1 ctlmid=ctlmid or 1
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(37564765,4)) e3:SetDescription(aux.Stringid(37564765,4))
...@@ -1418,7 +1418,7 @@ function cm.NegateSummonModule(c,tpcode,ctlm,ctlmid,con,cost) ...@@ -1418,7 +1418,7 @@ function cm.NegateSummonModule(c,tpcode,ctlm,ctlmid,con,cost)
e3:SetRange(LOCATION_MZONE) e3:SetRange(LOCATION_MZONE)
e3:SetCode(EVENT_SPSUMMON) e3:SetCode(EVENT_SPSUMMON)
if ctlm then e3:SetCountLimit(ctlm,ctlmid) end if ctlm then e3:SetCountLimit(ctlm,ctlmid) end
if bit.band(tpcode,8)==8 then if (tpcode & 8)==8 then
e3:SetLabel(2) e3:SetLabel(2)
else else
e3:SetLabel(1) e3:SetLabel(1)
...@@ -1432,15 +1432,15 @@ function cm.NegateSummonModule(c,tpcode,ctlm,ctlmid,con,cost) ...@@ -1432,15 +1432,15 @@ function cm.NegateSummonModule(c,tpcode,ctlm,ctlmid,con,cost)
local e1=e3:Clone() local e1=e3:Clone()
e1:SetCode(EVENT_SUMMON) e1:SetCode(EVENT_SUMMON)
local t={} local t={}
if bit.band(tpcode,1)==1 then if (tpcode & 1)==1 then
c:RegisterEffect(e1) c:RegisterEffect(e1)
table.insert(t,e1) table.insert(t,e1)
end end
if bit.band(tpcode,2)==2 then if (tpcode & 2)==2 then
c:RegisterEffect(e2) c:RegisterEffect(e2)
table.insert(t,e2) table.insert(t,e2)
end end
if bit.band(tpcode,4)==4 then if (tpcode & 4)==4 then
c:RegisterEffect(e3) c:RegisterEffect(e3)
table.insert(t,e3) table.insert(t,e3)
end end
...@@ -1763,7 +1763,7 @@ function cm.FusionCondition_3L(mf,f,min,max,myon,sub) ...@@ -1763,7 +1763,7 @@ function cm.FusionCondition_3L(mf,f,min,max,myon,sub)
return function(e,g,gc,chkfnf) return function(e,g,gc,chkfnf)
if g==nil then return true end if g==nil then return true end
local c=e:GetHandler() local c=e:GetHandler()
local chkf=bit.band(chkfnf,0xff) local chkf=(chkfnf & 0xff)
local mg=g:Filter(cm.FusionFilter_3L,nil,e:GetHandler(),mf,sub) local mg=g:Filter(cm.FusionFilter_3L,nil,e:GetHandler(),mf,sub)
local tp=e:GetHandlerPlayer() local tp=e:GetHandlerPlayer()
local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon) local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
...@@ -1785,7 +1785,7 @@ end ...@@ -1785,7 +1785,7 @@ end
function cm.FusionOperation_3L(mf,f,min,max,myon,sub) function cm.FusionOperation_3L(mf,f,min,max,myon,sub)
return function(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf) return function(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
local c=e:GetHandler() local c=e:GetHandler()
local chkf=bit.band(chkfnf,0xff) local chkf=(chkfnf & 0xff)
local mg=eg:Filter(cm.FusionFilter_3L,nil,e:GetHandler(),mf,sub) local mg=eg:Filter(cm.FusionFilter_3L,nil,e:GetHandler(),mf,sub)
local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon) local exg=Duel.GetMatchingGroup(cm.MyonCheckFilter,tp,0,LOCATION_MZONE,nil,c,myon)
mg:Merge(exg) mg:Merge(exg)
...@@ -2235,7 +2235,7 @@ function cm.multi_choice_target(m,...) ...@@ -2235,7 +2235,7 @@ function cm.multi_choice_target(m,...)
return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc) return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then if chkc then
local pr=e:GetProperty() local pr=e:GetProperty()
return bit.band(pr,EFFECT_FLAG_CARD_TARGET)~=0 and function_list[e:GetLabel()](e,tp,eg,ep,ev,re,r,rp,chk,chkc) return (pr & EFFECT_FLAG_CARD_TARGET)~=0 and function_list[e:GetLabel()](e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end end
local avaliable_list={} local avaliable_list={}
for i,tg in pairs(function_list) do for i,tg in pairs(function_list) do
...@@ -2307,7 +2307,7 @@ end ...@@ -2307,7 +2307,7 @@ end
function cm.GetFusionMaterial(tp,loc,oloc,f,gc,e,...) function cm.GetFusionMaterial(tp,loc,oloc,f,gc,e,...)
local g1=Duel.GetFusionMaterial(tp) local g1=Duel.GetFusionMaterial(tp)
if loc then if loc then
local floc=bit.band(loc,LOCATION_ONFIELD+LOCATION_HAND) local floc=(loc & LOCATION_ONFIELD+LOCATION_HAND)
if floc~=0 then if floc~=0 then
g1=g1:Filter(Card.IsLocation,nil,floc) g1=g1:Filter(Card.IsLocation,nil,floc)
else else
...@@ -2574,8 +2574,8 @@ function cm.DivideValueMax(f,...) ...@@ -2574,8 +2574,8 @@ function cm.DivideValueMax(f,...)
local ext_params={...} local ext_params={...}
return function(c) return function(c)
local v=f(c,table.unpack(ext_params)) local v=f(c,table.unpack(ext_params))
local v1=bit.band(v,0xffff) local v1=(v & 0xffff)
local v2=bit.rshift(v,16) local v2=(v >> 16)
return math.max(v1,v2) return math.max(v1,v2)
end end
end end
...@@ -2583,8 +2583,8 @@ function cm.DivideValueMin(f,...) ...@@ -2583,8 +2583,8 @@ function cm.DivideValueMin(f,...)
local ext_params={...} local ext_params={...}
return function(c) return function(c)
local v=f(c,table.unpack(ext_params)) local v=f(c,table.unpack(ext_params))
local v1=bit.band(v,0xffff) local v1=(v & 0xffff)
local v2=bit.rshift(v,16) local v2=(v >> 16)
if v1<=0 then if v1<=0 then
return v2 return v2
elseif v2<=0 then elseif v2<=0 then
......
...@@ -136,23 +136,23 @@ return function(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -136,23 +136,23 @@ return function(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabelObject(tc) e:SetLabelObject(tc)
local ctg=0 local ctg=0
if tc:IsSetCard(0x777) then if tc:IsSetCard(0x777) then
ctg=bit.bor(ctg,CATEGORY_REMOVE+CATEGORY_DRAW) ctg=(ctg | CATEGORY_REMOVE+CATEGORY_DRAW)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end end
if tc:IsAttribute(at) then if tc:IsAttribute(at) then
if at==ATTRIBUTE_WIND then if at==ATTRIBUTE_WIND then
ctg=bit.bor(ctg,CATEGORY_TOHAND+CATEGORY_SEARCH) ctg=(ctg | CATEGORY_TOHAND+CATEGORY_SEARCH)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
elseif at==ATTRIBUTE_FIRE then elseif at==ATTRIBUTE_FIRE then
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
ctg=bit.bor(ctg,CATEGORY_DESTROY) ctg=(ctg | CATEGORY_DESTROY)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
elseif at==ATTRIBUTE_EARTH then elseif at==ATTRIBUTE_EARTH then
ctg=bit.bor(ctg,CATEGORY_SPECIAL_SUMMON) ctg=(ctg | CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
elseif at==ATTRIBUTE_WATER then elseif at==ATTRIBUTE_WATER then
ctg=bit.bor(ctg,CATEGORY_TOGRAVE+CATEGORY_DECKDES) ctg=(ctg | CATEGORY_TOGRAVE+CATEGORY_DECKDES)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end end
end end
...@@ -277,7 +277,7 @@ function prim.ses(c,at) ...@@ -277,7 +277,7 @@ function prim.ses(c,at)
e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
local l=e:GetLabel() local l=e:GetLabel()
local b=false local b=false
if bit.band(l,1)~=0 and Duel.GetMZoneCount(tp)>0 then if (l & 1)~=0 and Duel.GetMZoneCount(tp)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,prim.sesspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,m) local g=Duel.SelectMatchingCard(tp,prim.sesspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,m)
local tc=g:GetFirst() local tc=g:GetFirst()
...@@ -292,7 +292,7 @@ function prim.ses(c,at) ...@@ -292,7 +292,7 @@ function prim.ses(c,at)
tc:RegisterEffect(e1,true) tc:RegisterEffect(e1,true)
end end
end end
if bit.band(l,2)~=0 and Duel.IsPlayerCanDraw(tp,1) then if (l & 2)~=0 and Duel.IsPlayerCanDraw(tp,1) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,prim.sessrfilter,tp,LOCATION_DECK,0,1,1,nil,at) local g=Duel.SelectMatchingCard(tp,prim.sessrfilter,tp,LOCATION_DECK,0,1,1,nil,at)
local tc=g:GetFirst() local tc=g:GetFirst()
......
...@@ -54,8 +54,8 @@ function cm.initial_effect(c) ...@@ -54,8 +54,8 @@ function cm.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function cm.chkf(c) function cm.chkf(c)
local t=bit.bor(c:GetType(),c:GetOriginalType()) local t=(c:GetType() | c:GetOriginalType())
return bit.band(t,TYPE_FUSION)==TYPE_FUSION return (t & TYPE_FUSION)==TYPE_FUSION
end end
function cm.dfilter(c) function cm.dfilter(c)
return true return true
...@@ -67,10 +67,10 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -67,10 +67,10 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.SelectTarget(tp,cm.dfilter,tp,0,LOCATION_ONFIELD,1,1,nil) local g=Duel.SelectTarget(tp,cm.dfilter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
local cat=e:GetCategory() local cat=e:GetCategory()
if bit.band(g:GetFirst():GetOriginalType(),TYPE_MONSTER)~=0 then if (g:GetFirst():GetOriginalType() & TYPE_MONSTER)~=0 then
e:SetCategory(bit.bor(cat,CATEGORY_SPECIAL_SUMMON)) e:SetCategory((cat | CATEGORY_SPECIAL_SUMMON))
else else
e:SetCategory(bit.band(cat,bit.bnot(CATEGORY_SPECIAL_SUMMON))) e:SetCategory((cat & bit.bnot(CATEGORY_SPECIAL_SUMMON)))
end end
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -33,7 +33,7 @@ function cm.effect_operation_3L(c) ...@@ -33,7 +33,7 @@ function cm.effect_operation_3L(c)
ex2:SetTargetRange(0,LOCATION_DECK+LOCATION_EXTRA) ex2:SetTargetRange(0,LOCATION_DECK+LOCATION_EXTRA)
ex2:SetTarget(function(e,c) ex2:SetTarget(function(e,c)
return c:GetOwner()~=e:GetHandlerPlayer() and (c:IsLocation(LOCATION_DECK) return c:GetOwner()~=e:GetHandlerPlayer() and (c:IsLocation(LOCATION_DECK)
or (c:IsLocation(LOCATION_EXTRA) and bit.band(c:GetOriginalType(),TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ)~=0)) or (c:IsLocation(LOCATION_EXTRA) and (c:GetOriginalType() & TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ)~=0))
end) end)
ex2:SetReset(RESET_EVENT+0x1fe0000) ex2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(ex2,true) c:RegisterEffect(ex2,true)
......
...@@ -72,7 +72,7 @@ function cm.eqlimit(e,c) ...@@ -72,7 +72,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.condition(e,tp,eg,ep,ev,re,r,rp) function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsOnField() and bit.band(re:GetHandler():GetOriginalType(),TYPE_PENDULUM)==0 and re:GetHandler():GetFlagEffect(m)==0 return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsOnField() and (re:GetHandler():GetOriginalType() & TYPE_PENDULUM)==0 and re:GetHandler():GetFlagEffect(m)==0
end end
function cm.operation(e,tp,eg,ep,ev,re,r,rp) function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler() local rc=re:GetHandler()
......
...@@ -25,7 +25,7 @@ function cm.initial_effect(c) ...@@ -25,7 +25,7 @@ function cm.initial_effect(c)
e0:SetCode(EVENT_SPSUMMON_SUCCESS) e0:SetCode(EVENT_SPSUMMON_SUCCESS)
e0:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) e0:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
return bit.band(c:GetSummonType(),0x829)==0x829 return (c:GetSummonType() & 0x829)==0x829
end) end)
e0:SetOperation(cm.skipop) e0:SetOperation(cm.skipop)
c:RegisterEffect(e0) c:RegisterEffect(e0)
......
...@@ -35,7 +35,7 @@ function cm.chkfilter_mokou(c) ...@@ -35,7 +35,7 @@ function cm.chkfilter_mokou(c)
end end
function cm.NegateEffectWithoutChainingCondition(e,tp,eg,ep,ev,re,r,rp) function cm.NegateEffectWithoutChainingCondition(e,tp,eg,ep,ev,re,r,rp)
local loc,np=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_CONTROLER) local loc,np=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_CONTROLER)
return e:GetHandler():GetFlagEffect(m)==0 and re:GetHandler():IsRelateToEffect(re) and not re:GetHandler():IsImmuneToEffect(e) and bit.band(loc,0x0c)~=0 and np~=tp and re:GetHandler():IsAbleToGrave() return e:GetHandler():GetFlagEffect(m)==0 and re:GetHandler():IsRelateToEffect(re) and not re:GetHandler():IsImmuneToEffect(e) and (loc & 0x0c)~=0 and np~=tp and re:GetHandler():IsAbleToGrave()
end end
function cm.NegateEffectWithoutChainingOperation(e,tp,eg,ep,ev,re,r,rp) function cm.NegateEffectWithoutChainingOperation(e,tp,eg,ep,ev,re,r,rp)
if not Duel.SelectYesNo(tp,m*16+2) then return end if not Duel.SelectYesNo(tp,m*16+2) then return end
......
...@@ -179,7 +179,7 @@ function cm.cop(te) ...@@ -179,7 +179,7 @@ function cm.cop(te)
if not te then return end if not te then return end
local c=e:GetHandler() local c=e:GetHandler()
local tg=te:GetTarget() local tg=te:GetTarget()
if bit.band(c:GetType(),TYPE_FIELD+TYPE_CONTINUOUS+TYPE_PENDULUM)==0 then if (c:GetType() & TYPE_FIELD+TYPE_CONTINUOUS+TYPE_PENDULUM)==0 then
c:CancelToGrave(false) c:CancelToGrave(false)
end end
local code=te:GetCode() local code=te:GetCode()
......
...@@ -138,7 +138,7 @@ end ...@@ -138,7 +138,7 @@ end
function cm.sfilter(c,tp,fc,e) function cm.sfilter(c,tp,fc,e)
if not fc then return false end if not fc then return false end
if e and not c:IsCanBeEffectTarget(e) then return false end if e and not c:IsCanBeEffectTarget(e) then return false end
return c:IsControler(tp) and c:IsLocation(LOCATION_REMOVED) and c:IsAbleToDeck() and c:IsType(TYPE_MONSTER) and Senya.check_set_3L(c) and Senya.EffectSourceFilter_3L(c,fc) and bit.band(c:GetReason(),0x40008)==0x40008 and c:GetReasonCard()==fc return c:IsControler(tp) and c:IsLocation(LOCATION_REMOVED) and c:IsAbleToDeck() and c:IsType(TYPE_MONSTER) and Senya.check_set_3L(c) and Senya.EffectSourceFilter_3L(c,fc) and (c:GetReason() & 0x40008)==0x40008 and c:GetReasonCard()==fc
end end
function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local fc=e:GetHandler():GetFirstCardTarget() local fc=e:GetHandler():GetFirstCardTarget()
......
...@@ -13,7 +13,7 @@ function cm.initial_effect(c) ...@@ -13,7 +13,7 @@ function cm.initial_effect(c)
Senya.sayuri_activate_effect[c]=e1 Senya.sayuri_activate_effect[c]=e1
end end
function cm.filter(c,e,tp,m1,m2,ft) function cm.filter(c,e,tp,m1,m2,ft)
if not Senya.check_set_sayuri(c) or bit.band(c:GetType(),0x81)~=0x81 if not Senya.check_set_sayuri(c) or (c:GetType() & 0x81)~=0x81
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
mg:Merge(m2) mg:Merge(m2)
......
...@@ -13,7 +13,7 @@ function cm.initial_effect(c) ...@@ -13,7 +13,7 @@ function cm.initial_effect(c)
Senya.sayuri_activate_effect[c]=e1 Senya.sayuri_activate_effect[c]=e1
end end
function cm.filter(c,e,tp,mg,ft) function cm.filter(c,e,tp,mg,ft)
if not Senya.check_set_sayuri(c) or bit.band(c:GetType(),0x81)~=0x81 if not Senya.check_set_sayuri(c) or (c:GetType() & 0x81)~=0x81
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=mg:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=mg:Filter(Card.IsCanBeRitualMaterial,c,c)
if c:IsCode(21105106) then return c:ritual_custom_condition(mg,ft) end if c:IsCode(21105106) then return c:ritual_custom_condition(mg,ft) end
......
...@@ -13,7 +13,7 @@ function cm.initial_effect(c) ...@@ -13,7 +13,7 @@ function cm.initial_effect(c)
Senya.sayuri_activate_effect[c]=e1 Senya.sayuri_activate_effect[c]=e1
end end
function cm.filter(c,e,tp,mg,ft) function cm.filter(c,e,tp,mg,ft)
if not Senya.check_set_sayuri(c) or bit.band(c:GetType(),0x81)~=0x81 if not Senya.check_set_sayuri(c) or (c:GetType() & 0x81)~=0x81
or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
local mg=mg:Filter(Card.IsCanBeRitualMaterial,c,c) local mg=mg:Filter(Card.IsCanBeRitualMaterial,c,c)
if c:IsCode(21105106) then return c:ritual_custom_condition(mg,ft) end if c:IsCode(21105106) then return c:ritual_custom_condition(mg,ft) end
......
...@@ -109,7 +109,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -109,7 +109,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
e:SetCondition(cm.rcon(e:GetCondition(),tc,copyt)) e:SetCondition(cm.rcon(e:GetCondition(),tc,copyt))
e:SetCost(cm.rcost(e:GetCost())) e:SetCost(cm.rcost(e:GetCost()))
if e:IsHasType(EFFECT_TYPE_IGNITION) then if e:IsHasType(EFFECT_TYPE_IGNITION) then
e:SetType(bit.bor(e:GetType()-EFFECT_TYPE_IGNITION,EFFECT_TYPE_QUICK_O)) e:SetType((e:GetType()-EFFECT_TYPE_IGNITION | EFFECT_TYPE_QUICK_O))
e:SetCode(EVENT_FREE_CHAIN) e:SetCode(EVENT_FREE_CHAIN)
e:SetHintTiming(0,0x1c0) e:SetHintTiming(0,0x1c0)
end end
......
...@@ -36,10 +36,10 @@ function cm.initial_effect(c) ...@@ -36,10 +36,10 @@ function cm.initial_effect(c)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
local cat=e:GetCategory() local cat=e:GetCategory()
if bit.band(re:GetHandler():GetOriginalType(),TYPE_MONSTER)~=0 then if (re:GetHandler():GetOriginalType() & TYPE_MONSTER)~=0 then
e:SetCategory(bit.bor(cat,CATEGORY_SPECIAL_SUMMON)) e:SetCategory((cat | CATEGORY_SPECIAL_SUMMON))
else else
e:SetCategory(bit.band(cat,bit.bnot(CATEGORY_SPECIAL_SUMMON))) e:SetCategory((cat & bit.bnot(CATEGORY_SPECIAL_SUMMON)))
end end
end end
end) end)
......
...@@ -71,7 +71,7 @@ function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -71,7 +71,7 @@ function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thcfilter,tp,LOCATION_REMOVED,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(cm.thcfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.thcfilter,tp,LOCATION_REMOVED,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,cm.thcfilter,tp,LOCATION_REMOVED,0,1,1,nil)
local s=bit.band(g:GetFirst():GetOriginalType(),TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ)==0 and 2 or 0 local s=(g:GetFirst():GetOriginalType() & TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ)==0 and 2 or 0
Duel.SendtoDeck(g,nil,s,REASON_COST) Duel.SendtoDeck(g,nil,s,REASON_COST)
end end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp) function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -120,8 +120,8 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp) ...@@ -120,8 +120,8 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local f=Card.RegisterEffect local f=Card.RegisterEffect
Card.RegisterEffect=function(tc,e,forced) Card.RegisterEffect=function(tc,e,forced)
local t=e:GetType() local t=e:GetType()
if bit.band(t,EFFECT_TYPE_IGNITION)~=0 then if (t & EFFECT_TYPE_IGNITION)~=0 then
e:SetType(bit.bor(t-EFFECT_TYPE_IGNITION,EFFECT_TYPE_QUICK_O)) e:SetType((t-EFFECT_TYPE_IGNITION | EFFECT_TYPE_QUICK_O))
e:SetCode(EVENT_FREE_CHAIN) e:SetCode(EVENT_FREE_CHAIN)
e:SetHintTiming(0,0x1e0) e:SetHintTiming(0,0x1e0)
end end
......
...@@ -50,7 +50,7 @@ function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -50,7 +50,7 @@ function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end end
function cm.thfilter(c,tc) function cm.thfilter(c,tc)
return Senya.check_set_sayuri(c) and c:IsType(bit.band(tc:GetType(),0x7)) and c:IsAbleToHand() return Senya.check_set_sayuri(c) and c:IsType((tc:GetType() & 0x7)) and c:IsAbleToHand()
end end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_HAND,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_HAND,1,nil) end
......
...@@ -112,7 +112,7 @@ function cm.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -112,7 +112,7 @@ function cm.eqop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.repval(e,re,r,rp) function cm.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE+REASON_EFFECT)~=0 return (r & REASON_BATTLE+REASON_EFFECT)~=0
end end
function cm.adcon(e,tp,eg,ep,ev,re,r,rp) function cm.adcon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetLabelObject():GetLabelObject() local ec=e:GetLabelObject():GetLabelObject()
...@@ -121,7 +121,7 @@ end ...@@ -121,7 +121,7 @@ end
function cm.atkval(e,c) function cm.atkval(e,c)
local ec=e:GetLabelObject():GetLabelObject() local ec=e:GetLabelObject():GetLabelObject()
local atk=ec:GetTextAttack() local atk=ec:GetTextAttack()
if ec:IsFacedown() or bit.band(ec:GetOriginalType(),TYPE_MONSTER)==0 or atk<0 then if ec:IsFacedown() or (ec:GetOriginalType() & TYPE_MONSTER)==0 or atk<0 then
return 0 return 0
else else
return atk return atk
...@@ -130,7 +130,7 @@ end ...@@ -130,7 +130,7 @@ end
function cm.defval(e,c) function cm.defval(e,c)
local ec=e:GetLabelObject():GetLabelObject() local ec=e:GetLabelObject():GetLabelObject()
local def=ec:GetTextDefense() local def=ec:GetTextDefense()
if ec:IsFacedown() or bit.band(ec:GetOriginalType(),TYPE_MONSTER)==0 or def<0 then if ec:IsFacedown() or (ec:GetOriginalType() & TYPE_MONSTER)==0 or def<0 then
return 0 return 0
else else
return def return def
......
...@@ -70,7 +70,7 @@ function cm.sfilter(c,e,tp) ...@@ -70,7 +70,7 @@ function cm.sfilter(c,e,tp)
return c:IsCode(m) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and c:IsType(TYPE_MONSTER) return c:IsCode(m) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and c:IsType(TYPE_MONSTER)
end end
function cm.sfilter1(c,e,tp) function cm.sfilter1(c,e,tp)
return c:IsLevelBelow(8) and Senya.check_set_sayuri(c) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and bit.band(c:GetType(),0x81)==0x81 return c:IsLevelBelow(8) and Senya.check_set_sayuri(c) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and (c:GetType() & 0x81)==0x81
end end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetMZoneCount(tp)>0 if chk==0 then return Duel.GetMZoneCount(tp)>0
......
...@@ -16,7 +16,7 @@ function cm.initial_effect(c) ...@@ -16,7 +16,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function cm.cfilter(c,ori) function cm.cfilter(c,ori)
return Senya.check_set_sayuri(c) and c:IsFaceup() and bit.band(c:GetType(),0x81)==0x81 return Senya.check_set_sayuri(c) and c:IsFaceup() and (c:GetType() & 0x81)==0x81
end end
function cm.condition2(e,tp,eg,ep,ev,re,r,rp) function cm.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil) return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil)
......
...@@ -15,7 +15,7 @@ function cm.initial_effect(c) ...@@ -15,7 +15,7 @@ function cm.initial_effect(c)
Senya.sayuri_activate_effect[c]=e1 Senya.sayuri_activate_effect[c]=e1
end end
function cm.filter(c,e,tp,mg) function cm.filter(c,e,tp,mg)
if not Senya.check_set_sayuri(c) or bit.band(c:GetType(),0x81)~=0x81 or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end if not Senya.check_set_sayuri(c) or (c:GetType() & 0x81)~=0x81 or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
if c.mat_filter then if c.mat_filter then
mg=mg:Filter(c.mat_filter,nil) mg=mg:Filter(c.mat_filter,nil)
end end
...@@ -72,11 +72,11 @@ function cm.retfilter(c) ...@@ -72,11 +72,11 @@ function cm.retfilter(c)
return c:IsFaceup() and c:IsAbleToDeckOrExtraAsCost() and Senya.check_set_sayuri(c) and c:IsType(TYPE_MONSTER) return c:IsFaceup() and c:IsAbleToDeckOrExtraAsCost() and Senya.check_set_sayuri(c) and c:IsType(TYPE_MONSTER)
end end
function cm.rcon(e,tp,eg,ep,ev,re,r,rp) function cm.rcon(e,tp,eg,ep,ev,re,r,rp)
local ct=bit.band(ev,0xffff) local ct=(ev & 0xffff)
return bit.band(r,REASON_COST)~=0 and re:GetHandler()==e:GetHandler() and re:IsHasType(0x7e0) and Duel.IsExistingMatchingCard(cm.retfilter,tp,LOCATION_REMOVED,0,ct,nil) return (r & REASON_COST)~=0 and re:GetHandler()==e:GetHandler() and re:IsHasType(0x7e0) and Duel.IsExistingMatchingCard(cm.retfilter,tp,LOCATION_REMOVED,0,ct,nil)
end end
function cm.rop(e,tp,eg,ep,ev,re,r,rp) function cm.rop(e,tp,eg,ep,ev,re,r,rp)
local ct=bit.band(ev,0xffff) local ct=(ev & 0xffff)
Duel.Hint(HINT_CARD,0,e:GetOwner():GetOriginalCode()) Duel.Hint(HINT_CARD,0,e:GetOwner():GetOriginalCode())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.retfilter,tp,LOCATION_REMOVED,0,ct,ct,nil) local g=Duel.SelectMatchingCard(tp,cm.retfilter,tp,LOCATION_REMOVED,0,ct,ct,nil)
......
...@@ -49,7 +49,7 @@ function c66677706.disop(e,tp,eg,ep,ev,re,r,rp) ...@@ -49,7 +49,7 @@ function c66677706.disop(e,tp,eg,ep,ev,re,r,rp)
end end
function c66677706.descon(e,tp,eg,ep,ev,re,r,rp) function c66677706.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
return rp~=tp and c:GetPreviousControler()==tp and bit.band(r,REASON_DESTROY)~=0 return rp~=tp and c:GetPreviousControler()==tp and (r & REASON_DESTROY)~=0
end end
function c66677706.filter(c) function c66677706.filter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and c:IsSetCard(0x777) and c:IsFaceup() return c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and c:IsSetCard(0x777) and c:IsFaceup()
......
...@@ -48,7 +48,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -48,7 +48,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.rfilter(c,tc) function cm.rfilter(c,tc)
return c:IsAbleToRemove() and bit.band(tc:GetAttribute(),c:GetAttribute())~=0 and c:IsType(TYPE_MONSTER) return c:IsAbleToRemove() and (tc:GetAttribute() & c:GetAttribute())~=0 and c:IsType(TYPE_MONSTER)
end end
function cm.cfilter(c,tp) function cm.cfilter(c,tp)
return c:IsSetCard(0x777) and c:IsControler(tp) and c:IsFaceup() and c:IsType(TYPE_MONSTER) return c:IsSetCard(0x777) and c:IsControler(tp) and c:IsFaceup() and c:IsType(TYPE_MONSTER)
......
...@@ -36,8 +36,8 @@ function cm.initial_effect(c) ...@@ -36,8 +36,8 @@ function cm.initial_effect(c)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e4:SetCode(EVENT_TO_GRAVE) e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) e4:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return bit.band(e:GetHandler():GetPreviousPosition(),POS_FACEUP)~=0 return (e:GetHandler():GetPreviousPosition() & POS_FACEUP)~=0
and bit.band(e:GetHandler():GetPreviousLocation(),LOCATION_ONFIELD)~=0 and (e:GetHandler():GetPreviousLocation() & LOCATION_ONFIELD)~=0
end) end)
e4:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) e4:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk)
local s0=Duel.IsExistingMatchingCard(cm.tfilter,tp,LOCATION_GRAVE,0,1,nil,0) local s0=Duel.IsExistingMatchingCard(cm.tfilter,tp,LOCATION_GRAVE,0,1,nil,0)
......
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