Commit f17f0c4e authored by IamIpanda's avatar IamIpanda

Big boom

parents
stages:
- build
- package
- release
build:
stage: build
tags:
- linux
image:
name: iami/cdb-transformer
entrypoint: [""]
script:
- /opt/cdb-transformer/cdb-transformer --from MyDIY.txt --to MyDIY.cdb --strings ./origin-strings.conf --strings ./strings.conf
- tar czf MyDIY.ypk script *.cdb
- echo $CI_JOB_ID > .job_id
artifacts:
paths:
- "MyDIY.ypk"
- .job_id
only:
- master
# upload package:
# stage: package
# tags:
# - linux
# image: curlimages/curl
# script:
# - date=$(date +%Y-%m-%d)
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file MyDIY.ypk "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/MyDIY.ypk"'
# only:
# - master
release:
stage: release
tags:
- linux
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- JOB_ID=$(cat .job_id)
- release-cli create --name "MyDIY-$CI_COMMIT_SHORT_SHA" --tag-name $CI_COMMIT_SHORT_SHA --assets-link "{\"name\":\"MyDIY-$(date +%Y-%m-%d).ypk\",\"url\":\"$CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$JOB_ID/artifacts/download\"}"
only:
- master
File added
This diff is collapsed.
This diff is collapsed.
-- 拓扑混沌交换熊
local s,id,o=GetID()
function s.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2,2)
c:EnableReviveLimit()
-- destro
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BECOME_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(s.destrocon)
e1:SetOperation(s.destroop)
c:RegisterEffect(e1)
-- skip M2
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(s.skipcon)
e2:SetOperation(s.skipop)
c:RegisterEffect(e2)
-- immune effect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetRange(LOCATION_MZONE)
e3:SetTarget(s.immunetg)
e3:SetValue(s.immunefilter)
e3:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
c:RegisterEffect(e3)
-- win
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetRange(LOCATION_REMOVED)
e4:SetCode(EVENT_REMOVE)
e4:SetCondition(s.wincon)
e4:SetOperation(s.winop)
c:RegisterEffect(e4)
end
function s.linkfilter(c)
return c:IsCode(47297616) and c:GetAttack()==2800
end
function s.destrocon(e,tp,eg,ep,ev,re,r,rp)
if #eg~=1 then return false end
local c=e:GetHandler()
local mg=c:GetMutualLinkedGroup()
if #mg>0 then return false end
local g=c:GetLinkedGroup()
local tc=eg:GetFirst()
return tc==c or g:IsContains(tc)
end
function s.destrofilter(c,ftg,e,tp,eg,ep,ev,re,r,rp)
return ftg(e,tp,eg,ep,ev,re,r,rp,0,c)
end
function s.destroop(e,tp,eg,ep,ev,re,r,rp)
local fop=re:GetOperation()
local ftg=re:GetTarget()
local c=e:GetHandler()
local g=c:GetLinkedGroup()
g:AddCard(c)
g=g:Filter(s.destrofilter,nil,ftg,e,tp,eg,ep,ev,re,r,rp)
g:KeepAlive()
Duel.Hint(HINT_CARD,0,id)
Duel.HintSelection(g)
--Duel.ChangeTargetCard(ev,g:Clone())
Duel.ChangeChainOperation(ev,s._destroop(fop,g))
end
function s._destroop(op,g)
return function(e,tp,eg,ep,ev,re,r,rp)
local rg=s.shuffle(g)
for _, tc in ipairs(rg) do
local tg=Group.FromCards(tc)
Duel.ChangeTargetCard(ev,tg)
op(e,tp,eg,ep,ev,re,r,rp)
tc=g:GetNext()
end
end
end
function s.shuffle(g)
local c=g:GetFirst()
local t={}
while c do
table.insert(t,c)
c=g:GetNext()
end
for i=#t,2,-1 do
local j = math.random(i)
t[i],t[j]=t[j],t[i]
end
return t
end
function s.skipcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():GetOwner()==tp
end
function s.skipop(e,tp,eg,ep,ev,re,r,rp)
Duel.SkipPhase(tp,PHASE_MAIN2,RESET_PHASE+PHASE_END,1)
end
function s.immunetg(e,c)
local tp=c:GetControler()
local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_EXTRA)
return ct>0 and ct<10
end
function s.immunefilter(e,re)
return e:GetHandlerPlayer()~=re:GetOwnerPlayer()
end
function s.wincon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
print(c:IsReason(REASON_EFFECT),rp,tp,c:IsPreviousControler(tp),c:IsPreviousLocation(LOCATION_ONFIELD),c:IsPreviousPosition(POS_FACEUP))
return c:IsReason(REASON_EFFECT) and rp==1-tp and c:IsPreviousControler(tp)
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP)
and c:IsLocation(LOCATION_REMOVED) and c:IsPosition(POS_FACEDOWN)
end
function s.winop(e,tp,eg,ep,ev,re,r,rp)
Duel.Win(tp,0xf0)
end
\ No newline at end of file
--愚者的进军
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter)
end
function s.chainfilter(re,tp,cid)
return not re:IsActiveType(TYPE_MONSTER)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(s.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER)
end
function s.filter(c)
return c:IsFaceup() and c:IsRace(RACE_WARRIOR+RACE_SPELLCASTER+RACE_PSYCHO)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
local ct=g:GetClassCount(Card.GetRace)
if ct==3 then ct=5 end
if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(ct)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
local ct=g:GetClassCount(Card.GetRace)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
Duel.Draw(p,ct,REASON_EFFECT)
if ct==3 then
Duel.Draw(p,2,REASON_EFFECT)
end
end
-- 冥府的使者 凯茵
local s,id,o=GetID()
function s.initial_effect(c)
-- destroy
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ANNOUNCE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_HAND)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetTarget(s.sgtg)
e2:SetOperation(s.sgop)
c:RegisterEffect(e2)
if not s.gf then
s.gf=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
ge1:SetCode(EVENT_TO_GRAVE)
ge1:SetCondition(s.descon)
ge1:SetOperation(s.desop)
Duel.RegisterEffect(ge1,0)
end
end
function s.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsPosition(POS_FACEUP)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end
local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,0,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,0,nil)
Duel.Destroy(sg,REASON_EFFECT)
end
function s.sgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local ct=Duel.GetFlagEffectLabel(tp,id)
return Duel.GetMatchingGroupCount(aux.TRUE,tp,LOCATION_ONFIELD,0,nil)==0
and ct and ct>0
and Duel.IsExistingMatchingCard(s.sgfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
end
function s.sgfilter(c)
return c:IsAbleToGrave()
end
function s.sgop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFlagEffectLabel(tp,id)
if ct and ct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectTarget(tp,s.sgfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
local c=eg:GetFirst()
while c do
if bit.band(r,REASON_DESTROY)~=0
and c:IsPreviousLocation(LOCATION_ONFIELD)
and (c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)) then
return true
end
c=eg:GetNext()
end
return false
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=eg:GetFirst()
while c do
local p=c:GetOwner()
local ct=Duel.GetFlagEffectLabel(p,id)
if ct==nil then
Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,1,1)
else
Duel.SetFlagEffectLabel(p,id,ct+1)
end
c=eg:GetNext()
end
end
\ No newline at end of file
--花火
local s,id,o=GetID()
function s.initial_effect(c)
--fail
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCost(s.cost)
e2:SetOperation(s.op)
c:RegisterEffect(e2)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
--fail in ep
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetOperation(s.op)
Duel.RegisterEffect(e1,tp)
--draw
local ge=Effect.CreateEffect(c)
ge:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge:SetCode(EVENT_CHAINING)
ge:SetLabelObject(c)
ge:SetCondition(s.drawcon)
ge:SetOperation(s.drawop)
Duel.RegisterEffect(ge,tp)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Win(1-tp,0xff)
end
function s.drawop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
local rc=re:GetHandler()
Duel.Draw(rp,1,REASON_COST)
if rc:IsOnField() and Duel.SelectYesNo(rp,aux.Stringid(id,0)) and Duel.SendtoGrave(rc,REASON_EFFECT)~=0 then
Duel.Draw(rp,1,REASON_EFFECT)
end
end
function s.drawcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetLabelObject()
if c:IsOnField() then
return true
else
e:Reset()
end
end
\ No newline at end of file
--万古的仪式
local s,id,o=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
while ct>0 do
local g=Duel.GetDecktopGroup(tp,ct)
local count=math.min(ct,15)
local dg=g:Select(tp,1,count,nil)
local c=dg:GetFirst()
while c do
Duel.MoveSequence(c,SEQ_DECKTOP)
c=dg:GetNext()
end
Duel.SortDecktop(tp,tp,#dg)
count=#dg
while count>0 do
g=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(g:GetFirst(),SEQ_DECKBOTTOM)
count=count-1
end
ct=ct-#dg
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(s.val)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,1-tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetReset(RESET_PHASE+PHASE_END)
e2:SetValue(1)
Duel.RegisterEffect(e2,1-tp)
-- Validate deck order
--ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
--s.drawall(tp,ct)
end
function s.val(e,re,val,r,rp,rc)
if e:GetHandlerPlayer()==1-rp then
return 0
else return val end
end
function s.drawall(tp,n)
while n>0 do
Duel.Draw(tp,1,REASON_EFFECT)
Duel.SelectYesNo(tp,aux.Stringid(id,0))
n=n-1
end
end
\ No newline at end of file
-- 岩融冰结
local s,id,o=GetID()
function s.initial_effect(c)
-- disable
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ANNOUNCE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetCondition(s.con)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,aux.FALSE)
end
function s.con(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return Duel.GetTurnPlayer()~=tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
if chkc then return true end
local ids={}
local c=e:GetLabel()
for i=1,c do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp)
Duel.SetTargetParam(ac)
table.insert(ids,ac)
end
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0)
e:SetOperation(s.op(ids))
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local count=s.count(tp)
local maxc=math.floor(Duel.GetLP(tp)/1500)-count
if chk==0 then return maxc>0 and e:GetHandler():IsAbleToGraveAsCost() end
if maxc<=0 then return end
--Duel.PayLPCost(1-tp, Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,LOCATION_ONFIELD)+1)
--Duel.PayLPCost(1-tp, Duel.GetTurnCount())
--Duel.PayLPCost(1-tp, Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)+1)
--Duel.PayLPCost(1-tp, Duel.GetCustomActivityCount(id,1-tp,ACTIVITY_CHAIN)+1)
local t={}
for i=1,maxc do t[i]=i end
local a1=Duel.AnnounceNumber(tp,table.unpack(t))
Duel.PayLPCost(tp,(a1+count)*1500)
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
e:SetLabel(a1)
end
function s.count(tp)
return Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,LOCATION_ONFIELD)
+Duel.GetTurnCount()-1 -- Turn starts in 1
+Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)
+Duel.GetCustomActivityCount(id,1-tp,ACTIVITY_CHAIN)-1 -- Activate itself counts 1
end
function s.op(ids)
return function (e,tp,eg,ep,ev,re,r,rp)
for i,id in pairs(ids) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_FORBIDDEN)
e1:SetTargetRange(0x7f,0x7f)
e1:SetTarget(s.bantg)
e1:SetLabel(id)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
Duel.RegisterEffect(e1,tp)
end
end
end
function s.bantg(e,c)
return c:IsCode(e:GetLabel()) and (not c:IsOnField() or c:GetRealFieldID()>e:GetFieldID())
end
--九鼎
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e2:SetTarget(s.immunetg)
e2:SetValue(s.immunefilter)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(s.eqlimit)
c:RegisterEffect(e3)
--redirect
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e5:SetCondition(aux.TRUE)
e5:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e5)
end
function s.filter(c)
return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
end
function s.eqlimit(e,c)
return c:IsRace(RACE_WARRIOR)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
local c=e:GetHandler()
local s=c:GetSequence()
local seq=Duel.SelectField(tp,9,LOCATION_ONFIELD,0,0xe0+(0x100<<s),id)
e:SetLabel(seq)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
local seq=e:GetLabel()
Duel.Hint(HINT_ZONE,0,seq)
Duel.Equip(tp,c,tc)
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,seq)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function s.immunetg(e,c)
local sc=e:GetHandler()
local tzone=sc:GetFlagEffectLabel(id)
if tzone==nil then return false end
local zone=s.getzone(c)
--print(seq,loc,tzone,zone)
return bit.band(tzone,zone)>0
end
function s.immunefilter(e,te)
local c=e:GetHandler()
local tc=c:GetEquipTarget()
return te:GetOwner()~=c
end
function s.getzone(c)
local seq=c:GetSequence()
local loc=c:GetLocation()
local zone=0
if loc==LOCATION_MZONE then
zone=0x1<<seq
elseif loc==LOCATION_SZONE then
zone=0x100<<seq
elseif loc==LOCATION_FZONE then
zone=0x1000
elseif loc==LOCATION_PZONE then
zone=0 -- ????
end
return zone
end
\ No newline at end of file
-- 白夜苦行
local s,id,o=GetID()
local LIMIT_NUMBER=3
function c172016007.initial_effect(c)
--redirect
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(s.limcon)
e1:SetCost(s.limcost)
e1:SetOperation(s.limop)
c:RegisterEffect(e1)
if not s.gf then
-- Card.SetUniqueOnField 只涉及场上的卡
-- Duel.RemoveCounter 目前为止只涉及场上的卡
-- Duel.IsCanRemoveCounter 目前为止只涉及场上的卡
-- Duel.GetCounter 目前为止只涉及场上的卡
-- Duel.GetFieldGroup 已单独处理
-- Duel.GetFieldGroupCount 已单独处理
s.hook_func2()
Duel.GetMatchingGroup = s.hook_func("GetMatchingGroup",Duel.GetMatchingGroup,1,2,3,4)
Duel.GetMatchingGroupCount = s.hook_func("GetMatchingGroupCount",Duel.GetMatchingGroupCount,1,2,3,4)
Duel.GetFirstMatchingCard = s.hook_func("GetFirstMatchingCard",Duel.GetFirstMatchingCard,1,2,3,4)
Duel.IsExistingMatchingCard = s.hook_func("IsExistingMatchingCard",Duel.IsExistingMatchingCard,1,2,3,4)
Duel.SelectMatchingCard = s.hook_func("SelectMatchingCard",Duel.SelectMatchingCard,2,3,4,5)
-- Duel.GetTargetCount 只涉及场上的卡
-- Duel.IsExistingTarget 只涉及场上的卡
-- Duel.SelectTarget 只涉及场上的卡
-- Duel.GetOverlayGroup 似乎只涉及场上的卡
-- Duel.GetOverlayCount 似乎只涉及场上的卡
-- Duel.CheckRemoveOverlayCard 似乎只涉及场上的卡
-- Duel.RemoveOverlayCard 似乎只涉及场上的卡
-- Duel.SelectDisableField 只涉及场上的卡
local ge=Effect.CreateEffect(c)
ge:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge:SetCode(EVENT_CHAINING)
ge:SetCountLimit(1,id)
ge:SetCondition(s.gecon)
ge:SetOperation(s.geop)
Duel.RegisterEffect(ge,0)
s.gf=true
end
end
function s.limcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return Duel.GetFlagEffect(tp,id)==0 and Duel.GetTurnPlayer()~=tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)
end
function s.limcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function s.limop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.SendtoHand(c,1-tp,REASON_EFFECT) then
Duel.ResetFlagEffect(1-tp,id)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(id)
e1:SetTargetRange(1,1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_IMMEDIATELY_APPLY)
e2:SetCondition(aux.TRUE)
e2:SetOperation(s.confirmop)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
local e3=e2:Clone()
Duel.RegisterEffect(e3,1-tp)
end
end
function s.confirmop(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetTurnPlayer()
Duel.ConfirmCards(p,Duel.GetFieldGroup(p,LOCATION_DECK,0))
end
function s.gecon(e,tp,eg,ep,ev,re,r,rp)
local ex2,g2,gc2,dp2,dv2=Duel.GetOperationInfo(ev,CATEGORY_SPECIAL_SUMMON)
local ex3,g3,gc3,dp3,dv3=Duel.GetOperationInfo(ev,CATEGORY_TOGRAVE)
local ex4=re:IsHasCategory(CATEGORY_DRAW)
local ex5=re:IsHasCategory(CATEGORY_SEARCH)
local ex6=re:IsHasCategory(CATEGORY_DECKDES)
return ((ex2 and bit.band(dv2,LOCATION_DECK)==LOCATION_DECK)
or (ex3 and bit.band(dv3,LOCATION_DECK)==LOCATION_DECK)
or ex4 or ex5 or ex6) and Duel.IsChainDisablable(ev)
end
function s.geop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(rp,id)==0 then
Duel.RegisterFlagEffect(rp,id,RESET_PHASE+PHASE_END,0,2)
end
end
function s.hook_filter(f)
if f==nil then
return s.filter
else
return aux.AND(f,s.filter)
end
end
function s.filter(c)
return c:IsLocation(~LOCATION_DECK) or (s.OriginGetFieldGroupCount(c:GetOwner(),LOCATION_DECK,0)-c:GetSequence()<=LIMIT_NUMBER)
end
function s.hook_func(name,f,fpos,playerpos,lpos1,lpos2,addfilter)
s["Origin"..name]=f
return function(...)
local args={...}
local argc=select("#",...)
if Duel.IsPlayerAffectedByEffect(args[playerpos],id) then
if fpos~=nil then
args[fpos] = s.hook_filter(args[fpos])
end
if lpos1~=nil and bit.band(args[lpos1],LOCATION_DECK)>0 then
args[lpos1] = LOCATION_DECK
end
if lpos2~=nil and bit.band(args[lpos2],LOCATION_DECK)>0 then
args[lpos2] = LOCATION_DECK
end
return f(table.unpack(args,1,argc))
else
return f(...)
end
end
end
function s.hook_func2()
s.OriginGetFieldGroup=Duel.GetFieldGroup
s.OriginGetFieldGroupCount=Duel.GetFieldGroupCount
Duel.GetFieldGroup = function(_player,_s,_o)
if Duel.IsPlayerAffectedByEffect(_player,id) then
if bit.band(_s,LOCATION_DECK)>0 then _s = LOCATION_DECK end
if bit.band(_o,LOCATION_DECK)>0 then _o = LOCATION_DECK end
end
local group=s.OriginGetFieldGroup(_player,_s,_o)
if Duel.IsPlayerAffectedByEffect(_player,id) then
group=group:Filter(s.filter,nil)
end
return group
end
--[[ Duel.GetFieldGroupCount = function(_player,_s,_o)
if Duel.IsPlayerAffectedByEffect(_player,id) then
if bit.band(_s,LOCATION_DECK)>0 then _s = LOCATION_DECK end
if bit.band(_o,LOCATION_DECK)>0 then _o = LOCATION_DECK end
local c1=s.OriginGetFieldGroupCount(_player,_s,0)
local c2=s.OriginGetFieldGroupCount(_player,0,_o)
if c1==LOCATION_DECK then c1=math.min(c1,LIMIT_NUMBER) end
if c2==LOCATION_DECK then c2=math.min(c2,LIMIT_NUMBER) end
return c1+c2
else
return s.OriginGetFieldGroupCount(_player,_s,_o)
end
end ]]
end
-- 因果应报
local s,id,o=GetID()
function s.initial_effect(c)
--burn
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetHintTiming(0,TIMING_CHAIN_END)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetCondition(s.burncon)
e1:SetTarget(s.burntg)
e1:SetCost(s.burncost)
e1:SetOperation(s.burnop)
c:RegisterEffect(e1)
if not s.gf then
s.gf=true
s.effect_order={}
s.effect_counter={0,0}
s.current_order=nil
s.last_effect=nil
s.last_effect_turn=0
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
ge1:SetCode(EVENT_CHAINING)
ge1:SetCondition(s.gecon)
ge1:SetOperation(s.geop)
Duel.RegisterEffect(ge1,0)
end
end
function s.burncon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return s.effect_counter[2-tp]>=10 and Duel.GetCurrentChain()==0 and s.last_effect_turn==Duel.GetTurnCount()
and Duel.IsExistingMatchingCard(Card.IsSummonType,tp,0,LOCATION_MZONE,1,nil,SUMMON_TYPE_SPECIAL)
and Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD+LOCATION_HAND,0)<Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD+LOCATION_HAND)
end
function s.burncost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function s.burnop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=Duel.GetMatchingGroupCount(Card.IsSummonType,tp,LOCATION_MZONE,nil,nil,SUMMON_TYPE_SPECIAL)
Duel.Damage(c:GetOwner(),ct*50,REASON_EFFECT)
end
function s.burntg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
s.current_order={}
for k,v in pairs(s.effect_order) do
s.current_order[k]=v
end
s.create_chain_effect()
end
function s.chaincon(e,tp,eg,ep,ev,re,r,rp)
return s.current_order~=nil and e:GetLabel()~=1
end
function s.chaintg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(1)
-------------------------------------------------
-- ct=#s.current_order
-- print("[")
-- for i=1,ct do
-- print(s.current_order[i]:GetCode())
-- end
-- print("]")
-------------------------------------------------
s.create_chain_effect()
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,50)
end
function s.create_chain_effect()
while true do
if #s.current_order==0 then
s.current_order={}
return
end
local c=table.remove(s.current_order,1)
local ce=Effect.CreateEffect(c)
ce:SetDescription(aux.Stringid(id,0))
ce:SetType(EFFECT_TYPE_QUICK_F)
ce:SetCode(EVENT_CHAINING)
ce:SetRange(~0)
ce:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
ce:SetCondition(s.chaincon)
ce:SetTarget(s.chaintg)
ce:SetOperation(s.burnop)
ce:SetReset(RESET_EVENT+RESET_CHAIN)
c:RegisterEffect(ce)
if ce:IsActivatable(c:GetControler(),true,true) then
break
end
ce:Reset()
end
end
function s.gecon(e,tp,eg,ep,ev,re,r,rp)
return s.last_effect~=re
end
function s.geop(e,tp,eg,ep,ev,re,r,rp)
local turn=Duel.GetTurnCount()
if turn~=s.last_effect_turn then
local ct=#s.effect_order
for i=1,ct do s.effect_order[i]=nil end
s.effect_counter={0,0}
end
table.insert(s.effect_order,re:GetHandler())
s.effect_counter[rp+1]=s.effect_counter[rp+1]+1
s.last_effect=re
s.last_effect_turn=turn
end
--以眼还眼
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_DECK,0,1,nil,re:GetHandler():GetCode())
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
if bit.band(re:GetHandler():GetOriginalType(),TYPE_MONSTER)~=0 then
e:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES)
else
e:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
end
return true
end
function s.filter(c,code)
return c:IsCode(code) and c:IsAbleToHand()
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)~=0 then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK,0,nil,rc:GetCode())
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
if rc:IsType(TYPE_MONSTER) and rc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) then
Duel.BreakEffect()
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.ConfirmCards(1-tp,sg)
elseif (rc:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) and rc:IsSSetable() then
Duel.BreakEffect()
Duel.SSet(tp,sg)
end
end
end
end
-- 希望的幻色
local s,id,o=GetID()
function s.initial_effect(c)
-- xyz summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCountLimit(1,id)
e1:SetOperation(s.op)
e1:SetCost(s.cost)
c:RegisterEffect(e1)
-- set from grave
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_GRAVE)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCountLimit(1,id)
e2:SetCondition(s.setcon)
e2:SetTarget(s.settg)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
-- no draw
if not s.gf then
s.gf=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
ge1:SetCode(EVENT_DRAW)
ge1:SetOperation(s.regop)
Duel.RegisterEffect(ge1,0)
end
end
function s.spfilter(c,e,tp,rank)
if rank~=nil and c:GetRank()~=rank then return false end
return c:IsType(TYPE_XYZ)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
and Duel.GetLocationCountFromEx(tp,tp,nil,c,0x60)>0
end
-- function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
-- if chk==0 then return aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_XMATERIAL)
-- and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,nil) end
-- Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
-- end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_EXTRA,nil,nil,e,tp)
local t={}
local tc=g:GetFirst()
while tc do
t[tc:GetRank()]=1
tc=g:GetNext()
end
local ls={}
for level,one in pairs(t) do
if Duel.CheckLPCost(tp,level*100) then
table.insert(ls,level)
end
end
if chk==0 then return #ls>0 end
local rank=Duel.AnnounceNumber(tp,table.unpack(ls))
Duel.PayLPCost(tp, rank*100)
e:SetLabel(rank)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local rank=e:GetLabel()
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,rank)
local tc=g:GetFirst()
if tc then
if Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP,0x60)~=0 then
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_SELF_TURN)
tc:RegisterEffect(e1,true)
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1)
tc:CompleteProcedure()
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_SELF_TURN)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(tc)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE_EFFECT)
e3:SetValue(RESET_TURN_SET)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_SELF_TURN)
tc:RegisterEffect(e3)
local e4=Effect.CreateEffect(tc)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetCountLimit(1)
e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetLabelObject(tc)
e4:SetCondition(s.retcon)
e4:SetOperation(s.retop)
Duel.RegisterEffect(e4,tp)
end
end
end
function s.retcon(e,tp,eg,ep,ev,re,r,rp)
if tp~=Duel.GetTurnPlayer() then return false end
local tc=e:GetLabelObject()
if tc:GetFlagEffect(id)~=0 then
return true
else
e:Reset()
return false
end
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_TEMPORARY)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
local xyz=eg:GetCount()==1 and eg:GetFirst():IsSummonType(SUMMON_TYPE_XYZ) and eg:GetFirst():IsControler(tp)
local nodraw=Duel.GetFlagEffect(tp,id)~=1
return xyz and nodraw
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsSSetable() end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SSet(tp,e:GetHandler())~=0 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(ep,id,RESET_PHASE+PHASE_END,0,1)
end
-- 卧薪尝胆
local s,id,o=GetID()
function s.initial_effect(c)
-- draw
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_BATTLE_END)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
-- resound
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(s.recon)
e2:SetOperation(s.reop)
c:RegisterEffect(e2)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_BATTLE
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)
if chk==0 then return c==0 end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,7)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,2,REASON_EFFECT)
Duel.Draw(1-tp,7,REASON_EFFECT)
if e:GetLabel()~=nil then e:Reset() end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CANNOT_INACTIVATE)
e1:SetTargetRange(1,1)
e1:SetCondition(s.accon)
e1:SetValue(aux.TRUE)
e1:SetLabel(Duel.GetTurnCount())
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_DISEFFECT)
Duel.RegisterEffect(e2,tp)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetValue(aux.tgoval)
Duel.RegisterEffect(e3,tp)
end
function s.accon(e)
return e:GetLabel()~=Duel.GetTurnCount()
end
function s.recon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0
end
function s.reop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_BATTLE)
e1:SetLabel(Duel.GetTurnCount())
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.op)
e1:SetCountLimit(1)
-- if Duel.GetCurrentPhase()<=PHASE_BATTLE then
-- e1:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_OPPO_TURN,2)
-- else
-- e1:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_OPPO_TURN)
-- end
Duel.RegisterEffect(e1,tp)
end
-- Shut up!
local s,id,o=GetID()
function s.initial_effect(c)
-- special summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetCost(s.cost)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.CheckPhaseActivity() and Duel.IsAbleToEnterBP()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local bc=e:GetLabelObject()
if chk==0 then return Duel.CheckLPCost(tp,100,true)
and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN_MONSTER,0,0,3,RACE_WARRIOR,ATTRIBUTE_EARTH) end
local maxc=Duel.GetLP(tp)
if maxc>25500 then maxc=25500 end
maxc=math.floor(maxc/100)*100
local t={}
for i=1,maxc/100 do
t[i]=i*100
end
local cost=Duel.AnnounceNumber(tp,table.unpack(t))
Duel.PayLPCost(tp,cost,true)
e:SetLabel(cost)
-- only token can attack
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTarget(s.antarget)
Duel.RegisterEffect(e1,tp)
end
function s.antarget(e,c)
return not c:IsType(TYPE_TOKEN)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
Duel.SetChainLimit(aux.FALSE)
end
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN_MONSTER,0,0,3,RACE_WARRIOR,ATTRIBUTE_EARTH) then return end
local c=e:GetHandler()
-- silent until get into Battle step.
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetReset(RESET_PHASE+PHASE_BATTLE_START)
e1:SetTargetRange(1,1)
e1:SetValue(1)
Duel.RegisterEffect(e1,tp)
-- can't goto ep, must bp
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_MAIN2+PHASE_BATTLE+RESET_SELF_TURN+RESET_OPPO_TURN)
Duel.RegisterEffect(e2,tp)
-- Create token
local token=Duel.CreateToken(tp,id+1)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_ATTACK)
s.initial_token_effect(e,tp,token)
Duel.BreakEffect()
Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
end
function s.disop(e)
return function(e2,...)
e:Reset()
e2:Reset()
end
end
function s.initial_token_effect(e,tp,token)
local c=e:GetHandler()
-- atk
local te0=Effect.CreateEffect(c)
te0:SetType(EFFECT_TYPE_SINGLE)
te0:SetCode(EFFECT_SET_ATTACK)
te0:SetValue(e:GetLabel())
te0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD)
token:RegisterEffect(te0)
-- can't release
local te1=Effect.CreateEffect(c)
te1:SetType(EFFECT_TYPE_SINGLE)
te1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
te1:SetRange(LOCATION_MZONE)
te1:SetCode(EFFECT_UNRELEASABLE_SUM)
te1:SetValue(1)
token:RegisterEffect(te1)
-- cannot be material
local te2=te1:Clone()
te2:SetCode(EFFECT_UNRELEASABLE_NONSUM)
token:RegisterEffect(te2)
local te3=te1:Clone()
te3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
te3:SetValue(aux.TRUE)
token:RegisterEffect(te3)
local te4=te1:Clone()
te4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
token:RegisterEffect(te4)
local te5=te1:Clone()
te5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
token:RegisterEffect(te5)
local te6=te1:Clone()
te6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
token:RegisterEffect(te6)
-- must attack
local te7=Effect.CreateEffect(c)
te7:SetType(EFFECT_TYPE_SINGLE)
te7:SetCode(EFFECT_MUST_ATTACK)
te7:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(te7)
-- shut up!
local te8=Effect.CreateEffect(c)
te8:SetType(EFFECT_TYPE_FIELD)
te8:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
te8:SetCode(EFFECT_CANNOT_ACTIVATE)
te8:SetRange(LOCATION_MZONE)
te8:SetTargetRange(1,1)
te8:SetValue(1)
te8:SetCondition(s.shutupcon)
token:RegisterEffect(te8)
-- chain attack
local te9=Effect.CreateEffect(c)
te9:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
te9:SetCode(EVENT_BATTLE_DESTROYING)
te9:SetCondition(s.chainacon)
te9:SetOperation(s.chainaop)
te9:SetReset(RESET_EVENT+RESETS_STANDARD)
te9:SetLabelObject(token)
--token:RegisterEffect(te9)
Duel.RegisterEffect(te9,tp)
local te10=Effect.CreateEffect(c)
te10:SetType(EFFECT_TYPE_FIELD)
te10:SetRange(LOCATION_MZONE)
te10:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
te10:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
te10:SetTargetRange(1,0)
token:RegisterEffect(te10)
end
function s.shutupcon(e)
return Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler()
end
function s.chainacon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
local bc=tc:GetBattleTarget()
return tc==eg:GetFirst() and tc:IsRelateToBattle() and bc and bc:IsPreviousControler(1-tp) and tc:IsChainAttackable(0)
end
function s.chainaop(e,tp,eg,ep,ev,re,r,rp)
if Duel.CheckLPCost(tp,2000) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
Duel.PayLPCost(tp,2000)
Duel.ChainAttack()
end
end
-- 神之怒火
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_SUMMON+CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
if not s.gf then
s.codelist={}
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
ge1:SetCode(EVENT_CHAIN_NEGATED)
ge1:SetCondition(s.recordcon)
ge1:SetOperation(s.recordop)
Duel.RegisterEffect(ge1,0)
s.gf=true
end
end
function s.filter(c)
return c:IsRace(RACE_FAIRY) and c:IsFaceup()
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsChainNegatable(ev) then return false end
if re==nil then return false end
local ec=re:GetHandler()
if ec:GetOriginalLevel()>ec:GetLevel() then return true end
if re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if tg and tg:IsExists(s.filter,1,nil) then return true end
end
return s.codelist[ec:GetCode()]~=nil
end
function s.cfilter(c)
return c:IsType(TYPE_COUNTER) and not c:IsPublic()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,e:GetHandler())
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp)
and Duel.CheckLPCost(tp,1000)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local cg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
local tc=cg:GetFirst()
Duel.ConfirmCards(1-tp,cg)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVED)
e2:SetRange(LOCATION_HAND)
e2:SetOperation(s.clearop)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
e2:SetLabel(Duel.GetCurrentChain())
e2:SetLabelObject(e1)
tc:RegisterEffect(e2)
Duel.PayLPCost(tp,1000)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.ndcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function s.spfilter(c,e,tp)
return c:IsCode(114514997) and Duel.GetMZoneCount(tp)>0
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local ec=re:GetHandler()
if Duel.NegateActivation(ev) and ec:IsRelateToEffect(re) then
if Duel.Destroy(eg,REASON_EFFECT)~=0 and ec:IsLocation(LOCATION_GRAVE) then
local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK+LOCATION_HAND,0,nil,e,tp)
if g:GetCount()>0 then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local sg=g:Select(tp,1,1,nil)
local sc=sg:GetFirst()
-- reduce to 0s
sc:RegisterFlagEffect(114514997,RESET_EVENT,1,0)
Duel.Summon(tp,sc,true,nil)
end
end
end
end
function s.clearop(e,tp,eg,ep,ev,re,r,rp)
if ev~=e:GetLabel() then return end
e:GetLabelObject():Reset()
e:Reset()
end
s.yhvhc={
[41420027]=1, --宣
[84749824]=1, --警
[40605147]=1, --通
[92512625]=1, --忠
[38891741]=1, --摄
--[id]=1, --怒
}
function s.recordcon(e,tp,eg,ep,ev,re,r,rp)
local se=Duel.GetChainInfo(0,CHAININFO_DISABLE_REASON)
local rc=se:GetHandler():GetCode()
return s.yhvhc[rc]~=nil
end
function s.recordop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
local rc=re:GetHandler():GetCode()
s.codelist[rc]=1
end
--大泽夜语
local s,id,o=GetID()
function s.initial_effect(c)
-- activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
c:RegisterEffect(e1)
-- remove setcode
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(id)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
c:RegisterEffect(e2)
-- revolution!
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(s.condition)
e3:SetCost(s.cost)
e3:SetOperation(s.op)
c:RegisterEffect(e3)
if not s.gf then
s.originIsSetCard = Card.IsSetCard
Card.IsSetCard = s.IsSetCard
s.originIsCodeListed = aux.IsCodeListed
aux.IsCodeListed = s.IsCodeListed
s.gf=true
end
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.CheckPhaseActivity()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local ge=Effect.CreateEffect(e:GetHandler())
ge:SetType(EFFECT_TYPE_FIELD)
ge:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ge:SetCode(id)
ge:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
ge:SetTargetRange(1,1)
Duel.RegisterEffect(ge,tp)
end
function s.IsSetCard(c,set)
if Duel.IsPlayerAffectedByEffect(c:GetControler(),id) then
return false
end
return s.originIsSetCard(c,set)
end
function s.IsCodeListed(c,code)
if Duel.IsPlayerAffectedByEffect(c:GetControler(),id) then
return false
end
return s.originIsCodeListed(c,code)
end
--转瞬即逝的噩梦
local s,id,o=GetID()
function s.initial_effect(c)
--activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
--quick activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetCondition(s.qacon)
e1:SetCost(s.cost)
e1:SetOperation(s.qaop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_F)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetCost(s.cost)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
local e2p=e2:Clone()
e2p:SetCode(EVENT_CHAIN_SOLVED)
c:RegisterEffect(e2p)
--self destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_SZONE)
e3:SetCategory(CATEGORY_DAMAGE)
e3:SetCountLimit(1)
e3:SetCondition(s.sdcon)
e3:SetOperation(s.sdop)
c:RegisterEffect(e3)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function s.qacon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph==PHASE_MAIN1 or ph==PHASE_MAIN2
end
function s.qaop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
function s.desfilter(c)
return c:IsOnField() and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsFaceup() and c:GetFlagEffect(id)==0
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return s.desfilter(chkc) and chkc~=e:GetHandler() end
if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.HintSelection(g)
local tc=g:GetFirst()
tc:RegisterFlagEffect(id,RESET_EVENT+RESET_CHAIN+RESET_LEAVE,0,1)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
Duel.Destroy(tc,REASON_EFFECT)
end
function s.sdcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,22200403)
end
function s.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.Damage(tp,3000,REASON_EFFECT)>0 then
Duel.Destroy(c,REASON_EFFECT)
end
end
\ No newline at end of file
--深渊的暗中谋划
--[[
82732705 技能抽取
73599290 灵魂抽取
68937720 精神抽取
53982768 冥界的魔王 哈·迪斯
53375573 深渊的冥王
]]
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.cfilter(c,id)
return c:IsFaceup() and c:IsCode(id)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLocationCount(tp,LOCATION_SZONE)>=3 and (
Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil,53375573)
or Duel.IsExistingMatchingCard(s.cfilter,tp,0,LOCATION_ONFIELD,1,nil,53982768))
end
function s.filter(c,tp,code)
return c:IsCode(code) and c:GetActivateEffect():IsActivatable(tp,true,true)
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,tp,82732705)
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,tp,73599290)
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,tp,68937720)
end
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
for _, tid in ipairs({82732705,73599290,68937720}) do
local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,tp,tid):GetFirst()
if tc then
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local te=tc:GetActivateEffect()
te:UseCountLimit(tp,1,true)
local tep=tc:GetControler()
local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
Duel.RaiseEvent(tc,tid,te,0,tp,tp,Duel.GetCurrentChain())
else
return
end
end
end
--暗黑界的静寂 无色
local s,id,o=GetID()
function s.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(s.putcon)
e1:SetOperation(s.putop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetOperation(s.rcounter)
c:RegisterEffect(e2)
end
function s.putcon(e,tp,eg,ep,ev,re,r,rp)
e:SetLabel(e:GetHandler():GetPreviousControler())
return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,0x4040)==0x4040
end
function s.putop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,nil,nil)
if g:GetCount()==0 then return end
Duel.BreakEffect()
Duel.Hint(HINT_CARD,0,id)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local g1=g:Select(tp,1,1,nil)
local tc=g1:GetFirst()
if tc:IsFaceup() then
tc:AddCounter(0x10e9,1)
if tc:GetFlagEffect(id)~=0 then return end
local te=Effect.CreateEffect(tc)
te:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
te:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
if tc:IsType(TYPE_FUSION) and tc:IsType(TYPE_MONSTER) then
te:SetType(EFFECT_TYPE_FIELD)
te:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
te:SetCode(EFFECT_CANNOT_ACTIVATE)
te:SetRange(LOCATION_MZONE)
te:SetTargetRange(1,1)
te:SetCondition(s.countercon)
te:SetValue(s.aclimit)
elseif tc:IsType(TYPE_MONSTER) then
te:SetRange(LOCATION_ONFIELD)
te:SetCode(EVENT_CHAINING)
te:SetRange(LOCATION_MZONE)
te:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
te:SetCondition(s.countercon)
te:SetOperation(s.chainop)
elseif tc:IsType(TYPE_SPELL) then
te:SetRange(LOCATION_ONFIELD)
te:SetCode(EVENT_CHAIN_SOLVING)
te:SetCondition(s.negcon)
te:SetOperation(s.negop)
elseif tc:IsType(TYPE_TRAP) then
te:SetType(EFFECT_TYPE_FIELD)
te:SetRange(LOCATION_ONFIELD)
te:SetCode(EFFECT_DISABLE)
te:SetCondition(s.countercon)
te:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
te:SetTarget(s.negtg)
end
tc:RegisterEffect(te)
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,0)
end
end
function s.filter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x6)
end
function s.nfilter(c,e,tp)
return not c:IsSetCard(0x6)
end
function s.cofilter(c)
return c:GetCounter(0x10e9)~=0
end
function s.countercon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x10e9)~=0
end
function s.aclimit(e,re,tp)
local rc=re:GetHandler()
return not rc:IsSetCard(0x6)
end
function s.chainop(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
if rc:IsSetCard(0x6) and ep==tp then
Duel.SetChainLimit(aux.FALSE)
end
end
function s.negcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return s.countercon(e,tp,eg,ep,ev,re,r,rp) and not rc:IsSetCard(0x6)
end
function s.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev,true)
end
function s.negtg(e,c)
return s.nfilter(c)
end
-- function s.redraw(e,tp,eg,ep,ev,re,r,rp)
-- local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND)
-- Duel.SendtoGrave(g,REASON_EFFECT+REASON_DISCARD)
-- Duel.BreakEffect()
-- Duel.Draw(tp,2,REASON_EFFECT)
-- Duel.Draw(1-tp,2,REASON_EFFECT)
-- end
function s.rcounter(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.cofilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
local tc=g:GetFirst()
local ss=false
while tc do
local sct=tc:GetCounter(0x10e9)
if sct>0 then ss=true end
tc:RemoveCounter(tp,0x10e9,sct,0)
tc:ResetFlagEffect(id)
tc=g:GetNext()
end
if ss then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
-- 暗黑界的武魂
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetHintTiming(0,TIMING_SPSUMMON)
c:RegisterEffect(e0)
-- force battle
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_SZONE)
e1:SetCondition(s.battlecon)
e1:SetTarget(s.battletg)
e1:SetOperation(s.battleop)
e1:SetCountLimit(1,id)
c:RegisterEffect(e1)
-- draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_HANDES+CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
--e2:SetCountLimit(1,id+id)
e2:SetCondition(s.drcon)
e2:SetTarget(s.drtg)
e2:SetOperation(s.drop)
c:RegisterEffect(e2)
end
function s.battlecon(e,tp,eg,ep,ev,re,r,rp)
if #eg~=1 then return false end
local ec=eg:GetFirst()
return ec:IsSetCard(0x6) and ec:IsFaceup() and ec:IsSummonPlayer(tp) and ec:IsAttackPos() and (Duel.GetCurrentPhase()==PHASE_MAIN1) and Duel.IsAbleToEnterBP()
end
function s.battletg(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,nil,LOCATION_MZONE,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACKTARGET)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,nil,LOCATION_MZONE,1,1,e:GetHandler())
end
function s.battleop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local ec=eg:GetFirst()
if ec:IsAttackable() and tc:IsOnField() then
-- attacker. Due to ygopro bug(?) must be a trigger_f
local e1=Effect.CreateEffect(ec)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
e1:SetProperty(EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(s.battleop2)
e1:SetTarget(s.battle2tg)
e1:SetLabelObject(tc)
e1:SetCountLimit(1)
ec:RegisterEffect(e1)
-- cannot goto ep
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetTargetRange(1,1)
e2:SetReset(RESET_PHASE+PHASE_MAIN2+PHASE_BATTLE+RESET_SELF_TURN+RESET_OPPO_TURN)
Duel.RegisterEffect(e2,tp)
-- silent to simulate skip battle start step
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetReset(RESET_PHASE+PHASE_BATTLE_START)
e3:SetCondition(s.silentcon(e1))
e3:SetTargetRange(1,1)
e3:SetValue(1)
Duel.RegisterEffect(e1,tp)
Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
end
end
function s.silentcon(te)
return function(e)
return e~=te
end
end
function s.battleop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
--draw
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLED)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(s.battledop)
e1:SetLabelObject(tc)
e1:SetReset(RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
--if Duel.GetTurnPlayer()~=tp then
-- Duel.CalculateDamage(tc,c,true)
--else
Duel.CalculateDamage(c,tc,true)
--end
e:Reset()
end
function s.battle2tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetChainLimit(aux.FALSE)
end
function s.cfilter(c,tp,re)
local rc=re:GetHandler()
return c:IsSetCard(0x6)
and c:IsPreviousControler(tp)
and not (c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_HAND))
end
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
return re and eg:IsExists(s.cfilter,1,nil,tp,re)
end
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2)
and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil,REASON_EFFECT) end
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function s.drop(e,tp,eg,ep,ev,re,r,rp)
if Duel.Draw(tp,1,REASON_EFFECT) then
Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_EFFECT+REASON_DISCARD)
end
end
function s.battledop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
if c and c:IsRelateToBattle() and Duel.GetBattleDamage(c:GetOwner())==0 then
Duel.Draw(c:GetOwner(),1,REASON_EFFECT)
else
Duel.DiscardHand(c:GetOwner(),Card.IsDiscardable,1,1,REASON_EFFECT+REASON_DISCARD)
end
if bc and bc:IsRelateToBattle() and Duel.GetBattleDamage(bc:GetOwner())==0 then
Duel.Draw(bc:GetOwner(),1,REASON_EFFECT)
else
Duel.DiscardHand(bc:GetOwner(),Card.IsDiscardable,1,1,REASON_EFFECT+REASON_DISCARD)
end
e:Reset()
end
\ No newline at end of file
-- 暗黑界的召集
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
c:RegisterEffect(e1)
--collect
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_LEAVE_GRAVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DISCARD)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,id)
e2:SetCondition(s.cocon)
e2:SetOperation(s.coop)
c:RegisterEffect(e2)
--collect spell
local e3=e2:Clone()
e3:SetDescription(aux.Stringid(id,3))
e3:SetCondition(s.cocon2)
e3:SetOperation(s.coop2)
c:RegisterEffect(e3)
end
function s.cofilter(c,tp,re)
local rc=re:GetHandler()
return c:IsSetCard(0x6)
and c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_HAND)
and c:IsPreviousControler(tp)
end
function s.monfilter(c)
return c:IsType(TYPE_MONSTER)
end
function s.spellfilter(c,tp)
return c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP) and c:IsPreviousControler(tp) and c:IsLocation(LOCATION_GRAVE)
end
function s.exist3(c,tp)
return Duel.GetMatchingGroup(aux.NecroValleyFilter(Card.IsCode),tp,0x35,0,nil,c:GetCode()):__len()>=3
end
function s.cocon(e,tp,eg,ep,ev,re,r,rp)
return re and eg:IsExists(aux.AND(s.cofilter,s.monfilter,s.exist3),1,nil,tp,re)
end
function s.cocon2(e,tp,eg,ep,ev,re,r,rp)
return re and eg:IsExists(aux.AND(s.cofilter,s.spellfilter),1,nil,tp,re)
end
function s.coop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil,REASON_EFFECT)
and Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))==0 then
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_EFFECT+REASON_DISCARD)
else
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
local ec=eg:GetFirst()
while ec do
if s.monfilter(ec) then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(Card.IsCode),tp,0x35,0,nil,ec:GetCode())
g:RemoveCard(ec)
if #g>=2 then
g=g:Select(tp,2,2,nil)
end
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
ec=eg:GetNext()
end
end
function s.coop2(e,tp,eg,ep,ev,re,r,rp)
local cg=eg:Filter(s.spellfilter,nil,e)
local n=Duel.SSet(tp,cg)
if n>0 then
Duel.DiscardHand(tp,aux.TRUE,n,n,REASON_EFFECT+REASON_DISCARD)
end
end
\ No newline at end of file
-- 暗黑界的唤笈
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
e1:SetCountLimit(1,id)
c:RegisterEffect(e1)
-- ret spell
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_GRAVE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1,id)
e2:SetCondition(s.retcon)
e2:SetTarget(s.rettg)
e2:SetCost(s.retcost)
e2:SetOperation(s.retop)
c:RegisterEffect(e2)
end
function s.filter0(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToDeck()
end
function s.filter1(c,e)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToDeck() and not c:IsImmuneToEffect(e)
end
function s.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x6) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_REMOVED,0,nil)
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_REMOVED,0,nil,e)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
local todeck=0
local nottodeck=0
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat=Duel.SelectFusionMaterial(tp,tc,mg,nil,chkf)
tc:SetMaterial(mat)
Duel.SendtoDeck(mat,nil,SEQ_DECKSHUFFLE,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
local mc=mat:GetFirst()
while mc do
if mc:IsLocation(LOCATION_DECK) then
todeck=todeck+1
else
nottodeck=nottodeck+1
end
mc=mat:GetNext()
end
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
Duel.BreakEffect()
if todeck>0 then
Duel.DiscardHand(tp,aux.TRUE,todeck,todeck,REASON_EFFECT+REASON_DISCARD)
end
if nottodeck>0 then
Duel.SetLP(tp,Duel.GetLP(tp)-Duel.GetLP(tp)/2*nottodeck)
end
end
end
function s.spellfilter(c,tp,re)
return (c:GetType()==TYPE_SPELL or c:GetType()==TYPE_QUICKPLAY+TYPE_SPELL or c:GetType()==TYPE_TRAP)
and c:IsSetCard(0x6)
and c:IsAbleToDeck()
and c:CheckActivateEffect(false,true,false)~=nil
end
function s.thfilter(c)
return c:IsDiscardable() and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x6)
end
function s.retcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
return true
end
function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if e:GetLabel()==0 then return false end
e:SetLabel(0)
return Duel.IsExistingMatchingCard(s.spellfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_HAND,0,1,nil)
end
e:SetLabel(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spellfilter,tp,LOCATION_GRAVE,0,1,1,nil)
local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
e:SetProperty(te:GetProperty())
local tg=te:GetTarget()
if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end
te:SetLabelObject(e:GetLabelObject())
e:SetLabelObject(te)
Duel.ClearOperationInfo(0)
end
function s.retcon(e,tp,eg,ep,ev,re,r,rp)
return true
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te then return end
e:SetLabelObject(te:GetLabelObject())
local op=te:GetOperation()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
if op and Duel.DiscardHand(tp,s.thfilter,1,1,REASON_EFFECT+REASON_DISCARD) then op(e,tp,eg,ep,ev,re,r,rp) end
end
-- 神影依骑 米德拉什
local s,id,o=GetID()
function s.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCode3(c,94977269,3717252,114514679,false,false)
--splimit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
e2:SetRange(~LOCATION_EXTRA)
e2:SetValue(aux.FALSE)
c:RegisterEffect(e2)
--copy effect
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetCondition(s.copycon)
e3:SetTarget(s.copytg)
e3:SetOperation(s.copyop)
c:RegisterEffect(e3)
--create shaddoll token
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,2))
e4:SetCategory(CATEGORY_TOKEN)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e4:SetTarget(s.dolltg)
e4:SetOperation(s.dollop)
e4:SetCountLimit(1,id)
c:RegisterEffect(e4)
--defusion
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,3))
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetRange(LOCATION_MZONE)
e5:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e5:SetCondition(s.decon)
e5:SetOperation(s.deop)
e5:SetCountLimit(1,id)
c:RegisterEffect(e5)
end
function s.copycon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function s.copyfilter(c)
return c:IsSetCard(0x9d) and c:IsType(TYPE_FUSION)
end
function s.copytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(s.copyfilter,tp,LOCATION_GRAVE,0,1,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectMatchingCard(tp,s.copyfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetTargetCard(g)
end
function s.copyop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and c:IsRelateToEffect(e) and c:IsFaceup() then
local code=tc:GetOriginalCode()
c:CopyEffect(code,RESET_EVENT+RESETS_STANDARD+RESET_DISABLE,1)
end
end
function s.dollfilter(c)
return c:IsFaceup() and c:IsCanTurnSet()
end
function s.dolltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c:IsControler(1-tp) and s.dollfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(s.dollfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,s.dollfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function s.dollop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local c=e:GetHandler()
local atk=tc:GetAttack()
local def=tc:GetDefense()
local code=Card.GetCode(tc)
local attr=tc:GetAttribute()
local race=tc:GetRace()
local level=tc:GetLevel()
if tc:IsRelateToEffect(e) and tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() and Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE)~=0 then
local token=Duel.CreateToken(tp,id+1)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(atk)
token:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
e2:SetValue(def)
token:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e3:SetValue(attr)
token:RegisterEffect(e3)
local e4=e1:Clone()
e4:SetCode(EFFECT_CHANGE_LEVEL)
e4:SetValue(level)
token:RegisterEffect(e4)
local e5=e1:Clone()
e5:SetCode(EFFECT_CHANGE_RACE)
e5:SetValue(race)
token:RegisterEffect(e5)
local e6=e1:Clone()
e6:SetCode(EFFECT_ADD_CODE)
e6:SetValue(id)
token:RegisterEffect(e6)
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e7:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e7)
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_SINGLE)
e8:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e8:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e8)
local e9=Effect.CreateEffect(c)
e9:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e9:SetCode(EVENT_LEAVE_FIELD)
e9:SetOperation(s.disop(e7))
token:RegisterEffect(e9)
end
end
function s.disop(te)
return function(e)
e:Reset()
te:Reset()
end
end
function s.defilter(c,e,tp,fusc,mg)
return c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE)
and c:GetReason()&(REASON_FUSION+REASON_MATERIAL)==(REASON_FUSION+REASON_MATERIAL) and c:GetReasonCard()==fusc
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and fusc:CheckFusionMaterial(mg,c,PLAYER_NONE,true)
end
function s.decon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
local mg=tc:GetMaterial()
local ct=mg:GetCount()
local sumtype=tc:GetSummonType()
return mg:FilterCount(aux.NecroValleyFilter(s.defilter),nil,e,tp,tc,mg)==ct
and not Duel.IsPlayerAffectedByEffect(tp,59822133)
and bit.band(sumtype,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
and Duel.IsPlayerCanSendtoGrave(tp)
end
function s.deop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler()
local mg=tc:GetMaterial()
local ct=mg:GetCount()
local sumtype=tc:GetSummonType()
if Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and bit.band(sumtype,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
and ct>0 and ct<=Duel.GetLocationCount(tp,LOCATION_MZONE)
and mg:FilterCount(aux.NecroValleyFilter(s.defilter),nil,e,tp,tc,mg)==ct
and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
Duel.BreakEffect()
Duel.SpecialSummon(mg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.ShuffleSetCard(mg)
end
end
--帝王的胎动
local s,id,o=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local n=s.scan_location(Card.IsAbleToHand,LOCATION_DECK,tp)
local attrs=s.available_attributes(n)
if chk==0 then return attrs>0 end
e:SetLabel(Duel.AnnounceAttribute(tp,1,attrs))
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,4,tp,LOCATION_DECK)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local l=s.scan_location(Card.IsAbleToHand,LOCATION_DECK,tp)
local attrs=s.available_attributes(l)
local attr=e:GetLabel()
if bit.band(attrs,attr)~=attr then return end
local g=
Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,attr,800)+
Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,attr,2400)+
Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,attr,2800)+
Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,attr,3000)
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
function s.filter(c,attr,atk)
return c:IsAttribute(attr) and c:IsAttack(atk) and c:IsDefense(1000)
end
function s.available_attributes(n)
return s.attribute_available(n, ATTRIBUTE_EARTH)
+s.attribute_available(n, ATTRIBUTE_WATER)
+s.attribute_available(n, ATTRIBUTE_FIRE)
+s.attribute_available(n, ATTRIBUTE_WIND)
+s.attribute_available(n, ATTRIBUTE_LIGHT)
+s.attribute_available(n, ATTRIBUTE_DARK)
end
function s.attribute_available(n,attribute)
local j=attribute*attribute*attribute*attribute*15
if bit.band(n,j)==j then
return attribute
else
return 0
end
end
function s.scan_location(f,l,tp)
local g=Duel.GetMatchingGroup(f,tp,l,0,nil)
local n=0
for c in aux.Next(g) do
n=s.scan_card(c,n)
end
return n
end
function s.scan_card(c,n)
-- 0000,0000,0000,0000,0000,0000
-- 暗 光 风 炎 水 地
-- 1 1 1 1
-- 混帝 大帝 帝 侍从
if not c:IsDefense(1000) then return n end
local bit=0
if c:IsAttack(800) then bit=bit+1
elseif c:IsAttack(2400) then bit=bit+2
elseif c:IsAttack(2800) then bit=bit+4
elseif c:IsAttack(3000) then bit=bit+8
end
if bit==0 then return n end
local a=c:GetAttribute()
while a>0 do
local ca=a&(a-1)
local cab=a-ca
n=n|(cab*cab*cab*cab*bit)
a=ca
end
return n
end
--未来来
local s,id,o=GetID()
function s.initial_effect(c)
c:EnableCounterPermit(0x10ea)
--activate
local e0=Effect.CreateEffect(c)
e0:SetCategory(CATEGORY_COUNTER)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetCost(s.cost)
e0:SetTarget(s.target)
c:RegisterEffect(e0)
--indes
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetRange(LOCATION_SZONE)
e1:SetTargetRange(LOCATION_ONFIELD,0)
e1:SetCondition(s.indescon)
e1:SetTarget(s.indestg)
e1:SetValue(1)
c:RegisterEffect(e1)
-- --disable spsummon
local e1p=Effect.CreateEffect(c)
e1p:SetType(EFFECT_TYPE_FIELD)
e1p:SetRange(LOCATION_SZONE)
e1p:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1p:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1p:SetTargetRange(1,0)
e1p:SetCondition(s.indescon)
e1p:SetTarget(s.sumlimit)
c:RegisterEffect(e1p)
--scry
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_QUICK_F)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(s.scrycon)
e2:SetOperation(s.scryop)
c:RegisterEffect(e2)
--wakeup (return card to deck top)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(s.wakeupcon)
e3:SetOperation(s.wakeupop)
c:RegisterEffect(e3)
-- reset the world
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetCategory(CATEGORY_REMOVE)
e4:SetDescription(aux.Stringid(id,4))
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetCondition(s.resetcon)
e4:SetTarget(s.resettg)
e4:SetOperation(s.resetop)
c:RegisterEffect(e4)
end
function s.filter(c)
return Card.IsAbleToRemoveAsCost(c) and c:IsSetCard(0xe6)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
local tg=Duel.GetOperatedGroup()
tg:KeepAlive()
e:SetLabelObject(tg)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsCanAddCounter(tp,0x10ea,7,c) end
c:AddCounter(0x10ea,3)
end
function s.indescon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
return ct>0
end
function s.indestg(e,c)
local cc=e:GetHandler()
return (c:IsFaceup() and c:IsSetCard(0xe6)) or c==cc
end
function s.sumlimit(e,c)
return not (c:IsSetCard(0xe6)) and c:IsLocation(LOCATION_EXTRA)
end
function s.scrycon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
local rc=re:GetHandler()
return ct>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=ct and
re:IsActiveType(TYPE_MONSTER) and rc:IsSetCard(0xe6)
-- and not e:GetHandler():IsStatus(STATUS_CHAINING)
end
function s.scryop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<ct then return end
s.scry(tp,ct)
end
function s.scry(tp,ct)
Duel.ConfirmDecktop(tp,ct)
local g=Duel.GetDecktopGroup(tp,ct)
local dg=g:Select(tp,0,#g,nil)
local ug=g-dg
local dc=dg:GetFirst()
while dc do
Duel.MoveSequence(dc,SEQ_DECKTOP)
dc=dg:GetNext()
end
Duel.SortDecktop(tp,tp,#dg)
for i=1,#dg do
local mg=Duel.GetDecktopGroup(tp,1)
Duel.MoveSequence(mg:GetFirst(),SEQ_DECKBOTTOM)
end
Duel.SortDecktop(tp,tp,#ug)
end
function s.wakeupfilter(c)
return c:IsLocation(LOCATION_DECK)
end
function s.wakeupcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
local rc=re:GetHandler()
return ct>0 and rc:IsSummonType(SUMMON_TYPE_SYNCHRO) and rc:IsSetCard(0xe6)
end
function s.wakeupop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
if ct>0 then
c:RemoveCounter(tp,0x10ea,1,REASON_EFFECT)
if Duel.SelectYesNo(tp,aux.Stringid(id,1)) and Duel.SendtoGrave(c,REASON_EFFECT)>0 then
local g=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_MZONE+LOCATION_GRAVE,0,nil,0xe6)
Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)
local tg=Duel.GetOperatedGroup():Filter(s.wakeupfilter,nil)
if #tg>0 then
s.scry(tp,#tg)
local e0=c:GetActivateEffect()
local tg2=e0:GetLabelObject()
Duel.SpecialSummon(tg2,0,tp,tp,false,false,POS_FACEUP)
end
end
end
end
function s.resetcon(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
end
function s.resettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
if ct>0 then ct=1 else ct=0 end
local loc=LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE
local g=Duel.GetMatchingGroup(aux.TRUE,tp,loc,loc*ct,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
end
function s.resetop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x10ea)
if ct>0 then ct=0 else ct=1 end
local loc=LOCATION_ONFIELD+LOCATION_HAND+LOCATION_GRAVE
local g=Duel.GetMatchingGroup(aux.TRUE,tp,loc,loc*ct,nil)
Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT)
Duel.SetLP(tp,8000)
Duel.Draw(tp,5,REASON_EFFECT)
if ct==1 then
Duel.SetLP(1-tp,8000)
Duel.Draw(1-tp,5,REASON_EFFECT)
end
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2)
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.DiscardDeck(tp,2,REASON_EFFECT)
end
--神碑之渊
local s,id,o=GetID()
function s.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_DECK_REVERSE_CHECK)
--leave
local e0p=Effect.CreateEffect(c)
e0p:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e0p:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0p:SetCode(EVENT_LEAVE_FIELD_P)
e0p:SetOperation(s.leavecheckop)
c:RegisterEffect(e0p)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e0:SetCode(EVENT_LEAVE_FIELD)
e0:SetOperation(s.leaveop)
e0:SetLabelObject(e0p)
c:RegisterEffect(e0)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.tdcost)
e1:SetTarget(s.tdtarget)
c:RegisterEffect(e1)
-- Reverse Deck
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_REVERSE_DECK)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(1,1)
c:RegisterEffect(e2)
-- draw
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_CHAIN_END)
e3:SetRange(LOCATION_FZONE)
e3:SetProperty(EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCondition(s.drcon)
e3:SetTarget(s.drtg)
e3:SetOperation(s.drop)
c:RegisterEffect(e3)
-- shuffle
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAINING)
e4:SetRange(LOCATION_FZONE)
e4:SetCondition(s.shufflecon)
e4:SetOperation(s.shuffleop)
c:RegisterEffect(e4)
-- replace draw
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_TOHAND)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetCode(EVENT_PREDRAW)
e5:SetRange(LOCATION_FZONE)
e5:SetTarget(s.thtg)
e5:SetOperation(s.thop)
c:RegisterEffect(e5)
end
function s.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(1-tp,1) end
local ct=aux.PlaceCardsOnDeckBottom(1-tp,Duel.GetFieldGroup(1-tp,LOCATION_HAND,0),REASON_COST)
e:SetLabel(ct)
end
function s.tdtarget(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsCanAddCounter(tp,0x10eb,Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0),c) end
local ct=e:GetLabel()
c:AddCounter(0x10eb,ct)
end
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x10eb)>0 and Duel.GetCurrentChain()==0
end
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,2)
end
function s.drop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():RemoveCounter(tp,0x10eb,1,REASON_EFFECT) then
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_RULE)
end
end
function s.shufflecon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
local c=e:GetHandler()
return rc:IsSetCard(0x17f) and rc:IsType(TYPE_QUICKPLAY) and rc:IsControler(tp) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function s.shuffleop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeChainOperation(ev,s._shuffleop(re:GetOperation()))
end
function s._shuffleop(op)
return function(e,tp,eg,ep,ev,re2,r,rp)
op(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.Hint(HINT_CARD,0,id)
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT)
Duel.ShuffleDeck(1-tp)
end
end
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return tp==Duel.GetTurnPlayer() end
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
aux.DrawReplaceCount=0
aux.DrawReplaceMax=dt
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_DRAW_COUNT)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_DRAW)
e1:SetValue(0)
Duel.RegisterEffect(e1,tp)
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thfilter(c)
return c:IsAbleToHand() and c:IsSetCard(0x17f) and c:IsType(TYPE_SPELL)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local op1_ct=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)
local op2_ct=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)
local op1_cards=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_REMOVED,0,nil)
local op2_cards=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.thfilter),tp,LOCATION_GRAVE,0,nil)
local op=aux.SelectFromOptions(tp,
{#op1_cards>=op1_ct,aux.Stringid(id,2)},
{#op2_cards>=op2_ct,aux.Stringid(id,3)},
{true,aux.Stringid(id,4)})
if op==1 then
local g1=op1_cards:Select(tp,op1_ct,op1_ct,nil)
Duel.SendtoHand(g1,nil,REASON_EFFECT)
elseif op==2 then
local g2=op2_cards:Select(tp,op2_ct,op2_ct,nil)
Duel.SendtoHand(g2,nil,REASON_EFFECT)
else
local g31=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_REMOVED,0,nil,0x17f)
local g32=Duel.GetMatchingGroup(aux.NecroValleyFilter(Card.IsSetCard),tp,LOCATION_GRAVE,0,nil,0x17f)
Duel.Remove(g32,POS_FACEUP,REASON_EFFECT)
Duel.SendtoGrave(g31,POS_FACEUP,REASON_EFFECT)
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function s.leavecheckop(e,tp,eg,ep,ev,re,r,rp)
e:SetLabel(e:GetHandler():GetCounter(0x10eb))
end
function s.leaveop(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabelObject():GetLabel()
if rp~=e:GetHandler():GetOwner() then return end
if ct==0 then return end
Duel.Draw(1-tp,ct,REASON_RULE)
Duel.SetLP(tp,Duel.GetLP(tp)-8000)
end
--无间行者帕尔修斯
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,56433456)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id)
e1:SetCondition(s.spcon)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--no monster
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(1,0)
e2:SetValue(s.aclimit)
e2:SetCondition(s.accon)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetTargetRange(0,1)
e3:SetCondition(s.accon2)
c:RegisterEffect(e3)
--set & henshin
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAIN_SOLVED)
e4:SetRange(LOCATION_MZONE)
e4:SetOperation(s.setop)
e4:SetCondition(s.setcon)
--e4:SetCountLimit(1,id+id)
c:RegisterEffect(e4)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)>=Duel.GetLP(1-tp)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetTarget(s.handtg)
e1:SetCountLimit(1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.handtg(e,c)
return c:IsType(TYPE_COUNTER)
end
function s.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER)
end
function s.accon(e,tp,eg,ep,ev,re,r,rp)
return not s.accon2(e,tp,eg,ep,ev,re,r,rp)
end
function s.accon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetFlagEffectLabel(id)==1
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
return c:GetFlagEffectLabel(id+100000000)~=1
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
local rc=re:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil,rc) end
end
function s.setfilter(c,rc)
return not c:IsCode(rc:GetCode()) and c:IsType(TYPE_COUNTER) and c:IsSSetable()
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_COUNTER) or not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() then return end
local rc=re:GetHandler()
Duel.Hint(HINT_CARD,tp,id)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil,rc)
if #g <= 0 then return end
c:RegisterFlagEffect(id+100000000,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1,1)
Duel.SSet(tp,g:GetFirst())
if not Duel.IsEnvironment(56433456) then return end
if Duel.GetLP(tp)<=Duel.GetLP(1-tp) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(ATTRIBUTE_LIGHT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetOwnerPlayer(tp)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e2:SetValue(Duel.GetLP(tp) - Duel.GetLP(1-tp))
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e3)
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1,1)
end
\ No newline at end of file
--混沌帝龙 -结末的使者-
local s,id,o=GetID()
o=1e9
function s.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.spcon)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
--to grave
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_DECKDES+CATEGORY_DAMAGE)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCost(s.sgcost)
e3:SetTarget(s.sgtg)
e3:SetOperation(s.sgop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,aux.FALSE)
--reset
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,2))
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAIN_NEGATED)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(s.rstcon)
e4:SetOperation(s.rstop)
c:RegisterEffect(e4)
local e4p=e4:Clone()
e4p:SetCode(EVENT_CHAIN_DISABLED)
c:RegisterEffect(e4p)
end
function s.spcostfilter(c)
return c:IsAbleToRemoveAsCost() and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
if Duel.GetMZoneCount(tp)<=0 then return false end
local g=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_GRAVE,0,nil)
return g:CheckSubGroup(aux.gfcheck,2,2,Card.IsAttribute,ATTRIBUTE_LIGHT,ATTRIBUTE_DARK)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_GRAVE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroup(tp,aux.gfcheck,false,2,2,Card.IsAttribute,ATTRIBUTE_LIGHT,ATTRIBUTE_DARK)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function s.sgcostfilter(c)
return c:IsAbleToRemoveAsCost() and c:IsType(TYPE_MONSTER)
end
function s.sgcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local t=c:GetFlagEffectLabel(id)
if t==nil then t=0 end
--print("f",Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN),t)
return Duel.CheckLPCost(tp,1000)
and Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)<=t
and Duel.GetFlagEffect(tp,id+o)==0
and Duel.IsExistingMatchingCard(s.sgcostfilter,tp,LOCATION_GRAVE,0,1,nil)
end
Duel.PayLPCost(tp,Duel.GetCustomActivityCount(s,tp,ACTIVITY_CHAIN)*1000)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,s.sgcostfilter,tp,LOCATION_GRAVE,0,1,1,nil)
local c=g:GetFirst()
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetLabel(c:GetAttribute())
-- Cannot start second time
Duel.RegisterFlagEffect(tp,id+o,RESET_PHASE+PHASE_END,0,1)
-- Cannot activitate
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(aux.TRUE)
e1:SetCondition(s.actcon)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.actcon(e)
return Duel.GetFlagEffect(tp,id+o)~=0
end
function s.damfilter(c,p)
return c:GetOwner()==p and c:IsAbleToGrave() and c:IsType(TYPE_MOSNTER)
end
function s.sgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ctp =Duel.GetFieldGroup(tp,LOCATION_DECK,0)
local cntp=Duel.GetFieldGroup(tp,0,LOCATION_DECK)
-- correctly set damage info for Super LP-Z
end
function s.sgfilter(c,p)
return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_MONSTER) and c:IsControler(p)
end
function s.exdmfilter(c,p,attr)
return s.sgfilter(c,p) and c:IsAttribute(attr)
end
function s.sgop(e,tp,eg,ep,ev,re,r,rp)
local attr=e:GetLabel()
for oc in aux.Next(Duel.GetDecktopGroup(tp,10)) do Duel.MoveSequence(oc,SEQ_DECKBOTTOM) end
for oc in aux.Next(Duel.GetDecktopGroup(1-tp,10)) do Duel.MoveSequence(oc,SEQ_DECKBOTTOM) end
local ctp =Duel.GetFieldGroup(tp,LOCATION_DECK,0)
local cntp=Duel.GetFieldGroup(tp,0,LOCATION_DECK)
Duel.DiscardDeck(tp,#ctp-10,REASON_EFFECT)
local tpg=Duel.GetOperatedGroup()
Duel.DiscardDeck(1-tp,#cntp-10,REASON_EFFECT)
local ntpg=Duel.GetOperatedGroup()
local tpc = tpg:FilterCount(s.sgfilter,nil,tp) + tpg:FilterCount(s.exdmfilter,nil,tp,attr)
local ntpc=ntpg:FilterCount(s.sgfilter,nil,1-tp)+ntpg:FilterCount(s.exdmfilter,nil,1-tp,attr)
if tpc>0 then Duel.Damage( tp,tpc *300,REASON_EFFECT,true) end
if ntpc>0 then Duel.Damage(1-tp,ntpc*300,REASON_EFFECT,true) end
Duel.RDComplete()
end
function s.rstcon(e,tp,eg,ep,ev,re,r,rp)
local de,dp=Duel.GetChainInfo(ev,CHAININFO_DISABLE_REASON,CHAININFO_DISABLE_PLAYER)
return rp==tp and dp==1-tp
end
function s.rstop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
local c=e:GetHandler()
local target=c:GetFlagEffectLabel(id)
local current=Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)
--print("->", current)
if target==nil then
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1,current)
else
c:SetFlagEffectLabel(id,current)
end
Duel.ResetFlagEffect(tp,id+o)
end
--雾天气 阳橙
local s,id,o=GetID()
function s.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkSetCard,0x109),2)
--extra summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(s.sucon)
e1:SetOperation(s.suop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_REMOVE)
e2:SetOperation(s.spreg)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetRange(LOCATION_REMOVED)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
--effect gain
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,2))
e4:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_CHAINING)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(s.discon2)
e4:SetCost(aux.bfgcost)
e4:SetOperation(s.disop2)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e5:SetRange(LOCATION_MZONE)
e5:SetTargetRange(LOCATION_MZONE,0)
e5:SetTarget(s.eftg)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
end
function s.sucon(e,tp,eg,ep,ev,re,r,rp,chk)
return e:GetHandler():GetSequence()>4
end
function s.sumfilter(c)
return c:IsSummonable(true,nil) and c:IsSetCard(0x109)
end
function s.suop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsFaceup() then return end
if not c:IsRelateToEffect(e) or c:IsControler(1-tp)
or Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0)<1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0)
local nseq=math.log(s,2)
Duel.MoveSequence(c,nseq)
if Duel.IsExistingMatchingCard(s.sumfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
Duel.BreakEffect()
Duel.ShuffleHand(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local sg=Duel.SelectMatchingCard(tp,s.sumfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
if sg:GetCount()>0 then
Duel.Summon(tp,sg:GetFirst(),true,nil)
end
end
end
function s.spreg(e,tp,eg,ep,ev,re,r,rp)
if not re then return end
local c=e:GetHandler()
local rc=re:GetHandler()
if c:IsReason(REASON_COST) and rc:IsSetCard(0x109) and c:IsPreviousLocation(LOCATION_ONFIELD) and re:IsActivated() then
e:SetLabel(Duel.GetTurnCount()+1)
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,2)
end
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():GetLabel()==Duel.GetTurnCount() and e:GetHandler():GetFlagEffect(id)>0
end
function s.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) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():ResetFlagEffect(id)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function s.eftg(e,c)
local lg=e:GetHandler():GetLinkedGroup()
return c:IsType(TYPE_EFFECT) and c:IsSetCard(0x109) and lg:IsContains(c)
end
function s.discon2(e,tp,eg,ep,ev,re,r,rp)
local ex,cg,cc,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DRAW)
return ex and cv>0
end
function s.disop2(e,tp,eg,ep,ev,re,r,rp)
s_dispo2_real_tp=rp
s_dispo2_real_e=re:Clone()
Duel.ChangeChainOperation(ev,s.repop)
end
function s.repop(e,tp,eg,ep,ev,re,r,rp)
if s_draw_func == nil then
s_draw_func = Duel.Draw
end
Duel.Draw = s.hackdraw
local op = s_dispo2_real_e:GetOperation()
op(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw = s_draw_func
end
function s.hackdraw(p,d,r)
s_draw_func(s_dispo2_real_tp,d,r)
end
--雾之天气模样
local s,id,o=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--effect gain
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(s.remtg)
e2:SetCost(aux.bfgcost)
e2:SetOperation(s.remop)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(s.eftg)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function s.eftg(e,c)
local seq=c:GetSequence()
return c:IsType(TYPE_EFFECT) and c:IsSetCard(0x109)
and seq<5 and math.abs(e:GetHandler():GetSequence()-seq)<=1
end
function s.filter(c)
return c:IsFaceup() and c:IsCanTurnSet()
end
function s.remtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end
end
function s.remop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 then
local sg=g:RandomSelect(1-tp,1)
local tc=sg:GetFirst()
if tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() then
Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE)
end
end
end
function s.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():GetFlagEffect(id)~=0
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
Duel.ReturnToField(e:GetLabelObject())
end
-- 黄昏的丧钟
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.atkcon)
e1:SetOperation(s.atkop)
c:RegisterEffect(e1)
--Deckdes
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DECKDES)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(s.descon)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
--Win
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(s.wincon)
e3:SetOperation(s.winop)
c:RegisterEffect(e3)
end
function s.atkfilter(c)
return c:IsAttribute(ATTRIBUTE_DARK)
end
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetMatchingGroupCount(s.atkfilter,tp,LOCATION_MZONE,nil,nil)>0
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_ONFIELD,nil,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT)
e1:SetValue(500)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetMatchingGroupCount(aux.TRUE,tp,LOCATION_DECK,nil,nil)>0
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ct=Duel.GetFlagEffectLabel(tp,id)
if ct==nil then ct=0 end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,e:GetHandler(),0,tp,ct+2)
Duel.SetOperationInfo(0,CATEGORY_DECKDES,e:GetHandler(),0,1-tp,ct+2)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=Duel.GetFlagEffectLabel(tp,id)
if ct==nil then
Duel.RegisterFlagEffect(tp,id,0,0,1,2)
ct=0
else
Duel.SetFlagEffectLabel(tp,id,ct+2)
end
ct=ct+2
local g1=Duel.GetDecktopGroup(tp,ct)
local g2=Duel.GetDecktopGroup(1-tp,ct)
g1:Merge(g2)
local tc=g1:GetFirst()
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x17a0000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x17a0000)
tc:RegisterEffect(e2)
tc=g1:GetNext()
end
Duel.SendtoGrave(g1,REASON_EFFECT)
Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
function s.losefilter(c)
return not c:IsCode(57774843) and not (c:IsSetCard(0x38) and bit.band(c:GetOriginalAttribute(),ATTRIBUTE_LIGHT)>0)
end
function s.wincon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetMatchingGroupCount(aux.TRUE,tp,LOCATION_DECK,nil,nil)==0
end
function s.winop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
if Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_MZONE,nil,nil,57774843)>0
and Duel.GetMatchingGroupCount(Card.IsSetCard,tp,LOCATION_MZONE,nil,nil,0x38)>0
and Duel.GetMatchingGroupCount(s.losefilter,tp,LOCATION_MZONE,nil,nil,0)==0 then
Duel.Win(tp,0xe6)
else
Duel.Win(1-tp,0xe6)
end
end
\ No newline at end of file
-- 天极辉星 巨熊舰长
local s,id,o=GetID()
function s.initial_effect(c)
-- pendulum summon
aux.EnablePendulumAttribute(c,false)
-- add ritual type
local e1=Effect.CreateEffect(c)
e1:SetDescription(1160)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetOperation(s.scaleop)
c:RegisterEffect(e1)
local e1p=Effect.CreateEffect(c)
e1p:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e1p:SetCode(EVENT_LEAVE_FIELD)
e1p:SetRange(LOCATION_PZONE)
e1p:SetOperation(s.leaveop)
c:RegisterEffect(e1p)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,aux.NOT(s.isLegalUrsarcticCard))
-- level up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_LEVEL)
e2:SetRange(LOCATION_PZONE)
e2:SetTargetRange(LOCATION_HAND,0)
e2:SetTarget(s.hlvfilter)
e2:SetValue(6)
c:RegisterEffect(e2)
-- call ship
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_PZONE)
e3:SetCountLimit(1)
e3:SetCost(s.cscost)
e3:SetCondition(s.cscon)
e3:SetOperation(s.csop)
c:RegisterEffect(e3)
-- force special summon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,0))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e5:SetCode(EVENT_SUMMON_SUCCESS)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e5:SetOperation(s.ssop)
c:RegisterEffect(e5)
local e5p=e5:Clone()
e5p:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e5p)
-- destroy
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(id,1))
e6:SetCategory(CATEGORY_DESTROY)
e6:SetCode(EVENT_FREE_CHAIN)
e6:SetType(EFFECT_TYPE_IGNITION)
e6:SetProperty(EFFECT_FLAG_CARD_TARGET)
e6:SetRange(LOCATION_MZONE)
e6:SetCost(s.descost)
e6:SetTarget(s.destg)
e6:SetOperation(s.desop)
c:RegisterEffect(e6)
end
-- Lua is evil and the one who write these sh&t must be devil.
function s.isLegalUrsarcticCard(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x163) and Duel.GetFlagEffectLabel(0,id)~=nil
end
function s.DrytronSpSummonLimit(e,c,sump,sumtype,sumpos,targetp,se)
return s.originDrytronSpSummonLimit(e,c,sump,sumtype,sumpos,targetp,se) and not s.isLegalUrsarcticCard(c)
end
function s.DrytronCostFilter(c,tp)
return (c:IsSetCard(0x154) or (c:IsSetCard(0x163) and Duel.GetFlagEffectLabel(0,id)~=nil) or c:IsType(TYPE_RITUAL))
and c:IsType(TYPE_MONSTER) and Duel.GetMZoneCount(tp,c)>0
and (c:IsControler(tp) or c:IsFaceup())
end
function s.GetCustomActivityCount(oid,tp,act)
if oid==97148796 and act==ACTIVITY_SPSUMMON and Duel.GetFlagEffectLabel(0,id)~=nil then
return math.max(0,s.originGetCustomActivityCount(oid,tp,act)-s.originGetCustomActivityCount(id,tp,act))
end
return s.originGetCustomActivityCount(oid,tp,act)
end
function s.scaleop(e,tp,eg,ep,ev,re,r,rp)
local count=Duel.GetFlagEffectLabel(0,id)
if count~=nil then
Duel.SetFlagEffectLabel(0,id,count+1)
else
Duel.RegisterFlagEffect(0,id,nil,0,1,1)
end
if not s.dry then
s.originDrytronSpSummonLimit = aux.DrytronSpSummonLimit
aux.DrytronSpSummonLimit = s.DrytronSpSummonLimit
s.originDrytronCostFilter = aux.DrytronCostFilter
aux.DrytronCostFilter = s.DrytronCostFilter
s.originGetCustomActivityCount = Duel.GetCustomActivityCount
Duel.GetCustomActivityCount = s.GetCustomActivityCount
-- 右枢可以拿北极天熊
if c97148796 then
c97148796.thfilter = function(c)
return c:IsAbleToHand() and ((c:IsType(TYPE_RITUAL) and c:IsType(TYPE_MONSTER)) or (Duel.GetFlagEffectLabel(0,id) and c:IsSetCard(0x163) and c:IsType(TYPE_MONSTER) ))
end
end
-- 天厨一可以展示北极天熊
if c22420202 then
c22420202.drfilter = function(c)
return (c:IsType(TYPE_RITUAL) and c:IsType(TYPE_MONSTER+TYPE_SPELL) and not c:IsPublic()) or (Duel.GetFlagEffectLabel(0,id) and c:IsSetCard(0x163) and c:IsType(TYPE_MONSTER) )
end
end
--扶筐增二在北极天熊在场时可以康
if c1174075 then
c1174075.cfilter = function(c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and (c:IsType(TYPE_RITUAL) or (Duel.GetFlagEffectLabel(0,id) and c:IsSetCard(0x163) and c:IsType(TYPE_MONSTER) ))
end
end
s.dry = true
end
end
function s.leaveop(e,tp,eg,ep,ev,re,r,rp)
local count=Duel.GetFlagEffectLabel(0,id)
if count<=1 then
Duel.ResetFlagEffect(0,id)
else
Duel.SetFlagEffectLabel(0,id,count-1)
end
end
function s.hlvfilter(e,c)
return c:IsLevelAbove(1) and c:IsLevelBelow(6) and c:IsSetCard(0x154)
end
function s.cscon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
end
function s.cscost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_EXTRA,0,nil,33250142)
if chk==0 then return #g>=3 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local cg=g:Select(tp,2,2,nil)
Duel.Remove(cg,POS_FACEUP,REASON_EFFECT)
end
function s.csop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,Card.IsCode,tp,LOCATION_EXTRA,0,1,1,nil,33250142)
if #g==0 then return end
local c=e:GetHandler()
local tc=g:GetFirst()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local te0=Effect.CreateEffect(c)
te0:SetCode(EFFECT_CHANGE_TYPE)
te0:SetType(EFFECT_TYPE_SINGLE)
te0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
te0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
te0:SetValue(TYPE_TRAP+TYPE_CONTINUOUS)
tc:RegisterEffect(te0)
-- gain effect
s.originRegisterEffect = Card.RegisterEffect
Card.RegisterEffect = s.RegisterEffect1
c33250142.initial_effect(tc)
Card.RegisterEffect = s.originRegisterEffect
-- scale up
Duel.BreakEffect()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LSCALE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_RSCALE)
c:RegisterEffect(e2)
end
function s.ssop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ss=false
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_SZONE,0,1,nil,33250142) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
-- special summon starts here
local g=Duel.SelectMatchingCard(tp,Card.IsCode,tp,LOCATION_SZONE,0,1,1,nil,e,tp,33250142)
local tc=g:GetFirst()
if Duel.SpecialSummon(tc,0,tp,tp,true,true,POS_FACEUP)~=0 then
ss=true
-- destroy starts here
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()~=0 then
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
end
end
end
-- to pen zone
if not ss and (Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
-- go to pzone so gain effect
s.scaleop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.desfilter(c)
return (c:IsType(TYPE_RITUAL) or c:IsType(TYPE_SYNCHRO)) and c:IsType(TYPE_MONSTER)
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_GRAVE+LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_GRAVE+LOCATION_MZONE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function s.RegisterEffect1(c,e)
e:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e:SetRange(LOCATION_SZONE)
s.originRegisterEffect(c,e)
end
This diff is collapsed.
This diff is collapsed.
--于天阴刻开的正道
local s,id,o=GetID()
o=1e9
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetHintTiming(0,TIMING_END_PHASE)
c:RegisterEffect(e0)
-- draw and handes
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_SZONE)
e1:SetCondition(s.drawcon)
e1:SetOperation(s.drawop)
c:RegisterEffect(e1)
--send to grave
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DECKDES)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(s.sgcon)
e2:SetOperation(s.sgop)
c:RegisterEffect(e2)
-- set itself
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(s.backcon)
e3:SetOperation(s.backop)
e3:SetCountLimit(1,id)
c:RegisterEffect(e3)
end
function s.drawcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
local c=e:GetHandler()
return re:IsHasCategory(CATEGORY_DECKDES) and rc:GetCode()~=id and c:GetFlagEffect(id)==0 and Duel.GetCurrentPhase()==PHASE_END
end
-- function s.drawtg(e,tp,eg,ep,ev,re,r,rp,chk)
-- local ex,g,gc,dp,dv=Duel.GetOperationInfo(ev,CATEGORY_DECKDES)
-- if chk==0 then return dv>0 end
-- Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,dv)
-- Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,dv)
-- end
function s.drawop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
Duel.Hint(HINT_CARD,0,id)
local c=e:GetHandler()
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
Duel.ChangeChainOperation(ev,s._drawop(re:GetOperation()))
end
end
function s._drawop(op)
return function(e,tp,eg,ep,ev,re2,r,rp)
local ex,g,gc,dp,dv=Duel.GetOperationInfo(ev,CATEGORY_DECKDES)
op(e,tp,eg,ep,ev,re,r,rp)
local d=Duel.Draw(tp,dv,REASON_EFFECT)
if d>0 then
Duel.ShuffleHand(tp)
Duel.DiscardHand(tp,aux.TRUE,dv,dv,REASON_EFFECT+REASON_DISCARD)
end
end
end
function s.sgfilter(c)
return c:IsType(TYPE_MONSTER)
and c:IsAttribute(ATTRIBUTE_LIGHT)
and c:IsLevelBelow(4)
and c:IsAbleToGrave()
end
function s.sgcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
local c=e:GetHandler()
return re:IsHasCategory(CATEGORY_HANDES) and rc:GetCode()~=id and c:GetFlagEffect(id+o)==0
end
function s.sgop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.Hint(HINT_CARD,0,id)
local c=e:GetHandler()
c:RegisterFlagEffect(id+o,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
Duel.ChangeChainOperation(ev,s._sgop(re:GetOperation()))
end
end
function s._sgop(op)
return function(e,tp,eg,ep,ev,re2,r,rp)
local ex,g,gc,dp,dv=Duel.GetOperationInfo(ev,CATEGORY_HANDES)
op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,s.sgfilter,tp,LOCATION_DECK,0,dv,dv,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
end
function s.backfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function s.backcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_DECK)
or (e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,0x4040)==0x4040)
end
function s.backop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local g1=Duel.GetMatchingGroup(s.backfilter,tp,LOCATION_MZONE,0,nil)
if #g1>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
local gg1=g1:Select(tp,1,1,nil)
Duel.SendtoHand(gg1,nil,REASON_EFFECT)
end
end
end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
!victory 0xf0 「拓扑混沌交换熊」特殊胜利
!victory 0xf1 「黄昏的丧钟」特殊胜利
!victory 0xff 「花火」特殊胜利
!setname 0xf72 跕怨少女
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