--[[message
卡数：27
规则：大师3
一起来我我我
]]
Debug.SetAIName("四妹")
Debug.ReloadFieldBegin(DUEL_ATTACK_FIRST_TURN+DUEL_SIMPLE_AI+DUEL_PSEUDO_SHUFFLE,3)
Debug.SetPlayerInfo(0,700,0,0)
Debug.SetPlayerInfo(1,12200,0,0)

Debug.AddCard(14785765,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(71453557,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(72355441,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(90673413,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(51790181,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(81816475,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(12298909,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(52105192,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(98494543,0,0,LOCATION_DECK,0,POS_FACEDOWN)
Debug.AddCard(26082117,0,0,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(33420078,0,0,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(77334267,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(92661479,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(38495396,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(91949988,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(95040215,0,0,LOCATION_EXTRA,0,POS_FACEDOWN)
Debug.AddCard(65878864,0,0,LOCATION_MZONE,2,POS_FACEDOWN_DEFENSE)
Debug.AddCard(61705417,0,0,LOCATION_SZONE,1,POS_FACEDOWN)
Debug.AddCard(97077563,0,0,LOCATION_SZONE,2,POS_FACEDOWN)
Debug.AddCard(44330098,1,1,LOCATION_HAND,0,POS_FACEDOWN)
Debug.AddCard(75652080,1,1,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(34710660,1,1,LOCATION_GRAVE,0,POS_FACEUP)
Debug.AddCard(80117527,1,1,LOCATION_GRAVE,0,POS_FACEUP,true)
Debug.AddCard(1992816,1,1,LOCATION_MZONE,2,POS_FACEUP_ATTACK,true)
Debug.AddCard(89631139,1,1,LOCATION_MZONE,2,POS_FACEUP_ATTACK)
local g1=Debug.AddCard(66235877,1,1,LOCATION_MZONE,2,POS_FACEUP_ATTACK)
g1:CompleteProcedure()
Debug.AddCard(44095762,1,1,LOCATION_SZONE,1,POS_FACEDOWN)
Debug.AddCard(44095762,1,1,LOCATION_SZONE,2,POS_FACEDOWN)
Debug.AddCard(44095762,1,1,LOCATION_SZONE,3,POS_FACEDOWN)
Debug.ReloadFieldEnd()
aux.BeginPuzzle()

local str = {}
local fun = {}

local cache_1

fun["通关邀请"] = function()
  local effect_100
  effect_100 = Effect.GlobalEffect()
  effect_100:SetType(EFFECT_TYPE_FIELD
    + EFFECT_TYPE_CONTINUOUS)
  effect_100:SetCode(EVENT_DAMAGE)
  function cache_1()

    cache_1 = Duel.GetLP(1)

    if cache_1 <= 0 then
      cache_1 = true
    else
      cache_1 = false
      end

    return cache_1
    end
  effect_100:SetCondition(cache_1)
  function cache_1()
    Debug.ShowHint("残局群181175613")
    return
    end
  effect_100:SetOperation(cache_1)
  Duel.RegisterEffect(effect_100
    , 0)
  end

fun["开局添加手卡"] = function(str_1)
  local effect_101
  effect_101 = Effect.GlobalEffect()
  effect_101:SetType(EFFECT_TYPE_FIELD
    + EFFECT_TYPE_CONTINUOUS)
  effect_101:SetCode(EVENT_ADJUST)
  effect_101:SetCountLimit(1)
  function cache_1()
    cache_1 = Duel.GetLP(0)
    if cache_1 > 0 then
      cache_1 = true
    else
      cache_1 = false
      end
    return cache_1
    end
  effect_101:SetCondition(cache_1)
  function cache_1(effect_event
    , player_who_activate_the_effect)
    cache_1 = Duel.SelectMatchingCard(player_who_activate_the_effect
       , Card.IsAbleToHand
       , player_who_activate_the_effect
       , LOCATION_DECK
       , 0
       , str_1
       , str_1
       , nil)
    cache_1 = cache_1:GetCount()
    if cache_1 > 0 then
      Duel.SendtoHand(cache_1
        , nil
        , REASON_RULE)
      end
    end
  effect_101:SetOperation(cache_1)
  Duel.RegisterEffect(effect_101
    , 0)
  end

fun["通关邀请"]()
fun["开局添加手卡"](6)

