Commit 9214ba80 authored by Nemo Ma's avatar Nemo Ma

fix

parent 3ac2f708
......@@ -84,6 +84,7 @@ function cm.filter2(c)
end
function cm.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.HintSelection(Group.FromCards(e:GetHandler()))
if Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.Hint(HINT_CARD,0,m)
if Duel.NegateEffect(ev) then
......
......@@ -43,49 +43,55 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ft1=math.min(5,Duel.GetLocationCount(tp,LOCATION_MZONE))
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft1=1 end
local ft2=math.min(5,Duel.GetLocationCount(1-tp,LOCATION_MZONE))
if ft1>0 and ft2>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,11451572,0,0x4011,1050,1050,10,RACE_MACHINE,0x3) and Duel.IsPlayerCanSpecialSummonMonster(1-tp,11451572,0,0x4011,1050,1050,10,RACE_MACHINE,0x3) and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
if Duel.IsPlayerAffectedByEffect(1-tp,59822133) then ft2=1 end
if (ft1>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,11451572,0,0x4011,1050,1050,10,RACE_MACHINE,0x3)) or (ft2>0 and Duel.IsPlayerCanSpecialSummonMonster(1-tp,11451572,0,0x4011,1050,1050,10,RACE_MACHINE,0x3)) then
local fid=e:GetHandler():GetFieldID()
local g=Group.CreateGroup()
local list1={}
for i=1,ft1 do list1[i]=i end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,0))
ct1=Duel.AnnounceNumber(tp,table.unpack(list1))
for i=1,ct1 do
local token=Duel.CreateToken(tp,11451572)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_ATTACK)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_SUM)
e2:SetValue(function(e,c) return not c:IsRace(RACE_MACHINE) end)
token:RegisterEffect(e2,true)
g:AddCard(token)
if ft1>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,11451572,0,0x4011,1050,1050,10,RACE_MACHINE,0x3) then
local list1={}
for i=1,ft1 do list1[i]=i end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,0))
ct1=Duel.AnnounceNumber(tp,table.unpack(list1))
for i=1,ct1 do
local token=Duel.CreateToken(tp,11451572)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_ATTACK)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_SUM)
e2:SetValue(function(e,c) return not c:IsRace(RACE_MACHINE) end)
token:RegisterEffect(e2,true)
g:AddCard(token)
end
end
local list2={}
for i=1,ft2 do list2[i]=i end
Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(m,0))
ct2=Duel.AnnounceNumber(1-tp,table.unpack(list2))
for i=1,ct2 do
local token=Duel.CreateToken(1-tp,11451572)
Duel.SpecialSummonStep(token,0,1-tp,1-tp,false,false,POS_FACEUP_ATTACK)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_SUM)
e2:SetValue(function(e,c) return not c:IsRace(RACE_MACHINE) end)
token:RegisterEffect(e2,true)
g:AddCard(token)
if ft2>0 and Duel.IsPlayerCanSpecialSummonMonster(1-tp,11451572,0,0x4011,1050,1050,10,RACE_MACHINE,0x3) then
local list2={}
for i=1,ft2 do list2[i]=i end
Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(m,0))
ct2=Duel.AnnounceNumber(1-tp,table.unpack(list2))
for i=1,ct2 do
local token=Duel.CreateToken(1-tp,11451572)
Duel.SpecialSummonStep(token,0,1-tp,1-tp,false,false,POS_FACEUP_ATTACK)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_UNRELEASABLE_SUM)
e2:SetValue(function(e,c) return not c:IsRace(RACE_MACHINE) end)
token:RegisterEffect(e2,true)
g:AddCard(token)
end
end
g:KeepAlive()
g:ForEach(Card.RegisterFlagEffect,m,RESET_EVENT+RESETS_STANDARD,0,1,fid)
......
......@@ -54,14 +54,16 @@ function cm.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,false)
e:GetHandler():CreateEffectRelation(te)
c:CancelToGrave(false)
te:SetType(EFFECT_TYPE_ACTIVATE)
local te2=te:Clone()
e:SetLabelObject(te2)
te:SetType(26)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetCountLimit(1)
e1:SetLabelObject(te)
e1:SetCondition(cm.rscon)
e1:SetLabelObject(te2)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re==te end)
e1:SetOperation(cm.rsop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
......@@ -69,11 +71,11 @@ function cm.costop(e,tp,eg,ep,ev,re,r,rp)
e2:SetCode(EVENT_CHAIN_NEGATED)
Duel.RegisterEffect(e2,tp)
end
function cm.rscon(e,tp,eg,ep,ev,re,r,rp)
return re==e:GetLabelObject()
end
function cm.rsop(e,tp,eg,ep,ev,re,r,rp)
re:SetType(EFFECT_TYPE_QUICK_O)
local rc=re:GetHandler()
local te2=e:GetLabelObject()
re:Reset()
rc:RegisterEffect(te2,true)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_END and Duel.GetCurrentChain()==0
......
......@@ -103,10 +103,24 @@ function cm.xylabel(c,tp)
end
return x,y
end
function cm.gradient(y,x)
if y>0 and x==0 then return math.pi/2 end
if y<0 and x==0 then return math.pi*3/2 end
if y>=0 and x>0 then return math.atan(y/x) end
if x<0 then return math.pi+math.atan(y/x) end
if y<0 and x>0 then return 2*math.pi+math.atan(y/x) end
return 1000
end
function cm.fieldline(x1,y1,x2,y2,...)
for _,k in pairs({...}) do
if cm.gradient(y2-y1,x2-x1)==k then return true end
end
return false
end
function cm.seqfilter(c,tc,tp)
local x1,y1=cm.xylabel(c,tp)
local x2,y2=cm.xylabel(tc,tp)
return math.abs(y1-y2)<=1 and math.abs(x1-x2)==1
return (math.abs(y1-y2)==1 or y1==y2) and math.abs(x1-x2)==1
end
function cm.distarget(e,c)
return (c:IsType(TYPE_EFFECT+TYPE_SPELL+TYPE_TRAP) or c:GetOriginalType()&TYPE_EFFECT~=0) and cm.seqfilter(c,e:GetHandler(),0)
......@@ -158,22 +172,62 @@ function cm.GetCardsInZone(tp,fd)
end
return Duel.GetFieldCard(p,loc,seq)
end
function cm.xytozone(x,y)
if x==-1 and y==0.5 then return 1<<13
elseif x==5 and y==3.5 then return 1<<29
elseif x>=0 and x<=4 then
if y==0 then return 1<<(x+8)
elseif y==1 then return 1<<x
elseif y==3 then return 1<<(20-x)
elseif y==4 then return 1<<(28-x)
elseif y==2 and x==1 then return 0x400020
elseif y==2 and x==3 then return 0x200040 end
end
return nil
end
function cm.islinkdir(lc,x,y,tp)
if lc:IsControler(1-tp) then x,y=4-x,4-y end
local x0,y0=cm.xylabel(lc,lc:GetControler())
local list={5/4,3/2,7/4,1,1000,0,3/4,1/2,1/4}
for i=0,8 do
if lc:IsLinkMarker(1<<i) and cm.fieldline(x0,y0,x,y,list[i+1]*math.pi) then return true end
end
return false
end
function cm.getlinkdirzone(lc,tp,...)
local loc,exlcheck,p=table.unpack({...})
local x0,y0=cm.xylabel(lc,lc:GetControler())
local res=0
for x=0,4 do
for y=0,4 do
local zone=cm.xytozone(x,y)
if zone and cm.islinkdir(lc,x,y,tp) then res=zone|res end
end
end
if loc and loc==LOCATION_MZONE then res=res&0xff00ff end
if loc and loc==LOCATION_SZONE then res=res&0xff00ff00 end
if exlcheck then
if (Duel.GetFieldCard(p,LOCATION_MZONE,5)~=nil and p==tp) or (Duel.GetFieldCard(p,LOCATION_MZONE,6)~=nil and p~=tp) then res=res&(~0x200040) end
if (Duel.GetFieldCard(p,LOCATION_MZONE,6)~=nil and p==tp) or (Duel.GetFieldCard(p,LOCATION_MZONE,5)~=nil and p~=tp) then res=res&(~0x400020) end
end
return res
end
function cm.stop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local zone=c:GetLinkedZone(tp)
local zone=c:GetLinkedZone(tp) --cm.getlinkdirzone(c,tp,LOCATION_MZONE,true,c:GetControler())
local seq=c:GetSequence()
if seq<5 then
local fd=0
if zone&0x600060>0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
local off=1
local ops,opval={},{}
if zone&0x400020>0 and ((c:IsControler(tp) and Duel.GetFieldCard(tp,LOCATION_MZONE,6)==nil) or (c:IsControler(1-tp) and Duel.GetFieldCard(1-tp,LOCATION_MZONE,5)==nil)) then
if zone&0x400020>0 then
ops[off]=aux.Stringid(m,1)
opval[off]=0
off=off+1
end
if zone&0x200040>0 and ((c:IsControler(tp) and Duel.GetFieldCard(tp,LOCATION_MZONE,5)==nil) or (c:IsControler(1-tp) and Duel.GetFieldCard(1-tp,LOCATION_MZONE,6)==nil)) then
if zone&0x200040>0 then
ops[off]=aux.Stringid(m,2)
opval[off]=1
off=off+1
......@@ -190,10 +244,11 @@ function cm.stop(e,tp,eg,ep,ev,re,r,rp)
local nseq=math.log(fd,2)
if c:IsControler(tp) then
if fd==0x400020 then nseq=5 elseif fd==0x200040 then nseq=6 end
if nseq<16 then Duel.MoveSequence(c,nseq) else Duel.GetControl(c,1-tp,0,0,1<<(nseq-16)) end
else
if fd==0x400020 then nseq=6 elseif fd==0x200040 then nseq=5 end
if fd==0x400020 then nseq=22 elseif fd==0x200040 then nseq=21 end
if nseq<16 then Duel.GetControl(c,tp,0,0,1<<nseq) else Duel.MoveSequence(c,nseq-16) end
end
if nseq<16 then Duel.MoveSequence(c,nseq) else Duel.MoveSequence(c,nseq-16) end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local fd=Duel.SelectField(tp,1,LOCATION_MZONE,LOCATION_MZONE,~zone)
......
......@@ -56,9 +56,9 @@ function c33200906.target(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetRange(LOCATION_SZONE)
e1:SetCondition(c33200906.descon)
e1:SetOperation(c33200906.desop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,5)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,9)
e:GetHandler():RegisterEffect(e1)
e:GetHandler():RegisterFlagEffect(33200906,RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,5)
e:GetHandler():RegisterFlagEffect(33200906,RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,9)
c33200906[e:GetHandler()]=e1
end
function c33200906.descon(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -44,9 +44,9 @@ function c33200917.sttarget(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetRange(LOCATION_SZONE)
e1:SetCondition(c33200917.tdescon)
e1:SetOperation(c33200917.tdesop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,5)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,9)
e:GetHandler():RegisterEffect(e1)
e:GetHandler():RegisterFlagEffect(33200917,RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,5)
e:GetHandler():RegisterFlagEffect(33200917,RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,9)
c33200917[e:GetHandler()]=e1
end
function c33200917.tdescon(e,tp,eg,ep,ev,re,r,rp)
......
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