--理所当然？？
function c60152013.initial_effect(c)
	--Activate
    local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(60152013,0))
    e1:SetType(EFFECT_TYPE_ACTIVATE)
    e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCountLimit(1,60152013)
	e1:SetCost(c60152013.cost)
    e1:SetOperation(c60152013.operation)
    c:RegisterEffect(e1)
	--
    local e2=Effect.CreateEffect(c)
    e2:SetDescription(aux.Stringid(60152013,0))
    e2:SetCategory(CATEGORY_DISABLE)
    e2:SetType(EFFECT_TYPE_QUICK_O)
    e2:SetRange(LOCATION_GRAVE)
    e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
    e2:SetCode(EVENT_FREE_CHAIN)
	e2:SetCountLimit(1,60152013)
    e2:SetCost(c60152013.negcost)
    e2:SetTarget(c60152013.target)
    e2:SetOperation(c60152013.activate2)
    c:RegisterEffect(e2)
end
function c60152013.filter(c)
    return c:IsSetCard(0x6b25) and c:IsType(TYPE_MONSTER) and c:IsReleasable()
end
function c60152013.cost(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return Duel.IsExistingMatchingCard(c60152013.filter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil) end
    local g=Duel.SelectMatchingCard(tp,c60152013.filter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
	Duel.Release(g,REASON_COST)
end
function c60152013.operation(e,tp,eg,ep,ev,re,r,rp)
    --
    local e1=Effect.CreateEffect(e:GetHandler())
    e1:SetType(EFFECT_TYPE_FIELD)
    e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
    e1:SetTarget(c60152013.tg)
    e1:SetCode(EFFECT_DISABLE)
	e1:SetReset(RESET_PHASE+PHASE_END)
    Duel.RegisterEffect(e1,tp)
    local e2=e1:Clone()
    e2:SetCode(EFFECT_CANNOT_ATTACK)
    Duel.RegisterEffect(e2,tp)
	local e3=Effect.CreateEffect(e:GetHandler())
    e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
    e3:SetCode(EVENT_PHASE+PHASE_END)
    e3:SetReset(RESET_PHASE+PHASE_END)
    e3:SetCountLimit(1)
    e3:SetOperation(c60152013.droperation)
    Duel.RegisterEffect(e3,tp)
end
function c60152013.tg(e,c)
    return c:GetSummonLocation()==LOCATION_EXTRA
end
function c60152013.tg2(c)
    return c:GetSummonLocation()==LOCATION_EXTRA and c:IsAbleToDeck()
end
function c60152013.droperation(e,tp,eg,ep,ev,re,r,rp)
    local g=Duel.GetMatchingGroup(c60152013.tg2,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
    if g:GetCount()>0 then
        Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
    end
end
function c60152013.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
    Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function c60152013.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
    if chk==0 then return Duel.IsExistingMatchingCard(c60152013.filter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil) end
end
function c60152013.activate2(e,tp,eg,ep,ev,re,r,rp)
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
    local g=Duel.SelectMatchingCard(tp,c60152013.filter,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
    if g:GetCount()>0 then
        Duel.Release(g,REASON_EFFECT)
    end
end