Commit 59a68af3 authored by POLYMER's avatar POLYMER

fix

parent 23d16351
......@@ -97,16 +97,42 @@ if not Duel.LoadScript and loadfile then
return require_list[str]
end
end
if not dofile and Duel.LoadScript then
function dofile(str)
require_list=require_list or {}
local name=str
for word in string.gmatch(str,"%w+") do
name=word
end
if not require_list[str] then
require_list[str]=Duel.LoadScript(name)
end
return require_list[str]
end
function loadfile(str)
require_list=require_list or {}
local name=str
for word in string.gmatch(str,"%w+") do
name=word
end
return function()
if not require_list[str] then
require_list[str]=Duel.LoadScript(name)
end
return require_list[str]
end
end
end
function cm.nnfilter(c,ec)
if c:GetOriginalType()==0x11 or c:GetOriginalType()==0x1011 then return false end
if c:GetOriginalType()&0x11==0x11 and c:GetOriginalType()&TYPE_PENDULUM==0 then return false end
if not c.initial_effect then return true end
return false
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
--if apricot_nightfall_adjust then return end
apricot_nightfall_adjust=true
e:Reset()
local c=e:GetHandler()
e:Reset()
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil)
if c:IsLocation(LOCATION_DECK) and #g>=36 then
......@@ -120,16 +146,22 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
if not cm.r then
cm.r=Duel.GetFieldGroup(0,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_EXTRA):GetSum(Card.GetCode)
end
--[[local tab={}
for i=1,10000000 do
tab[cm.r]=true
cm.roll(1,#g)
if i%100000==0 then Debug.Message(cm.r) end
if tab[cm.r] then Debug.Message(i.." "..cm.r) end
end--]]
local ct=cm.roll(1,#g)-1
local tc=g:Filter(function(c) return c:GetSequence()==ct end,nil):GetFirst()
if KOISHI_CHECK then
c:SetEntityCode(tc:GetOriginalCode())
local ini=cm.initial_effect
cm.initial_effect=function() end
c:ReplaceEffect(m,0)
c:SetStatus(STATUS_EFFECT_REPLACED,false)
cm.initial_effect=ini
if tc.initial_effect then tc.initial_effect(c) end
if tc:GetOriginalType()&0x11~=0x11 or tc:GetOriginalType()&TYPE_PENDULUM>0 then
c:ReplaceEffect(tc:GetOriginalCode(),0)
else
c:ReplaceEffect(80316585,0)
end
Duel.DisableShuffleCheck()
Duel.Exile(tc,0)
else
......@@ -165,7 +197,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
GetID=function()
return _G["c"..int],int,int<100000000 and 1 or 100
end
require("expansions/script/c"..int)
pcall(require,"expansions/script/c"..int)
local ini=ac.initial_effect
if ini then stack[#stack+1]=ac end
end
......
......@@ -48,14 +48,10 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
if KOISHI_CHECK then
local code=g:GetFirst():GetOriginalCode()
c:SetEntityCode(code)
local ini=cm.initial_effect
cm.initial_effect=function() end
c:ReplaceEffect(m,0)
cm.initial_effect=ini
if not g:GetFirst():IsType(TYPE_NORMAL) or g:GetFirst():IsType(TYPE_PENDULUM) then
local cn=getmetatable(g:GetFirst())
if cn then cn.initial_effect(c) end
--c:ReplaceEffect(code,0)
if g:GetFirst():GetOriginalType()&0x11~=0x11 or g:GetFirst():GetOriginalType()&TYPE_PENDULUM>0 then
c:ReplaceEffect(code,0)
else
c:ReplaceEffect(80316585,0)
end
Duel.ConfirmCards(1-tp,c)
Duel.ShuffleDeck(tp)
......
......@@ -68,6 +68,7 @@ function cm.cpop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local g=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,tc,tc:GetLevel())
if tc and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and (not tc:IsLocation(LOCATION_MZONE) or tc:IsFaceup()) and #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local fc=g:Select(tp,1,1,nil):GetFirst()
local code=tc:GetOriginalCode()
local e1=Effect.CreateEffect(c)
......@@ -78,13 +79,10 @@ function cm.cpop(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
fc:RegisterEffect(e1)
if fc:IsImmuneToEffect(e) then return end
if tc:GetOriginalType()&TYPE_NORMAL==0 then
if tc:GetOriginalType()&0x11~=0x11 or tc:GetOriginalType()&TYPE_PENDULUM>0 then
fc:ReplaceEffect(code,RESET_EVENT+RESETS_STANDARD,1)
else
local ini=cm.initial_effect
cm.initial_effect=function() end
fc:ReplaceEffect(m,RESET_EVENT+RESETS_STANDARD,1)
cm.initial_effect=ini
fc:ReplaceEffect(80316585,RESET_EVENT+RESETS_STANDARD,1)
end
end
end
\ No newline at end of file
......@@ -25,7 +25,7 @@ function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(0x20000000+m)
e1:SetCode(EFFECT_FLAG_EFFECT+m)
e1:SetLabelObject(re)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
......@@ -56,6 +56,8 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
end
end--]]
local g=Duel.GetMatchingGroup(Card.IsOriginalCodeRule,tp,0xff,0xff,nil,ac)
local og=Duel.GetOverlayGroup(0,1,1):Filter(Card.IsOriginalCodeRule,nil,ac)
g:Merge(og)
local reg=Card.RegisterEffect
local ctl=Effect.SetCountLimit
Effect.SetCountLimit=function(se,ct,code)
......@@ -76,7 +78,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
reg(sc,se,true)
if cm[se] then
cm[se]=nil
local eset={sc:IsHasEffect(0x20000000+m)}
local eset={sc:IsHasEffect(EFFECT_FLAG_EFFECT+m)}
if #eset>0 then
local ct=0
for _,ee in pairs(eset) do
......@@ -88,11 +90,7 @@ function cm.operation(e,tp,eg,ep,ev,re,r,rp)
end
for tc in aux.Next(g) do
if tc.initial_effect then
local ini=cm.initial_effect
cm.initial_effect=function() end
tc:ReplaceEffect(m,0)
cm.initial_effect=ini
tc.initial_effect(tc)
tc:ReplaceEffect(tc:GetOriginalCode(),0)
end
end
Card.RegisterEffect=reg
......
......@@ -44,10 +44,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,58192742,0,0x11,300,200,1,RACE_INSECT,ATTRIBUTE_EARTH) then
if KOISHI_CHECK then
c:SetEntityCode(58192742,true)
local ini=cm.initial_effect
cm.initial_effect=function() end
c:ReplaceEffect(m,0)
cm.initial_effect=ini
c:ReplaceEffect(80316585,0)
else
Duel.Remove(c,POS_FACEDOWN,REASON_RULE)
c=Duel.CreateToken(tp,58192742)
......
......@@ -185,13 +185,10 @@ function cm.mvop(e,tp,eg,ep,ev,re,r,rp,opt,lab)
local tc=g2:Select(tp,1,1,nil):GetFirst()
local code=tc:GetOriginalCode()
if not fc:IsImmuneToEffect(e) then
if tc:GetOriginalType()&TYPE_NORMAL==0 then
if tc:GetOriginalType()&0x11~=0x11 or tc:GetOriginalType()&TYPE_PENDULUM>0 then
fc:ReplaceEffect(code,RESET_EVENT+RESETS_STANDARD,1)
else
local ini=cm.initial_effect
cm.initial_effect=function() end
fc:ReplaceEffect(m,RESET_EVENT+RESETS_STANDARD,1)
cm.initial_effect=ini
fc:ReplaceEffect(80316585,RESET_EVENT+RESETS_STANDARD,1)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
......
......@@ -43,6 +43,7 @@ function c28321714.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmDecktop(p,ct)
local g=Duel.GetDecktopGroup(p,ct)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:FilterSelect(tp,c28321714.thfilter,0,#g,nil)
if #sg>0 then
Duel.DisableShuffleCheck()
......
......@@ -97,11 +97,12 @@ end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and rc:IsRace(RACE_PSYCHO) then
cm[rp][rc]=1
if cm[rp][rc] then cm[rp][rc]=cm[rp][rc]+1 else cm[rp][rc]=1 end
end
end
function cm.regop2(e,tp,eg,ep,ev,re,r,rp)
cm[rp][re:GetHandler()]=nil
local rc=re:GetHandler()
if cm[rp][rc] then cm[rp][rc]=cm[rp][rc]-1 else cm[rp][rc]=nil end
end
function cm.clearop(e,tp,eg,ep,ev,re,r,rp)
cm[0]={}
......
......@@ -97,11 +97,12 @@ end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and rc:IsRace(RACE_PSYCHO) then
cm[rp][rc]=1
if cm[rp][rc] then cm[rp][rc]=cm[rp][rc]+1 else cm[rp][rc]=1 end
end
end
function cm.regop2(e,tp,eg,ep,ev,re,r,rp)
cm[rp][re:GetHandler()]=nil
local rc=re:GetHandler()
if cm[rp][rc] then cm[rp][rc]=cm[rp][rc]-1 else cm[rp][rc]=nil end
end
function cm.clearop(e,tp,eg,ep,ev,re,r,rp)
cm[0]={}
......
......@@ -128,11 +128,12 @@ end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and rc:IsRace(RACE_PSYCHO) then
cm[rp][rc]=1
if cm[rp][rc] then cm[rp][rc]=cm[rp][rc]+1 else cm[rp][rc]=1 end
end
end
function cm.regop2(e,tp,eg,ep,ev,re,r,rp)
cm[rp][re:GetHandler()]=nil
local rc=re:GetHandler()
if cm[rp][rc] then cm[rp][rc]=cm[rp][rc]-1 else cm[rp][rc]=nil end
end
function cm.clearop(e,tp,eg,ep,ev,re,r,rp)
cm[0]={}
......
......@@ -123,17 +123,25 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and not s[0][re:GetHandler()] then
re:GetHandler():RegisterFlagEffect(id+100,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
end
if Duel.GetCurrentChain()>=4 then
for i=1,ev do
local te=Duel.GetChainInfo(i,CHAININFO_TRIGGERING_EFFECT)
if te:IsActiveType(TYPE_MONSTER) then
if te:GetHandler():GetFlagEffect(id+100)>0 then
s[0][te:GetHandler()]=1
end
end
end
end
function s.regop2(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():GetFlagEffect(id+100)>0 then
re:GetHandler():IsHasEffect(EFFECT_FLAG_EFFECT+id+100):Reset()
if re:GetHandler():GetFlagEffect(id+100)==0 then
s[0][re:GetHandler()]=nil
end
end
end
function s.clearop(e,tp,eg,ep,ev,re,r,rp)
s[0]={}
......
......@@ -122,17 +122,25 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and not s[0][re:GetHandler()] then
re:GetHandler():RegisterFlagEffect(id+100,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
end
if Duel.GetCurrentChain()>=4 then
for i=1,ev do
local te=Duel.GetChainInfo(i,CHAININFO_TRIGGERING_EFFECT)
if te:IsActiveType(TYPE_MONSTER) then
if te:GetHandler():GetFlagEffect(id+100)>0 then
s[0][te:GetHandler()]=1
end
end
end
end
function s.regop2(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():GetFlagEffect(id+100)>0 then
re:GetHandler():IsHasEffect(EFFECT_FLAG_EFFECT+id+100):Reset()
if re:GetHandler():GetFlagEffect(id+100)==0 then
s[0][re:GetHandler()]=nil
end
end
end
function s.clearop(e,tp,eg,ep,ev,re,r,rp)
s[0]={}
......
......@@ -143,17 +143,25 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and not s[0][re:GetHandler()] then
re:GetHandler():RegisterFlagEffect(id+100,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
end
if Duel.GetCurrentChain()>=4 then
for i=1,ev do
local te=Duel.GetChainInfo(i,CHAININFO_TRIGGERING_EFFECT)
if te:IsActiveType(TYPE_MONSTER) then
if te:GetHandler():GetFlagEffect(id+100)>0 then
s[0][te:GetHandler()]=1
end
end
end
end
function s.regop2(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():GetFlagEffect(id+100)>0 then
re:GetHandler():IsHasEffect(EFFECT_FLAG_EFFECT+id+100):Reset()
if re:GetHandler():GetFlagEffect(id+100)==0 then
s[0][re:GetHandler()]=nil
end
end
end
function s.clearop(e,tp,eg,ep,ev,re,r,rp)
s[0]={}
......
......@@ -145,17 +145,25 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if re:IsActiveType(TYPE_MONSTER) and not s[0][re:GetHandler()] then
re:GetHandler():RegisterFlagEffect(id+100,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
end
if Duel.GetCurrentChain()>=4 then
for i=1,ev do
local te=Duel.GetChainInfo(i,CHAININFO_TRIGGERING_EFFECT)
if te:IsActiveType(TYPE_MONSTER) then
if te:GetHandler():GetFlagEffect(id+100)>0 then
s[0][te:GetHandler()]=1
end
end
end
end
function s.regop2(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():GetFlagEffect(id+100)>0 then
re:GetHandler():IsHasEffect(EFFECT_FLAG_EFFECT+id+100):Reset()
if re:GetHandler():GetFlagEffect(id+100)==0 then
s[0][re:GetHandler()]=nil
end
end
end
function s.clearop(e,tp,eg,ep,ev,re,r,rp)
s[0]={}
......
......@@ -61,12 +61,12 @@ end
function s.stop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not (tc:IsRelateToEffect(e) and tc:IsControler(tp) and not tc:IsImmuneToEffect(e)) then return end
local zone=1<<tc:GetSequence()
local zone=1<<4-tc:GetSequence()
local oc=Duel.GetMatchingGroup(s.seqfilter,tp,0,LOCATION_MZONE,nil,tc:GetSequence()):GetFirst()
if oc then
Duel.Destroy(oc,REASON_RULE)
end
if Duel.SelectYesNo(tp,aux.Stringid(id,2)) and Duel.GetControl(tc,1-tp,0,0,zone) then
if Duel.GetControl(tc,1-tp,0,0,zone) then
local oc=Duel.GetMatchingGroup(s.seqfilter,tp,0,LOCATION_SZONE,nil,tc:GetSequence()):GetFirst()
if oc then
Duel.Destroy(oc,REASON_RULE)
......@@ -89,5 +89,5 @@ function s.stop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.seqfilter(c,seq)
return c:GetSequence()==seq
return 4-c:GetSequence()==seq
end
\ No newline at end of file
......@@ -71,7 +71,7 @@ function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return false
end
end
function s.thfilter(c,chk)
function s.thfilter(c,e,chk)
return c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -182,7 +182,15 @@ function Auxiliary.PreloadUds()
return 0
end
end
if not Card.GetLinkMarker then
function Card.GetLinkMarker(c)
local res=0
for i=0,8 do
if i~=4 and c:IsLinkMarker(1<<i) then res=res|(1<<i)
end
return res
end
end
local _CRegisterEffect=Card.RegisterEffect
function Card.RegisterEffect(c,e,...)
if aux.GetValueType(c)~="Card" then error("Card.RegisterEffect没有输入正确的Card参数。",2) return end
......
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