--[[message
更新：2023-04-14
卡数：19
规则：大师2020
]]
Debug.SetAIName("棉花")
Debug.ReloadFieldBegin(DUEL_ATTACK_FIRST_TURN+DUEL_SIMPLE_AI+DUEL_PSEUDO_SHUFFLE,5)
Debug.SetPlayerInfo(0,100,0,0)
Debug.SetPlayerInfo(1,13400,0,0)

local e0=Effect.GlobalEffect()
e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_ADJUST)
e0:SetCountLimit(1)
e0:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(0)>0 end)
e0:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_DECK,0,5,5,nil)
if g:GetCount()>0 then
  Duel.SendtoHand(g,nil,REASON_RULE)
end end)
Duel.RegisterEffect(e0,0)

Debug.AddCard(18282103,0,0,LOCATION_DECK,0,POS_FACEUP_ATTACK)
Debug.AddCard(82888408,0,0,LOCATION_DECK,3,POS_FACEUP_ATTACK)
Debug.AddCard(24040093,0,0,LOCATION_DECK,4,POS_FACEUP_ATTACK)
Debug.AddCard(82888408,0,0,LOCATION_DECK,0,POS_FACEUP_ATTACK)
Debug.AddCard(97439806,0,0,LOCATION_DECK,0,POS_FACEUP_ATTACK)
Debug.AddCard(97439806,0,0,LOCATION_GRAVE,0,POS_FACEUP_ATTACK)
Debug.AddCard(57421866,0,0,LOCATION_GRAVE,0,POS_FACEUP_ATTACK)
Debug.AddCard(44155002,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(39477584,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(54048462,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(47395382,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(76774528,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(76774528,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(76774528,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(12014404,0,0,LOCATION_EXTRA,0,POS_FACEDOWN_ATTACK)
Debug.AddCard(72328962,0,0,LOCATION_DECK,1,POS_FACEUP_ATTACK)
Debug.AddCard(19439119,0,0,LOCATION_DECK,2,POS_FACEUP_ATTACK)
--~ Debug.AddCard(82888408,0,0,LOCATION_DECK,3,POS_FACEUP_ATTACK)
--~ Debug.AddCard(24040093,0,0,LOCATION_DECK,4,POS_FACEUP_ATTACK)
Debug.AddCard(18282103,0,0,LOCATION_DECK,5,POS_FACEUP_ATTACK)
local m10=Debug.AddCard(90660762,1,1,LOCATION_MZONE,1,POS_FACEUP_ATTACK)
local m11=Debug.AddCard(90660762,1,1,LOCATION_MZONE,2,POS_FACEUP_ATTACK)
local m12=Debug.AddCard(90660762,1,1,LOCATION_MZONE,3,POS_FACEUP_ATTACK)
Debug.AddCard(19665973,1,1,LOCATION_HAND,3,POS_FACEUP_ATTACK)
Debug.AddCard(89631139,1,1,LOCATION_HAND,4,POS_FACEUP_ATTACK)


Debug.ReloadFieldEnd()

local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_USE_EXTRA_MZONE)
e1:SetValue(1)
Duel.RegisterEffect(e1,0)

Debug.ShowHint("从卡组中选择五张卡加入手卡！")

aux.BeginPuzzle()
local e999=Effect.GlobalEffect()
e999:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e999:SetCode(EVENT_DAMAGE)
e999:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(1)<=0 end)
e999:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
Debug.ShowHint("残局群181175613") end)
Duel.RegisterEffect(e999,0)



--~ local e1=Effect.GlobalEffect()
--~ e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
--~ e1:SetCode(EVENT_PHASE_START+PHASE_END)
--~ e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==0 end)
--~ e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
--~ Debug.ShowHint("提示：等级偷窃虫") end)
--~ Duel.RegisterEffect(e1,0)
