Commit 5902989e authored by Ma's avatar Ma

Update c82016179.lua

parent 3b16a5a7
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
function c82016179.initial_effect(c) function c82016179.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c82016179.cost) e1:SetCost(c82016179.cost)
e1:SetTarget(c82016179.target) e1:SetTarget(c82016179.target)
...@@ -15,25 +17,31 @@ function c82016179.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -15,25 +17,31 @@ function c82016179.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function c82016179.target(e,tp,eg,ep,ev,re,r,rp,chk) function c82016179.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,3) end if chk==0 then return Duel.IsPlayerCanDraw(tp,3) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(3)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,2)
end end
function c82016179.activate(e,tp,eg,ep,ev,re,r,rp) function c82016179.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,3,REASON_EFFECT) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.BreakEffect() if Duel.Draw(p,d,REASON_EFFECT)==3 then
local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_HAND,0,nil) Duel.ShuffleHand(tp)
if g:GetCount()>1 and g:IsExists(Card.IsSetCard,1,nil,0x90) then Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_HAND,0,nil)
local sg1=g:FilterSelect(tp,Card.IsSetCard,1,1,nil,0x90) if g:GetCount()>1 and g:IsExists(Card.IsSetCard,1,nil,0x90) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg2=g:Select(tp,1,1,sg1:GetFirst()) local sg1=g:FilterSelect(tp,Card.IsSetCard,1,1,nil,0x90)
sg1:Merge(sg2) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
Duel.ConfirmCards(1-tp,sg1) local sg2=g:Select(tp,1,1,sg1:GetFirst())
Duel.SendtoDeck(sg1,nil,0,REASON_EFFECT) sg1:Merge(sg2)
Duel.SortDecktop(tp,tp,2) Duel.ConfirmCards(1-tp,sg1)
else Duel.SendtoDeck(sg1,nil,0,REASON_EFFECT)
local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0) Duel.SortDecktop(tp,tp,2)
Duel.ConfirmCards(1-tp,hg) else
local ct=Duel.SendtoDeck(hg,nil,0,REASON_EFFECT) local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
Duel.SortDecktop(tp,tp,ct) Duel.ConfirmCards(1-tp,hg)
local ct=Duel.SendtoDeck(hg,nil,0,REASON_EFFECT)
Duel.SortDecktop(tp,tp,ct)
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