盗人の煙玉
モンスターに装備されているこのカードがカードの効果によって破壊された時、相手の手札を確認して1枚捨てる。
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_EQUIP)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
	e1:SetTarget(s.target)
	e1:SetOperation(s.operation)
	c:RegisterEffect(e1)
	--Equip limit
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_EQUIP_LIMIT)
	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
	e2:SetValue(1)
	c:RegisterEffect(e2)
	--Check & Discard
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 0))
	e3:SetCategory(CATEGORY_HANDES)
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e3:SetCode(EVENT_LEAVE_FIELD)
	e3:SetCondition(s.discon)
	e3:SetTarget(s.distg)
	e3:SetOperation(s.disop)
	c:RegisterEffect(e3)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
	end
	if chk == 0 then
		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
		Duel.Equip(tp, e:GetHandler(), tc)
	end
end
function s.discon(e, tp, eg, ep, ev, re, r, rp)
	return bit.band(r, 0x41) == 0x41 and e:GetHandler():GetEquipTarget() ~= nil
end
function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetTargetPlayer(tp)
	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, 1 - tp, 1)
end
function s.disop(e, tp, eg, ep, ev, re, r, rp)
	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
	local g = Duel.GetFieldGroup(p, 0, LOCATION_HAND)
	if g:GetCount() > 0 then
		Duel.ConfirmCards(p, g)
		Duel.Hint(HINT_SELECTMSG, p, HINTMSG_DISCARD)
		local sg = g:Select(p, 1, 1, nil)
		Duel.SendtoGrave(sg, REASON_EFFECT + REASON_DISCARD)
		Duel.ShuffleHand(1 - p)
	end
end


盗人の煙玉
モンスターに装備されているこのカードがカードの効果によって破壊された時、相手の手札を確認して1枚捨てる。
-- 盗人の煙玉
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_EQUIP)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
	e1:SetTarget(s.target)
	e1:SetOperation(s.operation)
	c:RegisterEffect(e1)
	--Equip limit
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_EQUIP_LIMIT)
	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
	e2:SetValue(1)
	c:RegisterEffect(e2)
	--Check & Discard
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 0))
	e3:SetCategory(CATEGORY_HANDES)
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e3:SetCode(EVENT_LEAVE_FIELD)
	e3:SetCondition(s.discon)
	e3:SetTarget(s.distg)
	e3:SetOperation(s.disop)
	c:RegisterEffect(e3)
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
	end
	if chk == 0 then
		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
end
function s.operation(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
		Duel.Equip(tp, e:GetHandler(), tc)
	end
end
function s.discon(e, tp, eg, ep, ev, re, r, rp)
	return bit.band(r, 0x41) == 0x41 and e:GetHandler():GetEquipTarget() ~= nil
end
function s.distg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return true
	end
	Duel.SetTargetPlayer(tp)
	Duel.SetOperationInfo(0, CATEGORY_HANDES, nil, 0, 1 - tp, 1)
end
function s.disop(e, tp, eg, ep, ev, re, r, rp)
	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
	local g = Duel.GetFieldGroup(p, 0, LOCATION_HAND)
	if g:GetCount() > 0 then
		Duel.ConfirmCards(p, g)
		Duel.Hint(HINT_SELECTMSG, p, HINTMSG_DISCARD)
		local sg = g:Select(p, 1, 1, nil)
		Duel.SendtoGrave(sg, REASON_EFFECT + REASON_DISCARD)
		Duel.ShuffleHand(1 - p)
	end
end

