--[[message
更新：2023-04-14
卡数：23
规则：大师3
不死海王星
]]
--puzzle1
Debug.SetAIName("四妹")
Debug.ReloadFieldBegin(DUEL_ATTACK_FIRST_TURN+DUEL_SIMPLE_AI+DUEL_PSEUDO_SHUFFLE,3)
Debug.SetPlayerInfo(0,500,0,0)
Debug.SetPlayerInfo(1,18500,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,3,3,nil)
if g:GetCount()>0 then
  Duel.SendtoHand(g,nil,REASON_RULE)
end end)
Duel.RegisterEffect(e0,0)

Debug.AddCard(7953868,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(14785765,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(4064256,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(88071625,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(7953868,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(12247206,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(43040603,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(48976825,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(17259470,0,0,LOCATION_GRAVE,0,POS_FACEDOWN)
Debug.AddCard(92826944,0,0,LOCATION_GRAVE,0,POS_FACEDOWN)
Debug.AddCard(65422840,0,0,LOCATION_GRAVE,0,POS_FACEDOWN)
Debug.AddCard(7953868,0,0,LOCATION_GRAVE,0,POS_FACEDOWN)
Debug.AddCard(14644902,0,0,LOCATION_DECK,0,POS_FACEDOWN)

Debug.AddCard(73776643,0,0,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(12014404,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(34086406,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(34086406,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(68597372,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(28150174,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(11398059,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(76067258,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(3897065,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(89631139,1,1,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(89631139,1,1,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(89631139,1,1,LOCATION_MZONE,2,POS_FACEUP_DEFENSE)
Debug.AddCard(22047978,1,1,LOCATION_SZONE,2,POS_FACEDOWN)
Debug.ReloadFieldEnd()
--~ Debug.ShowHint("在这个回合取得胜利！")
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)