Commit e2376929 authored by wind2009's avatar wind2009

Fix トラップホリック

parent 9261dc63
--陷阱痴迷症 --トラップホリック
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--Activate --Activate
...@@ -13,35 +13,33 @@ function s.initial_effect(c) ...@@ -13,35 +13,33 @@ function s.initial_effect(c)
e1:SetOperation(s.activate) e1:SetOperation(s.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function s.desfilter(c,ft) function s.desfilter(c,tp,ft)
if ft<1 and (not c:IsLocation(LOCATION_SZONE) or c:IsLocation(LOCATION_FZONE)) return c:IsType(TYPE_SPELL+TYPE_TRAP) and Duel.GetSZoneCount(tp,c)>ft
then return false end
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end end
function s.setfilter(c) function s.setfilter(c)
return c:GetType()==TYPE_TRAP and not c:IsCode(id) and c:IsSSetable(true) return c:GetType()==TYPE_TRAP and not c:IsCode(id) and c:IsSSetable(true)
end end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(tp) if chkc then return chkc:IsOnField() and chkc:IsControler(tp)
and chkc:IsType(TYPE_SPELL+TYPE_TRAP) end and chkc:IsType(TYPE_SPELL+TYPE_TRAP) and chkc~=e:GetHandler() end
local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) local ft=0
if chk==0 then if chk==0 then
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=ft-1 end if e:IsHasType(EFFECT_TYPE_ACTIVATE) and not e:GetHandler():IsLocation(LOCATION_SZONE) then ft=1 end
return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil,ft) return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil,tp,ft)
and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil,ft) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil,tp,ft)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end end
function s.activate(e,tp,eg,ep,ev,re,r,rp) function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then if tc and tc:IsRelateToChain() and Duel.Destroy(tc,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst() local sc=g:GetFirst()
if tc and Duel.SSet(tp,tc)~=0 then if sc and Duel.SSet(tp,sc)~=0 then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1)) e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
...@@ -49,7 +47,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -49,7 +47,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetCondition(s.actcon) e1:SetCondition(s.actcon)
tc:RegisterEffect(e1) sc:RegisterEffect(e1)
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment