local str = {}
local fun = {}

local cache_1
local cache_2
local cache_3



_G["通关邀请"] = function()
  local effect_1
  effect_1 = Effect.GlobalEffect()
  effect_1:SetType(EFFECT_TYPE_FIELD
    + EFFECT_TYPE_CONTINUOUS)
  effect_1: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_1:SetCondition(cache_1)
  function cache_1()
    Debug.ShowHint("残局群181175613")
    return
    end
  effect_1:SetOperation(cache_1)

  Duel.RegisterEffect(effect_1
    , 0)
  end

fun["是否效果卡"] = function(card)
  local cache_1
  local cache_2
  local cache_3

  cache_1 = Card.IsType(card, TYPE_SPELL)
  cache_2 = Card.IsType(card, TYPE_TRAP)
  cache_3 = Card.IsType(card, TYPE_EFFECT)

  if cache_1
  or cache_2
  or cache_3 then
    return true
    end
  return false
  end

_G["开局说明"] = function()
  str["我方卡组"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_DECK,0,nil)
  str["我方墓地"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_GRAVE,0,nil)
  str["我方怪兽区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_MZONE,0,nil)
  str["我方手卡"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_HAND,0,nil)
  str["我方灵摆区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_PZONE,0,nil)
  str["我方除外区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_REMOVED,0,nil)
  str["我方额外卡组"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_EXTRA,0,nil)
  str["我方魔陷区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_SZONE,0,nil)
  str["我方超量素材"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_OVERLAY,0,nil)

  str["对方卡组"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_DECK,nil)
  str["对方墓地"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_GRAVE,nil)
  str["对方怪兽区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_MZONE,nil)
  str["对方手卡"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_HAND,nil)
  str["对方灵摆区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_PZONE,nil)
  str["对方除外区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_REMOVED,nil)
  str["对方额外卡组"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_EXTRA,nil)
  str["对方魔陷区"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_SZONE,nil)
  str["对方超量素材"] = Duel.GetMatchingGroupCount(fun["是否效果卡"],0,0,LOCATION_OVERLAY,nil)


--~   Debug.ShowHint(Duel.GetMatchingGroupCount(fun["是否效果卡"],0,LOCATION_GRAVE,0,nil))

--~   local cache_1 = {}

--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_DECK,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_GRAVE,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_MZONE,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_HAND,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_PZONE,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_REMOVED,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_EXTRA,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,LOCATION_SZONE,0)
--~   cache_1:insert(cache_2)

--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_DECK)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_GRAVE)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_MZONE)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_HAND)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_PZONE)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_REMOVED)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_EXTRA)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetFieldGroup(0,0,LOCATION_SZONE)
--~   cache_1:insert(cache_2)

--~   cache_2 = Duel.GetOverlayGroup(0,LOCATION_MZONE,0)
--~   cache_1:insert(cache_2)
--~   cache_2 = Duel.GetOverlayGroup(0,0,LOCATION_SZONE)
--~   cache_1:insert(cache_2)

--~   for i=1, #cache_1 do
--~     end


  str["这个残局的效果卡数量"] = 0

--~   str["我方卡组"] = Duel.GetFieldGroupCount(0,LOCATION_DECK,0)
--~   str["我方墓地"] = Duel.GetFieldGroupCount(0,LOCATION_GRAVE,0)
--~   str["我方怪兽区"] = Duel.GetFieldGroupCount(0,LOCATION_MZONE,0)
--~   str["我方手卡"] = Duel.GetFieldGroupCount(0,LOCATION_HAND,0)
--~   str["我方灵摆区"] = Duel.GetFieldGroupCount(0,LOCATION_PZONE,0)
--~   str["我方除外区"] = Duel.GetFieldGroupCount(0,LOCATION_REMOVED,0)
--~   str["我方额外卡组"] = Duel.GetFieldGroupCount(0,LOCATION_EXTRA,0)
--~   str["我方魔陷区"] = Duel.GetFieldGroupCount(0,LOCATION_SZONE,0)

--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方卡组"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方墓地"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方怪兽区"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方手卡"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方灵摆区"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方除外区"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方额外卡组"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方魔陷区"]

--~   str["对方卡组"] = Duel.GetFieldGroupCount(0,0,LOCATION_DECK)
--~   str["对方墓地"] = Duel.GetFieldGroupCount(0,0,LOCATION_GRAVE)
--~   str["对方怪兽区"] = Duel.GetFieldGroupCount(0,0,LOCATION_MZONE)
--~   str["对方手卡"] = Duel.GetFieldGroupCount(0,0,LOCATION_HAND)
--~   str["对方灵摆区"] = Duel.GetFieldGroupCount(0,0,LOCATION_PZONE)
--~   str["对方除外区"] = Duel.GetFieldGroupCount(0,0,LOCATION_REMOVED)
--~   str["对方额外卡组"] = Duel.GetFieldGroupCount(0,0,LOCATION_EXTRA)
--~   str["对方魔陷区"] = Duel.GetFieldGroupCount(0,0,LOCATION_SZONE)

--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方卡组"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方墓地"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方怪兽区"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方手卡"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方灵摆区"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方除外区"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方额外卡组"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方魔陷区"]

--~   str["我方超量素材"] = Duel.GetOverlayCount(0, LOCATION_MZONE, 0)
--~   str["对方超量素材"] = Duel.GetOverlayCount(0, 0, LOCATION_MZONE)

--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["我方超量素材"]
--~   str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + str["对方超量素材"]

--~   Debug.ShowHint(str["这个残局的效果卡数量"])
  end


