Commit 52ef0fbd authored by REIKAI's avatar REIKAI 💬

update 06.27

parent 52fa2278
......@@ -4,8 +4,8 @@ stages:
variables:
GIT_DEPTH: "1"
LAST_UPDATE_DATE: "2023.05.30"
CURRENT_UPDATE_DATE: "2023.06.11"
LAST_UPDATE_DATE: "2023.06.11"
CURRENT_UPDATE_DATE: "2023.06.27"
redtext:
stage: prepare
......
No preview for this file type
--SAO 镰刀使 米特
local m=10220025
local cm=_G["c"..m]
function cm.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR),4,2)
c:EnableReviveLimit()
--attack
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(cm.xyztg)
e1:SetOperation(cm.xyzop)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_NO_TURN_RESET)
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(cm.atktg)
e2:SetOperation(cm.atkop)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(cm.spcon)
e3:SetCost(cm.spcost)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
end
function cm.xyztg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local s=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1))
e:SetLabel(s)
end
function cm.xyzop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()==0 then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ATTACK_ALL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
if e:GetLabel()==1 then
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DIRECT_ATTACK)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
end
end
function cm.filter(c)
return c:IsCode(10220051) and c:IsFaceup()
end
function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,LOCATION_MZONE,0,1,nil) end
e:GetHandler():RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,2))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,cm.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local fid=c:GetFieldID()
if c and tc and tc:IsFaceup() then
local x=0
local mite=c:GetSequence()
local asuna=tc:GetSequence()
if mite==5 then mite=1 end
if mite==6 then mite=3 end
if mite>asuna then x=mite-asuna else x=asuna-mite end
local atkup=1000*(5-x)
c:RegisterFlagEffect(m,0,0,1,atkup)
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(m,3))
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atkup)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetLabel(fid)
e2:SetLabelObject(tc)
e2:SetOperation(cm.reop)
Duel.RegisterEffect(e2,tp)
end
end
function cm.reop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
if not eg:IsContains(tc) then return end
if tc:GetFlagEffectLabel(m)~=e:GetLabel() then
e:Reset()
return
end
local e3=Effect.CreateEffect(c)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(-c:GetFlagEffectLabel(m))
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e3)
c:ResetFlagEffect(m)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_ONFIELD,0,1,nil)
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function cm.spfilter(c,e,tp)
return c:IsCode(10220051) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function cm.deffilter(c,e)
return c:IsFaceup() and not c:IsImmuneToEffect(e)
end
function cm.fdfilter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsCanChangePosition()
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) then
local g=Duel.GetMatchingGroup(cm.deffilter,tp,LOCATION_MZONE,0,nil,e)
if g:GetCount()>0 then
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_UPDATE_DEFENSE)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
local g2=Duel.GetMatchingGroup(cm.fdfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.ChangePosition(g2,POS_FACEUP_DEFENSE)
end
end
end
end
--青眼恶魔
local m=10220035
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetSPSummonOnce(m)
--xyz summon
aux.AddXyzProcedureLevelFree(c,cm.xyzfilter,nil,2,2,cm.ovfilter,aux.Stringid(m,0),cm.xyzop)
c:EnableReviveLimit()
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(cm.atklimit)
c:RegisterEffect(e1)
--cannot be target
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--control
local e3=Effect.CreateEffect(c)
e3:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
e3:SetCategory(CATEGORY_CONTROL)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,m)
e3:SetCondition(cm.ctcon)
e3:SetCost(cm.ctcost)
e3:SetTarget(cm.cttg)
e3:SetOperation(cm.ctop)
c:RegisterEffect(e3)
end
function cm.xyzfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x5a0) and c:IsLevel(8)
end
function cm.ovfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5a0)
end
function cm.cfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x5a0) and c:IsType(TYPE_XYZ)
and c:CheckRemoveOverlayCard(tp,1,REASON_COST)
end
function cm.xyzop(e,tp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEATTACHFROM)
local c=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst()
c:RemoveOverlayCard(tp,1,1,REASON_COST)
end
function cm.atklimit(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function cm.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
end
function cm.ctfilter(c,tp)
return c:IsReleasable() and c:IsControler(1-tp) and Duel.GetMZoneCount(1-tp,c,tp)>0
end
function cm.ctcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST)
and Duel.IsExistingMatchingCard(cm.ctfilter,tp,0,LOCATION_MZONE,1,nil,tp) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,cm.ctfilter,tp,0,LOCATION_MZONE,1,1,nil,tp)
Duel.Release(g,REASON_COST)
end
function cm.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsControlerCanBeChanged(true) end
e:GetHandler():RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,1))
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetOperation(cm.damop)
e1:SetReset(RESET_EVENT+RESET_MSCHANGE+RESET_OVERLAY+RESET_TURN_SET)
c:RegisterEffect(e1)
Duel.GetControl(c,1-tp)
end
end
function cm.damop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Damage(c:GetPreviousControler(),2000,REASON_EFFECT)
e:Reset()
end
--骸骨猎杀者
local m=10220045
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetSPSummonOnce(m)
--xyz summon
aux.AddXyzProcedureLevelFree(c,cm.xyzfilter,nil,2,2,cm.ovfilter,aux.Stringid(m,0),cm.xyzop)
c:EnableReviveLimit()
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(cm.atklimit)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetValue(cm.immfilter)
c:RegisterEffect(e2)
--control
local e3=Effect.CreateEffect(c)
e3:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
e3:SetCategory(CATEGORY_CONTROL)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,m)
e3:SetCondition(cm.ctcon)
e3:SetCost(cm.ctcost)
e3:SetTarget(cm.cttg)
e3:SetOperation(cm.ctop)
c:RegisterEffect(e3)
end
function cm.xyzfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x5a0) and c:IsLevel(12)
end
function cm.ovfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5a0)
end
function cm.cfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x5a0) and c:IsType(TYPE_XYZ)
and c:CheckRemoveOverlayCard(tp,2,REASON_COST)
end
function cm.xyzop(e,tp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEATTACHFROM)
local c=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst()
c:RemoveOverlayCard(tp,2,2,REASON_COST)
end
function cm.atklimit(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function cm.immfilter(e,te)
if te:GetOwnerPlayer()==e:GetHandlerPlayer() or not te:IsActivated() then return false end
if not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
return not g or not g:IsContains(e:GetHandler())
end
function cm.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
end
function cm.ctfilter(c,tp)
return c:IsReleasable()
end
function cm.ctcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST)
and Duel.IsExistingMatchingCard(cm.ctfilter,tp,0,LOCATION_SZONE,1,nil,tp) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,cm.ctfilter,tp,0,LOCATION_SZONE,1,1,nil,tp)
Duel.Release(g,REASON_COST)
end
function cm.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsControlerCanBeChanged() end
e:GetHandler():RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,1))
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(cm.tdtg)
e2:SetOperation(cm.tdop)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
Duel.GetControl(c,1-tp)
end
end
function cm.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,e:GetHandler())
if chk==0 then return g:GetCount()>0 end
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end
function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,aux.ExceptThisCard(e))
if g:GetCount()>0 then
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
--命运之镰
local m=10220055
local cm=_G["c"..m]
function c10220055.initial_effect(c)
c:SetSPSummonOnce(m)
--xyz summon
aux.AddXyzProcedureLevelFree(c,cm.xyzfilter,nil,2,2,cm.ovfilter,aux.Stringid(m,0),cm.xyzop)
c:EnableReviveLimit()
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetOperation(cm.atklimit)
c:RegisterEffect(e1)
--immune spell
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(cm.immcon)
e2:SetValue(cm.immfilter)
c:RegisterEffect(e2)
--destory
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_CHAIN_NEGATED)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(cm.descon)
e3:SetTarget(cm.destg)
e3:SetOperation(cm.desop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_CHAIN_DISABLED)
c:RegisterEffect(e4)
--skip phase
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_DRAW+CATEGORY_REMOVE)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetCode(EVENT_PHASE+PHASE_STANDBY)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetCondition(cm.skcon)
e5:SetTarget(cm.sktg)
e5:SetOperation(cm.skop)
c:RegisterEffect(e5)
--control
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_CONTROL)
e6:SetType(EFFECT_TYPE_IGNITION)
e6:SetRange(LOCATION_MZONE)
e6:SetCountLimit(1,m+EFFECT_COUNT_CODE_DUEL)
e6:SetCondition(cm.ctcon)
e6:SetCost(cm.ctcost)
e6:SetTarget(cm.cttg)
e6:SetOperation(cm.ctop)
c:RegisterEffect(e6)
end
function cm.xyzfilter(c,xyzc)
return c:IsFaceup() and c:IsSetCard(0x5a0) and c:IsLevel(1)
end
function cm.ovfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5a0)
end
function cm.cfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x5a0) and c:IsType(TYPE_XYZ)
and c:CheckRemoveOverlayCard(tp,3,REASON_COST)
end
function cm.xyzop(e,tp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEATTACHFROM)
local c=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst()
c:RemoveOverlayCard(tp,3,3,REASON_COST)
end
function cm.atklimit(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function cm.immcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_STANDBY
end
function cm.immfilter(e,te)
return te:GetOwnerPlayer()~=e:GetHandlerPlayer()
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_STANDBY
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Destroy(c,REASON_EFFECT)
end
end
function cm.skcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function cm.sktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanRemove(tp) and Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.skop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
Duel.ShuffleHand(p)
Duel.BreakEffect()
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
if g:GetCount()<=0 then return end
local tc=g:RandomSelect(tp,1):GetFirst()
if Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT)~=0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_SKIP_M1)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,1)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_SKIP_M2)
Duel.RegisterEffect(e2,tp)
end
end
function cm.ctcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN2 and e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
end
function cm.ctfilter(c)
return c:IsSetCard(0x5a0) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost(POS_FACEDOWN)
end
function cm.ctcost(e,tp,eg,ep,ev,re,r,rp,chk)
local xyz=e:GetHandler():GetOverlayCount()
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,xyz,REASON_COST)
and Duel.IsExistingMatchingCard(cm.ctfilter,tp,LOCATION_GRAVE,0,1,nil) end
e:GetHandler():RemoveOverlayCard(tp,xyz,xyz,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,cm.ctfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEDOWN,REASON_COST)
end
function cm.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsControlerCanBeChanged() end
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
--client hint
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,2))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(8000)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
--cannot release
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_UNRELEASABLE_NONSUM)
e3:SetValue(1)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_UNRELEASABLE_SUM)
c:RegisterEffect(e4)
--immune
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e5:SetValue(1)
e5:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e6:SetValue(1)
e6:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e6)
--control power
Duel.GetControl(c,1-tp)
end
end
--七海的冥护-神鱼迪斯雷斯坦
function c11900074.initial_effect(c)
c:EnableReviveLimit()
end
--七海的制裁
function c11900075.initial_effect(c)
aux.AddCodeList(c,11900074)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c11900075.actg)
e1:SetOperation(c11900075.acop)
c:RegisterEffect(e1)
end
function c11900075.spfil(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) and c:IsCode(11900074)
end
function c11900075.actg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,12,nil) and Duel.IsExistingMatchingCard(c11900075.spfil,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,12,PLAYER_ALL,LOCATION_ONFIELD)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c11900075.acop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if g:GetCount()>=12 then
local sg=g:Select(tp,12,12,nil)
if Duel.SendtoDeck(sg,nil,2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(c11900075.spfil,tp,LOCATION_HAND,0,1,nil,e,tp) then
local tc=Duel.SelectMatchingCard(tp,c11900075.spfil,tp,LOCATION_HAND,0,1,1,nil,e,tp):GetFirst()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(10000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
tc:RegisterEffect(e2)
tc:CompleteProcedure()
end
end
end
......@@ -5,7 +5,7 @@ function cm.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c,false)
--synchro summon
aux.AddSynchroProcedure(c,aux.Tuner(nil),aux.NonTuner(nil),1,99)
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1,99)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(m,4))
......
......@@ -85,7 +85,7 @@ function cm.otop(e,tp,eg,ep,ev,re,r,rp,c)
end
--Effect 1
function cm.splimit(e,c)
return not (c:IsSetCard(0xccb,0xccd) or c:IsRace(RACE_FAIRY))
return true
end
--Effect 2
function cm.setcost(e,tp,eg,ep,ev,re,r,rp,chk)
......
--霸王眷龙 水晶翼
local s,id,o=GetID()
function s.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_LIGHT),aux.NonTuner(Card.IsSynchroType,TYPE_PENDULUM),1)
c:EnableReviveLimit()
--atk up
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetCountLimit(3)
e1:SetCondition(s.discon)
e1:SetTarget(s.distg)
e1:SetOperation(s.disop)
c:RegisterEffect(e1)
--pendulum summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(17033270,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_MAIN_END+TIMING_BATTLE_START+TIMING_BATTLE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.spcon)
e2:SetCost(s.spcost)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetCurrentChain()
if ct<2 then return end
local te,p=Duel.GetChainInfo(ev-1,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER)
return te and te:GetHandler():IsOnField() and te:GetHandler():GetOriginalType()&TYPE_MONSTER~=0 and p==tp and rp==1-tp
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local te,p=Duel.GetChainInfo(ev-1,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER)
local tc=te:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsOnField() and not tc:IsImmuneToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetLabelObject(re)
e1:SetRange(LOCATION_ONFIELD)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(s.efilter)
e1:SetReset(RESET_EVENT+RESET_CHAIN)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_ATTACK_FINAL)
e2:SetValue(c:GetAttack()*2)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
c:RegisterEffect(e2)
end
end
function s.efilter(e,re)
return re==e:GetLabelObject()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local lpz=Duel.GetFieldCard(tp,LOCATION_PZONE,0)
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
if lpz==nil or rpz==nil then return false end
local loc=0
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then loc=loc+LOCATION_HAND end
if Duel.GetLocationCountFromEx(tp,tp,e:GetHandler(),TYPE_PENDULUM)>0 then loc=loc+LOCATION_EXTRA end
if loc==0 then return false end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(aux.TRUE)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local eset={e1}
local lscale=lpz:GetLeftScale()
local rscale=rpz:GetRightScale()
if lscale>rscale then lscale,rscale=rscale,lscale end
local g=Duel.GetFieldGroup(tp,loc,0)
local res=g:IsExists(aux.PConditionFilter,1,nil,e,tp,lscale,rscale,eset)
e1:Reset()
local ph=Duel.GetCurrentPhase()
return res and (ph==PHASE_MAIN1 or (ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE) or ph==PHASE_MAIN2)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToExtraAsCost() end
Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_COST)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(aux.TRUE)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local eset={e1}
local lpz=Duel.GetFieldCard(tp,LOCATION_PZONE,0)
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
local lscale=lpz:GetLeftScale()
local rscale=rpz:GetRightScale()
if lscale>rscale then lscale,rscale=rscale,lscale end
local loc=0
local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ft2=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM)
local ft=Duel.GetUsableMZoneCount(tp)
local ect=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp]
if ect and ect<ft2 then ft2=ect end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then
if ft1>0 then ft1=1 end
if ft2>0 then ft2=1 end
ft=1
end
if ft1>0 then loc=loc|LOCATION_HAND end
if ft2>0 then loc=loc|LOCATION_EXTRA end
local tg=Duel.GetMatchingGroup(aux.PConditionFilter,tp,loc,0,nil,e,tp,lscale,rscale,eset)
tg=tg:Filter(aux.PConditionExtraFilterSpecific,nil,e,tp,lscale,rscale,e1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
aux.GCheckAdditional=aux.PendOperationCheck(ft1,ft2,ft)
local g=tg:SelectSubGroup(tp,aux.TRUE,true,1,math.min(#tg,ft))
aux.GCheckAdditional=nil
if not g then
e1:Reset()
return
end
local sg=Group.CreateGroup()
sg:Merge(g)
Duel.HintSelection(Group.FromCards(lpz))
Duel.HintSelection(Group.FromCards(rpz))
Duel.SpecialSummon(sg,SUMMON_TYPE_PENDULUM,tp,tp,true,true,POS_FACEUP)
e1:Reset()
end
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsAbleToEnterBP()
end
\ No newline at end of file
--霸王眷龙 强欲毒
local s,id,o=GetID()
function s.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,s.ffilter,2,false)
aux.AddContactFusionProcedure(c,Card.IsReleasable,LOCATION_MZONE,0,Duel.Release,REASON_COST+REASON_MATERIAL)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(s.splimit)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(1621413,0))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1)
e2:SetTarget(s.atktg)
e2:SetOperation(s.atkop)
c:RegisterEffect(e2)
end
function s.ffilter(c)
return c:IsFusionAttribute(ATTRIBUTE_LIGHT) and c:IsFusionType(TYPE_PENDULUM)
end
function s.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and aux.nzatk(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.nzatk,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,aux.nzatk,tp,0,LOCATION_MZONE,1,1,nil)
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
--act limit
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:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e2:SetValue(1)
e2:SetTargetRange(1,0)
tc:RegisterEffect(e2)
end
end
\ No newline at end of file
--红莲战士 莫特
local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(cm.cos1)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_EQUIP)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(cm.con2)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
end
--e1
function cm.cos1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.tg1f1(c)
return c:IsAbleToHand() and c:IsSetCard(0x3fd2)
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tg1f1,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.tg1f1,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--e2
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()&(PHASE_DAMAGE+PHASE_DAMAGE_CAL)==0
end
function cm.tg2f2(c,e,tp,g,tc,f)
if not (c:IsType(TYPE_FUSION) and (not f or f(c)) and c:IsSetCard(0x6fd2) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false)) then return false end
local min,max=aux.GetMaterialListCount(c)
return g:CheckSubGroup(cm.gchk,min,max,tc,tp,c)
end
function cm.gchk(g,c,tp,fc)
return g:IsContains(c) and Duel.GetLocationCountFromEx(tp,tp,g,fc)>0 and g:IsExists(cm.cchk,1,nil,g,fc.fmatchk,1,Group.CreateGroup())
end
function cm.cchk(c,g,f,i,sg)
if type(f[i])=="number" and not (c:IsCode(f[i]) or (c:IsFusionSetCard(0x5fd2) and aux.IsCodeListed(c,f[i]))) then return false end
if type(f[i])~="number" and not (f[i])(c) then return false end
return #f==i or g:IsExists(cm.cchk,1,sg,g,f,i+1,sg+c)
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(Card.IsCanBeFusionMaterial,tp,LOCATION_ONFIELD,0,nil)
local res=Duel.IsExistingMatchingCard(cm.tg2f2,tp,LOCATION_EXTRA,0,1,nil,e,tp,g,e:GetHandler())
if Duel.IsExistingMatchingCard(cm.tg2f2,tp,LOCATION_EXTRA,0,1,nil,e,tp,g,e:GetHandler()) then return true end
local ce=Duel.GetChainMaterial(tp)
if not ce then return false end
g=ce:GetTarget()(ce,e,tp)
local mf=ce:GetValue()
return Duel.IsExistingMatchingCard(cm.tg2f2,tp,LOCATION_EXTRA,0,1,nil,e,tp,g,e:GetHandler(),mf)
end
Duel.Hint(24,0,aux.Stringid(m,0))
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
local mg1=Duel.GetMatchingGroup(Card.IsCanBeFusionMaterial,tp,LOCATION_ONFIELD,0,nil):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e)
local sg1=Duel.GetMatchingGroup(cm.tg2f2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,e:GetHandler())
local mg2=Group.CreateGroup()
local sg2=Group.CreateGroup()
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
mg2=ce:GetTarget()(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.tg2f2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,e:GetHandler(),mf)
end
if #(sg1+sg2)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=(sg1+sg2):Select(tp,1,1,nil):GetFirst()
local min,max=aux.GetMaterialListCount(tc)
if sg1:IsContains(tc) and (not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat=mg1:SelectSubGroup(tp,cm.gchk,false,min,max,e:GetHandler(),tp,tc)
tc:SetMaterial(mat)
Duel.SendtoGrave(mat,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat=mg2:SelectSubGroup(tp,cm.gchk,false,min,max,e:GetHandler(),tp,tc)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat)
end
tc:CompleteProcedure()
end
end
\ No newline at end of file
--红莲龙律者 莫特
local cm,m,o=GetID()
function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddFusionProcMix(c,true,true,20000206,aux.FilterBoolFunction(Card.IsFusionSetCard,0x3fd2))
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(cm.con1)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(1)
e2:SetCondition(cm.con2)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_EXTRA_ATTACK)
c:RegisterEffect(e3)
end
cm.fmatchk={20000206,function(c) return c:IsFusionSetCard(0x3fd2) end}
--e1
function cm.con1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler()
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(Card.IsType,tp,0,LOCATION_ONFIELD,nil,TYPE_SPELL+TYPE_TRAP)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not (c:IsFaceup() and c:IsRelateToEffect(e)) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tc=Duel.SelectMatchingCard(tp,Card.IsType,tp,0,LOCATION_ONFIELD,1,1,nil,TYPE_SPELL+TYPE_TRAP):GetFirst()
if tc then Duel.Destroy(tc,REASON_EFFECT) end
end
--e2
function cm.con2(e)
return e:GetHandler():GetEquipCount()>0
end
\ No newline at end of file
--红莲武士 爱菈
local cm,m,o=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,m)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.con1)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_RELEASE+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(cm.con2)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2(cm.op2ex))
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_CHAINING)
e3:SetCondition(cm.con3)
e3:SetOperation(cm.op2(cm.op3ex))
c:RegisterEffect(e3)
end
--e1
function cm.con1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function cm.tg1(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 cm.op1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not (Duel.NegateAttack() and c:IsRelateToEffect(e)) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
--e2
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsContains(e:GetHandler())
end
function cm.tg2f(c,e,tp)
return c:IsSetCard(0x6fd2) and c:IsLevel(5) and c:GetType()&0x81==0x81 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true)
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsReleasableByEffect() and Duel.IsExistingMatchingCard(cm.tg2f,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function cm.op2(exop)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,cm.tg2f,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst()
if not (c:IsRelateToEffect(e) and tc) then return end
tc:SetMaterial(Group.FromCards(c))
Duel.ReleaseRitualMaterial(Group.FromCards(c))
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
exop(e,tp,eg,ep,ev,re,r,rp,c,tc)
end
end
function cm.op2ex(e,tp,eg,ep,ev,re,r,rp,c,tc)
if Duel.GetAttacker():IsImmuneToEffect(e) or not Duel.SelectYesNo(tp,aux.Stringid(m,1)) then return end
Duel.BreakEffect()
Duel.ChangeAttackTarget(tc)
end
--e3
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if re:GetHandler():IsSetCard(0x5fd2) then Duel.Hint(24,0,aux.Stringid(m,0)) end
return g and g:IsContains(e:GetHandler())
end
function cm.op3ex(e,tp,eg,ep,ev,re,r,rp,c,tc)
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if not (#g==1 and g:GetFirst()==c and Duel.CheckChainTarget(ev,tc) and Duel.SelectYesNo(tp,aux.Stringid(m,2))) then return end
Duel.BreakEffect()
Duel.ChangeTargetCard(ev,Group.FromCards(tc))
end
\ No newline at end of file
--红莲龙律者 爱菈
local cm,m,o=GetID()
function cm.initial_effect(c)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetCondition(cm.con1)
e1:SetValue(cm.val1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_POSITION)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(cm.con2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
end
--e1
function cm.con1(e)
return e:GetHandler():IsDefensePos()
end
function cm.val1(e,re,tp)
return re:GetHandler():IsDefensePos()
end
--e2
function cm.con2f(c,tp)
return c:IsControler(tp) and c:IsFaceup() and c:IsAttribute(ATTRIBUTE_FIRE)
end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
local c=Duel.GetAttacker()
local tc=Duel.GetAttackTarget()
return c and tc and (cm.con2f(c) or cm.con2f(tc))
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateAttack()
end
--荣耀红莲团
local cm,m,o=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,m)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1)
e2:SetCondition(cm.con2(0x6fd2))
e2:SetCost(cm.cos2)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetCondition(cm.con2(0x3fd2))
e3:SetTarget(cm.tg3)
e3:SetOperation(cm.op3)
c:RegisterEffect(e3)
end
--e2
function cm.con2f(c,tp,setcode)
return c:IsFaceup() and c:IsSummonPlayer(tp) and c:IsSetCard(setcode)
end
function cm.con2(setcode)
return function(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.con2f,1,nil,tp,setcode)
end
end
function cm.cos2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.tg2f(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSetCard(0x3fd2) and c:IsSSetable() and not c:IsCode(m)
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tg2f,tp,LOCATION_DECK,0,1,nil) end
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local tc=Duel.SelectMatchingCard(tp,cm.tg2f,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
if not tc then return end
Duel.SSet(tp,tc)
end
--e3
function cm.tg3f(c)
return c:IsSetCard(0x5fd2) and c:IsAbleToHand()
end
function cm.tg3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tg3f,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function cm.op3(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tg3f),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tp):GetFirst()
if not tc then return end
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
\ No newline at end of file
--命定的龙心武装
local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
end
function cm.tg1f1(c,tp)
return Duel.IsExistingMatchingCard(cm.tg1f2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,c)
end
function cm.tg1f2(c,tc)
return c:IsSetCard(0x5fd2) and c:IsType(TYPE_EQUIP) and aux.IsCodeListed(tc,c:GetCode()) and c:IsAbleToHand()
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tg1f1,tp,LOCATION_EXTRA,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local tc=Duel.SelectMatchingCard(tp,cm.tg1f1,tp,LOCATION_EXTRA,0,1,1,nil,tp):GetFirst()
if tc then
Duel.ConfirmCards(1-tp,tc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tg1f2),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc):GetFirst()
if tc then
Duel.BreakEffect()
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_DISEFFECT)
e1:SetTargetRange(LOCATION_ONFIELD,0)
e1:SetValue(cm.op1val1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function cm.op1val1(e,ct)
local te=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT)
return te:GetHandler():IsSetCard(0x5fd2) or te:GetHandler():GetEquipGroup():IsExists(Card.IsSetCard,1,nil,0x5fd2)
end
\ No newline at end of file
--红莲团奥义 高天阳
local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(aux.dscon)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
end
function cm.tg1f(c)
return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.tg1f(chkc) and chkc:IsControler(tp) end
if chk==0 then return Duel.IsExistingTarget(cm.tg1f,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,cm.tg1f,tp,LOCATION_MZONE,0,1,1,nil)
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=Duel.GetFirstTarget()
if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end
local atk=tc:GetAttack()
for sc in aux.Next(g) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-atk)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
sc:RegisterEffect(e1)
end
if tc:IsType(TYPE_FUSION) or tc:IsType(TYPE_RITUAL) then
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e2:SetValue(1)
tc:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
tc:RegisterEffect(e3)
end
if tc:GetEquipCount()>0 then
g=tc:GetEquipGroup()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sc=Duel.SelectMatchingCard(tp,cm.op1f,tp,LOCATION_EXTRA,0,1,1,nil,g):GetFirst()
if sc then
atk=sc:GetBaseAttack()
Duel.ConfirmCards(1-tp,sc)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_BASE_ATTACK)
e2:SetValue(atk)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_BATTLE)
tc:RegisterEffect(e2)
end
end
end
function cm.op1f(c,g)
for tc in aux.Next(g) do
if aux.IsCodeListed(tc,c:GetCode()) then return true end
end
return false
end
\ No newline at end of file
--红莲团奥义 月夜见
local cm,m,o=GetID()
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetCondition(cm.con1)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
end
--e1
function cm.con1(e,tp,eg,ep,ev,re,r,rp)
local sc=Duel.GetAttackTarget()
return sc and sc:IsControler(tp)
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetCard(Duel.GetAttackTarget())
end
function cm.tg1f1(c,tp)
return Duel.IsExistingMatchingCard(cm.tg1f2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp,c)
end
function cm.tg1f2(c,tp,tc)
return c:IsSetCard(0x5fd2) and c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(tc)
and c:CheckUniqueOnField(tp) and not c:IsForbidden()and aux.IsCodeListed(tc,c:GetCode())
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
if not Duel.NegateAttack() then return end
local sc=Duel.GetFirstTarget()
if not sc:IsRelateToEffect(e) then return end
local atk=Duel.GetAttacker():GetAttack()
if sc:GetEquipCount()==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local tc=Duel.SelectMatchingCard(tp,cm.tg1f1,tp,LOCATION_EXTRA,0,1,1,nil,tp):GetFirst()
if not tc then return end
Duel.ConfirmCards(1-tp,tc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tg1f2),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tp,tc):GetFirst()
if tc then Duel.Equip(tp,tc,sc) end
else
Duel.Draw(tp,atk//1000,REASON_EFFECT)
end
end
\ No newline at end of file
--龙心武装 银河巨剑
local cm,m,o=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,20000206)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_EQUIP_LIMIT)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(cm.eqf0)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetCondition(cm.con2)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_BATTLE_START)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(cm.con3)
e3:SetTarget(cm.tg3)
e3:SetOperation(cm.op3)
c:RegisterEffect(e3)
end
--e0
function cm.eqf0(e,c)
return c:IsRace(RACE_WARRIOR)
end
--e1
function cm.tgf1(c)
return c:IsRace(RACE_WARRIOR) and c:IsFaceup()
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.tgf1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.tgf1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,cm.tgf1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
--e2
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsLocation(LOCATION_GRAVE) and r==REASON_FUSION
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local rc=c:GetReasonCard()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and cm.tgf1(rc) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0)
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=c:GetReasonCard()
if c:IsRelateToEffect(e) and rc:IsFaceup() then
Duel.Equip(tp,c,rc)
end
end
--e3
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetHandler():GetEquipTarget()
local fid=c:GetFieldID()+tc:GetFieldID()
if tc:IsRelateToBattle() then
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1,fid)
end
return tc:IsRelateToBattle() and c:GetFlagEffect(m)==2 and c:GetFlagEffectLabel(m)==fid
end
function cm.tgf3(c,e,tp)
return c:IsCode(20000206) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function cm.tg3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tgf3,tp,LOCATION_EXTRA,0,1,nil,e,tp) and e:GetHandler():IsCanOverlay() end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
if e:GetHandler():GetEquipTarget():IsSetCard(0x6fd2) then
Duel.Hint(24,0,aux.Stringid(m,0))
Duel.Hint(24,0,aux.Stringid(m,1))
end
end
function cm.op3(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,cm.tgf3,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c):GetFirst()
if not tc then return end
if Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)==0 then return end
tc:CompleteProcedure()
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
if not c:IsRelateToEffect(e) then return end
Duel.Overlay(tc,Group.FromCards(c))
Duel.Hint(24,0,aux.Stringid(m,2))
mg=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if #mg==0 or not Duel.SelectYesNo(tp,1101) then return end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
mg=mg:Select(tp,1,1,nil)
Duel.HintSelection(mg)
Duel.Destroy(mg,REASON_EFFECT)
end
\ No newline at end of file
--热血星龙 盖金迦
local cm,m,o=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,20000205)
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_DRAGON),8,3)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
e1:SetCountLimit(1)
e1:SetCondition(cm.con1)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(cm.con2)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
local ew=Effect.CreateEffect(c)
ew:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
ew:SetCode(EVENT_SPSUMMON_SUCCESS)
ew:SetCondition(cm.conw)
c:RegisterEffect(ew)
end
--e1
function cm.con1(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(20000205)>0 and aux.bdocon(e,tp,eg,ep,ev,re,r,rp)
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local bc=e:GetHandler():GetBattleTarget()
Duel.SetTargetCard(bc)
end
function cm.op1con(e)
return Duel.GetTurnCount()~=e:GetLabel()
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and c:IsFaceup() and c:IsRelateToEffect(e) then
local atk=tc:GetBaseAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_BP_TWICE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
if Duel.GetTurnPlayer()==tp and (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE) then
e2:SetLabel(Duel.GetTurnCount())
e2:SetCondition(cm.op1con)
e2:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,2)
else
e2:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_SELF_TURN,1)
end
Duel.RegisterEffect(e2,tp)
end
end
--e2
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_MZONE)
end
function cm.tg2f2(c,ec)
return c:IsFaceup() and ec:CheckEquipTarget(c) and c:IsSetCard(0x6fd2)
end
function cm.tg2f1(c,tp)
if not c:IsCode(20000205) then return false end
return c:IsAbleToHand() or (Duel.IsExistingMatchingCard(cm.tg2f2,tp,LOCATION_MZONE,0,1,nil,c) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0)
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tg2f1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp) end
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.tg2f1),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tp):GetFirst()
if not tc then return end
local g=Duel.GetMatchingGroup(cm.tg2f2,tp,LOCATION_MZONE,0,nil,tc)
local res=#g>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
if c:IsAbleToHand() and (not res or Duel.SelectOption(tp,1190,1068)==1) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
g=g:Select(tp,1,1,nil)
Duel.Equip(tp,tc,g:GetFirst())
end
end
--ew
function cm.conw(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():GetFlagEffect(20000205)>0 then Duel.Hint(24,0,aux.Stringid(m,0)) end
return false
end
\ No newline at end of file
--龙心武装 热血剑
local cm,m,o=GetID()
function cm.initial_effect(c)
aux.AddCodeList(c,20000211)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_EQUIP_LIMIT)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetValue(cm.eqf0)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.tg1)
e1:SetOperation(cm.op1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_DEFENSE_ATTACK)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_ATTACK_DISABLED)
e3:SetRange(LOCATION_SZONE)
e3:SetTarget(cm.tg3)
e3:SetOperation(cm.op3)
c:RegisterEffect(e3)
end
--e0
function cm.eqf0(e,c)
return c:IsAttribute(ATTRIBUTE_FIRE)
end
--e1
function cm.tgf1(c)
return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsFaceup()
end
function cm.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.tgf1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.tgf1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,cm.tgf1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function cm.op1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
--e3
function cm.tgf3(c,e,tp)
return c:IsCode(20000211) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial()
and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function cm.tg3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasableByEffect() and aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_FMATERIAL)
and Duel.IsExistingMatchingCard(cm.tgf3,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.op3(e,tp,eg,ep,ev,re,r,rp)
if Duel.Release(e:GetHandler(),REASON_EFFECT)~=1 then return end
if not aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_FMATERIAL) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,cm.tgf3,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if not tc then return end
tc:SetMaterial(nil)
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
Duel.Hint(24,0,aux.Stringid(m,0))
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
end
\ No newline at end of file
--热血龙 異角
local cm,m,o=GetID()
function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddCodeList(c,20000204)
aux.AddFusionProcFunRep(c,cm.fmat,2,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SET_POSITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetTarget(cm.tg1)
e1:SetValue(POS_FACEUP_DEFENSE)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetCondition(aux.bdocon)
e2:SetTarget(cm.tg2)
e2:SetOperation(cm.op2)
c:RegisterEffect(e2)
end
--fmat
function cm.fmat(c,fc,sub,mg,sg)
return not sg or (not sg:IsExists(Card.IsLevel,1,c,c:GetLevel()) and c:GetLevel()>0)
end
--e1
function cm.tg1(e,c)
return c:IsFaceup() and c:IsAttackBelow(e:GetHandler():GetAttack())
end
--e2
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(20000204)>0 and aux.bdocon(e,tp,eg,ep,ev,re,r,rp)
end
function cm.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToBattle() end
local bc=e:GetHandler():GetBattleTarget()
Duel.SetTargetCard(bc)
end
function cm.op2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToBattle() and c:IsFaceup() then
if tc:IsRelateToEffect(e) then
local def=math.ceil(tc:GetBaseDefense()/2)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(def)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_BATTLE)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EXTRA_ATTACK)
e3:SetValue(1)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_BATTLE)
c:RegisterEffect(e3)
end
end
\ No newline at end of file
--古道登仙·筑龙基
local m=30682100
local cm=_G["c"..m]
function cm.initial_effect(c)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.eqtg)
e1:SetOperation(cm.eqop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_HAND)
e3:SetCountLimit(1,m+1)
e3:SetCost(cm.thcost)
e3:SetTarget(cm.tktg)
e3:SetOperation(cm.tkop)
c:RegisterEffect(e3)
end
function cm.filter(c,ec)
return c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(ec) and c:IsSetCard(0xc1b)
end
function cm.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK)
end
function cm.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil,c)
if g:GetCount()>0 then
Duel.Equip(tp,g:GetFirst(),c)
end
end
function cm.thcost(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 cm.tktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,30682101,0xc1b,TYPES_TOKEN_MONSTER,0,0,1,RACE_WYRM,ATTRIBUTE_LIGHT) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
end
function cm.tkop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,30682101,0xc1b,TYPES_TOKEN_MONSTER,0,0,1,RACE_WYRM,ATTRIBUTE_LIGHT) then return end
local token=Duel.CreateToken(tp,30682101)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
--古道登仙·准入龙门
local m=30682105
local cm=_G["c"..m]
function cm.initial_effect(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,cm.matfilter,1,1)
--
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetRange(LOCATION_EXTRA)
e0:SetValue(cm.splimit)
c:RegisterEffect(e0)
--attribute
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_ADD_ATTRIBUTE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK+ATTRIBUTE_WATER+ATTRIBUTE_EARTH+ATTRIBUTE_WIND)
c:RegisterEffect(e1)
--immune
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE)
e5:SetRange(LOCATION_MZONE)
e5:SetCode(EFFECT_IMMUNE_EFFECT)
e5:SetValue(cm.efilter)
c:RegisterEffect(e5)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_ONFIELD,0)
e3:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_EQUIP))
e3:SetValue(aux.indoval)
c:RegisterEffect(e3)
end
function cm.matfilter(c)
return c:IsLinkRace(RACE_WYRM) and c:IsLevel(12) and c:GetEquipCount()>2
end
function cm.efilter(e,te)
if te:IsActiveType(TYPE_SPELL+TYPE_TRAP) then
local ec=te:GetOwner()
return not (ec:IsType(TYPE_EQUIP) or ec:IsType(TYPE_COUNTER))
elseif te:IsActiveType(TYPE_MONSTER) and te:GetOwner()~=e:GetOwner() then
local lv=e:GetHandler():GetLevel()
local ec=te:GetOwner()
if ec:IsType(TYPE_LINK) then
return ec:GetLink()<9
elseif ec:IsType(TYPE_XYZ) then
return ec:GetOriginalRank()<13
else
return ec:GetOriginalLevel()<13
end
else
return false
end
end
function cm.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_LINK)~=0
end
--古道登仙·魂龙丹
local m=30682110
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_DRAGON+RACE_WYRM),2,2)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,m)
e1:SetCondition(cm.spcon)
e1:SetCost(cm.spcost)
e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
--atk
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetValue(cm.atkval)
c:RegisterEffect(e3)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,m+1)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e2:SetCondition(cm.descon1)
e2:SetTarget(cm.destg1)
e2:SetOperation(cm.desop1)
c:RegisterEffect(e2)
--material limit
local e13=Effect.CreateEffect(c)
e13:SetType(EFFECT_TYPE_SINGLE)
e13:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e13:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e13:SetValue(cm.linklimit)
c:RegisterEffect(e13)
end
function cm.linklimit(e,c)
if not c then return false end
return not c:IsSetCard(0xc1b)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.spfilter(c,e,tp)
return c:IsSetCard(0xc1b) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK+LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_HAND)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK+LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.atkval(e,c)
return c:GetLinkedGroupCount()*1000
end
function cm.descon1(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipGroup():IsExists(Card.IsSetCard,1,nil,0xc1b)
end
function cm.destg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function cm.desop1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
\ No newline at end of file
--古道登仙·启天
local m=30682115
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetUniqueOnField(1,0,30682115)
--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(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
--cannot be destroyed
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e2:SetValue(cm.valcon)
e2:SetCountLimit(3)
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(cm.eqlimit)
c:RegisterEffect(e3)
--act limit
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_CANNOT_ACTIVATE)
e6:SetRange(LOCATION_SZONE)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(0,1)
e6:SetCondition(cm.actcon)
e6:SetValue(1)
c:RegisterEffect(e6)
--recover
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_RECOVER)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_PHASE+PHASE_END)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetRange(LOCATION_SZONE)
e5:SetCountLimit(1)
e5:SetCondition(cm.reccon)
e5:SetTarget(cm.rectg)
e5:SetOperation(cm.recop)
c:RegisterEffect(e5)
end
function cm.eqlimit(e,c)
return c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.eqfilter1(c)
return c:IsFaceup() and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.eqfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.eqfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,cm.eqfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function cm.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() and c:CheckUniqueOnField(tp) then
Duel.Equip(tp,c,tc)
end
end
function cm.valcon(e,re,r,rp)
return bit.band(r,REASON_BATTLE+REASON_EFFECT)~=0
end
function cm.efilter(e,re)
return e:GetHandlerPlayer()~=re:GetOwnerPlayer()
end
function cm.actcon(e)
local a=Duel.GetBattleMonster(e:GetHandlerPlayer())
return a and a:IsFaceup() and a:IsRace(RACE_DRAGON) and e:GetHandler():GetEquipTarget():IsRace(RACE_DRAGON)
end
function cm.reccon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget():IsRace(RACE_WYRM)
end
function cm.rectg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1000)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,1000)
end
function cm.recop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
end
--古道登仙·倚天
local m=30682120
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetUniqueOnField(1,0,30682120)
--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(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(cm.eqlimit)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,m+1)
e3:SetTarget(cm.tktg)
e3:SetOperation(cm.tkop)
c:RegisterEffect(e3)
--spsummon
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(m,1))
e6:SetCategory(CATEGORY_SPECIAL_SUMMON)
e6:SetType(EFFECT_TYPE_IGNITION)
e6:SetRange(LOCATION_SZONE)
e6:SetCountLimit(1)
e6:SetCondition(cm.igcon1)
e6:SetTarget(cm.sptg)
e6:SetOperation(cm.spop)
c:RegisterEffect(e6)
--Atk,def
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_EQUIP)
e7:SetCode(EFFECT_UPDATE_LEVEL)
e7:SetCondition(cm.igcon2)
e7:SetValue(2)
c:RegisterEffect(e7)
end
function cm.eqlimit(e,c)
return c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.eqfilter1(c)
return c:IsFaceup() and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.eqfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.eqfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,cm.eqfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function cm.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() and c:CheckUniqueOnField(tp) then
Duel.Equip(tp,c,tc)
end
end
function cm.tktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,30682102,0xc1b,TYPES_TOKEN_MONSTER,0,0,1,RACE_WYRM,ATTRIBUTE_LIGHT) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
end
function cm.tkop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,30682102,0xc1b,TYPES_TOKEN_MONSTER,0,0,1,RACE_WYRM,ATTRIBUTE_LIGHT) then return end
local token=Duel.CreateToken(tp,30682102)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
--material limit
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetValue(cm.linklimit)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e2:SetValue(cm.fuslimit)
token:RegisterEffect(e2,true)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
token:RegisterEffect(e3,true)
Duel.SpecialSummonComplete()
end
function cm.fuslimit(e,c,sumtype)
if not c then return false end
return sumtype==SUMMON_TYPE_FUSION and not c:IsSetCard(0xc1b)
end
function cm.linklimit(e,c)
if not c then return false end
return not c:IsSetCard(0xc1b)
end
function cm.igcon1(e)
return e:GetHandler():GetEquipTarget():IsRace(RACE_DRAGON)
end
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.igcon2(e)
return e:GetHandler():GetEquipTarget():IsRace(RACE_WYRM)
end
--古道登仙·金龙丹
local m=30682125
local cm=_G["c"..m]
function cm.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_DRAGON+RACE_WYRM),aux.NonTuner(Card.IsRace,RACE_DRAGON+RACE_WYRM),1)
c:EnableReviveLimit()
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,m)
e1:SetCondition(cm.thcon)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,m+1)
e2:SetCondition(cm.spcon)
e2:SetTarget(cm.sptg)
e2:SetOperation(cm.spop)
c:RegisterEffect(e2)
--draw
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,2))
e4:SetCategory(CATEGORY_DRAW)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(EVENT_BATTLE_DESTROYING)
e4:SetCountLimit(1,m+2)
e4:SetCondition(aux.bdocon)
e4:SetTarget(cm.drtg)
e4:SetOperation(cm.drop)
c:RegisterEffect(e4)
if not cm.global_check then
cm.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVED)
ge1:SetRange(LOCATION_MZONE)
ge1:SetOperation(cm.checkop1)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_SPSUMMON_SUCCESS)
ge2:SetRange(LOCATION_MZONE)
ge2:SetOperation(cm.checkop2)
Duel.RegisterEffect(ge2,0)
local ge3=ge2:Clone()
ge3:SetCode(EVENT_SUMMON_SUCCESS)
Duel.RegisterEffect(ge3,0)
end
end
function cm.checkop1(e,tp,eg,ep,ev,re,r,rp)
local te,code=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_CODE)
local tc=te:GetHandler()
if code~=30682125 and tc:IsSetCard(0xc1b) then
local tsp=te:GetHandlerPlayer()
Duel.RegisterFlagEffect(tsp,m,RESET_PHASE+PHASE_END,0,1)
Duel.RegisterFlagEffect(1-tsp,m,RESET_PHASE+PHASE_END,0,1)
end
end
function cm.checksum(c)
return c:IsSetCard(0xc1b) and not c:IsCode(30682125)
end
function cm.checkop2(e,tp,eg,ep,ev,re,r,rp)
if eg:IsExists(cm.checksum,1,nil) then
Duel.RegisterFlagEffect(rp,m,RESET_PHASE+PHASE_END,0,1)
end
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.thfilter(c)
return c:IsSetCard(0xc1b) and c:IsAbleToHand()
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_TO_HAND)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCondition(cm.rcon)
e1:SetTargetRange(1,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsLocation,LOCATION_DECK))
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_DRAW)
e2:SetCondition(cm.rcon)
e2:SetReset(RESET_PHASE+PHASE_END)
e2:SetTargetRange(1,0)
Duel.RegisterEffect(e2,tp)
end
end
function cm.rcon(e)
local tp=e:GetHandlerPlayer()
return Duel.GetFlagEffect(tp,m)==0
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
\ No newline at end of file
--古道登仙·金龙丹
local m=30682130
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,cm.mfilter,2,2)
c:EnableReviveLimit()
c:SetSPSummonOnce(m)
--extra link
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(m,0))
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e0:SetRange(LOCATION_EXTRA)
e0:SetCondition(cm.lkcon)
e0:SetOperation(cm.lkop)
e0:SetValue(SUMMON_TYPE_LINK)
c:RegisterEffect(e0)
--cannot be targeted
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(aux.tgoval)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCountLimit(1,m)
e2:SetCondition(cm.thcon)
e2:SetCost(cm.discost)
e2:SetTarget(cm.thtg)
e2:SetOperation(cm.thop)
c:RegisterEffect(e2)
--material limit
local e13=Effect.CreateEffect(c)
e13:SetType(EFFECT_TYPE_SINGLE)
e13:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e13:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e13:SetValue(cm.linklimit)
c:RegisterEffect(e13)
end
function cm.linklimit(e,c)
if not c then return false end
return not c:IsSetCard(0xc1b)
end
function cm.mfilter(c)
return c:IsLevelAbove(4) and c:IsLinkRace(RACE_DRAGON+RACE_WYRM)
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function cm.revfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToRemoveAsCost()
end
function cm.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.revfilter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,cm.revfilter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsType(TYPE_TUNER) and c:IsAttribute(ATTRIBUTE_FIRE)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
local tc=g:GetFirst()
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_MZONE)
e1:SetAbsoluteRange(tp,1,0)
e1:SetTarget(cm.splimit1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1,true)
end
end
end
function cm.splimit1(e,c)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA) and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.lcheck(g,lc)
return g:GetClassCount(Card.GetLinkCode)==g:GetCount()
end
function cm.lkcon(e,c)
if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(cm.lkfilter,tp,LOCATION_ONFIELD,0,nil,c,tp)
local sg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_LMATERIAL)}) do
local pc=pe:GetHandler()
if not mg:IsContains(pc) then return false end
sg:AddCard(pc)
end
local ct=sg:GetCount()
local minc=2
local maxc=2
if ct>maxc then return false end
return cm.lcheck(tp,sg,c,minc,ct) or mg:IsExists(cm.lkchenk,1,nil,tp,sg,mg,c,ct,minc,maxc)
end
--
function cm.lkop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(cm.lkfilter,tp,LOCATION_ONFIELD,0,nil,c,tp)
local sg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_LMATERIAL)}) do
sg:AddCard(pe:GetHandler())
end
local ct=sg:GetCount()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
sg:Select(tp,ct,ct,nil)
local minc=2
local maxc=2
for i=ct,maxc-1 do
local cg=mg:Filter(cm.lkchenk,sg,tp,sg,mg,c,i,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.lcheck(tp,sg,c,minc,i) then
if not Duel.SelectYesNo(tp,210) then break end
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local g=cg:Select(tp,minct,1,nil)
if g:GetCount()==0 then break end
sg:Merge(g)
end
c:SetMaterial(sg)
Duel.SendtoGrave(sg,REASON_MATERIAL+REASON_LINK)
end
function cm.lkfilter(c,lc,tp)
local flag=c:IsFaceup() and c:IsCanBeLinkMaterial(lc)
if c:IsType(TYPE_MONSTER) then
return flag and c:IsLevelAbove(4) and c:IsLinkRace(RACE_DRAGON+RACE_WYRM)
else
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
end
function cm.lvfilter(c)
if c:IsType(TYPE_LINK) and c:GetLink()>1 then
return 1+0x10000*c:GetLink()
else
return 1
end
end
function cm.lcheck(tp,sg,lc,minc,ct)
return ct>=minc and sg:CheckWithSumEqual(cm.lvfilter,lc:GetLink(),ct,ct) and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0
end
function cm.lkchenk(c,tp,sg,mg,lc,ct,minc,maxc)
sg:AddCard(c)
ct=ct+1
local res=cm.lcheck(tp,sg,lc,minc,ct) or (ct<maxc and mg:IsExists(cm.lkchenk,1,sg,tp,sg,mg,lc,ct,minc,maxc))
sg:RemoveCard(c)
ct=ct-1
return res
end
--古道登仙·焚天
local m=30682135
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetUniqueOnField(1,0,30682135)
--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(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(cm.eqlimit)
c:RegisterEffect(e2)
--disable
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(cm.discon1)
e3:SetCost(cm.atkcost)
e3:SetOperation(cm.disop1)
c:RegisterEffect(e3)
--damage
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DAMAGE)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(EVENT_BATTLE_DESTROYING)
e4:SetCondition(cm.damcon)
e4:SetTarget(cm.damtg)
e4:SetOperation(cm.damop)
c:RegisterEffect(e4)
--Indes
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_EQUIP)
e5:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e5:SetCondition(cm.igcon2)
e5:SetValue(1)
c:RegisterEffect(e5)
end
function cm.eqlimit(e,c)
return c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.eqfilter1(c)
return c:IsFaceup() and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.eqfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.eqfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,cm.eqfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function cm.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() and c:CheckUniqueOnField(tp) then
Duel.Equip(tp,c,tc)
end
end
function cm.discon1(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
return ec and (ec==Duel.GetAttacker() or ec==Duel.GetAttackTarget()) and ec:GetBattleTarget() and not ec:GetBattleTarget():IsAttribute(ATTRIBUTE_FIRE)
end
function cm.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(m)==0 end
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_DAMAGE_CAL,0,1)
end
function cm.disop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetEquipTarget()
local rc=bc:GetBattleTarget()
c:CreateRelation(rc,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DAMAGE_CAL)
e2:SetValue(rc:GetAttack())
bc:RegisterEffect(e2)
end
function cm.damcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetEquipTarget()
local des=eg:GetFirst()
local rc=des:GetReasonCard()
return des:IsLocation(LOCATION_GRAVE) and des:IsType(TYPE_MONSTER) and rc:IsRelateToBattle() and rc==tc
end
function cm.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local damp=eg:GetFirst():GetPreviousControler()
local damg=eg:GetFirst():GetBaseAttack()
Duel.SetTargetPlayer(damp)
Duel.SetTargetParam(damg)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,damp,damg)
end
function cm.damop(e,tp,eg,ep,ev,re,r,rp)
local p,v=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,v,REASON_EFFECT)
end
function cm.igcon2(e)
return e:GetHandler():GetEquipTarget():IsRace(RACE_WYRM)
end
--古道登仙·剑冢孤
local m=30682140
local cm=_G["c"..m]
function cm.initial_effect(c)
--tohand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--token
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetDescription(aux.Stringid(m,1))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCountLimit(1,m+1)
e3:SetRange(LOCATION_MZONE)
e3:SetCost(cm.spcost)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
end
function cm.thfilter(c)
return c:IsSetCard(0xc1b) and c:IsAbleToHand() and c:IsType(TYPE_EQUIP)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_GRAVE,0,nil)
local sg=g:Filter(cm.thfilter,nil)
if aux.NecroValleyNegateCheck(sg) then return end
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
function cm.spfilter(c)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsAbleToRemoveAsCost(POS_FACEDOWN)
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEDOWN,REASON_COST)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,30682103,0xc1b,TYPES_TOKEN_MONSTER,0,0,1,RACE_WYRM,ATTRIBUTE_LIGHT) end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,ft,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,ft,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,30682103,0xc1b,TYPES_TOKEN_MONSTER,0,0,1,RACE_WYRM,ATTRIBUTE_LIGHT) then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
for i=1,ft do
local token=Duel.CreateToken(tp,30682103)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetAbsoluteRange(tp,1,0)
e1:SetTarget(cm.splimit)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
Duel.SpecialSummonComplete()
end
end
function cm.splimit(e,c)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA) and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
--古道登仙·侍剑童
local m=30682145
local cm=_G["c"..m]
function cm.initial_effect(c)
--special summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetRange(LOCATION_HAND)
e0:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e0:SetCondition(cm.spcon)
c:RegisterEffect(e0)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,m+1)
e1:SetTarget(cm.srtg)
e1:SetOperation(cm.srop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,m+2)
e3:SetCost(cm.cost)
e3:SetTarget(cm.target)
e3:SetOperation(cm.operation)
c:RegisterEffect(e3)
if not cm.global_check then
cm.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVED)
ge1:SetRange(LOCATION_MZONE)
ge1:SetOperation(cm.checkop1)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_SPSUMMON_SUCCESS)
ge2:SetRange(LOCATION_MZONE)
ge2:SetOperation(cm.checkop2)
Duel.RegisterEffect(ge2,0)
local ge3=ge2:Clone()
ge3:SetCode(EVENT_SUMMON_SUCCESS)
Duel.RegisterEffect(ge3,0)
end
end
function cm.checkop1(e,tp,eg,ep,ev,re,r,rp)
local te,code=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_CODE)
local tc=te:GetHandler()
if code~=30682145 and tc:IsSetCard(0xc1b) then
local tsp=te:GetHandlerPlayer()
Duel.RegisterFlagEffect(tsp,m,RESET_PHASE+PHASE_END,0,1)
Duel.RegisterFlagEffect(1-tsp,m,RESET_PHASE+PHASE_END,0,1)
end
end
function cm.checksum(c)
return c:IsSetCard(0xc1b) and not c:IsCode(30682145)
end
function cm.checkop2(e,tp,eg,ep,ev,re,r,rp)
if eg:IsExists(cm.checksum,1,nil) then
Duel.RegisterFlagEffect(rp,m,RESET_PHASE+PHASE_END,0,1)
end
end
function cm.cfilter(c)
return c:IsRace(RACE_WYRM)
end
function cm.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function cm.srfilter(c)
return c:IsSetCard(0xc1b) and c:IsType(TYPE_EQUIP) and c:IsAbleToHand()
end
function cm.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.srfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.srop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.srfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg0=g:SelectSubGroup(tp,aux.dncheck,false,1,2)
Duel.SendtoHand(sg0,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg0)
Duel.ResetFlagEffect(tp,m)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetCondition(cm.discon2)
e1:SetValue(cm.actlimit2)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function cm.actlimit2(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and not re:GetHandler():IsType(TYPE_SPIRIT)
end
function cm.discon2(e)
local tp=e:GetHandlerPlayer()
return Duel.GetFlagEffect(tp,m)==0
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function cm.thfilter(c)
return c:IsSetCard(0xc1b) and c:IsType(TYPE_EQUIP) and c:IsAbleToHand()
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_REMOVED)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.thfilter,tp,LOCATION_REMOVED,0,nil)
if g:GetCount()<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg1=g:SelectSubGroup(tp,aux.dncheck,false,1,3)
Duel.SendtoHand(sg1,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg1)
end
--古道登仙·元龙婴
local m=30682150
local cm=_G["c"..m]
function cm.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,m)
e1:SetCost(cm.srcost)
e1:SetTarget(cm.srtg)
e1:SetOperation(cm.srop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,2))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,m+1)
e2:SetCost(cm.spcost)
e2:SetTarget(cm.sptg)
e2:SetOperation(cm.spop)
c:RegisterEffect(e2)
end
------------
function cm.srcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
if chk==0 then return true end
end
function cm.tfilter1(c,att)
return (c:IsAttribute(att) or c:IsAttribute(ATTRIBUTE_DARK)) and c:IsAttackBelow(1500) and c:IsAttackAbove(500) and c:IsLevelBelow(6)
and c:IsAbleToHand() and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.CheckFilter(cg,tp)
local num=0
local check=false
for tc in aux.Next(cg) do
local ag=Duel.GetMatchingGroup(cm.tfilter1,tp,LOCATION_DECK,0,nil,tc:GetOriginalAttribute())
if ag:GetCount()>0 then check=true end
end
return check
end
function cm.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
local sg=Duel.GetMatchingGroup(Card.IsDiscardable,tp,LOCATION_HAND,0,e:GetHandler())
return sg:CheckSubGroup(cm.CheckFilter,2,2,tp)
end
e:SetLabel(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local sg=Duel.GetMatchingGroup(Card.IsDiscardable,tp,LOCATION_HAND,0,e:GetHandler())
local dg=sg:SelectSubGroup(tp,cm.CheckFilter,false,2,2,tp)
local att1=dg:GetFirst():GetOriginalAttribute()
local att2=dg:GetNext():GetOriginalAttribute()
e:SetLabel(att1,att2)
dg:AddCard(c)
Duel.SendtoGrave(dg,REASON_COST+REASON_DISCARD)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.ofilter1(c,att1,att2)
return (c:IsAttribute(att1) or c:IsAttribute(att2) or c:IsAttribute(ATTRIBUTE_DARK)) and c:IsAttackBelow(1500)
and c:IsAttackAbove(500) and c:IsAbleToHand() and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.srop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local att1,att2=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.ofilter1,tp,LOCATION_DECK,0,1,1,nil,att1,att2)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
local e1_1=Effect.CreateEffect(c)
e1_1:SetType(EFFECT_TYPE_FIELD)
e1_1:SetCode(EFFECT_ACTIVATE_COST)
e1_1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1_1:SetTargetRange(1,0)
e1_1:SetCost(cm.costchk)
e1_1:SetTarget(cm.actarget)
e1_1:SetOperation(cm.costop)
e1_1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1_1,tp)
end
end
function cm.costchk(e,te_or_c,tp)
return Duel.CheckLPCost(tp,1500)
end
function cm.actarget(e,te,tp)
return te:IsHasType(EFFECT_TYPE_ACTIONS) and not (te:GetHandler():IsSetCard(0xc1b)
or aux.IsCodeListed(te:GetHandler(),30682180))
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.CheckLPCost(tp,1500)
Duel.PayLPCost(tp,1500)
end
-----
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost(POS_FACEDOWN) end
Duel.Remove(e:GetHandler(),POS_FACEDOWN,REASON_COST)
end
function cm.filter(c,e,tp)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
\ No newline at end of file
--古道登仙·凝龙体
local m=30682155
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.AddCodeList(c,30682180)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,m)
e1:SetCode(EVENT_CHAIN_NEGATED)
e1:SetCondition(cm.condition)
e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_CHAIN_DISABLED)
c:RegisterEffect(e2)
--copy effect
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCountLimit(1,m+1)
e3:SetCost(cm.copycost)
e3:SetTarget(cm.copytg)
e3:SetOperation(cm.copyop)
c:RegisterEffect(e3)
--special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,2))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1,m+2)
e4:SetCost(cm.cost)
e4:SetCondition(cm.tdcon)
e4:SetOperation(cm.operation)
c:RegisterEffect(e4)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()~=tp then return false end
local ph=Duel.GetCurrentPhase()
return not (ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE)
end
function cm.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)
end
function cm.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 cm.copycost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(m)==0 end
e:GetHandler():RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function cm.copyfilter(c)
return c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_TOKEN) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
and c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsLevelBelow(4) and c:IsAttackBelow(1500) and c:IsAttackAbove(500)
end
function cm.copytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsLocation(LOCATION_MZONE+LOCATION_GRAVE) and cm.copyfilter(chkc) and chkc~=c end
if chk==0 then return Duel.IsExistingTarget(cm.copyfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,cm.copyfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,1,c)
end
function cm.copyop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e)
and (tc:IsFaceup() or tc:IsLocation(LOCATION_GRAVE)) then
local code=tc:GetOriginalCodeRule()
local cid=0
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_ADD_CODE)
e1:SetValue(code)
e1:SetReset(RESET_EVENT+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
if not tc:IsType(TYPE_TRAPMONSTER) then
cid=cm.CopyEffectExtraCount(c,2,code,RESET_EVENT+RESET_TODECK+RESET_TURN_SET+RESET_TEMP_REMOVE+RESET_REMOVE+RESET_PHASE+PHASE_END,1)
--(Card c,int count,int code,int reset_flag,int reset_count)
--为卡片c添加卡号是code的卡的可复制的效果,并且改变成count的次数和添加重置条件,那些效果会在int reset_count次int reset_flag时点后重置
end
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(m,1))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_MZONE)
e3:SetReset(RESET_EVENT+RESET_TODECK+RESET_TURN_SET+RESET_TEMP_REMOVE+RESET_REMOVE+RESET_PHASE+PHASE_END)
e3:SetLabelObject(e1)
e3:SetLabel(cid)
e3:SetOperation(cm.rstop)
c:RegisterEffect(e3)
local e1_1=Effect.CreateEffect(c)
e1_1:SetType(EFFECT_TYPE_FIELD)
e1_1:SetCode(EFFECT_ACTIVATE_COST)
e1_1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1_1:SetTargetRange(1,0)
e1_1:SetCost(cm.costchk)
e1_1:SetTarget(cm.actarget)
e1_1:SetOperation(cm.costop)
e1_1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1_1,tp)
end
end
function cm.costchk(e,te_or_c,tp)
return Duel.CheckLPCost(tp,2000)
end
function cm.actarget(e,te,tp)
return te:IsHasType(EFFECT_TYPE_ACTIONS) and not (te:GetHandler():IsSetCard(0xc1b)
or aux.IsCodeListed(te:GetHandler(),30682180))
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.CheckLPCost(tp,2000)
Duel.PayLPCost(tp,2000)
end
function cm.CopyEffectExtraCount(c,ctlm,code,res,resct)
if not ctlm then return c:CopyEffect(code,res,resct) end
local et={}
local ef=Effect.SetCountLimit
local rf=Card.RegisterEffect
Effect.SetCountLimit=cm.replace_set_count_limit(et)
Card.RegisterEffect=cm.replace_register_effect(et,ctlm,ef,rf)
c:RegisterFlagEffect(m+1,res,0,resct,ctlm)
local cid=c:CopyEffect(code,res,resct)
Effect.SetCountLimit=ef
Card.RegisterEffect=rf
c:ResetFlagEffect(m+1)
return cid
end
function cm.replace_set_count_limit(et)
return function(e,ct,cd) et[e]={ct,cd} end
end
--0x7e0=0x0400+0x0200+0x0100+0x0080+0x0040+0x0020
--诱发即时必发效果+诱发必发效果+诱发即时效果+诱发选发效果+起动效果+翻转效果
function cm.replace_register_effect(et,ctlm,ef,rf)
return function(c,e,forced)
local t=et[e]
if t then
if e:IsHasType(0x7e0) then
t[1]=math.max(t[1],ctlm)
end
ef(e,table.unpack(t))
end
rf(c,e,forced)
end
end
function cm.rstop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local cid=e:GetLabel()
if cid~=0 then
c:ResetEffect(cid,RESET_COPY)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
end
local e1=e:GetLabelObject()
e1:Reset()
Duel.HintSelection(Group.FromCards(c))
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.tdcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(m)~=0
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHandAsCost() end
Duel.SendtoHand(e:GetHandler(),nil,REASON_COST)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
--古道登仙·煅龙之体
local m=30682160
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_DRAGON+RACE_WYRM),2,99,cm.lcheck)
c:EnableReviveLimit()
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,1))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCountLimit(1,m)
e1:SetCost(cm.thcost)
e1:SetCondition(cm.thcon)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
--indes
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e4:SetValue(1)
c:RegisterEffect(e4)
local e2=e4:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e2)
--avoid battle damage
local e5=e4:Clone()
e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e5)
--draw(battle)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_PHASE+PHASE_BATTLE)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,m+1)
e3:SetCondition(cm.drcon)
e3:SetTarget(cm.drtg)
e3:SetOperation(cm.drop)
c:RegisterEffect(e3)
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e8:SetCode(EVENT_SPSUMMON_SUCCESS)
e8:SetCondition(cm.txtcon)
e8:SetOperation(cm.txtop)
c:RegisterEffect(e8)
--material limit
local e13=Effect.CreateEffect(c)
e13:SetType(EFFECT_TYPE_SINGLE)
e13:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e13:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e13:SetValue(cm.linklimit)
c:RegisterEffect(e13)
end
function cm.linklimit(e,c)
if not c then return false end
return not c:IsSetCard(0xc1b)
end
function cm.txtcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_LINK)
end
function cm.txtop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(24,0,aux.Stringid(m,12))
Duel.Hint(24,0,aux.Stringid(m,13))
Duel.Hint(24,0,aux.Stringid(m,14))
end
function cm.lcheck(g)
return g:IsExists(Card.IsLinkSetCard,1,nil,0xc1b)
end
function cm.cfilter(c)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsAbleToRemoveAsCost()
end
function cm.srfilter(c)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsAbleToHand()
end
function cm.gcheck(g,tp)
return aux.gfcheck(g,Card.IsType,TYPE_MONSTER,TYPE_MONSTER)
and Duel.IsExistingMatchingCard(cm.srfilter,tp,LOCATION_GRAVE,0,2,g)
end
function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.cfilter,tp,LOCATION_GRAVE,0,nil)
if chk==0 then return g:CheckSubGroup(cm.gcheck,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroup(tp,cm.gcheck,false,2,2,tp)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.srfilter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_GRAVE)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.srfilter,tp,LOCATION_GRAVE,0,nil)
if g:GetCount()<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg0=g:SelectSubGroup(tp,aux.TRUE,false,2,2)
Duel.SendtoHand(sg0,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg0)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OATH)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function cm.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetBattledGroupCount()>0
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
--古道登仙·此乃神游太虚
local m=30682165
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,cm.mfilter,1)
c:SetSPSummonOnce(m)
--effect gain
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(cm.tkcon)
e1:SetOperation(cm.tkop)
c:RegisterEffect(e1)
--Attribute Dark
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_SINGLE)
e8:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e8:SetCode(EFFECT_ADD_ATTRIBUTE)
e8:SetRange(LOCATION_MZONE)
e8:SetValue(ATTRIBUTE_DARK)
c:RegisterEffect(e8)
--attack limit
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e6:SetCode(EFFECT_CANNOT_ATTACK)
c:RegisterEffect(e6)
--cannot be target
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e7:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e7:SetRange(LOCATION_MZONE)
e7:SetValue(aux.imval1)
c:RegisterEffect(e7)
--material limit
local e13=Effect.CreateEffect(c)
e13:SetType(EFFECT_TYPE_SINGLE)
e13:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e13:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e13:SetValue(cm.linklimit)
c:RegisterEffect(e13)
end
function cm.linklimit(e,c)
if not c then return false end
return not c:IsSetCard(0xc1b)
end
function cm.mfilter(c)
return c:IsLinkType(TYPE_LINK) and c:GetLink()>=2 and c:IsSetCard(0xc1b)
end
function cm.tkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function cm.tkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=c:GetMaterial()
local link=0
local tc=g:GetFirst()
while tc do
local lk
if tc:IsLinkAbove(1) then
lk=tc:GetLink()
else lk=0
end
link=link+lk
tc=g:GetNext()
end
if c:GetFlagEffect(30682166)==0 and link>=1 then
--spsummon
local e1_1=Effect.CreateEffect(e:GetHandler())
e1_1:SetDescription(aux.Stringid(m,0))
e1_1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1_1:SetType(EFFECT_TYPE_IGNITION)
e1_1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1_1:SetRange(LOCATION_MZONE)
e1_1:SetCountLimit(1,m)
e1_1:SetTarget(cm.sptg)
e1_1:SetOperation(cm.spop)
e1_1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1_1)
c:RegisterFlagEffect(30682166,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,3))
end
if c:GetFlagEffect(30682167)==0 and link>=2 then
--return
local e2_1=Effect.CreateEffect(e:GetHandler())
e2_1:SetDescription(aux.Stringid(m,1))
e2_1:SetType(EFFECT_TYPE_IGNITION)
e2_1:SetRange(LOCATION_MZONE)
e2_1:SetCountLimit(1,m+1)
e2_1:SetTarget(cm.rttg)
e2_1:SetOperation(cm.rtop)
e2_1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2_1)
c:RegisterFlagEffect(30682167,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,4))
end
if c:GetFlagEffect(30682168)==0 and link>=3 then
--damage reduce
local e3_1=Effect.CreateEffect(e:GetHandler())
e3_1:SetDescription(aux.Stringid(m,2))
e3_1:SetCategory(CATEGORY_SEARCH)
e3_1:SetType(EFFECT_TYPE_IGNITION)
e3_1:SetRange(LOCATION_MZONE)
e3_1:SetCountLimit(1,m+2)
e3_1:SetCost(cm.thcost)
e3_1:SetTarget(cm.thtg)
e3_1:SetOperation(cm.thop)
e3_1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e3_1)
c:RegisterFlagEffect(30682168,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,5))
end
end
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(cm.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cm.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
Duel.SpecialSummonComplete()
end
c:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(30682165,6))
end
function cm.rttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_REMOVED)
end
function cm.rtop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_REMOVED,0,1,3,nil)
if #g>0 then
Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN)
end
c:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(30682165,7))
end
function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.thfilter(c,tp)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsAbleToHand()
and not Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,c:GetCode())
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
--zone limit
local e0=Effect.CreateEffect(e:GetHandler())
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_MUST_USE_MZONE)
e0:SetRange(LOCATION_MZONE)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetTargetRange(1,0)
e0:SetValue(cm.zonelimit)
e0:SetReset(RESET_PHASE+PHASE_END)
c:RegisterEffect(e0)
c:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(30682165,8))
end
function cm.zonelimit(e)
return 0x7f007f & ~e:GetHandler():GetLinkedZone()
end
--道术!百炼之体!
local m=30682170
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.AddCodeList(c,30682180)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES+CATEGORY_GRAVE_SPSUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(cm.condition)
e1:SetCost(cm.descost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
function cm.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.cfilter(c,tp)
return c:IsRace(RACE_DRAGON+RACE_WYRM) and c:IsPreviousControler(tp)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.cfilter,1,nil,tp)
end
function cm.spfilter(c,e,tp)
if not (c:IsCode(30682160) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)) then return false end
if c:IsLocation(LOCATION_EXTRA) then
return Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
else
return Duel.GetMZoneCount(tp)>0
end
end
function cm.tdfilter(c)
return c:IsCode(30682180) and c:IsFaceup()
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA+LOCATION_GRAVE)
local g=Duel.GetMatchingGroup(cm.tdfilter,tp,LOCATION_ONFIELD,0,nil)
if g:GetCount()>0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES+CATEGORY_GRAVE_SPSUMMON+CATEGORY_DRAW)
e:SetLabel(1)
else
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES+CATEGORY_GRAVE_SPSUMMON)
e:SetLabel(0)
end
end
function cm.spfilter2(c,e,tp,mc)
return c:IsSetCard(0x10dc) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and aux.IsCodeListed(mc,c:GetCode())
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(24,0,aux.Stringid(m,12))
Duel.Hint(24,0,aux.Stringid(m,13))
Duel.Hint(24,0,aux.Stringid(m,14))
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_EXTRA+LOCATION_GRAVE,0,nil,e,tp)
if g:GetCount()==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(1)
tc:RegisterEffect(e1)
Duel.SpecialSummonComplete()
end
if e:GetLabel()==1 and Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
--道术!证剑之道!
local m=30682175
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.AddCodeList(c,30682180)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(cm.descon)
e1:SetCost(cm.descost)
e1:SetTarget(cm.destg)
e1:SetOperation(cm.desop)
c:RegisterEffect(e1)
end
function cm.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function cm.actfilter(c)
return c:IsFaceup() and (c:IsRankAbove(10) or c:IsLevelAbove(10) or c:IsLinkAbove(6)) and c:GetEquipCount()>0
and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.actfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function cm.tdfilter(c)
return c:IsCode(30682180) and c:IsFaceup()
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and cm.actfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.actfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,cm.actfilter,tp,LOCATION_MZONE,0,1,1,nil)
local g=Duel.GetMatchingGroup(cm.tdfilter,tp,LOCATION_ONFIELD,0,nil)
if g:GetCount()>0 then
e:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DRAW)
e:SetLabel(1)
else
e:SetCategory(CATEGORY_ATKCHANGE)
e:SetLabel(0)
end
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(24,0,aux.Stringid(m,12))
Duel.Hint(24,0,aux.Stringid(m,13))
Duel.Hint(24,0,aux.Stringid(m,14))
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and cm.actfilter(tc) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e0=Effect.CreateEffect(e:GetHandler())
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_DISABLE)
e0:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e0,true)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE,EFFECT_FLAG2_WICKED)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(114514)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetValue(cm.efilter)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(e:GetHandler())
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)
tc:RegisterEffect(e3,true)
local e4=Effect.CreateEffect(e:GetHandler())
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CANNOT_TRIGGER)
e4:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e4,true)
local e5=Effect.CreateEffect(e:GetHandler())
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_UNRELEASABLE_SUM)
e5:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e5:SetValue(1)
tc:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EFFECT_UNRELEASABLE_NONSUM)
tc:RegisterEffect(e6)
local e7=e5:Clone()
e7:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e7:SetValue(cm.fuslimit)
tc:RegisterEffect(e7)
local e8=e5:Clone()
e8:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
tc:RegisterEffect(e8)
local e9=e5:Clone()
e9:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
tc:RegisterEffect(e9)
local e10=e5:Clone()
e10:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e10)
--actlimit
local e12=Effect.CreateEffect(c)
e12:SetType(EFFECT_TYPE_FIELD)
e12:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e12:SetCode(EFFECT_CANNOT_ACTIVATE)
e12:SetRange(LOCATION_MZONE)
e12:SetTargetRange(1,1)
e12:SetValue(1)
e12:SetCondition(cm.actcon)
tc:RegisterEffect(e12)
--check
local e17=Effect.CreateEffect(c)
e17:SetType(EFFECT_TYPE_SINGLE)
e17:SetCode(21208154)
e17:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e17:SetRange(LOCATION_MZONE)
e17:SetValue(1)
tc:RegisterEffect(e17)
Duel.SpecialSummonComplete()
end
local e100=Effect.CreateEffect(e:GetHandler())
e100:SetType(EFFECT_TYPE_FIELD)
e100:SetCode(EFFECT_CHANGE_DAMAGE)
e100:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e100:SetTargetRange(1,1)
e100:SetValue(0)
e100:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e100,tp)
local e200=e100:Clone()
e200:SetCode(EFFECT_NO_EFFECT_DAMAGE)
e200:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e200,tp)
if e:GetLabel()==1 and Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function cm.actcon(e)
return Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler()
end
function cm.fuslimit(e,c,sumtype)
return sumtype==SUMMON_TYPE_FUSION
end
function cm.efilter(e,te)
return te:GetOwner()~=e:GetOwner()
end
--藏经阁
local m=30682180
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.AddCodeList(c,30682180)
c:EnableCounterPermit(0xc1b)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH)
c:RegisterEffect(e1)
--recover
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(cm.reccon)
e2:SetOperation(cm.recop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e4)
--spsummon
local e10=Effect.CreateEffect(c)
e10:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e10:SetRange(LOCATION_SZONE)
e10:SetCode(EVENT_SUMMON_SUCCESS)
e10:SetOperation(cm.ctop)
c:RegisterEffect(e10)
local e11=e10:Clone()
e11:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e11)
local e13=e10:Clone()
e13:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e13)
--atk & def
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_UPDATE_ATTACK)
e5:SetRange(LOCATION_SZONE)
e5:SetTargetRange(LOCATION_MZONE,0)
e5:SetCondition(cm.con2)
e5:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_DRAGON+RACE_WYRM))
e5:SetValue(700)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e6)
--cannot be target
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD)
e7:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e7:SetRange(LOCATION_SZONE)
e7:SetTargetRange(LOCATION_MZONE,0)
e7:SetCondition(cm.con3)
e7:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_DRAGON+RACE_WYRM))
e7:SetValue(cm.indesval)
c:RegisterEffect(e7)
local e8=e7:Clone()
e8:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e8:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e8:SetValue(aux.tgoval)
c:RegisterEffect(e8)
--to hand
local e9=Effect.CreateEffect(c)
e9:SetDescription(aux.Stringid(m,0))
e9:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e9:SetType(EFFECT_TYPE_IGNITION)
e9:SetRange(LOCATION_SZONE)
e9:SetCountLimit(1)
e9:SetCondition(cm.con4)
e9:SetTarget(cm.target)
e9:SetOperation(cm.activate)
c:RegisterEffect(e9)
--spsummon
local e12=Effect.CreateEffect(c)
e12:SetDescription(aux.Stringid(m,1))
e12:SetCategory(CATEGORY_SPECIAL_SUMMON)
e12:SetType(EFFECT_TYPE_IGNITION)
e12:SetRange(LOCATION_SZONE)
e12:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e12:SetCountLimit(1,m+1+EFFECT_COUNT_CODE_DUEL)
e12:SetCost(cm.spcost)
e12:SetCondition(cm.con5)
e12:SetTarget(cm.sptg)
e12:SetOperation(cm.spop)
c:RegisterEffect(e12)
if not cm.global_check_spsummoncount then
cm.global_check_spsummoncount=true
local ge0=Effect.CreateEffect(c)
ge0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge0:SetCode(EVENT_SPSUMMON_SUCCESS)
ge0:SetOperation(cm.checkop)
Duel.RegisterEffect(ge0,0)
end
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
if tc:IsSetCard(0xc1b) then
Duel.RegisterFlagEffect(tc:GetSummonPlayer(),m,nil,0,1)
end
tc=eg:GetNext()
end
end
function cm.cfilter2(c,tp)
return c:IsSummonPlayer(tp) and c:IsSetCard(0xc1b)
end
function cm.ctop(e,tp,eg,ep,ev,re,r,rp)
if eg:IsExists(cm.cfilter2,1,nil,tp) then
e:GetHandler():AddCounter(0xc1b,1)
end
end
function cm.cfilter(c,tp)
return c:IsSummonPlayer(tp) and c:IsRace(RACE_DRAGON+RACE_WYRM)
end
function cm.reccon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.cfilter,1,nil,tp) and Duel.GetFlagEffect(e:GetHandlerPlayer(),m)>2
end
function cm.recop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,30682180)
Duel.Recover(tp,200,REASON_EFFECT)
end
function cm.con2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),m)>5
end
function cm.con3(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),m)>8
end
function cm.indesval(e,re,rp)
return rp~=e:GetHandlerPlayer()
end
function cm.con4(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),m)>11
end
function cm.filter(c)
return aux.IsCodeListed(c,30682180) and c:IsAbleToHand()
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function cm.con5(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),m)>18
end
function cm.spfilter(c,e,tp)
return c:IsSetCard(0xc1b) and c:IsCode(30682185) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function cm.rfilter(c,e,tp,ft)
return c:IsSetCard(0xc1b) and c:IsReleasable() and not c:IsCode(30682185)
and (ft>0 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup())
end
function cm.costfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDiscardable() and aux.IsCodeListed(c,30682180)
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return ft>-1 and Duel.CheckReleaseGroup(tp,cm.rfilter,1,nil,e,tp,ft)
and Duel.IsExistingMatchingCard(cm.costfilter,tp,LOCATION_HAND,0,2,e:GetHandler()) end
local g=Duel.SelectReleaseGroup(tp,cm.rfilter,1,1,nil,e,tp,ft)
local tc=g:GetFirst()
Duel.Release(tc,REASON_COST)
local ct=Duel.DiscardHand(tp,cm.costfilter,2,99,REASON_COST+REASON_DISCARD)
e:SetLabel(ct)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
local atk=e:GetLabel()*1000
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
tc:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
tc:RegisterEffect(e2,true)
end
end
--古道登仙·出窍问道
local m=30682190
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.AddCodeList(c,30682180)
--fusion material
aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0xc1b),aux.FilterBoolFunction(Card.IsRace,RACE_DRAGON+RACE_WYRM),true)
c:EnableReviveLimit()
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,m)
e1:SetCondition(cm.thcon)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,m+1)
e2:SetCost(cm.drcost)
e2:SetTarget(cm.drtg)
e2:SetOperation(cm.drop)
c:RegisterEffect(e2)
if not cm.global_check then
cm.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVED)
ge1:SetRange(LOCATION_MZONE)
ge1:SetOperation(cm.checkop1)
Duel.RegisterEffect(ge1,0)
end
end
function cm.checkop1(e,tp,eg,ep,ev,re,r,rp)
local te,code=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_CODE)
local tc=te:GetHandler()
if code~=30682190 and (aux.IsCodeListed(tc,30682180) or tc:IsSetCard(0xc1b)) then
local tsp=te:GetHandlerPlayer()
Duel.RegisterFlagEffect(tsp,m,RESET_PHASE+PHASE_END,0,1)
Duel.RegisterFlagEffect(1-tsp,m,RESET_PHASE+PHASE_END,0,1)
end
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function cm.thfilter(c)
return aux.IsCodeListed(c,30682180) and c:IsAbleToHand()
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function cm.cfilter2(c)
return (c:IsSetCard(0xc1b) or c:IsRace(RACE_DRAGON+RACE_WYRM)) and (c:IsAbleToDeckAsCost() or c:IsAbleToExtraAsCost())
end
function cm.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.cfilter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,2,3,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function cm.thfilter2(c)
return c:IsSetCard(0xc1b) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter2,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function cm.drop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(cm.thfilter2,tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
sg=g:Select(tp,1,1,nil)
end
Duel.SendtoHand(sg,nil,REASON_EFFECT)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetCondition(cm.discon2)
e1:SetValue(cm.actlimit2)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function cm.actlimit2(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and not re:GetHandler():IsType(TYPE_SPIRIT)
end
function cm.discon2(e)
local tp=e:GetHandlerPlayer()
return Duel.GetFlagEffect(tp,m)==0
end
......@@ -4,6 +4,7 @@
local s,id=GetID()
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
xpcall(function() require("expansions/script/utterconfusionlib") end,function() require("script/utterconfusionlib") end)
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
......
--慈英州対張銅羅
--Duel of the Walkers || Duello dei Camminatori
--Scripted by: XGlitchy30
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
local s,id,o=GetID()
function s.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_SELF_TOGRAVE)
--Counter Permit workaround for placing counters at activation (do NOT assign the EFFECT_FLAG_SINGLE_RANGE property)
local ct=Effect.CreateEffect(c)
ct:SetType(EFFECT_TYPE_SINGLE)
ct:SetRange(LOCATION_FZONE)
ct:SetCode(EFFECT_COUNTER_PERMIT|0x46c)
c:RegisterEffect(ct)
--[[Activate this card by paying half of your LP. If you do, when this card resolves, place 1 Life Counter on this card for every 400 LP you paid this way (rounded up).]]
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.cost)
c:RegisterEffect(e1)
--[[Monsters cannot activate their effects or declare an attack, during the turn they were Normal Summoned/Set.]]
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(1,1)
e2:SetValue(s.aclimit)
c:RegisterEffect(e2)
local e2x=Effect.CreateEffect(c)
e2x:SetType(EFFECT_TYPE_FIELD)
e2x:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e2x:SetRange(LOCATION_FZONE)
e2x:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2x:SetTarget(aux.TargetBoolFunction(Card.HasFlagEffect,id))
c:RegisterEffect(e2x)
--[[You choose the attack targets for your opponent's attacks, also you can make them direct attacks.]]
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_PATRICIAN_OF_DARKNESS)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(0,1)
c:RegisterEffect(e3)
local e3x=Effect.CreateEffect(c)
e3x:SetType(EFFECT_TYPE_FIELD)
e3x:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e3x:SetCode(EFFECT_DIRECT_ATTACK)
e3x:SetRange(LOCATION_FZONE)
e3x:SetTargetRange(0,LOCATION_MZONE)
c:RegisterEffect(e3x)
--[[If you would gain LP, place 1 Life Counter on this card for each 400 LP you would have gained, instead.]]
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CHANGE_RECOVER)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetRange(LOCATION_FZONE)
e4:SetTargetRange(1,0)
e4:SetValue(s.recval)
c:RegisterEffect(e4)
local e4x=Effect.CreateEffect(c)
e4x:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
e4x:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e4x:SetRange(LOCATION_FZONE)
e4x:SetCondition(s.bdcon)
e4x:SetOperation(s.bdop)
c:RegisterEffect(e4x)
--[[If you would take damage, remove 1 Life Counter from this card for each 400 damage you would have taken, instead.]]
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_CHANGE_DAMAGE)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetRange(LOCATION_FZONE)
e5:SetTargetRange(1,0)
e5:SetValue(s.damval)
c:RegisterEffect(e5)
local e5x=e5:Clone()
e5x:SetCode(EFFECT_NO_EFFECT_DAMAGE)
e5x:SetValue(s.CheckProtectionApplicability)
c:RegisterEffect(e5x)
--[[If there are no Life Counters on this card, send it to the GY.]]
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e6:SetCode(EFFECT_SELF_TOGRAVE)
e6:SetRange(LOCATION_FZONE)
e6:SetCondition(s.selftg)
c:RegisterEffect(e6)
--[[If this card leaves the field: Halve your LP.]]
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(id,1))
e7:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_LEAVE_FIELD)
e7:SetOperation(s.hlop)
c:RegisterEffect(e7)
--
if not s.global_check then
s.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SUMMON_SUCCESS)
ge1:SetOperation(s.regsum)
Duel.RegisterEffect(ge1,0)
end
end
function s.regsum(e,tp,eg,ep,ev,re,r,rp)
for tc in aux.Next(eg) do
tc:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&(~(RESET_TEMP_REMOVE|RESET_TURN_SET)))|RESET_PHASE|PHASE_END,EFFECT_FLAG_SET_AVAILABLE,1)
end
end
--E1
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local cost=math.floor(Duel.GetLP(tp)/2)
if chk==0 then return c:IsCanAddCounter(0x46c,math.ceil(cost/400),false,LOCATION_FZONE) end
Duel.PayLPCost(tp,cost)
e:SetLabel(math.ceil(cost/400))
c:AddCounter(0x46c,math.ceil(cost/400))
end
--E2
function s.aclimit(e,re,tp)
local tc=re:GetHandler()
return tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() and re:IsActiveType(TYPE_MONSTER) and tc:HasFlagEffect(id)
end
--E4
function s.recval(e,r,val)
local c=e:GetHandler()
local ct=math.floor(val/400)
if ct>0 and c:IsCanAddCounter(0x46c,ct) then
c:AddCounter(0x46c,ct)
end
return 0
end
--E4X
function s.bdcon(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetBattleDamage(tp)<=0 or Duel.IsPlayerAffectedByEffect(tp,EFFECT_AVOID_BATTLE_DAMAGE) then return false end
local DamageWillBeReversed=false
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_DAMAGE)}) do
local val=ce:GetValue()
local rc = (re and re&REASON_EFFECT==REASON_EFFECT) and re:GetHandler() or Duel.GetAttacker()
if not val or (type(val)=="number" and val~=0) or val(ce,re,r|REASON_BATTLE,rp,rc) then
DamageWillBeReversed=true
break
end
end
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_RECOVER)}) do
local val=ce:GetValue()
if not val or (type(val)=="number" and val~=0) or val(ce,re,r|REASON_BATTLE,rp) then
DamageWillBeReversed=false
break
end
end
return DamageWillBeReversed
end
function s.bdop(e,tp,eg,ep,ev,re,r,rp)
if Duel.PlayerHasFlagEffect(tp,id) then return end
local c=e:GetHandler()
local ct=math.floor(Duel.GetBattleDamage(tp)/400)
if ct>0 and c:IsCanAddCounter(0x46c,ct) then
c:AddCounter(0x46c,ct)
Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_DAMAGE,0,1)
Duel.ChangeBattleDamage(tp,0)
end
end
--E5
function s.damval(e,re,val,r,rp,rc)
local c=e:GetHandler()
local tp=e:GetHandlerPlayer()
local ct=math.floor(val/400)
if ct>0 and c:IsCanRemoveCounter(tp,0x46c,ct,REASON_EFFECT) then
Duel.IgnoreActionCheck(Card.RemoveCounter,c,tp,0x46c,ct,REASON_EFFECT)
return 0
end
return ev
end
--E5X
function s.CheckProtectionApplicability(e,dam)
return dam>=400
end
--E6
function s.selftg(e)
return e:GetHandler():GetCounter(0x46c)==0
end
--E7
function s.hlop(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(tp,math.ceil(Duel.GetLP(tp)/2))
end
\ No newline at end of file
--无声交流
--Expression in Silence || Espressione nel Silenzio
--Scripted by: XGlitchy30
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
local s,id,o=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--[[While this card is on the field, you skip your Draw Phase.]]
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(1,0)
e2:SetCode(EFFECT_SKIP_DP)
c:RegisterEffect(e2)
--[[During your Standby Phase: Look at the top 3 cards of your Deck, place 1 of them on the bottom of the Deck, and if you do,
add 1 of them to your hand, and keep it revealed as long as it remains in your hand, then add the remaining card to your hand.]]
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORIES_SEARCH)
e3:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_PHASE|PHASE_STANDBY)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetCondition(aux.TurnPlayerCond(0))
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
--[[Once per turn, during the End Phase: Banish, face-down, all revealed cards in your hand that were revealed by this card's effect.]]
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,3))
e4:SetCategory(CATEGORY_REMOVE)
e4:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_PHASE|PHASE_END)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetTarget(s.rmtg)
e4:SetOperation(s.rmop)
c:RegisterEffect(e4)
--[[When your opponent activates a card or effect, while this card is in the GY: You can banish this card and 1 card with the same name from your GY, face-down, and if you do, negate that effect.]]
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,4))
e5:SetCategory(CATEGORY_DISABLE|CATEGORY_REMOVE)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_CHAINING)
e5:SetRange(LOCATION_GRAVE)
e5:SetCondition(s.discon)
e5:SetTarget(s.distg)
e5:SetOperation(s.disop)
c:RegisterEffect(e5)
end
--E3
function s.thop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<3 then return end
local g=Duel.GetDecktopGroup(tp,3)
Duel.ConfirmCards(tp,g)
local bg=g:Select(tp,1,1,nil)
if #bg>0 then
local bc=bg:GetFirst()
Duel.MoveSequence(bc,1)
if bc:IsLocation(LOCATION_DECK) and bc:GetSequence()==0 then
g:RemoveCard(bc)
local sg=g:Filter(Card.IsAbleToHand,nil)
if #sg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg1=sg:Select(tp,1,1,nil)
if #sg1>0 then
Duel.DisableShuffleCheck()
if Duel.SendtoHand(sg1,nil,REASON_EFFECT)>0 and aux.PLChk(sg1,tp,LOCATION_HAND) then
Duel.ConfirmCards(1-tp,sg1)
local sc1=sg1:GetFirst()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetLabel(tp)
e1:SetCondition(s.resetcon)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
sc1:RegisterEffect(e1)
sc1:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_IGNORE_IMMUNE|EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2))
sg:RemoveCard(sc1)
if #sg>0 then
Duel.BreakEffect()
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
Duel.ShuffleHand(tp)
end
end
end
end
end
function s.resetcon(e)
local c=e:GetHandler()
if c:GetControler()~=e:GetLabel() then
e:ResetFlagEffect(id)
e:Reset()
return false
end
return true
end
--FILTERS E4
function s.revfilter(c,tp)
return c:IsPublic() and c:HasFlagEffect(id) and c:IsAbleToRemove(tp,POS_FACEDOWN)
end
--E4
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.Group(s.revfilter,tp,LOCATION_HAND,0,nil,tp)
if #g>0 then
Duel.SetCardOperationInfo(g,CATEGORY_REMOVE)
end
end
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.Group(s.revfilter,tp,LOCATION_HAND,0,nil,tp)
if #g>0 then
Duel.Banish(g,POS_FACEDOWN)
end
end
--FILTERS E5
function s.rmfilter(c,tp,code1,code2)
return c:IsCode(code1,code2) and c:IsAbleToRemove(tp,POS_FACEDOWN)
end
--E5
function s.discon(e,tp,eg,ep,ev,re,r,rp)
if rp==tp or not Duel.IsChainDisablable(ev) then return false end
return true
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local code1,code2=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2)
if chk==0 then
return not re:GetHandler():IsStatus(STATUS_DISABLED) and c:IsAbleToRemove(tp,POS_FACEDOWN) and Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_GRAVE,0,1,c,tp,code1,code2)
end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,c,2,tp,LOCATION_GRAVE)
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToChain() then return end
local code1,code2=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2)
local g=Duel.Select(HINTMSG_REMOVE,false,tp,aux.Necro(s.rmfilter),tp,LOCATION_GRAVE,0,1,1,c,tp,code1,code2)
if not c:IsHasEffect(EFFECT_NECRO_VALLEY) and c:IsAbleToRemove(tp,POS_FACEDOWN) then
g:AddCard(c)
end
if #g>0 then
Duel.HintSelection(g)
if Duel.Banish(g,POS_FACEDOWN)>0 then
Duel.NegateEffect(ev)
end
end
end
\ No newline at end of file
--无尽的重担 ~月童~
--Timeless Burden - Tsukiwarawa- || Fardello senza Tempo - Tsukiwarawa-
--Scripted by: XGlitchy30
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
local s,id,o=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
c:EnableCounterPermit(0x46d)
--[[If this is your first turn of the Duel, you can activate this card from your hand.]]
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(id,0))
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e0:SetCondition(s.handcon)
c:RegisterEffect(e0)
--[[When this card is activated: You lose 2000 LP, also until the End Phase of your opponent's next turn, all damage you would take becomes 0.]]
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--[[Cannot be destroyed by other card effects.]]
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetRange(LOCATION_SZONE)
e2:SetValue(s.efilter)
c:RegisterEffect(e2)
--[[Once per turn, during your Main Phase: You can place 1 counter on this card, and if you do, draw cards equal to the number of counters on this card (if any).]]
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,3))
e3:SetCategory(CATEGORY_COUNTER|CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetHintTiming(0,RELEVANT_TIMINGS)
e3:SetCondition(aux.MainPhaseCond(0))
e3:SetTarget(s.cttg)
e3:SetOperation(s.ctop)
c:RegisterEffect(e3)
--[[During the Standby Phase: You take damage equal to the number of counters on this card x 400.]]
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,4))
e4:SetCategory(CATEGORY_DAMAGE)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_PHASE|PHASE_STANDBY)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetTarget(s.damtg)
e4:SetOperation(s.damop)
c:RegisterEffect(e4)
--[[If you have 6 or more cards in your hand, destroy this card.]]
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_SZONE)
e5:SetCode(EFFECT_SELF_DESTROY)
e5:SetCondition(s.descon)
c:RegisterEffect(e5)
--[[If this card leaves the field: You lose LP equal to the number of counters that were on it x 2000.]]
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_CONTINUOUS)
e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e6:SetCode(EVENT_LEAVE_FIELD_P)
e6:SetOperation(s.regop)
c:RegisterEffect(e6)
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(id,5))
e7:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_LEAVE_FIELD)
e7:SetLabelObject(e6)
e7:SetCondition(s.lpcon)
e7:SetOperation(s.lpop)
c:RegisterEffect(e7)
if not s.global_check then
s.global_check=true
s[0]=0
s[1]=0
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START|PHASE_DRAW)
ge1:SetCountLimit(1,id)
ge1:SetOperation(s.regturn)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
ge2:SetCode(EVENT_PHASE_START|PHASE_STANDBY)
Duel.RegisterEffect(ge2,0)
local ge3=ge1:Clone()
ge3:SetCode(EVENT_PHASE_START|PHASE_MAIN1)
Duel.RegisterEffect(ge3,0)
local ge4=ge1:Clone()
ge4:SetCode(EVENT_PHASE_START|PHASE_BATTLE_START)
Duel.RegisterEffect(ge4,0)
local ge5=ge1:Clone()
ge5:SetCode(EVENT_PHASE_START|PHASE_MAIN2)
Duel.RegisterEffect(ge5,0)
local ge6=ge1:Clone()
ge6:SetCode(EVENT_PHASE_START|PHASE_END)
Duel.RegisterEffect(ge6,0)
end
end
function s.regturn(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetTurnPlayer()
s[p]=s[p]+1
end
--E0
function s.handcon(e)
return s[e:GetHandlerPlayer()]==1
end
--E1
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(Card.IsSpellTrapOnField,tp,LOCATION_ONFIELD,0,1,e:GetHandler())
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.LoseLP(tp,2000)
local c=e:GetHandler()
local rct = (Duel.GetTurnPlayer()==tp and 1 or 2)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,2))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT|EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetTargetRange(1,0)
e1:SetValue(0)
e1:SetReset(RESET_PHASE|PHASE_END|RESET_TURN_OPPO,rct)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
e2:SetReset(RESET_PHASE|PHASE_END|RESET_TURN_OPPO,rct)
Duel.RegisterEffect(e2,tp)
end
--E2
function s.efilter(e,te)
return te:GetOwner()~=e:GetOwner()
end
--E3
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local ct=c:GetCounter(0x46d)+1
if chk==0 then return c:IsCanAddCounter(0x46d,1) and Duel.IsPlayerCanDraw(tp,ct) end
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0x46d)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct)
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not (c:IsRelateToChain() and c:IsFaceup() and c:AddCounter(0x46d,1)) then return end
local ct=c:GetCounter(0x46d)
if ct>0 then
Duel.Draw(tp,ct,REASON_EFFECT)
end
end
--E4
function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ct=e:GetHandler():GetCounter(0x46d)
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,ct*400)
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToChain() then
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local ct=math.max(0,c:GetCounter(0x46d))
Duel.Damage(p,ct*400,REASON_EFFECT)
end
end
--E5
function s.descon(e)
return Duel.GetHandCount(e:GetHandlerPlayer())>=116
end
--E6 and E7
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetHandler():GetCounter(0x46d)
e:SetLabel(ct)
end
function s.lpcon(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabelObject():GetLabel()
e:SetLabel(ct)
return ct>0
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
Duel.LoseLP(tp,e:GetLabel()*2000)
end
\ No newline at end of file
--直面光明
--Facing the Light || Affrontare la Luce
--Scripted by: XGlitchy30
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
local s,id,o=GetID()
function s.initial_effect(c)
--[[Banish, from your hand, field, and/or Extra Deck, LIGHT monsters with a total Level of 50 or more,
and if you do, your opponent sends to the GY, 1 monster they control, 1 card in their Spell & Trap Card Zones, and 1 card in their hand,
and if less than 3 cards are sent to the GY by this effect, inflict damage to your opponent equal to the difference x 800.
If this card is activated on or after the 5th turn of this Duel, you can also banish cards from your GY.]]
local e1=Effect.CreateEffect(c)
e1:Desc(0)
e1:SetCategory(CATEGORY_REMOVE|CATEGORY_TOGRAVE|CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:HOPT(true)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
--FILTERS E1
function s.rmfilter(c)
return (not c:IsOnField() or c:IsFaceup()) and c:IsMonster() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:HasLevel() and c:IsAbleToRemove()
end
function s.gcheck(g)
Duel.SetSelectedCard(g)
return g:CheckWithSumGreater(Card.GetLevel,50)
end
function s.tgfilter(c,tp)
return (not c:IsLocation(LOCATION_SZONE) or c:GetSequence()<5) and Duel.IsPlayerCanSendtoGrave(1-tp,c)
end
function s.tgcheck(g)
return g:GetClassCount(Card.GetLocation)==#g
end
--E1
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local loc=LOCATION_HAND|LOCATION_MZONE|LOCATION_EXTRA
if Duel.GetTurnCount()>=5 then
loc=loc|LOCATION_GRAVE
end
if chk==0 then
local g=Duel.Group(s.rmfilter,tp,loc,0,nil)
return #g>0 and g:CheckWithSumGreater(Card.GetLevel,50)
end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,loc)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local loc=LOCATION_HAND|LOCATION_MZONE|LOCATION_EXTRA
if Duel.GetTurnCount()>=5 then
loc=loc|LOCATION_GRAVE
end
local g=Duel.Group(aux.Necro(s.rmfilter),tp,loc,0,nil)
if #g>0 and g:CheckWithSumGreater(Card.GetLevel,50) then
Duel.HintMessage(tp,HINTMSG_REMOVE)
local rg=g:SelectWithSumGreater(tp,Card.GetLevel,50)
if #rg>0 and Duel.Banish(rg)>0 then
local ct=3
local sg=Duel.Group(s.tgfilter,tp,0,LOCATION_HAND|LOCATION_MZONE|LOCATION_SZONE,nil,tp)
if #sg>0 then
local min=3
local loclist={LOCATION_HAND,LOCATION_MZONE,LOCATION_SZONE}
for i=1,3 do
if not sg:IsExists(Card.IsLocation,1,nil,loclist[i]) then
min=min-1
if min==1 then
break
end
end
end
Duel.HintMessage(1-tp,HINTMSG_TOGRAVE)
aux.GCheckAdditional=s.tgcheck
local tg=sg:SelectSubGroup(1-tp,aux.TRUE,false,min,min)
aux.GCheckAdditional=nil
if #tg>0 and Duel.SendtoGrave(tg,REASON_RULE)>0 then
local oct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_GRAVE)
ct=3-oct
end
end
if ct>0 then
Duel.Damage(1-tp,ct*800,REASON_EFFECT)
end
end
end
end
\ No newline at end of file
--电脑童
--Brilliant Program & Genius Kid || Programma Brillante & Bambino Geniale
--Scripted by: XGlitchy30
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
local s,id,o=GetID()
function s.initial_effect(c)
--[[(Quick Effect): You can send this card from your hand or field to the GY; reveal 1 monster in your Extra Deck, then banish it face-down, and if you do, choose up to 2 of the below values. For the rest of this turn, the chosen values of all face-up monster on the field become the respective original values of the monster banished by this card's effect.
● ATK
● DEF
● Type
● Attribute.]]
local e1=Effect.CreateEffect(c)
e1:Desc(0)
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND|LOCATION_MZONE)
e1:SetHintTiming(0,RELEVANT_TIMINGS)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
--FILTERS E1
function s.rmfilter(c,tp)
return not c:IsPublic() and c:IsMonster() and c:IsAbleToRemove(tp,POS_FACEDOWN)
end
--E1
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToGraveAsCost() end
Duel.SendtoGrave(c,REASON_COST)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_EXTRA,0,1,nil,tp)
end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_EXTRA)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.Select(HINTMSG_CONFIRM,false,tp,s.rmfilter,tp,LOCATION_EXTRA,0,1,1,nil,tp)
if #g>0 then
Duel.ConfirmCards(1-tp,g)
local tc=g:GetFirst()
local atk,def,type,attr = tc:GetTextAttack(),tc:GetTextDefense(),tc:GetOriginalRace(),tc:GetOriginalAttribute()
local hasdef = not tc:IsType(TYPE_LINK)
Duel.BreakEffect()
if Duel.Banish(g,POS_FACEDOWN)>0 then
local val=0
for i=1,2 do
local b1 = val&0x1==0
local b2 = val&0x2==0 and hasdef
local b3 = val&0x4==0
local b4 = val&0x8==0
local opt=aux.Option(tp,id,1,b1,b2,b3,b4)
val = val|(2^opt)
end
if val~=0 then
local c=e:GetHandler()
if val&0x1==0x1 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(0,EFFECT_FLAG2_WICKED)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetValue(atk)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
if val&0x2==0x2 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(0,EFFECT_FLAG2_WICKED)
e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetValue(def)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
if val&0x4==0x4 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_RACE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetValue(type)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
if val&0x8==0x8 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetValue(attr)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
end
end
end
\ No newline at end of file
--「小双子星」冰川日菜
local m=64800205
local cm=_G["c"..m]
function cm.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,m)
e1:SetCondition(cm.spcon)
e1:SetTarget(cm.sptg)
e1:SetOperation(cm.spop)
c:RegisterEffect(e1)
--spsummon2
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,m)
e2:SetCost(cm.cost)
e2:SetTarget(cm.sptg1)
e2:SetOperation(cm.spop1)
c:RegisterEffect(e2)
end
--e1
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function cm.spfilter(c,e,tp)
return c:IsType(TYPE_TUNER) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(cm.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cm.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
e3:SetCode(EFFECT_CHANGE_LEVEL)
e3:SetValue(4)
c:RegisterEffect(e3)
end
end
Duel.SpecialSummonComplete()
end
--e2
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100,0,0)
return true
end
function cm.costfilter(c,e,tp)
return c:IsType(TYPE_TUNER) and c:IsLevelAbove(1) and c:IsFaceup()
and Duel.IsExistingMatchingCard(cm.spfilter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,c:GetCode(),c:GetLevel(),c)
end
function cm.spfilter1(c,e,tp,code,lv,mc)
return c:IsType(TYPE_TUNER) and c:IsType(TYPE_SYNCHRO) and c:IsLevel(lv) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false)
and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function cm.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
local check,code,lv=e:GetLabel()
if chk==0 then
if check~=100 then return false end
e:SetLabel(0,0,0)
return Duel.CheckReleaseGroup(tp,cm.costfilter,1,nil,e,tp)
end
local tc=Duel.SelectReleaseGroup(tp,cm.costfilter,1,1,nil,e,tp):GetFirst()
e:SetLabel(0,tc:GetCode(),tc:GetLevel())
Duel.Release(tc,REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.spop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local check,code,lv=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.spfilter1),tp,LOCATION_EXTRA,0,1,1,nil,e,tp,code,lv,nil)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
end
end
--在天连理之比翼鸟
local m=64800206
local cm=_G["c"..m]
function cm.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST),4,2)
c:EnableReviveLimit()
--fusion summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,m+10000)
e2:SetCondition(cm.thcon)
e2:SetTarget(cm.thtg)
e2:SetOperation(cm.thop)
c:RegisterEffect(e2)
end
--e1
function cm.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function cm.filter3(c)
return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial()
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local chkf=tp
local mg1=c:GetOverlayGroup():Filter(cm.filter3,nil)
local res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,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(cm.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 cm.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local c=e:GetHandler()
local mg1=c:GetOverlayGroup():Filter(cm.filter3,nil)
local sg1=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg3=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg3=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(cm.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 mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
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()
end
end
--e2
function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (c:IsLocation(LOCATION_GRAVE) or c:IsLocation(LOCATION_REMOVED) and c:IsFaceup()) and r==REASON_FUSION
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
--清朗之迦陵频伽
local m=64800207
local cm=_G["c"..m]
function cm.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST),1)
c:EnableReviveLimit()
--ANNOUNCE_CARD
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,m)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
function cm.spfilter(c,e,tp,code)
return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp,TYPE_MONSTER,OPCODE_ISTYPE)
e:SetLabel(ac)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ac=e:GetLabel()
local token=Duel.CreateToken(tp,ac)
if token:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST) then
if Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND+LOCATION_REMOVED,LOCATION_GRAVE,1,nil,e,tp,ac) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_HAND+LOCATION_REMOVED,LOCATION_GRAVE,1,1,nil,e,tp,ac)
local tc=g:GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
else
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(cm.distg)
e1:SetLabel(ac)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetCondition(cm.discon)
e2:SetOperation(cm.disop)
e2:SetLabel(ac)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
end
function cm.distg(e,c)
local ac=e:GetLabel()
return c:IsOriginalCodeRule(ac)
end
function cm.discon(e,tp,eg,ep,ev,re,r,rp)
local ac=e:GetLabel()
return re:GetHandler():IsOriginalCodeRule(ac)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
--蝶现-「启」
yume=yume or {}
if c71401001 then
function c71401001.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401001,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetCountLimit(1,71401001)
e1:SetCondition(c71401001.con1)
e1:SetCost(c71401001.cost1)
e1:SetTarget(c71401001.tg1)
e1:SetOperation(c71401001.op1)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401001,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,71501001)
e2:SetCost(c71401001.cost2)
e2:SetTarget(c71401001.tg2)
e2:SetOperation(c71401001.op2)
c:RegisterEffect(e2)
local e2a=e2:Clone()
e2a:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e2a)
yume.ButterflyCounter()
end
function c71401001.con1(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_MONSTER)
end
function c71401001.filterc1(c,tp)
return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS) and c:IsAbleToRemoveAsCost()
and Duel.GetMZoneCount(tp,c)>0
end
function c71401001.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401001.filterc1,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401001.filterc1,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401001.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c71401001.op1(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 c71401001.rmtg(e,c)
return c:GetOwner()==e:GetHandlerPlayer()
end
function c71401001.filter2ext(c)
return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS)
end
function c71401001.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function c71401001.filter2(c,e,tp,check)
return c:IsRace(RACE_SPELLCASTER) and c:IsLevel(4)
and (c:IsAbleToHand() or check and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c71401001.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
local check=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then return Duel.IsExistingMatchingCard(c71401001.filter2ext,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(c71401001.filter2,tp,LOCATION_DECK,0,1,nil,e,tp,check) end
end
function c71401001.op2(e,tp,eg,ep,ev,re,r,rp)
local check=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c71401001.filter2,tp,LOCATION_DECK,0,1,1,nil,e,tp,check)
local tc=g:GetFirst()
if tc then
if tc:IsAbleToHand() and (not (check and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)) or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e1:SetTargetRange(0xff,0xfe)
e1:SetValue(LOCATION_REMOVED)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTarget(c71401001.rmtg)
Duel.RegisterEffect(e1,tp)
end
end
function yume.ButterflyCounter()
Duel.AddCustomActivityCounter(71401001,ACTIVITY_CHAIN,yume.ButterflyCounterFilter)
end
function yume.ButterflyCounterFilter(re,tp,cid)
return not re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function yume.RegButterflyCostLimit(e,tp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(yume.ButterflyAcLimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function yume.ButterflyAcLimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function yume.AddButterflySpell(c,id)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401001,2))
e1:SetRange(LOCATION_HAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,id)
e1:SetCost(yume.ButterflyPlaceCost)
e1:SetTarget(yume.ButterflyPlaceTg)
e1:SetOperation(yume.ButterflySpellOp)
c:RegisterEffect(e1)
end
function yume.ButterflyPlaceTg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and e:GetHandler():CheckUniqueOnField(tp) end
end
function yume.ButterflyPlaceCost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function yume.ButterflySpellOp(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
c:RegisterEffect(e1)
end
end
function yume.AddButterflyTrap(c,id)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401001,3))
e1:SetRange(LOCATION_HAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,id)
e1:SetCost(yume.ButterflyPlaceCost)
e1:SetTarget(yume.ButterflyPlaceTg)
e1:SetOperation(yume.ButterflyTrapOp)
c:RegisterEffect(e1)
end
function yume.ButterflyTrapOp(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_TRAP+TYPE_CONTINUOUS)
c:RegisterEffect(e1)
end
--蝶现-「启」
yume=yume or {}
if c71401001 then
function c71401001.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401001,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetCountLimit(1,71401001)
e1:SetCondition(c71401001.con1)
e1:SetCost(c71401001.cost1)
e1:SetTarget(c71401001.tg1)
e1:SetOperation(c71401001.op1)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401001,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,71501001)
e2:SetCost(c71401001.cost2)
e2:SetTarget(c71401001.tg2)
e2:SetOperation(c71401001.op2)
c:RegisterEffect(e2)
local e2a=e2:Clone()
e2a:SetCode(EVENT_SUMMON_SUCCESS)
c:RegisterEffect(e2a)
yume.ButterflyCounter()
end
function c71401001.con1(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_MONSTER)
end
function c71401001.filterc1(c,tp)
return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS) and c:IsAbleToRemoveAsCost()
and Duel.GetMZoneCount(tp,c)>0
end
function c71401001.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401001.filterc1,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401001.filterc1,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401001.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c71401001.op1(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 c71401001.rmtg(e,c)
return c:GetOwner()==e:GetHandlerPlayer()
end
function c71401001.filter2ext(c)
return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS)
end
function c71401001.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function c71401001.filter2(c,e,tp,check)
return c:IsRace(RACE_SPELLCASTER) and c:IsLevel(4)
and (c:IsAbleToHand() or check and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c71401001.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
local check=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then return Duel.IsExistingMatchingCard(c71401001.filter2ext,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(c71401001.filter2,tp,LOCATION_DECK,0,1,nil,e,tp,check) end
end
function c71401001.op2(e,tp,eg,ep,ev,re,r,rp)
local check=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c71401001.filter2,tp,LOCATION_DECK,0,1,1,nil,e,tp,check)
local tc=g:GetFirst()
if tc then
if tc:IsAbleToHand() and (not (check and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)) or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e1:SetTargetRange(0xff,0xfe)
e1:SetValue(LOCATION_REMOVED)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTarget(c71401001.rmtg)
Duel.RegisterEffect(e1,tp)
end
end
function yume.ButterflyCounter()
Duel.AddCustomActivityCounter(71401001,ACTIVITY_CHAIN,yume.ButterflyCounterFilter)
end
function yume.ButterflyCounterFilter(re,tp,cid)
return not re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function yume.RegButterflyCostLimit(e,tp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(yume.ButterflyAcLimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function yume.ButterflyAcLimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function yume.AddThisCardBanishedAlreadyCheck(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_REMOVE)
e1:SetCondition(aux.ThisCardInGraveAlreadyCheckReg)
c:RegisterEffect(e1)
return e1
end
function yume.AddButterflySpell(c,id)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401001,2))
e1:SetRange(LOCATION_HAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,id)
e1:SetCost(yume.ButterflyPlaceCost)
e1:SetTarget(yume.ButterflyPlaceTg)
e1:SetOperation(yume.ButterflySpellOp)
c:RegisterEffect(e1)
end
function yume.ButterflyPlaceTg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and e:GetHandler():CheckUniqueOnField(tp) end
end
function yume.ButterflyPlaceCost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function yume.ButterflySpellOp(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
c:RegisterEffect(e1)
end
end
function yume.AddButterflyTrap(c,id)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401001,3))
e1:SetRange(LOCATION_HAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,id)
e1:SetCost(yume.ButterflyPlaceCost)
e1:SetTarget(yume.ButterflyPlaceTg)
e1:SetOperation(yume.ButterflyTrapOp)
c:RegisterEffect(e1)
end
function yume.ButterflyTrapOp(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_TRAP+TYPE_CONTINUOUS)
c:RegisterEffect(e1)
end
end
\ No newline at end of file
--蝶忆-「染」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401003.initial_effect(c)
yume.AddButterflyTrap(c,71401003)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401003,0))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetCountLimit(1,71501003)
e2:SetCondition(c71401003.con2)
e2:SetCost(c71401003.cost2)
e2:SetTarget(c71401003.tg2)
e2:SetOperation(c71401003.op2)
c:RegisterEffect(e2)
yume.ButterflyCounter()
end
function c71401003.con2(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and e:GetHandler():GetType()==TYPE_TRAP+TYPE_CONTINUOUS
end
function c71401003.filterc2(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c71401003.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401003.filterc2,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401003.filterc2,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401003.filter2(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsAttribute(ATTRIBUTE_LIGHT) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and (c:IsAbleToHand() or not c:IsForbidden() and c:CheckUniqueOnField(tp))
end
function c71401003.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401003.filter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED)
end
function c71401003.filter2a(c)
return c:IsAbleToRemove() and c:IsFaceup()
end
function c71401003.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c71401003.filter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
local tc=g:GetFirst()
if tc then
local b1=tc:IsAbleToHand()
local b2=not tc:IsForbidden() and tc:CheckUniqueOnField(tp)
local flag=0
if b1 and (not b2 or Duel.SelectOption(tp,1190,aux.Stringid(71401003,1))==0) then
flag=Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
flag=1
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
local rg=Duel.GetMatchingGroup(c71401003.filter2a,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if flag>0 and rg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(71401003,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local srg=rg:Select(tp,1,1,nil)
Duel.Remove(srg,POS_FACEUP,REASON_EFFECT)
end
end
--蝶忆-「染」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401003.initial_effect(c)
yume.AddButterflyTrap(c,71401003)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401003,0))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetCountLimit(1,71501003)
e2:SetCondition(c71401003.con2)
e2:SetCost(c71401003.cost2)
e2:SetTarget(c71401003.tg2)
e2:SetOperation(c71401003.op2)
c:RegisterEffect(e2)
yume.ButterflyCounter()
end
function c71401003.con2(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and e:GetHandler():GetType()==TYPE_TRAP+TYPE_CONTINUOUS
end
function c71401003.filterc2(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c71401003.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401003.filterc2,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401003.filterc2,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401003.filter2(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsAttribute(ATTRIBUTE_LIGHT) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and (c:IsAbleToHand() or not c:IsForbidden() and c:CheckUniqueOnField(tp))
end
function c71401003.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401003.filter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED)
end
function c71401003.filter2a(c)
return c:IsAbleToRemove() and c:IsFaceup()
end
function c71401003.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,c71401003.filter2,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
local tc=g:GetFirst()
if tc then
local b1=tc:IsAbleToHand()
local b2=not tc:IsForbidden() and tc:CheckUniqueOnField(tp)
local flag=0
if b1 and (not b2 or Duel.SelectOption(tp,1190,aux.Stringid(71401003,1))==0) then
flag=Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
flag=1
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
local rg=Duel.GetMatchingGroup(c71401003.filter2a,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if flag>0 and rg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(71401003,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local srg=rg:Select(tp,1,1,nil)
Duel.Remove(srg,POS_FACEUP,REASON_EFFECT)
end
end
end
\ No newline at end of file
--蝶现-「像」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401004.initial_effect(c)
--same effect send this card to grave and spsummon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401004,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetCountLimit(1,71401004)
e1:SetLabelObject(e0)
e1:SetCost(c71401004.cost1)
e1:SetCondition(c71401004.con1)
e1:SetTarget(c71401004.tg1)
e1:SetOperation(c71401004.op1)
c:RegisterEffect(e1)
local e1a=e1:Clone()
e1a:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e1a)
--banish
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401004,1))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetCountLimit(1,71501004)
e2:SetCondition(c71401004.con2)
e2:SetCost(c71401004.cost2)
e2:SetTarget(c71401004.tg2)
e2:SetOperation(c71401004.op2)
c:RegisterEffect(e2)
yume.ButterflyCounter()
end
function c71401004.filtercon1(c,tp,se)
return se==nil or c:GetReasonEffect()~=se
end
function c71401004.con1(e,tp,eg,ep,ev,re,r,rp)
local se=e:GetLabelObject():GetLabelObject()
return eg:IsExists(c71401004.filtercon1,1,nil,tp,se) or e:GetHandler():IsLocation(LOCATION_HAND)
end
function c71401004.filterc1(c,tp)
return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER) and c:IsAbleToRemoveAsCost()
and Duel.GetMZoneCount(tp,c)>0
end
function c71401004.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401004.filterc1,tp,LOCATION_MZONE,0,1,nil,tp) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401004.filterc1,tp,LOCATION_MZONE,0,1,1,nil,tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401004.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c71401004.op1(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 c71401004.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function c71401004.con2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousPosition(POS_FACEUP)
end
function c71401004.filter2ext(c)
return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS)
end
function c71401004.filter2(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsAbleToRemove()
end
function c71401004.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401004.filter2ext,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(c71401004.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c71401004.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401004.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_SPELLCASTER))
e1:SetValue(1)
Duel.RegisterEffect(e1,tp)
--蝶现-「像」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401004.initial_effect(c)
--same effect sends this card to grave or banishes it, and spsummon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
local e0a=yume.AddThisCardBanishedAlreadyCheck(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71401004,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetCountLimit(1,71401004)
e1:SetCost(c71401004.cost1)
e1:SetTarget(c71401004.tg1)
e1:SetOperation(c71401004.op1)
c:RegisterEffect(e1)
local e1a=e1:Clone()
e1a:SetCode(EVENT_SPSUMMON_SUCCESS)
e1a:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1a:SetCondition(c71401004.con1)
e1a:SetLabelObject(e0)
c:RegisterEffect(e1a)
local e1b=e1a:Clone()
e1b:SetCode(EVENT_SPSUMMON_SUCCESS)
e1b:SetRange(LOCATION_REMOVED)
e1b:SetLabelObject(e0a)
c:RegisterEffect(e1b)
--banish
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401004,1))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetCountLimit(1,71501004)
e2:SetCondition(c71401004.con2)
e2:SetCost(c71401004.cost2)
e2:SetTarget(c71401004.tg2)
e2:SetOperation(c71401004.op2)
c:RegisterEffect(e2)
yume.ButterflyCounter()
end
function c71401004.filtercon1(c,tp,se)
return se==nil or c:GetReasonEffect()~=se
end
function c71401004.con1(e,tp,eg,ep,ev,re,r,rp)
local se=e:GetLabelObject():GetLabelObject()
return eg:IsExists(c71401004.filtercon1,1,nil,tp,se)
end
function c71401004.filterc1(c,tp)
return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER) and c:IsAbleToRemoveAsCost()
and Duel.GetMZoneCount(tp,c)>0
end
function c71401004.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401004.filterc1,tp,LOCATION_MZONE,0,1,nil,tp) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401004.filterc1,tp,LOCATION_MZONE,0,1,1,nil,tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401004.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c71401004.op1(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 c71401004.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function c71401004.con2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousPosition(POS_FACEUP)
end
function c71401004.filter2ext(c)
return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS)
end
function c71401004.filter2(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsAbleToRemove()
end
function c71401004.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401004.filter2ext,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(c71401004.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c71401004.op2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401004.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_SPELLCASTER))
e1:SetValue(1)
Duel.RegisterEffect(e1,tp)
end
\ No newline at end of file
--蝶幻-「胧」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401008.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_SPELLCASTER),aux.NonTuner(Card.IsRace,RACE_SPELLCASTER),1)
c:EnableReviveLimit()
--indestructable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_SZONE,0)
e1:SetTarget(c71401008.indtg)
e1:SetValue(1)
c:RegisterEffect(e1)
--place
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401008,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,71401008)
e2:SetCost(c71401008.cost2)
e2:SetOperation(c71401008.op2)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(71401008,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,71501008)
e3:SetCondition(c71401008.con3)
e3:SetCost(c71401008.cost3)
e3:SetTarget(c71401008.tg3)
e3:SetOperation(c71401008.op3)
c:RegisterEffect(e3)
yume.ButterflyCounter()
end
function c71401008.indtg(e,c)
return c:GetOriginalType()&TYPE_MONSTER~=0
end
function c71401008.filterc2(c,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToRemoveAsCost()
and (c:IsLocation(LOCATION_SZONE) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) and Duel.IsExistingMatchingCard(c71401008.filter2,tp,LOCATION_DECK,0,1,nil,c,tp)
end
function c71401008.filter2(c,cc,tp)
return c:IsLevel(4) and not c:IsForbidden() and c:CheckUniqueOnField(tp,LOCATION_ONFIELD,cc)
end
function c71401008.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401008.filterc2,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401008.filterc2,tp,LOCATION_ONFIELD,0,1,1,nil,tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401008.op2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local tc=Duel.SelectMatchingCard(tp,c71401008.filter2,tp,LOCATION_DECK,0,1,1,nil,nil,tp):GetFirst()
if tc then
local c=e:GetHandler()
local ctype=Duel.SelectOption(tp,aux.Stringid(71401008,2),aux.Stringid(71401008,3))==0 and TYPE_SPELL or TYPE_TRAP
if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(ctype+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
if c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(71401008,4)) then
Duel.BreakEffect()
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e2=Effect.CreateEffect(c)
e2:SetCode(EFFECT_CHANGE_TYPE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e2:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
c:RegisterEffect(e2)
end
end
end
end
end
function c71401008.con3(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetType()==TYPE_SPELL+TYPE_CONTINUOUS
end
function c71401008.filterc3(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c71401008.cost3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401008.filterc3,tp,LOCATION_MZONE,0,1,nil) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401008.filterc3,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401008.tg3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
end
function c71401008.op3(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local sg=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,1,nil)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
--蝶幻-「胧」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401008.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_SPELLCASTER),aux.NonTuner(Card.IsRace,RACE_SPELLCASTER),1)
c:EnableReviveLimit()
--indestructable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_SZONE,0)
e1:SetTarget(c71401008.indtg)
e1:SetValue(1)
c:RegisterEffect(e1)
--place
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401008,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,71401008)
e2:SetCost(c71401008.cost2)
e2:SetOperation(c71401008.op2)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(71401008,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,71501008)
e3:SetCondition(c71401008.con3)
e3:SetCost(c71401008.cost3)
e3:SetTarget(c71401008.tg3)
e3:SetOperation(c71401008.op3)
c:RegisterEffect(e3)
yume.ButterflyCounter()
end
function c71401008.indtg(e,c)
return c:GetOriginalType()&TYPE_MONSTER~=0
end
function c71401008.filterc2(c,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToRemoveAsCost()
and (c:IsLocation(LOCATION_SZONE) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) and Duel.IsExistingMatchingCard(c71401008.filter2,tp,LOCATION_DECK,0,1,nil,c,tp)
end
function c71401008.filter2(c,cc,tp)
return c:IsLevel(4) and not c:IsForbidden() and c:CheckUniqueOnField(tp,LOCATION_ONFIELD,cc)
end
function c71401008.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401008.filterc2,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401008.filterc2,tp,LOCATION_ONFIELD,0,1,1,nil,tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401008.op2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local tc=Duel.SelectMatchingCard(tp,c71401008.filter2,tp,LOCATION_DECK,0,1,1,nil,nil,tp):GetFirst()
if tc then
local c=e:GetHandler()
local ctype=Duel.SelectOption(tp,aux.Stringid(71401008,2),aux.Stringid(71401008,3))==0 and TYPE_SPELL or TYPE_TRAP
if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(ctype+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
if c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.SelectYesNo(tp,aux.Stringid(71401008,4)) then
Duel.BreakEffect()
if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e2=Effect.CreateEffect(c)
e2:SetCode(EFFECT_CHANGE_TYPE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e2:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
c:RegisterEffect(e2)
end
end
end
end
end
function c71401008.con3(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetType()==TYPE_SPELL+TYPE_CONTINUOUS
end
function c71401008.filterc3(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c71401008.cost3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c71401008.filterc3,tp,LOCATION_MZONE,0,1,nil) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71401008.filterc3,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401008.tg3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
end
function c71401008.op3(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local sg=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,1,nil)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -21,7 +21,6 @@ function c71401009.initial_effect(c)
e2:SetHintTiming(0,TIMING_END_PHASE+TIMING_EQUIP)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,71401009)
e2:SetCondition(c71401009.con2)
e2:SetCost(c71401009.cost2)
e2:SetTarget(c71401009.tg2)
e2:SetOperation(c71401009.op2)
......@@ -49,9 +48,6 @@ end
function c71401009.atkval(e,c)
return Duel.GetMatchingGroupCount(c71401009.atkfilter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)*200
end
function c71401009.con2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
end
function c71401009.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) and Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
......
--蝶境-「漫」
xpcall(function() require("expansions/script/c71401001") end,function() require("script/c71401001") end)
function c71401010.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,nil,2,2,c71401010.lcheck)
--target
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_GRAVE+LOCATION_REMOVED,LOCATION_GRAVE+LOCATION_REMOVED)
e1:SetTarget(c71401010.tg1)
e1:SetValue(aux.tgoval)
c:RegisterEffect(e1)
--spsummon from hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71401010,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1,71401010)
e2:SetTarget(c71401010.tg2)
e2:SetCost(c71401010.cost2)
e2:SetOperation(c71401010.op2)
c:RegisterEffect(e2)
--place
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(71401010,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetCountLimit(1,71501010)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetCost(c71401010.cost3)
e3:SetTarget(c71401010.tg3)
e3:SetOperation(c71401010.op3)
c:RegisterEffect(e3)
yume.ButterflyCounter()
end
function c71401010.lcheck(g)
return g:GetClassCount(Card.GetLinkAttribute)==g:GetCount()
end
function c71401010.tg1(e,c)
return c:IsRace(RACE_SPELLCASTER) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
end
function c71401010.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 end
yume.RegButterflyCostLimit(e,tp)
end
function c71401010.tg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetLinkedGroupCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c71401010.op2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local lct=c:GetLinkedGroupCount()
if lct==0 then return end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetMatchingGroup(Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,nil,e,tp)
if ft<=0 or g:GetCount()==0 then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local ct=math.min(g:GetClassCount(Card.GetAttribute),ft,lct)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,aux.dabcheck,false,1,ct)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
function c71401010.filterc3(c)
return c:IsAbleToRemoveAsCost() and c:IsRace(RACE_SPELLCASTER)
end
function c71401010.fselect(g,tp)
return aux.dabcheck(g) and Duel.IsExistingMatchingCard(c71401010.filter3,tp,LOCATION_HAND,0,1,g,tp)
end
function c71401010.filter3(c,tp)
return c:IsType(TYPE_MONSTER) and not c:IsForbidden() and c:CheckUniqueOnField(tp,LOCATION_ONFIELD,nil)
end
function c71401010.cost3(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c71401010.filterc3,tp,LOCATION_HAND,0,nil)
if chk==0 then return Duel.GetCustomActivityCount(71401001,tp,ACTIVITY_CHAIN)==0 and g:CheckSubGroup(c71401010.fselect,2,2,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroup(tp,c71401010.fselect,false,2,2,tp)
Duel.Remove(sg,POS_FACEUP,REASON_COST)
yume.RegButterflyCostLimit(e,tp)
end
function c71401010.tg3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
if e:GetHandler():IsLocation(LOCATION_GRAVE) then
e:SetCategory(CATEGORY_GRAVE_SPSUMMON+CATEGORY_SPECIAL_SUMMON)
else
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
end
end
function c71401010.op3(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local tc=Duel.SelectMatchingCard(tp,c71401010.filter3,tp,LOCATION_HAND,0,1,1,nil,tp):GetFirst()
if tc then
local c=e:GetHandler()
local ctype=Duel.SelectOption(tp,aux.Stringid(71401010,2),aux.Stringid(71401010,3))==0 and TYPE_SPELL or TYPE_TRAP
if Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(ctype+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
if c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.SelectYesNo(tp,aux.Stringid(71401010,4)) then
Duel.BreakEffect()
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
end
end
\ No newline at end of file
--天空之都
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--change effect type
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(id)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(1,0)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetRange(LOCATION_FZONE)
e3:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_REMOVE)
c:RegisterEffect(e4)
end
function s.cfilter(c,tp)
return c:IsSetCard(0x3285) and c:IsType(TYPE_MONSTER) and c:IsPreviousControler(tp)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter,1,nil,tp)
end
function s.tdfilter(c)
return c:IsSetCard(0x3285) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED)
end
function s.spfilter(c,tp)
return c:IsType(TYPE_MONSTER) and c:IsPreviousControler(tp) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,3,nil)
if g:GetCount()>0 then
if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and g:IsExists(s.spfilter,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
local sg1=g:Filter(s.spfilter,nil,e,tp)
local sg=sg1:Select(tp,1,1,nil)
local sc=sg:GetFirst()
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)
g:RemoveCard(sc)
end
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
end
end
--高性能机动Ⅰ型
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(s.spcon)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--equip
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_EQUIP+CATEGORY_HANDES)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetTarget(s.eqtg)
e2:SetOperation(s.eqop)
c:RegisterEffect(e2)
--spsummon cost
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SPSUMMON_COST)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCost(s.spcost)
e3:SetOperation(s.spcop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
end
function s.counterfilter(c)
return c:IsSetCard(0x3285)
end
function s.spfilter(c,ft,tp)
return (ft>0 or (c:IsControler(tp) and c:GetSequence()<5))
and (c:IsAbleToDeckAsCost() or c:IsAbleToExtraAsCost())
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil,ft,tp)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),ft,tp)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function s.eqfilter(c,tp)
return c:IsSetCard(0x3285) and c:IsType(TYPE_MONSTER) and c:CheckUniqueOnField(tp) and not c:IsForbidden() and Duel.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,1,c)
end
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1)
end
function s.eqfilter2(c,tp)
return c:IsSetCard(0x3285) and c:IsType(TYPE_MONSTER) and c:CheckUniqueOnField(tp) and not c:IsForbidden()
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or not Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,tp) then return end
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
if Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT+REASON_DISCARD)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,s.eqfilter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,tp)
local tc=g:GetFirst()
if tc then
if not Duel.Equip(tp,tc,c) then return end
--equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetLabelObject(c)
e1:SetValue(s.eqlimit)
tc:RegisterEffect(e1)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(500)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
--def up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENSE)
e3:SetValue(500)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
end
end
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
end
function s.spcost(e,c,tp)
return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
end
function s.spcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsSetCard(0x3285)
end
\ No newline at end of file
--高性能机动Ⅱ型
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(s.spcon)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--spsummon cost
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SPSUMMON_COST)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCost(s.spcost)
e3:SetOperation(s.spcop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e4:SetCondition(s.spcon2)
e4:SetTarget(s.sptg2)
e4:SetOperation(s.spop2)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetHintTiming(0,TIMING_END_PHASE)
e5:SetCondition(s.spcon3)
c:RegisterEffect(e5)
end
function s.counterfilter(c)
return c:IsSetCard(0x3285)
end
function s.spfilter(c,ft,tp)
return (ft>0 or (c:IsControler(tp) and c:GetSequence()<5))
and (c:IsAbleToDeckAsCost() or c:IsAbleToExtraAsCost())
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil,ft,tp)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),ft,tp)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function s.spcost(e,c,tp)
return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
end
function s.spcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsSetCard(0x3285)
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget() and not Duel.IsPlayerAffectedByEffect(tp,96030200)
end
function s.sptg2(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,true) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function s.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x3285) and c:IsType(TYPE_MONSTER)
end
function s.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,true,POS_FACEUP)~=0 then
if Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,c)
and Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
end
end
end
function s.spcon3(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,96030200)
end
\ No newline at end of file
--高性能机动Ⅲ型
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(s.spcon)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--spsummon cost
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_COST)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCost(s.spcost)
e2:SetOperation(s.spcop)
c:RegisterEffect(e2)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
--
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_REMOVE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
end
function s.counterfilter(c)
return c:IsSetCard(0x3285)
end
function s.spfilter(c,ft,tp)
return (ft>0 or (c:IsControler(tp) and c:GetSequence()<5))
and (c:IsAbleToDeckAsCost() or c:IsAbleToExtraAsCost())
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil,ft,tp)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),ft,tp)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function s.spcost(e,c,tp)
return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
end
function s.spcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsSetCard(0x3285)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_EXTRA,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_EXTRA)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
--高性能机动Ⅳ型
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(s.spcon)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--spsummon cost
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_COST)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCost(s.spcost)
e2:SetOperation(s.spcop)
c:RegisterEffect(e2)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e4:SetCondition(s.spcon2)
e4:SetTarget(s.sptg2)
e4:SetOperation(s.spop2)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetHintTiming(0,TIMING_END_PHASE)
e5:SetCondition(s.spcon3)
c:RegisterEffect(e5)
end
function s.counterfilter(c)
return c:IsSetCard(0x3285)
end
function s.spfilter(c,ft,tp)
return (ft>0 or (c:IsControler(tp) and c:GetSequence()<5))
and (c:IsAbleToDeckAsCost() or c:IsAbleToExtraAsCost())
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil,ft,tp)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),ft,tp)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function s.spcost(e,c,tp)
return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
end
function s.spcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsSetCard(0x3285)
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget() and not Duel.IsPlayerAffectedByEffect(tp,96030200)
end
function s.filter0(c,e)
return c:IsLocation(LOCATION_ONFIELD) 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 (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_ONFIELD,0,nil,e)
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.spop2(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_ONFIELD,0,nil,e)
local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,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 mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1)
Duel.SendtoDeck(mat1,nil,SEQ_DECKSHUFFLE,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function s.spcon3(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,96030200)
end
\ No newline at end of file
--高性能机动Ⅴ型
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND+LOCATION_DECK)
e1:SetCondition(s.spcon)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--spsummon cost
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SPSUMMON_COST)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCost(s.spcost)
e3:SetOperation(s.spcop)
c:RegisterEffect(e3)
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE)
e4:SetCondition(s.spcon2)
e4:SetTarget(s.sptg2)
e4:SetOperation(s.spop2)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetHintTiming(0,TIMING_END_PHASE)
e5:SetCondition(s.spcon3)
c:RegisterEffect(e5)
end
function s.counterfilter(c)
return c:IsSetCard(0x3285)
end
function s.spfilter(c,ft,tp)
return (ft>0 or (c:IsControler(tp) and c:GetSequence()<5))
and (c:IsAbleToDeckAsCost() or c:IsAbleToExtraAsCost())
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return ft>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil,ft,tp)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),ft,tp)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function s.spcost(e,c,tp)
return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
end
function s.spcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.splimit(e,c)
return not c:IsSetCard(0x3285)
end
function s.sdfilter(c)
return c:IsFacedown() or not c:IsSetCard(0x3285)
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget() and not Duel.IsExistingMatchingCard(s.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) and not Duel.IsPlayerAffectedByEffect(tp,96030200)
end
function s.filter(c)
return c:IsSummonable(true,nil)
end
function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function s.exrtg(e,c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function s.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--extra material
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_ADD_EXTRA_TRIBUTE)
e3:SetTargetRange(LOCATION_ONFIELD,0)
e3:SetTarget(s.exrtg)
e3:SetValue(POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e4:SetTargetRange(LOCATION_HAND,0)
e4:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_MONSTER))
e4:SetLabelObject(e3)
e4:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e4,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil)
end
end
function s.spcon3(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,96030200)
end
\ No newline at end of file
--高性能机动 机动武装
local s,id=GetID()
function s.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunFunRep(c,s.mfilter1,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE),1,63,true)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetTarget(s.destg)
e3:SetOperation(s.desop)
c:RegisterEffect(e3)
--destroy replace
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_DESTROY_REPLACE)
e4:SetTarget(s.reptg)
c:RegisterEffect(e4)
end
function s.mfilter1(c)
return c:IsRace(RACE_MACHINE) and c:IsFusionType(TYPE_FUSION)
end
function s.seqfil(c,bc)
local seq=c:GetSequence()
local seq2=4-bc:GetSequence()
local a=seq2==5 and (seq==0 or seq==1 or seq==2)
local b=seq2==6 and (seq==2 or seq==3 or seq==4)
local m=seq<5 and seq2<5 and math.abs(seq2-seq)<=1
local d=(seq==5 and c:IsLocation(LOCATION_MZONE)) and (seq2==0 or seq2==1 or seq2==2)
local e=(seq==6 and c:IsLocation(LOCATION_MZONE)) and (seq2==2 or seq2==3 or seq2==4)
return a or b or m or d or e
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return true end
local g=Duel.GetMatchingGroup(s.seqfil,tp,0,LOCATION_ONFIELD,nil,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),1-tp,LOCATION_ONFIELD)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(s.seqfil,tp,0,LOCATION_ONFIELD,nil,c)
Duel.Destroy(g,REASON_EFFECT)
end
function s.repfilter(c)
return c:IsSetCard(0x3285) and c:IsAbleToRemove()
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsReason(REASON_BATTLE+REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_ONFIELD,0,1,c) end
if Duel.SelectEffectYesNo(tp,c,96) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE)
local g=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_ONFIELD,0,1,1,c)
if Duel.Remove(g,POS_FACEUP,REASON_EFFECT+REASON_REPLACE)~=0 and Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_ONFIELD,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil)
if #g2>0 then
Duel.HintSelection(g2)
Duel.Destroy(g2,REASON_EFFECT)
end
end
return true
else return false end
end
\ No newline at end of file
--高性能机动 武装核心
local s,id=GetID()
function s.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE),2,true)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetRange(LOCATION_REMOVED)
e1:SetCountLimit(1,id)
e1:SetCondition(s.eqcon)
e1:SetTarget(s.eqtg)
e1:SetOperation(s.eqop)
c:RegisterEffect(e1)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,id+10000)
e4:SetCondition(s.spcon2)
e4:SetTarget(s.sptg2)
e4:SetOperation(s.spop2)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetHintTiming(0,TIMING_END_PHASE)
e5:SetCondition(s.spcon3)
c:RegisterEffect(e5)
end
function s.cfilter(c,tp)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:GetControler()==tp
end
function s.tgfilter(c,g)
return g:IsContains(c)
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter,1,nil,tp) and not eg:IsContains(e:GetHandler())
end
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=eg:Filter(s.cfilter,nil,tp)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,g) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,g)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc then return end
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsLocation(LOCATION_SZONE) or c:IsFacedown() then return end
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:IsFacedown() or not tc:IsRelateToEffect(e) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
Duel.Equip(tp,c,tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(s.eqlimit)
e1:SetLabelObject(tc)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(500)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENSE)
e3:SetValue(500)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e3)
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetEquipTarget() and not Duel.IsPlayerAffectedByEffect(tp,96030200)
end
function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
local eqc=e:GetHandler():GetEquipTarget()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,eqc) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,eqc)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function s.ofilter1(c,tp)
return c:IsType(TYPE_FIELD) and c:GetActivateEffect():IsActivatable(tp,true,true) and c:IsCode(96030200)
end
function s.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local c=e:GetHandler()
local eqc=c:GetEquipTarget()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Equip(tp,tc,eqc) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(s.eqlimit)
e1:SetLabelObject(eqc)
tc:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(500)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENSE)
e3:SetValue(500)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
local sg=Duel.GetMatchingGroup(s.ofilter1,tp,LOCATION_DECK,0,nil,tp)
if sg:GetCount()<1 then return end
if Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
local tc2=sg:GetFirst()
local fc=Duel.GetFieldCard(tp,LOCATION_SZONE,5)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc2,tp,tp,LOCATION_FZONE,POS_FACEUP,true)
local te=tc2:GetActivateEffect()
te:UseCountLimit(tp,1,true)
local tep=tc2:GetControler()
local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
Duel.RaiseEvent(tc2,4179255,te,0,tp,tp,Duel.GetCurrentChain())
end
end
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
end
function s.spcon3(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,96030200)
end
\ No newline at end of file
--封龙殿
function c96030212.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_TRIGGER)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetCondition(c96030212.efcon)
e2:SetTarget(c96030212.eftg)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(96030212,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,96030212)
e3:SetTarget(c96030212.thtg)
e3:SetOperation(c96030212.thop)
c:RegisterEffect(e3)
end
function c96030212.cfilter1(c,seq)
return c:IsFaceup() and c:IsSetCard(0x5285) and c:IsRace(RACE_SPELLCASTER) and seq==c:GetSequence()
end
function c96030212.efcon(e,tp,eg,ep,ev,re,r,rp)
local seq=e:GetHandler():GetSequence()
return Duel.IsExistingMatchingCard(c96030212.cfilter1,tp,LOCATION_MZONE,0,1,nil,seq)
end
function c96030212.eftg(e,c)
return e:GetHandler():GetColumnGroup():IsContains(c)
end
function c96030212.thfilter1(c)
return c:IsSetCard(0x5285) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c96030212.thfilter2(c)
return c:IsRace(RACE_DRAGON) and c:IsLevelAbove(8) and c:IsType(TYPE_RITUAL) and c:IsAbleToHand()
end
function c96030212.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c96030212.thfilter1,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c96030212.cfilter1(c)
return c:IsFaceup() and c:IsSetCard(0x5285) and c:IsRace(RACE_SPELLCASTER)
end
function c96030212.thop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c96030212.thfilter1,tp,LOCATION_DECK,0,1,nil) then
if Duel.IsExistingMatchingCard(c96030212.thfilter2,tp,LOCATION_DECK,0,1,nil) and Duel.IsExistingMatchingCard(c96030212.cfilter1,tp,LOCATION_MZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(96030212,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c96030212.thfilter2,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c96030212.thfilter1,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
elseif Duel.IsExistingMatchingCard(c96030212.thfilter2,tp,LOCATION_DECK,0,1,nil) and Duel.IsExistingMatchingCard(c96030212.cfilter1,tp,LOCATION_MZONE,0,1,nil) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c96030212.thfilter2,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
\ No newline at end of file
--封龙焚烬
function c96030213.initial_effect(c)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(96030213,0))
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,96030213)
e1:SetCost(c96030213.thcost)
e1:SetTarget(c96030213.thtg)
e1:SetOperation(c96030213.thop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(c96030213.effilter)
e2:SetValue(aux.indoval)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(96130213,1))
e3:SetCategory(CATEGORY_RELEASE)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetCountLimit(1,96130213)
e3:SetTarget(c96030213.rltg)
e3:SetOperation(c96030213.rlop)
c:RegisterEffect(e3)
end
function c96030213.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsPublic() end
end
function c96030213.filter1(c,e,tp)
return c:IsSetCard(0x5285) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c96030213.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c96030213.filter1,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND+LOCATION_ONFIELD)
end
function c96030213.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
if sg:GetCount()>0 and Duel.SendtoDeck(sg,nil,SEQ_DECKTOP,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c96030213.filter1,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
function c96030213.effilter(e,c)
return c:IsSetCard(0x5285) or c:IsAttribute(ATTRIBUTE_FIRE)
end
function c96030213.rlfilter(c)
return (c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)) and c:IsReleasableByEffect()
end
function c96030213.filter2(c)
return c:IsSetCard(0x5285) and (c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)) and c:IsAbleToHand()
end
function c96030213.rltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsReleasableByEffect() end
if chk==0 then return Duel.IsExistingTarget(c96030213.rlfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectTarget(tp,c96030213.rlfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_RELEASE,g,1,0,0)
end
function c96030213.rlop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 and tc:IsPreviousControler(tp) and Duel.IsExistingMatchingCard(c96030213.filter2,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(96030213,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c96030213.filter2,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
\ No newline at end of file
--封龙山
function c96030214.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_TRIGGER)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetCondition(c96030214.efcon)
e2:SetTarget(c96030214.eftg)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(96030214,0))
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_SZONE)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e3:SetCountLimit(1,96030214)
e3:SetTarget(c96030214.mvtg)
e3:SetOperation(c96030214.mvop)
c:RegisterEffect(e3)
end
function c96030214.cfilter1(c,seq)
return c:IsFaceup() and c:IsSetCard(0x5285) and c:IsRace(RACE_SPELLCASTER) and seq==c:GetSequence()
end
function c96030214.efcon(e,tp,eg,ep,ev,re,r,rp)
local seq=e:GetHandler():GetSequence()
return Duel.IsExistingMatchingCard(c96030214.cfilter1,tp,LOCATION_MZONE,0,1,nil,seq)
end
function c96030214.eftg(e,c)
return e:GetHandler():GetColumnGroup():IsContains(c)
end
function c96030214.tdfilter(c)
return c:IsFaceup() and c:GetSequence()<5
end
function c96030214.mvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c96030214.tdfilter,tp,LOCATION_MZONE,0,2,nil) end
local g=Duel.SelectTarget(tp,c96030214.tdfilter,tp,LOCATION_MZONE,0,2,2,nil)
end
function c96030214.filter(c,e,tp)
return c:IsRace(RACE_DRAGON) and c:IsType(TYPE_RITUAL) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true)
end
function c96030214.mvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
local tc1=tg:GetFirst()
local tc2=tg:GetNext()
Duel.SwapSequence(tc1,tc2)
if tc1:IsSetCard(0x5285) and tc1:IsRace(RACE_SPELLCASTER) and tc2:IsSetCard(0x5285) and tc2:IsRace(RACE_SPELLCASTER) and Duel.IsExistingMatchingCard(c96030214.filter,tp,LOCATION_HAND,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(96030214,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c96030214.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
tc:SetMaterial(nil)
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
tc:CompleteProcedure()
end
end
end
\ No newline at end of file
--封龙舞姬 黯龙使
function c96030215.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,96030215)
e1:SetTarget(c96030215.tg)
e1:SetOperation(c96030215.op)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_MOVE)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,96130215)
e2:SetCondition(c96030215.descon)
e2:SetTarget(c96030215.destg)
e2:SetOperation(c96030215.desop)
c:RegisterEffect(e2)
end
function c96030215.filter(c)
return c:IsAbleToDeck() and not c:IsPublic()
end
function c96030215.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c96030215.tffilter,tp,LOCATION_DECK,0,nil,tp)
if chk==0 then return g:GetCount()>0 and Duel.IsExistingMatchingCard(c96030215.filter,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=Duel.SelectMatchingCard(tp,c96030215.filter,tp,LOCATION_HAND,0,1,1,nil)
Duel.ConfirmCards(1-tp,g)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c96030215.tffilter(c,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsType(TYPE_CONTINUOUS) and c:IsSetCard(0x5285)
and not c:IsForbidden() and c:CheckUniqueOnField(tp)
end
function c96030215.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
Duel.ShuffleDeck(tp)
local g=Duel.GetMatchingGroup(c96030215.tffilter,tp,LOCATION_DECK,0,nil,tp)
if g:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local sg=g:Select(tp,1,1,nil)
Duel.MoveToField(sg:GetFirst(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
if Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0)>0 and Duel.SelectYesNo(tp,aux.Stringid(96030215,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local fd=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0)
Duel.Hint(HINT_ZONE,tp,fd)
local seq=math.log(fd,2)
local pseq=c:GetSequence()
Duel.MoveSequence(c,seq)
end
end
end
end
function c96030215.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsLocation(LOCATION_MZONE)
and (c:GetPreviousSequence()~=c:GetSequence() or c:GetPreviousControler()~=tp)
end
function c96030215.thfilter(c)
return not c:IsCode(49131917) and c:IsSetCard(0x17d) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c96030215.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,600)
end
function c96030215.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5285) and c:IsType(TYPE_RITUAL)
end
function c96030215.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Damage(1-tp,600,REASON_EFFECT)
local seq=c:GetSequence()
local g=c:GetColumnGroup():Filter(Card.IsControler,nil,1-tp)
if g:GetCount()>0 and Duel.IsExistingMatchingCard(c96030215.cfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(96030215,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
tc=g:Select(tp,1,1,nil):GetFirst()
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
Duel.ShuffleDeck(1-tp)
end
end
\ No newline at end of file
--封龙舞姬 苍龙使
function c96030216.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,96030216)
e1:SetTarget(c96030216.tg)
e1:SetOperation(c96030216.op)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_MOVE)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,96130216)
e2:SetCondition(c96030216.retcon)
e2:SetTarget(c96030216.rettg)
e2:SetOperation(c96030216.retop)
c:RegisterEffect(e2)
end
function c96030216.filter(c)
return c:IsAbleToDeck() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c96030216.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c96030216.tffilter,tp,LOCATION_DECK,0,nil,tp)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsReleasableByEffect() end
if chk==0 then return g:GetCount()>0 and Duel.IsExistingTarget(c96030216.filter,tp,LOCATION_ONFIELD,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectTarget(tp,c96030216.filter,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c96030216.tffilter(c,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsType(TYPE_CONTINUOUS) and c:IsSetCard(0x5285)
and not c:IsForbidden() and c:CheckUniqueOnField(tp)
end
function c96030216.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
Duel.ShuffleDeck(tp)
local g=Duel.GetMatchingGroup(c96030216.tffilter,tp,LOCATION_DECK,0,nil,tp)
if g:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local sg=g:Select(tp,1,1,nil)
Duel.MoveToField(sg:GetFirst(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
if Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0)>0 and Duel.SelectYesNo(tp,aux.Stringid(96030216,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local fd=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0)
Duel.Hint(HINT_ZONE,tp,fd)
local seq=math.log(fd,2)
local pseq=c:GetSequence()
Duel.MoveSequence(c,seq)
end
end
end
end
function c96030216.retcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsLocation(LOCATION_MZONE)
and (c:GetPreviousSequence()~=c:GetSequence() or c:GetPreviousControler()~=tp)
end
function c96030216.thfilter(c)
return not c:IsCode(49131917) and c:IsSetCard(0x17d) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c96030216.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,600)
end
function c96030216.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x5285) and c:IsType(TYPE_RITUAL)
end
function c96030216.retop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Recover(tp,600,REASON_EFFECT)
local seq=c:GetSequence()
local g=c:GetColumnGroup():Filter(Card.IsControler,nil,1-tp)
if g:GetCount()>0 and Duel.IsExistingMatchingCard(c96030216.cfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(96030216,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
tc=g:Select(tp,1,1,nil):GetFirst()
Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)
Duel.ShuffleDeck(1-tp)
end
end
\ No newline at end of file
--封龙炎舞
function c96030217.initial_effect(c)
aux.AddCodeList(c,96030213)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,96030217)
e1:SetTarget(c96030217.target)
e1:SetOperation(c96030217.activate)
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(96030217,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,96030217)
e2:SetCost(c96030217.thcost)
e2:SetTarget(c96030217.thtg)
e2:SetOperation(c96030217.thop)
c:RegisterEffect(e2)
end
function c96030217.rfilter1(c,e,tp)
return c:IsRace(RACE_DRAGON)
end
function c96030217.rfilter2(c,e,tp)
return bit.band(c:GetType(),0x81)==0x81 and c:IsCode(96030213) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true)
end
function c96030217.cfilter(c,e,tp)
return c:IsFaceup() and not c:IsImmuneToEffect(e) and c:IsControler(tp)
end
function c96030217.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetReleaseGroup(1-tp):Filter(c96030217.cfilter,nil,e,1-tp)
return Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,1,nil,c96030217.rfilter1,e,tp,mg1,nil,Card.GetLevel,"Equal")
or (mg2:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c96030217.rfilter2,tp,LOCATION_HAND,0,1,nil,e,tp))
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c96030217.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
::cancel::
local mg1=Duel.GetRitualMaterial(tp)
local mg2=Duel.GetReleaseGroup(1-tp):Filter(c96030217.cfilter,nil,e,1-tp)
local g1=Duel.GetMatchingGroup(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,nil,c96030217.rfilter1,e,tp,mg1,nil,Card.GetLevel,"Equal")
local g2=nil
local g=g1
if mg2:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
g2=Duel.GetMatchingGroup(c96030217.rfilter2,tp,LOCATION_HAND,0,nil,e,tp)
g=g1+g2
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=g:Select(tp,1,1,nil):GetFirst()
if tc then
local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,tc,tp)
else
mg:RemoveCard(tc)
end
if g1:IsContains(tc) and (not g2 or (g2:IsContains(tc) and not Duel.SelectYesNo(tp,aux.Stringid(96030217,2)))) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,true,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal")
aux.GCheckAdditional=nil
if not mat then goto cancel end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local matc=mg2:SelectUnselect(nil,tp,false,true,1,1)
if not matc then goto cancel end
local mat=Group.FromCards(matc)
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
end
Duel.BreakEffect()
if Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)>0 then
tc:CompleteProcedure()
end
end
end
function c96030217.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToDeckAsCost() end
Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function c96030217.thfilter(c)
return c:IsSetCard(0x5285) and c:IsType(TYPE_RITUAL) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c96030217.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c96030217.thfilter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c96030217.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c96030217.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c96030217.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
\ No newline at end of file
Glitchy = Glitchy or {}
self_reference_effect = nil
self_reference_tp = nil
LOCATION_ALL = LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE+LOCATION_SZONE+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA
EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER = 33720071
EFFECT_UTTER_CONFUSION_CONFIDENCE = 33720072
Glitchy.EnableTestChamber = false
Glitchy.TestChamberResult = 0
Glitchy.TestChamberResultGroup = {}
Glitchy.UndefinedActionWarning = false
GLITCHY_ENABLE_TEST_CHAMBER = 33720071
TEST_CHAMBER_TARGET = 0x1
TEST_CHAMBER_TOHAND = 0x2
--Modified functions
local duel_recover, duel_damage, aux_damcon1 = Duel.Recover, Duel.Damage, Auxiliary.damcon1
--Internal Archetypes
ARCHE_UTTER_CONFUSION = {33720051,33720052,33720053,33720070,33720071,33720072,33720073,33720074}
--TEST CHAMBER MECHANIC (necessary for UTTER CONFUSION - CONFIDENCE)
local _Hint, _IsCanBeEffectTarget, _IsAbleToHand, _IsAbleToHandAsCost, _SelectMatchingCard, _SelectTarget, _GetMatchingGroup, _GroupFilter, _GroupSelect, _FilterSelect, _SelectUnselect, _GroupMerge, _GroupClone, _SelectSubGroup,
_SelectSubGroupEach, _SelectWithSumEqual, _SelectWithSumGreater =
Duel.Hint, Card.IsCanBeEffectTarget, Card.IsAbleToHand, Card.IsAbleToHandAsCost, Duel.SelectMatchingCard, Duel.SelectTarget, Duel.GetMatchingGroup, Group.Filter, Group.Select, Group.FilterSelect, Group.SelectUnselect, Group.Merge, Group.Clone,
Group.SelectSubGroup, Group.SelectSubGroupEach, Group.SelectWithSumEqual, Group.SelectWithSumGreater
Duel.Hint = function(hinttype,p,hint)
if hint==HINTMSG_OPERATECARD then
Glitchy.UndefinedActionWarning = true
end
return _Hint(hinttype,p,hint)
end
Card.IsCanBeEffectTarget = function(c,e)
if Glitchy.EnableTestChamber and Glitchy.TestChamberResult&TEST_CHAMBER_TARGET==0 then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | TEST_CHAMBER_TARGET
end
return _IsCanBeEffectTarget(c,e)
end
Card.IsAbleToHand = function(c,...)
local x = {...}
local p = x[1]
if Glitchy.EnableTestChamber and Glitchy.TestChamberResult&TEST_CHAMBER_TOHAND==0 and (not p or p==self_reference_effect) then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | TEST_CHAMBER_TOHAND
end
return _IsAbleToHand(c,...)
end
Card.IsAbleToHandAsCost = function(c)
if Glitchy.EnableTestChamber and Glitchy.TestChamberResult&TEST_CHAMBER_TOHAND==0 then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | TEST_CHAMBER_TOHAND
end
return _IsAbleToHandAsCost(c)
end
Duel.SelectMatchingCard = function(p,f,pov,loc1,loc2,min,max,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
local test_chamber = _GetMatchingGroup(f,pov,loc1,loc2,exc,...)
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(test_chamber) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
local result = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
local player = p
local nloc1,nloc2 = loc1,loc2
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
player = 1-p
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if loc1&~(LOCATION_DECK+LOCATION_GRAVE)==0 and loc2==0 then
player = 1-p
else
local opt = loc1&(LOCATION_DECK+LOCATION_GRAVE)==0 and 2 or Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
nloc1=nloc1&(LOCATION_DECK+LOCATION_GRAVE)
nloc2=0
elseif opt==1 then
nloc1 = nloc1&~(LOCATION_DECK+LOCATION_GRAVE)
end
Duel.Recover = function(p,v,r,...)
if Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER) then
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER)}) do
local val=e:GetValue()
if val and (aux.GetValueType(val)=="number" or val(e,r,v)) then
if aux.GetValueType(val)~="number" then
val=val(e,r,v)
end
return duel_recover(p,val,r,...)
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectMatchingCard(player,f,pov,nloc1,nloc2,min,max,exc,...)
else
return _SelectMatchingCard(p,f,pov,loc1,loc2,min,max,exc,...)
return duel_recover(p,v,r,...)
end
end
Duel.GetMatchingGroup = function(f,pov,loc1,loc2,exc,...)
local g = _GetMatchingGroup(f,pov,loc1,loc2,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(g) do
f(tc,...)
Duel.Damage = function(p,v,r,...)
if Duel.IsPlayerAffectedByEffect(p,EFFECT_REVERSE_DAMAGE) and Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER) then
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER)}) do
local val=e:GetValue()
if val and (aux.GetValueType(val)=="number" or val(e,r|REASON_RDAMAGE,v)) then
if aux.GetValueType(val)~="number" then
val=val(e,r|REASON_RDAMAGE,v)
end
return duel_damage(p,val,r,...)
end
end
Glitchy.EnableTestChamber = false
Glitchy.TestChamberResultGroup[g] = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
else
return duel_damage(p,v,r,...)
end
return g
end
Group.Filter = function(g,f,exc,...)
local new_g = _GroupFilter(g,f,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(g) do
f(tc,...)
Auxiliary.damcon1 = function(e,tp,eg,ep,ev,re,r,rp)
local e1=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_DAMAGE)
local e2=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_RECOVER)
local rd=e1 and not e2
local rr=not e1 and e2
local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE)
local takedamcheck=true
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_NO_EFFECT_DAMAGE)}) do
local value=ce:GetValue()
if not value or value(ce,cv) then
takedamcheck=false
break
end
Glitchy.EnableTestChamber = false
Glitchy.TestChamberResultGroup[new_g] = Glitchy.TestChamberResult
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[new_g] = Glitchy.TestChamberResultGroup[new_g] | Glitchy.TestChamberResultGroup[g]
end
Glitchy.TestChamberResult = 0
end
return new_g
if ex and (cp==tp or cp==PLAYER_ALL) and not rd and takedamcheck then
return true
end
ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER)
return ex and (cp==tp or cp==PLAYER_ALL) and rr and takedamcheck
end
Duel.SelectTarget = function(p,f,pov,loc1,loc2,min,max,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
local test_chamber = _GetMatchingGroup(f,pov,loc1,loc2,exc,...)
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(test_chamber) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
local result = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
local player = p
local nloc1,nloc2 = loc1,loc2
if p==self_reference_effect:GetHandlerPlayer() then
if Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if loc1&~(LOCATION_DECK+LOCATION_GRAVE)==0 and loc2==0 then
player = 1-p
else
local opt = loc1&(LOCATION_DECK+LOCATION_GRAVE)==0 and 2 or Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
nloc1=nloc1&(LOCATION_DECK+LOCATION_GRAVE)
nloc2=0
elseif opt==1 then
nloc1 = nloc1&~(LOCATION_DECK+LOCATION_GRAVE)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectTarget(player,f,pov,loc1,loc2,min,max,exc,...)
--Glitchylib imports
EFFECT_CHANGE_RECOVER = 1508
--Rating types
RATING_LEVEL = 0x1
RATING_RANK = 0x2
RATING_LINK = 0x4
--Stat types
STAT_ATTACK = 0x1
STAT_DEFENSE = 0x2
--COIN RESULTS
COIN_HEADS = 1
COIN_TAILS = 0
--Effects
GLOBAL_EFFECT_RESET = 10203040
--Properties
EFFECT_FLAG_DD = EFFECT_FLAG_DAMAGE_STEP|EFFECT_FLAG_DAMAGE_CAL
EFFECT_FLAG_DDD = EFFECT_FLAG_DELAY|EFFECT_FLAG_DAMAGE_STEP|EFFECT_FLAG_DAMAGE_CAL
--zone constants
EXTRA_MONSTER_ZONE=0x60
--resets
RESETS_REDIRECT_FIELD = 0x047e0000
RESETS_STANDARD_UNION = RESETS_STANDARD&(~(RESET_TOFIELD|RESET_LEAVE))
RESETS_STANDARD_TOFIELD = RESETS_STANDARD&(~(RESET_TOFIELD))
RESETS_STANDARD_EXC_GRAVE = RESETS_STANDARD&~(RESET_LEAVE|RESET_TOGRAVE)
--timings
RELEVANT_TIMINGS = TIMINGS_CHECK_MONSTER|TIMING_MAIN_END|TIMING_END_PHASE
--win
WIN_REASON_CUSTOM = 0xff
--constants aliases
TYPE_ST = TYPE_SPELL|TYPE_TRAP
RACES_BEASTS = RACE_BEAST|RACE_BEASTWARRIOR|RACE_WINDBEAST
ARCHE_FUSION = 0x46
LOCATION_ALL = LOCATION_DECK|LOCATION_HAND|LOCATION_MZONE|LOCATION_SZONE|LOCATION_GRAVE|LOCATION_REMOVED|LOCATION_EXTRA
LOCATION_GB = LOCATION_GRAVE|LOCATION_REMOVED
MAX_RATING = 14
REASON_EXCAVATE = REASON_REVEAL
RESET_TURN_SELF = RESET_SELF_TURN
RESET_TURN_OPPO = RESET_OPPO_TURN
--Shortcuts
function Duel.IsExists(target,f,tp,loc1,loc2,min,exc,...)
if aux.GetValueType(target)~="boolean" then return false end
local func = (target==true) and Duel.IsExistingTarget or Duel.IsExistingMatchingCard
else
return _SelectTarget(p,f,pov,loc1,loc2,min,max,exc,...)
end
return func(f,tp,loc1,loc2,min,exc,...)
end
Group.Select = function(g,p,min,max,exc)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _GroupSelect(g,player,min,max,exc)
function Duel.Select(hint,target,tp,f,pov,loc1,loc2,min,max,exc,...)
if aux.GetValueType(target)~="boolean" then return false end
local func = (target==true) and Duel.SelectTarget or Duel.SelectMatchingCard
local hint = hint or HINTMSG_TARGET
else
return _GroupSelect(g,p,min,max,exc)
Duel.Hint(HINT_SELECTMSG,tp,hint)
local g=func(tp,f,pov,loc1,loc2,min,max,exc,...)
return g
end
function Duel.Group(f,tp,loc1,loc2,exc,...)
local g=Duel.GetMatchingGroup(f,tp,loc1,loc2,exc,...)
return g
end
function Duel.HintMessage(tp,msg)
return Duel.Hint(HINT_SELECTMSG,tp,msg)
end
function Auxiliary.Necro(f)
return aux.NecroValleyFilter(f)
end
function Card.Activation(c,oath)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
if oath then
e1:HOPT(true)
end
c:RegisterEffect(e1)
return e1
end
Group.FilterSelect = function(g,p,f,min,max,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(g) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | Glitchy.TestChamberResultGroup[g]
end
local result = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _FilterSelect(g,player,f,min,max,exc,...)
else
return _FilterSelect(g,p,f,min,max,exc,...)
--Custom Categories
if not global_effect_category_table_global_check then
global_effect_category_table_global_check=true
global_effect_category_table={}
global_effect_info_table={}
end
function Effect.SetCustomCategory(e,cat,flags)
if not cat then cat=0 end
if not flags then flags=0 end
if not global_effect_category_table[e] then global_effect_category_table[e]={} end
global_effect_category_table[e][1]=cat
global_effect_category_table[e][2]=flags
end
function Effect.GetCustomCategory(e)
if not global_effect_category_table[e] then return 0,0 end
return global_effect_category_table[e][1], global_effect_category_table[e][2]
end
function Effect.IsHasCustomCategory(e,cat1,cat2)
local ocat1,ocat2=e:GetCustomCategory()
return (cat1 and ocat1&cat1>0) or (cat2 and ocat2&cat2>0)
end
function Duel.SetCustomOperationInfo(ch,cat,g,ct,p,val,...)
local extra={...}
if not global_effect_info_table[ch+1] or #global_effect_info_table[ch+1]>0 then
global_effect_info_table[ch+1]={}
end
table.insert(global_effect_info_table[ch+1],{cat,g,ct,p,val,table.unpack(extra)})
end
Group.SelectUnselect = function(g,ug,p,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
--Card Actions
function Duel.Attach(c,xyz)
if aux.GetValueType(c)=="Card" then
local og=c:GetOverlayGroup()
if og:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(xyz,Group.FromCards(c))
return xyz:GetOverlayGroup():IsContains(c)
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
elseif aux.GetValueType(c)=="Group" then
for tc in aux.Next(c) do
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectUnselect(g,ug,player,...)
else
return _SelectUnselect(g,ug,p,...)
end
end
Group.Merge = function(g,c)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and aux.GetValueType(c)=="Group" and type(Glitchy.TestChamberResultGroup[c])=="number" then
if type(Glitchy.TestChamberResultGroup[g])~="number" then Glitchy.TestChamberResultGroup[g] = 0 end
Glitchy.TestChamberResultGroup[g] = Glitchy.TestChamberResultGroup[g] + Glitchy.TestChamberResultGroup[c]
Duel.Overlay(xyz,c)
return c:FilterCount(function (card,group) return group:IsContains(card) end, nil, xyz:GetOverlayGroup())
end
return _GroupMerge(g,c)
end
Group.Clone = function(g,g2)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g2])=="number" then
if type(Glitchy.TestChamberResultGroup[g])~="number" then Glitchy.TestChamberResultGroup[g] = 0 end
Glitchy.TestChamberResultGroup[g] = Glitchy.TestChamberResultGroup[g] + Glitchy.TestChamberResultGroup[g2]
end
return _GroupClone(g,g2)
function Duel.Banish(g,pos,r)
if not pos then pos=POS_FACEUP end
if not r then r=REASON_EFFECT end
return Duel.Remove(g,pos,r)
end
Group.SelectSubGroup = function(g,tp,f,cancelable,min,max,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Auxiliary.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[fg] = Glitchy.TestChamberResultGroup[g]
end
fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if Auxiliary.CheckGroupRecursiveCapture(c,sg,eg,f,min,max,ext_params) then
cg:Merge(Auxiliary.SubGroupCaptured)
else
eg:RemoveCard(c)
end
end
function Duel.BanishUntil(g,pos,phase,id,phasect,phasenext,rc,r)
local e, tp = self_reference_effect, current_triggering_player
if aux.GetValueType(g)=="Card" then g=Group.FromCards(g) end
if not phase then phase=PHASE_END end
if not phasect then phasect=1 end
if not rc then rc=e:GetHandler() end
if not r then r=REASON_EFFECT end
local ct=Duel.Remove(g,pos,r|REASON_TEMPORARY)
if ct>0 then
local og=g:Filter(Card.IsLocation,nil,LOCATION_REMOVED)
if #og>0 then
og:KeepAlive()
local turnct,turnct2=0,phasect
local ph = phase&(PHASE_DRAW|PHASE_STANDBY|PHASE_MAIN1|PHASE_BATTLE_START|PHASE_BATTLE_STEP|PHASE_DAMAGE|PHASE_DAMAGE_CAL|PHASE_BATTLE|PHASE_MAIN2|PHASE_END)
local player = phase&(RESET_SELF_TURN|RESET_OPPO_TURN)
if (player==RESET_SELF_TURN and Duel.GetTurnPlayer()~=tp) or (player==RESET_OPPO_TURN and Duel.GetTurnPlayer()~=1-tp) then
turnct=1
elseif Duel.GetCurrentPhase()>ph then
turnct=1
end
cg:Sub(sg)
finish=(#sg>=min and #sg<=max and f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[cg] = Glitchy.TestChamberResultGroup[g]
end
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
if not tc then break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
if phasenext then
if Duel.GetCurrentPhase()==phase
and (player==0 or (player==RESET_SELF_TURN and Duel.GetTurnPlayer()==tp) or (player==RESET_OPPO_TURN and Duel.GetTurnPlayer()==1-tp)) then
turnct=turnct+1
turnct2=turnct2+1
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
return nil
end
else
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
end
Group.SelectSubGroupEach = function(g,tp,checks,cancelable,f,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
if cancelable==nil then cancelable=false end
if f==nil then f=Auxiliary.TRUE end
local ct=#checks
local ext_params={...}
local sg=Group.CreateGroup()
local finish=false
while #sg<ct do
local cg=g:Filter(Auxiliary.CheckGroupRecursiveEach,sg,sg,g,f,checks,ext_params)
if #cg==0 then break end
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[cg] = Glitchy.TestChamberResultGroup[g]
end
local tc=cg:SelectUnselect(sg,tp,false,cancelable,ct,ct)
if not tc then break end
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==ct then finish=true end
else
sg:Clear()
end
end
if finish then
return sg
else
return nil
for tc in aux.Next(og) do
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|phase,EFFECT_FLAG_SET_AVAILABLE|EFFECT_FLAG_CLIENT_HINT,turnct2,0,STRING_TEMPORARILY_BANISHED)
end
local e1=Effect.CreateEffect(rc)
e1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE|phase)
e1:SetReset(RESET_PHASE|phase,phasect)
e1:SetCountLimit(1)
e1:SetLabel(Duel.GetTurnCount()+turnct*phasect)
e1:SetLabelObject(og)
e1:SetCondition(aux.TimingCondition(ph,player))
e1:SetOperation(aux.ReturnLabelObjectToFieldOp(id))
Duel.RegisterEffect(e1,tp)
end
else
return _SelectSubGroupEach(g,tp,checks,cancelable,f,...)
end
return ct
end
Group.SelectWithSumEqual = function(g,p,f,acc,min,max,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
function Auxiliary.TimingCondition(phase,player)
return function(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==phase and (player==0 or (player==RESET_SELF_TURN and Duel.GetTurnPlayer()==tp) or (player==RESET_OPPO_TURN and Duel.GetTurnPlayer()==1-tp))
and Duel.GetTurnCount()==e:GetLabel()
end
end
function Auxiliary.ReturnLabelObjectToFieldOp(id)
return function(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local sg=g:Filter(Card.HasFlagEffect,nil,id)
local rg=Group.CreateGroup()
for p=tp,1-tp,1-2*tp do
local sg1=sg:Filter(Card.IsPreviousControler,nil,p)
if #sg1>0 then
local ft=Duel.GetLocationCount(p,LOCATION_MZONE)
if ft>0 then
if ft<#sg1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local tg=sg1:Select(tp,ft,ft,nil)
if #tg>0 then
rg:Merge(tg)
end
else
rg:Merge(sg1)
end
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
if #rg>0 then
for tc in aux.Next(rg) do
Duel.ReturnToField(tc)
end
end
g:DeleteGroup()
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectWithSumEqual(g,player,f,acc,min,max,...)
else
return _SelectWithSumEqual(g,p,f,acc,min,max,...)
end
end
Group.SelectWithSumGreater = function(g,p,f,acc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
function Duel.EquipAndRegisterLimit(p,be_equip,equip_to,...)
local res=Duel.Equip(p,be_equip,equip_to,...)
if res and equip_to:GetEquipGroup():IsContains(be_equip) then
local e1=Effect.CreateEffect(equip_to)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
e1:SetValue(function(e,c)
return e:GetOwner()==c
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectWithSumGreater(g,player,f,acc,...)
else
return _SelectWithSumGreater(g,p,f,acc,...)
)
be_equip:RegisterEffect(e1)
end
return res and equip_to:GetEquipGroup():IsContains(be_equip)
end
--Glitchylib imports
function Auxiliary.Option(id,tp,desc,...)
local list={...}
local off=1
local ops={}
local opval={}
local truect=1
for ct,b in ipairs(list) do
local check=b
local localid=id
local localdesc=desc+truect-1
if aux.GetValueType(b)=="table" then
check=b[1]
localid=b[2]
localdesc=b[3]
else
truect=truect+1
end
if check==true then
ops[off]=aux.Stringid(localid,localdesc)
opval[off]=ct-1
off=off+1
end
function Duel.EquipAndRegisterCustomLimit(f,p,be_equip,equip_to,...)
local res=Duel.Equip(p,be_equip,equip_to,...)
if res and equip_to:GetEquipGroup():IsContains(be_equip) then
local e1=Effect.CreateEffect(equip_to)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
e1:SetValue(f)
be_equip:RegisterEffect(e1)
end
local op=Duel.SelectOption(tp,table.unpack(ops))+1
local sel=opval[op]
Duel.Hint(HINT_OPSELECTED,1-tp,ops[op])
return sel
return res and equip_to:GetEquipGroup():IsContains(be_equip)
end
function Duel.Attach(c,xyz)
if aux.GetValueType(c)=="Card" then
local og=c:GetOverlayGroup()
if og:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
Duel.Overlay(xyz,Group.FromCards(c))
return xyz:GetOverlayGroup():IsContains(c)
elseif aux.GetValueType(c)=="Group" then
for tc in aux.Next(c) do
local og=tc:GetOverlayGroup()
if og:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
end
function Card.Recreate(c,...)
local x={...}
if #x==0 then return end
local datalist={CARDDATA_CODE,CARDDATA_ALIAS,CARDDATA_SETCODE,CARDDATA_TYPE,CARDDATA_LEVEL,CARDDATA_ATTRIBUTE,CARDDATA_RACE,CARDDATA_ATTACK,CARDDATA_DEFENSE,CARDDATA_LSCALE,CARDDATA_RSCALE}
for i,newval in ipairs(x) do
if newval then
c:SetCardData(datalist[i],newval)
end
Duel.Overlay(xyz,c)
return c:FilterCount(function (card,group) return group:IsContains(card) end, nil, xyz:GetOverlayGroup())
end
end
function Card.CheckNegateConjunction(c,e1,e2,e3)
return not c:IsImmuneToEffect(e1) and not c:IsImmuneToEffect(e2) and (not e3 or not c:IsImmuneToEffect(e3))
end
function Duel.Negate(tc,e,reset,notfield,forced)
if not reset then reset=0 end
local rct=1
if not reset then
reset=0
elseif type(reset)=="table" then
rct=reset[2]
reset=reset[1]
end
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+reset,rct)
tc:RegisterEffect(e1,forced)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
......@@ -577,35 +351,1046 @@ function Duel.Negate(tc,e,reset,notfield,forced)
if not notfield then
e2:SetValue(RESET_TURN_SET)
end
e2:SetReset(RESET_EVENT+RESETS_STANDARD+reset)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+reset,rct)
tc:RegisterEffect(e2,forced)
if not notfield and tc:IsType(TYPE_TRAPMONSTER) then
local e=Effect.CreateEffect(e:GetHandler())
e:SetType(EFFECT_TYPE_SINGLE)
e:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e:SetReset(RESET_EVENT+RESETS_STANDARD+reset)
tc:RegisterEffect(e,forced)
return e1,e2,e
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+reset,rct)
tc:RegisterEffect(e3,forced)
local res=tc:CheckNegateConjunction(e1,e2,e3)
if res then
Duel.AdjustInstantly(tc)
end
return e1,e2,e3,res
end
local res=tc:CheckNegateConjunction(e1,e2)
if res then
Duel.AdjustInstantly(tc)
end
return e1,e2,res
end
function Duel.NegateInGY(tc,e,reset)
if not reset then reset=0 end
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD_EXC_GRAVE+reset)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+RESETS_STANDARD_EXC_GRAVE+reset)
tc:RegisterEffect(e2)
return e1,e2
end
function Duel.UpdateFlagEffectLabel(p,id,ct)
if not ct then ct=1 end
return Duel.SetFlagEffectLabel(p,id,Duel.GetFlagEffectLabel(p,id)+ct)
function Duel.PositionChange(c)
return Duel.ChangePosition(c,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
function Duel.Search(g,tp,p)
if aux.GetValueType(g)=="Card" then g=Group.FromCards(g) end
local ct=Duel.SendtoHand(g,p,REASON_EFFECT)
local cg=g:Filter(aux.PLChk,nil,tp,LOCATION_HAND)
if #cg>0 then
Duel.ConfirmCards(1-tp,cg)
end
return ct,#cg,cg
end
function Duel.Bounce(g)
if aux.GetValueType(g)=="Card" then g=Group.FromCards(g) end
local ct=Duel.SendtoHand(g,nil,REASON_EFFECT)
local cg=g:Filter(aux.PLChk,nil,nil,LOCATION_HAND)
return ct,#cg,cg
end
--Other Imports
function Card.HasLevel(c)
if c:IsType(TYPE_MONSTER) then
return (c:GetType()&TYPE_LINK~=TYPE_LINK and c:GetType()&TYPE_XYZ~=TYPE_XYZ) and not c:IsStatus(STATUS_NO_LEVEL)
elseif c:IsOriginalType(TYPE_MONSTER) then
return not (c:IsOriginalType(TYPE_XYZ+TYPE_LINK) or c:IsStatus(STATUS_NO_LEVEL))
function Duel.ShuffleIntoDeck(g,p)
local ct=Duel.SendtoDeck(g,p,SEQ_DECKSHUFFLE,REASON_EFFECT)
if ct>0 then
aux.AfterShuffle(g)
if aux.GetValueType(g)=="Card" and aux.PLChk(g,p,LOCATION_DECK+LOCATION_EXTRA) then
return 1
elseif aux.GetValueType(g)=="Group" then
return g:FilterCount(aux.PLChk,nil,p,LOCATION_DECK+LOCATION_EXTRA)
end
end
return false
return 0
end
function Card.HasDefense(c)
return not c:IsOriginalType(TYPE_LINK)
function Duel.PlaceOnTopOfDeck(g,p)
local ct=Duel.SendtoDeck(g,p,SEQ_DECKTOP,REASON_EFFECT)
if ct>0 then
local og=g:Filter(Card.IsLocation,nil,LOCATION_DECK)
for pp=tp,1-tp,1-2*tp do
local dg=og:Filter(Card.IsControler,nil,pp)
if #dg>1 then
Duel.SortDecktop(p,pp,#dg)
end
end
return ct
end
return 0
end
function Auxiliary.PLChk(c,p,loc,min)
if not min then min=1 end
if aux.GetValueType(c)=="Card" then
return (not p or c:IsControler(p)) and (not loc or c:IsLocation(loc))
elseif aux.GetValueType(c)=="Group" then
return c:IsExists(aux.PLChk,min,nil,p,loc)
else
return false
end
end
function Auxiliary.AfterShuffle(g)
for p=0,1 do
if aux.PLChk(g,p,LOCATION_DECK) then
Duel.ShuffleDeck(p)
end
end
end
--Battle Phase
function Card.IsCapableOfAttacking(c,tp)
if not tp then tp=Duel.GetTurnPlayer() end
return not c:IsForbidden() and not c:IsHasEffect(EFFECT_CANNOT_ATTACK) and not c:IsHasEffect(EFFECT_ATTACK_DISABLED) and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_SKIP_BP)
end
--Card Filters
function Card.IsMonster(c,typ)
return c:IsType(TYPE_MONSTER) and (aux.GetValueType(typ)~="number" or c:IsType(typ))
end
function Card.IsSpell(c,typ)
return c:IsType(TYPE_SPELL) and (aux.GetValueType(typ)~="number" or c:IsType(typ))
end
function Card.IsTrap(c,typ)
return c:IsType(TYPE_TRAP) and (aux.GetValueType(typ)~="number" or c:IsType(typ))
end
function Card.IsNormalSpell(c)
return c:GetType()&(TYPE_SPELL|TYPE_CONTINUOUS|TYPE_RITUAL|TYPE_EQUIP|TYPE_QUICKPLAY|TYPE_FIELD)==TYPE_SPELL
end
function Card.IsNormalTrap(c)
return c:GetType()&(TYPE_TRAP|TYPE_CONTINUOUS|TYPE_COUNTER)==TYPE_TRAP
end
function Card.IsST(c,typ)
return c:IsType(TYPE_ST) and (aux.GetValueType(typ)~="number" or c:IsType(typ))
end
function Card.MonsterOrFacedown(c)
return c:IsMonster() or c:IsFacedown()
end
function Card.IsAppropriateEquipSpell(c,ec,tp)
return c:IsSpell(TYPE_EQUIP) and c:CheckEquipTarget(ec) and c:CheckUniqueOnField(tp) and not c:IsForbidden()
end
function Card.HasAttack(c)
return true
end
function Card.HasDefense(c)
return not c:IsOriginalType(TYPE_LINK)
end
function Card.HasHighest(c,stat,g,f)
if not g then g=Duel.GetFieldGroup(0,LOCATION_MZONE,LOCATION_MZONE):Filter(Card.IsFaceup,nil) end
local func = function(tc,val,fil)
return stat(tc)>val and (not fil or fil(tc))
end
return not g:IsExists(func,1,c,stat(c),f)
end
function Card.HasLowest(c,stat,g,f)
if not g then g=Duel.GetFieldGroup(0,LOCATION_MZONE,LOCATION_MZONE):Filter(Card.IsFaceup,nil) end
local func = function(tc,val,fil)
return stat(tc)<val and (not fil or fil(tc))
end
return not g:IsExists(func,1,c,stat(c),f)
end
function Card.HasHighestATK(c,g,f)
return c:HasHighest(Card.GetAttack,g,f)
end
function Card.HasLowestATK(c,g,f)
return c:HasLowest(Card.GetAttack,g,f)
end
function Card.HasHighestDEF(c,g,f)
return c:HasHighest(Card.GetDefense,g,f)
end
function Card.HasLowestDEF(c,g,f)
return c:HasLowest(Card.GetDefense,g,f)
end
function Card.HasOriginalLevel(c)
return not c:IsOriginalType(TYPE_XYZ+TYPE_LINK)
end
function Card.IsOriginalType(c,typ)
return c:GetOriginalType()&typ>0
end
function Card.IsOriginalRace(c,rc)
return c:GetOriginalRace()&rc>0
end
function Card.HasRank(c)
return c:IsType(TYPE_XYZ) or c:IsOriginalType(TYPE_XYZ) or c:IsHasEffect(EFFECT_ORIGINAL_LEVEL_RANK_DUALITY)
end
function Card.GetRating(c)
local list={false,false,false,false}
if c:HasLevel() then
list[1]=c:GetLevel()
end
if c:IsOriginalType(TYPE_XYZ) then
list[2]=c:GetRank()
end
if c:IsOriginalType(TYPE_LINK) then
list[3]=c:GetLink()
end
if c:IsOriginalType(TYPE_TIMELEAP) then
list[4]=c:GetFuture()
end
return list
end
function Card.IsRating(c,rtyp,...)
local x={...}
local lv=rtyp&RATING_LEVEL>0
local rk=rtyp&RATING_RANK>0
local link=rtyp&RATING_LINK>0
local fut=rtyp&RATING_FUTURE>0
for i,n in ipairs(x) do
if (lv and c:HasLevel() and c:IsLevel(n)) or (rk and c:HasRank() and c:IsRank(n)) or (link and c:IsOriginalType(TYPE_LINK) and c:IsLink(n))
or (fut and c:IsOriginalType(TYPE_TIMELEAP) and c:IsFuture(n)) then
return true
end
end
return false
end
function Card.IsRatingAbove(c,rtyp,...)
local x={...}
local lv=rtyp&RATING_LEVEL>0
local rk=rtyp&RATING_RANK>0
local link=rtyp&RATING_LINK>0
local fut=rtyp&RATING_FUTURE>0
for i,n in ipairs(x) do
if (lv and c:HasLevel() and c:IsLevelAbove(n)) or (rk and c:HasRank() and c:IsRankAbove(n)) or (link and c:IsOriginalType(TYPE_LINK) and c:IsLinkAbove(n))
or (fut and c:IsOriginalType(TYPE_TIMELEAP) and c:IsFutureAbove(n)) then
return true
end
end
end
function Card.IsRatingBelow(c,rtyp,...)
local x={...}
local lv=rtyp&RATING_LEVEL>0
local rk=rtyp&RATING_RANK>0
local link=rtyp&RATING_LINK>0
local fut=rtyp&RATING_FUTURE>0
for i,n in ipairs(x) do
if (lv and c:HasLevel() and c:IsLevelBelow(n)) or (rk and c:HasRank() and c:IsRankBelow(n)) or (link and c:IsOriginalType(TYPE_LINK) and c:IsLinkBelow(n))
or (fut and c:IsOriginalType(TYPE_TIMELEAP) and c:IsFutureBelow(n)) then
return true
end
end
end
function Card.IsStat(c,rtyp,...)
local x={...}
local atk=rtyp&STAT_ATTACK>0
local def=rtyp&STAT_DEFENSE>0
for i,n in ipairs(x) do
if (not atk or (c:HasAttack() and c:IsAttack(n))) and (not def or (c:HasDefense() and c:IsDefense(n))) then
return true
end
end
return false
end
function Card.IsStatBelow(c,rtyp,...)
local x={...}
local atk=rtyp&STAT_ATTACK>0
local def=rtyp&STAT_DEFENSE>0
for i,n in ipairs(x) do
if (not atk or (c:HasAttack() and c:IsAttackBelow(n))) or (not def or (c:HasDefense() and c:IsDefenseBelow(n))) then
return true
end
end
return false
end
function Card.IsStatAbove(c,rtyp,...)
local x={...}
local atk=rtyp&STAT_ATTACK>0
local def=rtyp&STAT_DEFENSE>0
for i,n in ipairs(x) do
if (not atk or (c:HasAttack() and c:IsAttackAbove(n))) or (not def or (c:HasDefense() and c:IsDefenseAbove(n))) then
return true
end
end
return false
end
function Card.ByBattleOrEffect(c,f,p)
return function(e,tp,eg,ep,ev,re,r,rp)
return c:IsReason(REASON_BATTLE) or c:IsReason(REASON_EFFECT) and (not f or re and f(re:GetHandler(),e,tp,eg,ep,ev,re,r,rp)) and (not p or rp~=(1-p))
end
end
function Card.IsContained(c,g,exc)
return g:IsContains(c) and (not exc or not exc:IsContains(c))
end
--Chain Info
function Duel.GetTargetParam()
return Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
end
--Cloned Effects
function Effect.SpecialSummonEventClone(e,c,notreg)
local ex=e:Clone()
ex:SetCode(EVENT_SPSUMMON_SUCCESS)
if not notreg then
c:RegisterEffect(ex)
end
return ex
end
function Effect.FlipSummonEventClone(e,c,notreg)
local ex=e:Clone()
ex:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
if not notreg then
c:RegisterEffect(ex)
end
return ex
end
function Effect.UpdateDefenseClone(e,c,notreg)
local ex=e:Clone()
ex:SetCode(EFFECT_UPDATE_DEFENSE)
if not notreg then
c:RegisterEffect(ex)
end
return ex
end
--Columns
function Card.GlitchyGetColumnGroup(c,left,right,without_center)
local left = (left and aux.GetValueType(left)=="number" and left>=0) and left or 0
local right = (right and aux.GetValueType(right)=="number" and right>=0) and right or 0
if left==0 and right==0 then
return c:GetColumnGroup()
else
local f = function(card,refc,val)
local refseq
if refc:GetSequence()<5 then
refseq=refc:GetSequence()
else
if refc:GetSequence()==5 then
refseq = 1
elseif refc:GetSequence()==6 then
refseq = 3
end
end
if card:GetSequence()<5 then
if card:IsControler(refc:GetControler()) then
return math.abs(refseq-card:GetSequence())==val
else
return math.abs(refseq+card:GetSequence()-4)==val
end
elseif card:GetSequence()==5 then
local seq = card:IsControler(refc:GetControler()) and 1 or 3
return math.abs(refseq-seq)==val
elseif card:GetSequence()==6 then
local seq = card:IsControler(refc:GetControler()) and 3 or 1
return math.abs(refseq-seq)==val
end
end
local lg=Duel.Group(f,c:GetControler(),LOCATION_MZONE+LOCATION_SZONE,LOCATION_MZONE+LOCATION_SZONE,nil,c,left)
local cg = without_center and Group.CreateGroup() or c:GetColumnGroup()
local rg=Duel.Group(f,c:GetControler(),LOCATION_MZONE+LOCATION_SZONE,LOCATION_MZONE+LOCATION_SZONE,nil,c,right)
cg:Merge(lg)
cg:Merge(rg)
return cg
end
end
--Exception
function Auxiliary.ActivateException(e,chk)
local c=e:GetHandler()
if c and e:IsHasType(EFFECT_TYPE_ACTIVATE) and not c:IsType(TYPE_CONTINUOUS+TYPE_FIELD+TYPE_EQUIP) and not c:IsHasEffect(EFFECT_REMAIN_FIELD) and (chk or c:IsRelateToChain(0)) then
return c
else
return nil
end
end
function Auxiliary.ExceptThis(c)
if aux.GetValueType(c)=="Effect" then c=c:GetHandler() end
if c:IsRelateToChain() then return c else return nil end
end
--Descriptions
function Effect.Desc(e,id,...)
local x = {...}
local code = #x>0 and x[1] or e:GetOwner():GetOriginalCode()
return e:SetDescription(aux.Stringid(code,id))
end
function Card.AskPlayer(c,tp,desc)
local string = desc<=15 and aux.Stringid(c:GetOriginalCode(),desc) or desc
return Duel.SelectYesNo(tp,string)
end
function Auxiliary.Option(id,tp,desc,...)
if id<2 then
id,tp=tp,id
end
local list={...}
local off=1
local ops={}
local opval={}
local truect=1
for ct,b in ipairs(list) do
local check=b
local localid
local localdesc
if aux.GetValueType(b)=="table" then
check=b[1]
if #b==3 then
localid=b[2]
localdesc=b[3]
else
localid=false
localdesc=b[2]
end
else
localid=id
localdesc=desc+truect-1
truect=truect+1
end
if check==true then
if localid then
ops[off]=aux.Stringid(localid,localdesc)
else
ops[off]=localdesc
end
opval[off]=ct-1
off=off+1
end
end
local op=Duel.SelectOption(tp,table.unpack(ops))+1
local sel=opval[op]
Duel.Hint(HINT_OPSELECTED,1-tp,ops[op])
return sel
end
function Duel.RegisterHint(p,flag,reset,rct,id,desc)
if not reset then reset=PHASE_END end
if not rct then rct=1 end
return Duel.RegisterFlagEffect(p,flag,RESET_PHASE+reset,EFFECT_FLAG_CLIENT_HINT,rct,0,aux.Stringid(id,desc))
end
--Excavate
function Duel.IsPlayerCanExcavateAndSpecialSummon(tp)
return Duel.IsPlayerCanSpecialSummon(tp) and not Duel.IsPlayerAffectedByEffect(tp,CARD_EHERO_BLAZEMAN)
end
--Filters
function Auxiliary.Filter(f,...)
local ext_params={...}
return aux.FilterBoolFunction(f,table.unpack(ext_params))
end
function Auxiliary.BuildFilter(f,...)
local ext_params={...}
return function(c)
for _,func in ipairs(ext_params) do
if type(func)=="function" then
if not func(c) then
return false
end
elseif type(func)=="table" then
if not func[1](c,func[2]) then
return false
end
end
end
return true
end
end
function Auxiliary.Faceup(f)
return function(c,...)
return (not f or f(c,...)) and c:IsFaceup()
end
end
function Auxiliary.Facedown(f)
return function(c,...)
return (not f or f(c,...)) and c:IsFacedown()
end
end
function Auxiliary.FaceupFilter(f,...)
local ext_params={...}
return function(target)
return target:IsFaceup() and f(target,table.unpack(ext_params))
end
end
function Auxiliary.ArchetypeFilter(set,f,...)
local ext_params={...}
return function(target)
return target:IsSetCard(set) and (not f or f(target,table.unpack(ext_params)))
end
end
function Auxiliary.MonsterFilter(typ,f,...)
local ext_params={...}
if type(typ)=="function" then
if type(f)~="nil" then
table.insert(ext_params,1,f)
end
f=typ
typ=nil
end
return function(target)
return target:IsMonster(typ) and (not f or f(target,table.unpack(ext_params)))
end
end
function Auxiliary.RaceFilter(race,f,...)
local ext_params={...}
return function(target)
return target:IsRace(race) and (not f or f(target,table.unpack(ext_params)))
end
end
function Auxiliary.STFilter(f,...)
local ext_params={...}
return function(target)
return target:IsST() and (not f or f(target,table.unpack(ext_params)))
end
end
--Flag Effects
function Card.HasFlagEffect(c,id,...)
local flags={...}
if id then
table.insert(flags,id)
end
for _,flag in ipairs(flags) do
if c:GetFlagEffect(flag)>0 then
return true
end
end
return false
end
function Duel.PlayerHasFlagEffect(p,id,...)
local flags={...}
if id then
table.insert(flags,id)
end
for _,flag in ipairs(flags) do
if Duel.GetFlagEffect(p,flag)>0 then
return true
end
end
return false
end
function Card.UpdateFlagEffectLabel(c,id,ct)
if not ct then ct=1 end
return c:SetFlagEffectLabel(id,c:GetFlagEffectLabel(id)+ct)
end
function Duel.UpdateFlagEffectLabel(p,id,ct)
if not ct then ct=1 end
return Duel.SetFlagEffectLabel(p,id,Duel.GetFlagEffectLabel(p,id)+ct)
end
function Card.HasFlagEffectLabel(c,id,val)
if not c:HasFlagEffect(id) then return false end
for _,label in ipairs({c:GetFlagEffectLabel(id)}) do
if label==val then
return true
end
end
return false
end
function Card.HasFlagEffectLabelLower(c,id,val)
if not c:HasFlagEffect(id) then return false end
for _,label in ipairs({c:GetFlagEffectLabel(id)}) do
if label<val then
return true
end
end
return false
end
function Card.HasFlagEffectLabelHigher(c,id,val)
if not c:HasFlagEffect(id) then return false end
for _,label in ipairs({c:GetFlagEffectLabel(id)}) do
if label>val then
return true
end
end
return false
end
function Duel.PlayerHasFlagEffectLabel(tp,id,val)
if Duel.GetFlagEffect(tp,id)==0 then return false end
for _,label in ipairs({Duel.GetFlagEffectLabel(tp,id)}) do
if label==val then
return true
end
end
return false
end
--Gain Effect
function Auxiliary.GainEffectType(c,oc,reset)
if not oc then oc=c end
if not reset then reset=0 end
if not c:IsType(TYPE_EFFECT) then
local e=Effect.CreateEffect(oc)
e:SetType(EFFECT_TYPE_SINGLE)
e:SetCode(EFFECT_ADD_TYPE)
e:SetValue(TYPE_EFFECT)
e:SetReset(RESET_EVENT+RESETS_STANDARD+reset)
c:RegisterEffect(e,true)
end
end
--Labels
function Effect.SetLabelPair(e,l1,l2)
if l1 and l2 then
e:SetLabel(l1,l2)
elseif l1 then
local _,o2=e:GetLabel()
e:SetLabel(l1,o2)
else
local o1,_=e:GetLabel()
e:SetLabel(o1,l2)
end
end
function Effect.GetSpecificLabel(e,pos)
if not pos then pos=1 end
local tab={e:GetLabel()}
if #tab<pos then return end
return tab[pos]
end
--LP
function Duel.LoseLP(p,val)
return Duel.SetLP(tp,Duel.GetLP(tp)-math.abs(val))
end
--Locations
function Card.IsBanished(c,pos)
return c:IsLocation(LOCATION_REMOVED) and (not pos or c:IsPosition(pos))
end
function Card.IsInExtra(c,fu)
return c:IsLocation(LOCATION_EXTRA) and (fu==nil or fu and c:IsFaceup() or not fu and c:IsFacedown())
end
function Card.IsInGY(c)
return c:IsLocation(LOCATION_GRAVE)
end
function Card.IsInMMZ(c)
return c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5
end
function Card.IsInEMZ(c)
return c:IsLocation(LOCATION_MZONE) and c:GetSequence()>=5
end
function Card.IsInBackrow(c)
return c:IsLocation(LOCATION_SZONE) and c:GetSequence()<5
end
function Card.IsSequence(c,seq)
return c:GetSequence()==seq
end
function Card.IsSequenceBelow(c,seq)
return c:GetSequence()<=seq
end
function Card.IsSequenceAbove(c,seq)
return c:GetSequence()>=seq
end
function Card.IsInMainSequence(c)
return c:IsSequenceBelow(4)
end
function Card.IsSpellTrapOnField(c)
return not c:IsLocation(LOCATION_MZONE) or (c:IsFaceup() and c:IsST())
end
function Card.NotOnFieldOrFaceup(c)
return not c:IsOnField() or c:IsFaceup()
end
function Card.NotBanishedOrFaceup(c)
return not c:IsLocation(LOCATION_REMOVED) or c:IsFaceup()
end
function Card.NotInExtraOrFaceup(c)
return not c:IsLocation(LOCATION_EXTRA) or c:IsFaceup()
end
function Card.IsFusionSummoned(c)
return c:IsSummonType(SUMMON_TYPE_FUSION)
end
function Card.IsRitualSummoned(c)
return c:IsSummonType(SUMMON_TYPE_RITUAL)
end
function Card.IsSynchroSummoned(c)
return c:IsSummonType(SUMMON_TYPE_SYNCHRO)
end
function Card.IsXyzSummoned(c)
return c:IsSummonType(SUMMON_TYPE_XYZ)
end
function Card.IsPendulumSummoned(c)
return c:IsSummonType(SUMMON_TYPE_PENDULUM)
end
function Card.IsLinkSummoned(c)
return c:IsSummonType(SUMMON_TYPE_LINK)
end
function Card.IsPandemoniumSummoned(c)
return c:IsSummonType(SUMMON_TYPE_PANDEMONIUM)
end
function Card.IsTimeleapSummoned(c)
return c:IsSummonType(SUMMON_TYPE_TIMELEAP)
end
function Card.IsBigbangSummoned(c)
return c:IsSummonType(SUMMON_TYPE_BIGBANG)
end
function Card.IsDriveSummoned(c)
return c:IsSummonType(SUMMON_TYPE_DRIVE)
end
function Card.IsSelfSummoned(c)
return c:IsSummonType(SUMMON_TYPE_SPECIAL+1)
end
function Card.GetZone(c,tp)
local rzone = c:IsControler(tp) and (1 <<c:GetSequence()) or (1 << (16+c:GetSequence()))
if c:IsSequence(5,6) then
rzone = rzone | (c:IsControler(tp) and (1 << (16 + 11 - c:GetSequence())) or (1 << (11 - c:GetSequence())))
end
return rzone
end
function Card.GetPreviousZone(c,tp)
local rzone = c:IsControler(tp) and (1 <<c:GetPreviousSequence()) or (1 << (16+c:GetPreviousSequence()))
if c:GetPreviousSequence()==5 or c:GetPreviousSequence()==6 then
rzone = rzone | (c:IsControler(tp) and (1 << (16 + 11 - c:GetPreviousSequence())) or (1 << (11 - c:GetPreviousSequence())))
end
return rzone
end
function Duel.CheckPendulumZones(tp)
return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)
end
function Card.IsInLinkedZone(c,cc)
return cc:GetLinkedGroup():IsContains(c)
end
function Card.WasInLinkedZone(c,cc)
return cc:GetLinkedZone(c:GetPreviousControler())&c:GetPreviousZone()~=0
end
function Card.HasBeenInLinkedZone(c,cc)
return cc:GetLinkedGroup():IsContains(c) or (not c:IsLocation(LOCATION_MZONE) and cc:GetLinkedZone(c:GetPreviousControler())&c:GetPreviousZone()~=0)
end
--Location Groups
function Duel.GetHand(p)
return Duel.GetFieldGroup(p,LOCATION_HAND,0)
end
function Duel.GetHandCount(p)
return Duel.GetFieldGroupCount(p,LOCATION_HAND,0)
end
function Duel.GetDeck(p)
return Duel.GetFieldGroup(p,LOCATION_DECK,0)
end
function Duel.GetDeckCount(p)
return Duel.GetFieldGroupCount(p,LOCATION_DECK,0)
end
function Duel.GetGY(p)
return Duel.GetFieldGroup(p,LOCATION_GY,0)
end
function Duel.GetGYCount(p)
return Duel.GetFieldGroupCount(p,LOCATION_GY,0)
end
function Duel.GetExtraDeck(p)
return Duel.GetFieldGroup(p,LOCATION_EXTRA,0)
end
function Duel.GetExtraDeckCount(p)
return Duel.GetFieldGroupCount(p,LOCATION_EXTRA,0)
end
function Duel.GetPendulums(p)
return Duel.GetFieldGroup(p,LOCATION_PZONE,0)
end
function Duel.GetPendulumsCount(p)
return Duel.GetFieldGroupCount(p,LOCATION_PZONE,0)
end
--Materials
function Auxiliary.GetMustMaterialGroup(p,eff)
return Duel.GetMustMaterial(p,eff)
end
--Normal Summon/set
function Card.IsSummonableOrSettable(c)
return c:IsSummonable(true,nil) or c:IsMSetable(true,nil)
end
function Duel.SummonOrSet(tp,tc,ignore_limit,min)
if not ignore_limit then ignore_limit=true end
if tc:IsSummonable(ignore_limit,min) and (not tc:IsMSetable(ignore_limit,min) or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK|POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,ignore_limit,min)
else
Duel.MSet(tp,tc,ignore_limit,min)
end
end
--Set Monster/Spell/Trap
function Card.IsCanBeSet(c,e,tp,ignore_mzone,ignore_szone)
if c:IsMonster() then
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) and (not ignore_mzone or Duel.GetMZoneCount(tp)>0)
elseif c:IsST() then
return c:IsSSetable(ignore_szone)
end
end
function Duel.Set(tp,g)
if aux.GetValueType(g)=="Card" then g=Group.FromCards(g) end
local ct=0
local mg=g:Filter(Card.IsMonster,nil)
if #mg>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
for tc in aux.Next(mg) do
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) then
Duel.ConfirmCards(1-tp,tc)
end
end
end
local sg=g:Filter(Card.IsST,nil)
if #sg>0 then
for tc in aux.Next(sg) do
if tc:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then
ct=ct+Duel.SSet(tp,tc)
end
end
end
ct=ct+Duel.SpecialSummonComplete()
return ct
end
--Once per turn
function Effect.OPT(e,ct)
if not ct then ct=1 end
return e:SetCountLimit(ct)
end
if not Auxiliary.HOPTTracker then
Auxiliary.HOPTTracker={}
end
function Effect.HOPT(e,oath)
if not e:GetOwner() then return end
local c=e:GetOwner()
local cid=c:GetOriginalCode()
if not aux.HOPTTracker[c] then
aux.HOPTTracker[c]=-1
end
aux.HOPTTracker[c]=aux.HOPTTracker[c]+1
if type(aux.HOPTTracker[c])=="number" then
cid=cid+aux.HOPTTracker[c]*100
end
local flag=0
if oath then
flag=flag|EFFECT_COUNT_CODE_OATH
end
return e:SetCountLimit(1,cid+flag)
end
function Effect.SHOPT(e,oath)
if not e:GetOwner() then return end
local c=e:GetOwner()
local cid=c:GetOriginalCode()
if not aux.HOPTTracker[c] then
aux.HOPTTracker[c]=0
end
if type(aux.HOPTTracker[c])=="number" then
cid=cid+aux.HOPTTracker[c]*100
end
local flag=0
if oath then
flag=flag|EFFECT_COUNT_CODE_OATH
end
return e:SetCountLimit(1,cid+flag)
end
--Phases
function Duel.IsDrawPhase(tp)
return (not tp or Duel.GetTurnPlayer()==tp) and Duel.GetCurrentPhase()==PHASE_DRAW
end
function Duel.IsStandbyPhase(tp)
return (not tp or Duel.GetTurnPlayer()==tp) and Duel.GetCurrentPhase()==PHASE_STANDBY
end
function Duel.IsMainPhase(tp,ct)
return (not tp or Duel.GetTurnPlayer()==tp)
and (not ct and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) or ct==1 and Duel.GetCurrentPhase()==PHASE_MAIN1 or ct==2 and Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function Duel.IsBattlePhase(tp)
local ph=Duel.GetCurrentPhase()
return (not tp or Duel.GetTurnPlayer()==tp) and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE
end
function Duel.IsEndPhase(tp)
return (not tp or Duel.GetTurnPlayer()==tp) and Duel.GetCurrentPhase()==PHASE_END
end
--PositionChange
function Card.IsCanTurnSetGlitchy(c)
if c:IsPosition(POS_FACEDOWN_DEFENSE) then return false end
if not c:IsPosition(POS_FACEDOWN_ATTACK) then
return c:IsCanTurnSet()
else
return not c:IsType(TYPE_LINK|TYPE_TOKEN) and not c:IsHasEffect(EFFECT_CANNOT_TURN_SET) and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_TURN_SET)
end
end
--Previous
function Card.IsPreviousCodeOnField(c,code,...)
local codes={...}
table.insert(codes,1,code)
local precodes={c:GetPreviousCodeOnField()}
for _,prename in ipairs(precodes) do
for _,name in ipairs(codes) do
if prename==name then
return true
end
end
end
return false
end
function Card.IsPreviousTypeOnField(c,typ)
return c:GetPreviousTypeOnField()&typ==typ
end
function Card.IsPreviousLevelOnField(c,lv)
return c:GetPreviousLevelOnField()==lv
end
function Card.IsPreviousRankOnField(c,lv)
return c:GetPreviousRankOnField()==lv
end
function Card.IsPreviousAttributeOnField(c,att)
return c:GetPreviousAttributeOnField()&att==att
end
function Card.IsPreviousRaceOnField(c,rac)
return c:GetPreviousRaceOnField()&rac==rac
end
function Card.IsPreviousAttackOnField(c,atk)
return c:GetPreviousAttackOnField()==atk
end
function Card.IsPreviousDefenseOnField(c,def)
return c:GetPreviousDefenseOnField()==def
end
--Remain on field
function Auxiliary.RemainOnFieldCost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_REMAIN_FIELD)
e1:SetProperty(EFFECT_FLAG_OATH)
e1:SetReset(RESET_CHAIN)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_DISABLED)
e2:SetOperation(aux.RemainOnFieldCostFunction)
e2:SetLabel(cid)
e2:SetReset(RESET_CHAIN)
Duel.RegisterEffect(e2,tp)
end
function Auxiliary.RemainOnFieldCostFunction(e,tp,eg,ep,ev,re,r,rp)
local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
if cid~=e:GetLabel() then return end
if e:GetOwner():IsRelateToChain(ev) then
e:GetOwner():CancelToGrave(false)
end
end
--Location Check
function Auxiliary.AddThisCardBanishedAlreadyCheck(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_REMOVE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(Auxiliary.ThisCardInGraveAlreadyCheckOperation)
c:RegisterEffect(e1)
return e1
end
--Glitchylib_cond imports
--Turn/Phase Conditions
function Auxiliary.DrawPhaseCond(tp)
return function(e,p)
local tp = (tp==0) and p or (tp==1) and 1-p or nil
return Duel.IsDrawPhase(tp)
end
end
function Auxiliary.StandbyPhaseCond(tp)
return function(e,p)
local tp = (tp==0) and p or (tp==1) and 1-p or nil
return Duel.IsStandbyPhase(tp)
end
end
function Auxiliary.MainPhaseCond(tp,ct)
return function(e,p)
local tp = (tp==0) and p or (tp==1) and 1-p or nil
return Duel.IsMainPhase(tp,ct)
end
end
function Auxiliary.BattlePhaseCond(tp)
return function(e,p)
local tp = (tp==0) and p or (tp==1) and 1-p or nil
return Duel.IsBattlePhase(tp)
end
end
function Auxiliary.MainOrBattlePhaseCond(tp,ct)
return function(e,p)
local tp = (tp==0) and p or (tp==1) and 1-p or nil
return Duel.IsMainPhase(tp,ct) or Duel.IsBattlePhase(tp)
end
end
function Auxiliary.EndPhaseCond(tp)
return function(e,p)
local tp = (tp==0) and p or (tp==1) and 1-p or nil
return Duel.IsEndPhase(tp)
end
end
function Auxiliary.ExceptOnDamageStep()
return Auxiliary.ExceptOnDamageCalc()
end
function Auxiliary.ExceptOnDamageCalc()
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function Auxiliary.TurnPlayerCond(tp)
return function(e,p)
if not p then p=e:GetHandlerPlayer() end
local tp = (not tp or tp==0) and p or 1-p
return Duel.GetTurnPlayer()==tp
end
end
--Glitchylib_cost imports
function Auxiliary.LabelCost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
if chk==0 then return true end
end
--Other Imports
function Card.HasLevel(c,general)
if c:IsType(TYPE_MONSTER) then
return ((c:GetType()&TYPE_LINK~=TYPE_LINK and c:GetType()&TYPE_XYZ~=TYPE_XYZ)) and not c:IsStatus(STATUS_NO_LEVEL)
elseif general and c:IsOriginalType(TYPE_MONSTER) then
return not (c:IsOriginalType(TYPE_XYZ+TYPE_LINK) or c:IsStatus(STATUS_NO_LEVEL))
end
return false
end
function Card.HasDefense(c)
return not c:IsOriginalType(TYPE_LINK)
end
function Duel.IgnoreActionCheck(f,...)
Duel.DisableActionCheck(true)
local cr=coroutine.create(f)
local ret={}
while coroutine.status(cr)~="dead" do
local sret={coroutine.resume(cr,...)}
for i=2,#sret do
table.insert(ret,sret[i])
end
end
Duel.DisableActionCheck(false)
return table.unpack(ret)
end
--EFFECT TABLES
......
Glitchy = Glitchy or {}
EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER = 33720071
EFFECT_UTTER_CONFUSION_CONFIDENCE = 33720072
Glitchy.EnableTestChamber = false
Glitchy.TestChamberResult = 0
Glitchy.TestChamberResultGroup = {}
Glitchy.UndefinedActionWarning = false
GLITCHY_ENABLE_TEST_CHAMBER = 33720071
TEST_CHAMBER_TARGET = 0x1
TEST_CHAMBER_TOHAND = 0x2
--Internal Archetypes
ARCHE_UTTER_CONFUSION = {33720051,33720052,33720053,33720070,33720071,33720072,33720073,33720074}
--TEST CHAMBER MECHANIC (necessary for UTTER CONFUSION - CONFIDENCE)
local _Hint, _IsCanBeEffectTarget, _IsAbleToHand, _IsAbleToHandAsCost, _SelectMatchingCard, _SelectTarget, _GetMatchingGroup, _GroupFilter, _GroupSelect, _FilterSelect, _SelectUnselect, _GroupMerge, _GroupClone, _SelectSubGroup,
_SelectSubGroupEach, _SelectWithSumEqual, _SelectWithSumGreater =
Duel.Hint, Card.IsCanBeEffectTarget, Card.IsAbleToHand, Card.IsAbleToHandAsCost, Duel.SelectMatchingCard, Duel.SelectTarget, Duel.GetMatchingGroup, Group.Filter, Group.Select, Group.FilterSelect, Group.SelectUnselect, Group.Merge, Group.Clone,
Group.SelectSubGroup, Group.SelectSubGroupEach, Group.SelectWithSumEqual, Group.SelectWithSumGreater
Duel.Hint = function(hinttype,p,hint)
if hint==HINTMSG_OPERATECARD then
Glitchy.UndefinedActionWarning = true
end
return _Hint(hinttype,p,hint)
end
Card.IsCanBeEffectTarget = function(c,e)
if Glitchy.EnableTestChamber and Glitchy.TestChamberResult&TEST_CHAMBER_TARGET==0 then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | TEST_CHAMBER_TARGET
end
return _IsCanBeEffectTarget(c,e)
end
Card.IsAbleToHand = function(c,...)
local x = {...}
local p = x[1]
if Glitchy.EnableTestChamber and Glitchy.TestChamberResult&TEST_CHAMBER_TOHAND==0 and (not p or p==self_reference_effect) then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | TEST_CHAMBER_TOHAND
end
return _IsAbleToHand(c,...)
end
Card.IsAbleToHandAsCost = function(c)
if Glitchy.EnableTestChamber and Glitchy.TestChamberResult&TEST_CHAMBER_TOHAND==0 then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | TEST_CHAMBER_TOHAND
end
return _IsAbleToHandAsCost(c)
end
Duel.SelectMatchingCard = function(p,f,pov,loc1,loc2,min,max,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
local test_chamber = _GetMatchingGroup(f,pov,loc1,loc2,exc,...)
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(test_chamber) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
local result = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
local player = p
local nloc1,nloc2 = loc1,loc2
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
player = 1-p
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if loc1&~(LOCATION_DECK+LOCATION_GRAVE)==0 and loc2==0 then
player = 1-p
else
local opt = loc1&(LOCATION_DECK+LOCATION_GRAVE)==0 and 2 or Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
nloc1=nloc1&(LOCATION_DECK+LOCATION_GRAVE)
nloc2=0
elseif opt==1 then
nloc1 = nloc1&~(LOCATION_DECK+LOCATION_GRAVE)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectMatchingCard(player,f,pov,nloc1,nloc2,min,max,exc,...)
else
return _SelectMatchingCard(p,f,pov,loc1,loc2,min,max,exc,...)
end
end
Duel.GetMatchingGroup = function(f,pov,loc1,loc2,exc,...)
local g = _GetMatchingGroup(f,pov,loc1,loc2,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(g) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
Glitchy.TestChamberResultGroup[g] = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
end
return g
end
Group.Filter = function(g,f,exc,...)
local new_g = _GroupFilter(g,f,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(g) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
Glitchy.TestChamberResultGroup[new_g] = Glitchy.TestChamberResult
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[new_g] = Glitchy.TestChamberResultGroup[new_g] | Glitchy.TestChamberResultGroup[g]
end
Glitchy.TestChamberResult = 0
end
return new_g
end
Duel.SelectTarget = function(p,f,pov,loc1,loc2,min,max,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
local test_chamber = _GetMatchingGroup(f,pov,loc1,loc2,exc,...)
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(test_chamber) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
local result = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
local player = p
local nloc1,nloc2 = loc1,loc2
if p==self_reference_effect:GetHandlerPlayer() then
if Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if loc1&~(LOCATION_DECK+LOCATION_GRAVE)==0 and loc2==0 then
player = 1-p
else
local opt = loc1&(LOCATION_DECK+LOCATION_GRAVE)==0 and 2 or Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
nloc1=nloc1&(LOCATION_DECK+LOCATION_GRAVE)
nloc2=0
elseif opt==1 then
nloc1 = nloc1&~(LOCATION_DECK+LOCATION_GRAVE)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectTarget(player,f,pov,loc1,loc2,min,max,exc,...)
else
return _SelectTarget(p,f,pov,loc1,loc2,min,max,exc,...)
end
end
Group.Select = function(g,p,min,max,exc)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _GroupSelect(g,player,min,max,exc)
else
return _GroupSelect(g,p,min,max,exc)
end
end
Group.FilterSelect = function(g,p,f,min,max,exc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Glitchy.EnableTestChamber = true
Glitchy.TestChamberResult = 0
for tc in aux.Next(g) do
f(tc,...)
end
Glitchy.EnableTestChamber = false
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResult = Glitchy.TestChamberResult | Glitchy.TestChamberResultGroup[g]
end
local result = Glitchy.TestChamberResult
Glitchy.TestChamberResult = 0
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _FilterSelect(g,player,f,min,max,exc,...)
else
return _FilterSelect(g,p,f,min,max,exc,...)
end
end
Group.SelectUnselect = function(g,ug,p,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectUnselect(g,ug,player,...)
else
return _SelectUnselect(g,ug,p,...)
end
end
Group.Merge = function(g,c)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and aux.GetValueType(c)=="Group" and type(Glitchy.TestChamberResultGroup[c])=="number" then
if type(Glitchy.TestChamberResultGroup[g])~="number" then Glitchy.TestChamberResultGroup[g] = 0 end
Glitchy.TestChamberResultGroup[g] = Glitchy.TestChamberResultGroup[g] + Glitchy.TestChamberResultGroup[c]
end
return _GroupMerge(g,c)
end
Group.Clone = function(g,g2)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g2])=="number" then
if type(Glitchy.TestChamberResultGroup[g])~="number" then Glitchy.TestChamberResultGroup[g] = 0 end
Glitchy.TestChamberResultGroup[g] = Glitchy.TestChamberResultGroup[g] + Glitchy.TestChamberResultGroup[g2]
end
return _GroupClone(g,g2)
end
Group.SelectSubGroup = function(g,tp,f,cancelable,min,max,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
Auxiliary.SubGroupCaptured=Group.CreateGroup()
local min=min or 1
local max=max or #g
local ext_params={...}
local sg=Group.CreateGroup()
local fg=Duel.GrabSelectedCard()
if #fg>max or min>max or #(g+fg)<min then return nil end
for tc in aux.Next(fg) do
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[fg] = Glitchy.TestChamberResultGroup[g]
end
fg:SelectUnselect(sg,tp,false,false,min,max)
end
sg:Merge(fg)
local finish=(#sg>=min and #sg<=max and f(sg,...))
while #sg<max do
local cg=Group.CreateGroup()
local eg=g:Clone()
for c in aux.Next(g-sg) do
if not cg:IsContains(c) then
if Auxiliary.CheckGroupRecursiveCapture(c,sg,eg,f,min,max,ext_params) then
cg:Merge(Auxiliary.SubGroupCaptured)
else
eg:RemoveCard(c)
end
end
end
cg:Sub(sg)
finish=(#sg>=min and #sg<=max and f(sg,...))
if #cg==0 then break end
local cancel=not finish and cancelable
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[cg] = Glitchy.TestChamberResultGroup[g]
end
local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
if not tc then break end
if not fg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==max then finish=true end
else
sg:RemoveCard(tc)
end
elseif cancelable then
return nil
end
end
if finish then
return sg
else
return nil
end
else
return _SelectSubGroup(g,tp,f,cancelable,min,max,...)
end
end
Group.SelectSubGroupEach = function(g,tp,checks,cancelable,f,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 then
if cancelable==nil then cancelable=false end
if f==nil then f=Auxiliary.TRUE end
local ct=#checks
local ext_params={...}
local sg=Group.CreateGroup()
local finish=false
while #sg<ct do
local cg=g:Filter(Auxiliary.CheckGroupRecursiveEach,sg,sg,g,f,checks,ext_params)
if #cg==0 then break end
if type(Glitchy.TestChamberResultGroup[g])=="number" then
Glitchy.TestChamberResultGroup[cg] = Glitchy.TestChamberResultGroup[g]
end
local tc=cg:SelectUnselect(sg,tp,false,cancelable,ct,ct)
if not tc then break end
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==ct then finish=true end
else
sg:Clear()
end
end
if finish then
return sg
else
return nil
end
else
return _SelectSubGroupEach(g,tp,checks,cancelable,f,...)
end
end
Group.SelectWithSumEqual = function(g,p,f,acc,min,max,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectWithSumEqual(g,player,f,acc,min,max,...)
else
return _SelectWithSumEqual(g,p,f,acc,min,max,...)
end
end
Group.SelectWithSumGreater = function(g,p,f,acc,...)
if Duel.GetFlagEffect(p,GLITCHY_ENABLE_TEST_CHAMBER)>0 and type(Glitchy.TestChamberResultGroup[g])=="number" then
local result = Glitchy.TestChamberResultGroup[g]
local player = p
if p==self_reference_effect:GetHandlerPlayer() then
if result&TEST_CHAMBER_TARGET>0 and Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER) then
for _,ce in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)}) do
if ce and aux.GetValueType(ce)=="Effect" and ce.SetLabel then
local val=ce:GetValue()
if not val or val(ce,self_reference_effect,self_reference_tp) then
player = 1-p
break
end
end
end
elseif result&TEST_CHAMBER_TOHAND>0 and not Glitchy.UndefinedActionWarning and Duel.IsPlayerAffectedByEffect(p,EFFECT_UTTER_CONFUSION_CONFIDENCE) then
if not g:IsExists(function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,1,nil,p) then
player = 1-p
else
local opt=Duel.SelectOption(p,aux.Stringid(33720071,0),aux.Stringid(33720071,1))
if opt==0 then
player = 1-p
g = _GroupFilter(g,function(card,tp) return card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) and card:IsControler(tp) end,nil,p)
else
g = _GroupFilter(g,function(card,tp) return not card:IsLocation(LOCATION_DECK+LOCATION_GRAVE) or card:IsControler(1-tp) end,nil,p)
end
end
end
end
if Glitchy.UndefinedActionWarning then
Glitchy.UndefinedActionWarning = false
end
return _SelectWithSumGreater(g,player,f,acc,...)
else
return _SelectWithSumGreater(g,p,f,acc,...)
end
end
\ No newline at end of file
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