name: Kikinagashi
card_text: 2 Level 1 monsters
  Unaffected by other cards' effects. Once per turn (Quick Effect): You can detach 2 materials from this card; for the rest of this turn, this card cannot be destroyed by battle, also you take no battle damage from attacks involving this card.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 1, 2)
  	c:EnableReviveLimit()
  	--immune
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_IMMUNE_EFFECT)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.efilter)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(aux.bpcon)
  	e2:SetCost(s.indcost)
  	e2:SetOperation(s.indop)
  	c:RegisterEffect(e2)
  end
  function s.efilter(e, te)
  	return te:GetOwner() ~= e:GetOwner()
  end
  function s.indcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 2, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 2, 2, REASON_COST)
  end
  function s.indop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  		c:RegisterEffect(e2)
  	end
  end
  
  
source_text: Kikinagashi
  2 Level 1 monsters
  Unaffected by other cards' effects. Once per turn (Quick Effect): You can detach 2 materials from this card; for the rest of this turn, this card cannot be destroyed by battle, also you take no battle damage from attacks involving this card.
target_text: -- Kikinagashi
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 1, 2)
  	c:EnableReviveLimit()
  	--immune
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_IMMUNE_EFFECT)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(s.efilter)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(aux.bpcon)
  	e2:SetCost(s.indcost)
  	e2:SetOperation(s.indop)
  	c:RegisterEffect(e2)
  end
  function s.efilter(e, te)
  	return te:GetOwner() ~= e:GetOwner()
  end
  function s.indcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 2, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 2, 2, REASON_COST)
  end
  function s.indop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  		c:RegisterEffect(e2)
  	end
  end
  
  