--时穿剑·雄之剑 local m=14000005 local cm=_G["c"..m] cm.named_with_Chronoblade=1 xpcall(function() require("expansions/script/c14000001") end,function() require("script/c14000001") end) function cm.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(cm.cost) e1:SetTarget(cm.target) e1:SetOperation(cm.activate) c:RegisterEffect(e1) --link summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(m,2)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_ONFIELD) e2:SetHintTiming(0,0x1e0) e2:SetCountLimit(1) e2:SetCost(cm.lkcost) e2:SetTarget(cm.lktg) e2:SetOperation(cm.lkop) c:RegisterEffect(e2) --remain field local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_REMAIN_FIELD) c:RegisterEffect(e3) end function cm.setfilter(c) return c:IsCode(14000006) and c:IsType(TYPE_SPELL+TYPE_TRAP) and not c:IsForbidden() end function cm.cfilter(c) return chrb.CHRB(c) and c:IsAbleToDeckAsCost() end function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_HAND,0,1,1,e:GetHandler()) Duel.ConfirmCards(1-tp,g) Duel.SendtoDeck(g,nil,2,REASON_COST) end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function cm.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Damage(p,d,REASON_EFFECT)~=0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.setfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end end end function cm.filter1(c) return c:IsCode(14000006) and c:IsFaceup() and c:IsAbleToGraveAsCost() end function cm.profilter(c,e,tp) return c:IsCode(14000007) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_LINK,tp,false,false) end function cm.lkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(cm.filter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local mat=Duel.SelectMatchingCard(tp,cm.filter1,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SendtoGrave(e:GetHandler(),REASON_COST) Duel.SendtoGrave(mat,REASON_COST) end function cm.lktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(cm.profilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function cm.lkop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCountFromEx(tp)<=0 then return end local sg=Duel.GetMatchingGroup(cm.profilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg) if sg:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() Duel.ConfirmCards(1-tp,tc) local tc=Duel.GetFirstMatchingCard(cm.profilter,tp,LOCATION_EXTRA,0,nil,e,tp) if not tc then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then Duel.SendtoGrave(tc,REASON_EFFECT) tc:CompleteProcedure() else Duel.SpecialSummon(tc,SUMMON_TYPE_LINK,tp,tp,false,false,POS_FACEUP) tc:CompleteProcedure() end end end