name: Dual
card_text: "Dual Avatar Feet - Kokoku" + 2 "Dual Avatar" monsters
  The first time each "Dual Avatar" Fusion Monster you control would be destroyed by battle each turn, it is not destroyed. Once per turn, during your Main Phase: You can return all Spells and Traps your opponent controls to the hand. When a monster effect is activated on your opponent's field while you control 2 or more Fusion Monsters (Quick Effect): You can destroy that monster. You can only use this effect of "Dual Avatar - Empowered Mitsu-Jaku" once per turn.
external_ids: local CARD_ID_0 = 11759079 --Dual Avatar Feet - Kokoku
  local SETCARD_ID_0 = 0x14f --Dual
  
lua: local CARD_ID_0 = 11759079 --Dual Avatar Feet - Kokoku
  local SETCARD_ID_0 = 0x14f --Dual
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion
  	c:EnableReviveLimit()
  	aux.AddFusionProcCodeFun(c, CARD_ID_0, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 2, true, true)
  	--effect monster material check
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetCode(EFFECT_MATERIAL_CHECK)
  	e0:SetValue(s.matcheck)
  	c:RegisterEffect(e0)
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.indtg)
  	e1:SetValue(s.indct)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	--destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_DESTROY)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_CHAINING)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.descon)
  	e3:SetTarget(s.destg)
  	e3:SetOperation(s.desop)
  	c:RegisterEffect(e3)
  end
  function s.matcheck(e, c)
  	local g = c:GetMaterial()
  	if g:IsExists(Card.IsType, 1, nil, TYPE_EFFECT) then
  		c:RegisterFlagEffect(85360035, RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD, 0, 1)
  	end
  end
  function s.indtg(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FUSION)
  end
  function s.indct(e, re, r, rp)
  	if bit.band(r, REASON_BATTLE) ~= 0 then
  		return 1
  	else
  		return 0
  	end
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, 0, LOCATION_ONFIELD, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, g:GetCount(), 0, 0)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, 0, LOCATION_ONFIELD, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_FUSION)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return ep == 1 - tp
  		and re:GetHandler():IsOnField()
  		and re:GetHandler():IsRelateToEffect(re)
  		and re:IsActiveType(TYPE_MONSTER)
  		and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 2, nil)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return re:GetHandler():IsDestructable()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	if re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  
source_text: Dual
  "Dual Avatar Feet - Kokoku" + 2 "Dual Avatar" monsters
  The first time each "Dual Avatar" Fusion Monster you control would be destroyed by battle each turn, it is not destroyed. Once per turn, during your Main Phase: You can return all Spells and Traps your opponent controls to the hand. When a monster effect is activated on your opponent's field while you control 2 or more Fusion Monsters (Quick Effect): You can destroy that monster. You can only use this effect of "Dual Avatar - Empowered Mitsu-Jaku" once per turn.
target_text: -- Dual
  local CARD_ID_0 = 11759079 --Dual Avatar Feet - Kokoku
  local SETCARD_ID_0 = 0x14f --Dual
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion
  	c:EnableReviveLimit()
  	aux.AddFusionProcCodeFun(c, CARD_ID_0, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 2, true, true)
  	--effect monster material check
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_SINGLE)
  	e0:SetCode(EFFECT_MATERIAL_CHECK)
  	e0:SetValue(s.matcheck)
  	c:RegisterEffect(e0)
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.indtg)
  	e1:SetValue(s.indct)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetCountLimit(1)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	--destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_DESTROY)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_CHAINING)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.descon)
  	e3:SetTarget(s.destg)
  	e3:SetOperation(s.desop)
  	c:RegisterEffect(e3)
  end
  function s.matcheck(e, c)
  	local g = c:GetMaterial()
  	if g:IsExists(Card.IsType, 1, nil, TYPE_EFFECT) then
  		c:RegisterFlagEffect(85360035, RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD, 0, 1)
  	end
  end
  function s.indtg(e, c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FUSION)
  end
  function s.indct(e, re, r, rp)
  	if bit.band(r, REASON_BATTLE) ~= 0 then
  		return 1
  	else
  		return 0
  	end
  end
  function s.thfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, 0, LOCATION_ONFIELD, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, g:GetCount(), 0, 0)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, 0, LOCATION_ONFIELD, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_FUSION)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return ep == 1 - tp
  		and re:GetHandler():IsOnField()
  		and re:GetHandler():IsRelateToEffect(re)
  		and re:IsActiveType(TYPE_MONSTER)
  		and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 2, nil)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return re:GetHandler():IsDestructable()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	if re:GetHandler():IsRelateToEffect(re) then
  		Duel.Destroy(eg, REASON_EFFECT)
  	end
  end
  
  