Commit d8a346f2 authored by wind2009's avatar wind2009

Fix 霆王の閃光

parent 1220326e
Pipeline #42614 canceled with stages
in 5 seconds
No preview for this file type
--霆王の閃光 --霆王の閃光
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--Act in hand --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0)) e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EFFECT_TRAP_ACT_IN_HAND) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCondition(s.handcon) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--Activate --Act in hand
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1)) e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetType(EFFECT_TYPE_ACTIVATE) e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCode(EVENT_FREE_CHAIN) e2:SetCondition(s.handcon)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e2:SetTarget(s.target)
e2:SetOperation(s.activate)
c:RegisterEffect(e2) c:RegisterEffect(e2)
Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter)
end end
...@@ -30,12 +31,11 @@ function s.handcon(e) ...@@ -30,12 +31,11 @@ function s.handcon(e)
return Duel.GetCustomActivityCount(id,1-tp,ACTIVITY_CHAIN)>0 return Duel.GetCustomActivityCount(id,1-tp,ACTIVITY_CHAIN)>0
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:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) end if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,nil) end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,1-tp,LOCATION_HAND)
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
e:SetLabel(100) e:SetLabel(100)
end end
...@@ -46,17 +46,17 @@ end ...@@ -46,17 +46,17 @@ 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:IsRelateToChain() and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then if tc:IsRelateToChain() and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0
if Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_GRAVE,0,nil,TYPE_TRAP)==0 and tc:IsLocation(LOCATION_REMOVED)
and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and not Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_GRAVE,0,1,nil,TYPE_TRAP)
and Duel.IsExistingMatchingCard(s.spfilter,1-tp,LOCATION_HAND,0,1,nil,e,1-tp) and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
and Duel.SelectYesNo(1-tp,aux.Stringid(id,2)) then and Duel.IsExistingMatchingCard(s.spfilter,1-tp,LOCATION_HAND,0,1,nil,e,1-tp)
Duel.BreakEffect() and Duel.SelectYesNo(1-tp,aux.Stringid(id,2)) then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) Duel.BreakEffect()
local g=Duel.SelectMatchingCard(1-tp,s.spfilter,1-tp,LOCATION_HAND,0,1,1,nil,e,1-tp) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON)
if #g>0 then local g=Duel.SelectMatchingCard(1-tp,s.spfilter,1-tp,LOCATION_HAND,0,1,1,nil,e,1-tp)
Duel.SpecialSummon(g,0,1-tp,1-tp,false,false,POS_FACEUP) if #g>0 then
end Duel.SpecialSummon(g,0,1-tp,1-tp,false,false,POS_FACEUP)
end end
end end
if e:GetLabel()==100 then if e:GetLabel()==100 then
...@@ -73,4 +73,4 @@ end ...@@ -73,4 +73,4 @@ end
function s.aclimit(e,re,tp) function s.aclimit(e,re,tp)
local c=re:GetHandler() local c=re:GetHandler()
return c:IsAttribute(ATTRIBUTE_EARTH+ATTRIBUTE_WATER+ATTRIBUTE_FIRE+ATTRIBUTE_WIND) and re:IsActiveType(TYPE_MONSTER) return c:IsAttribute(ATTRIBUTE_EARTH+ATTRIBUTE_WATER+ATTRIBUTE_FIRE+ATTRIBUTE_WIND) and re:IsActiveType(TYPE_MONSTER)
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