name: Poly-Chemicritter
card_text: This card is treated as a Normal Monster while face-up on the field or in the Graveyard. While this card is a Normal Monster on the field, you can Normal Summon it to have it become an Effect Monster with these effects.
  ● When another Gemini monster is Normal Summoned: You can make that monster gain 500 ATK and DEF.
  ● If a Gemini monster(s) you control would be destroyed by a card effect, you can destroy 1 other card you control instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.EnableDualAttribute(c)
  	--atkup
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_FIELD)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCondition(aux.IsDualState)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(aux.IsDualState)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	e2:SetOperation(s.repop)
  	c:RegisterEffect(e2)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local tc = eg:GetFirst()
  	if chk == 0 then
  		return tc:IsType(TYPE_DUAL) and tc ~= e:GetHandler()
  	end
  	Duel.SetTargetCard(tc)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_DUAL) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:GetFlagEffect(id) == 0
  end
  function s.desfilter(c, e, tp)
  	return c:IsControler(tp) and c:IsOnField() and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED + STATUS_BATTLE_DESTROYED)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_ONFIELD, 0, 1, nil, e, tp) and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
  		local g = eg:Filter(s.repfilter, nil, tp)
  		if g:GetCount() == 1 then
  			e:SetLabelObject(g:GetFirst())
  		else
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
  			local cg = g:Select(tp, 1, 1, nil)
  			e:SetLabelObject(cg:GetFirst())
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
  		local tg = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil, e, tp)
  		Duel.SetTargetCard(tg)
  		tg:GetFirst():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET + RESET_CHAIN, 0, 1)
  		tg:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED, true)
  		return true
  	else
  		return false
  	end
  end
  function s.repval(e, c)
  	return c == e:GetLabelObject()
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, id)
  	local tc = Duel.GetFirstTarget()
  	tc:SetStatus(STATUS_DESTROY_CONFIRMED, false)
  	Duel.Destroy(tc, REASON_EFFECT + REASON_REPLACE)
  end
  
  
source_text: Poly-Chemicritter
  This card is treated as a Normal Monster while face-up on the field or in the Graveyard. While this card is a Normal Monster on the field, you can Normal Summon it to have it become an Effect Monster with these effects.
  ● When another Gemini monster is Normal Summoned: You can make that monster gain 500 ATK and DEF.
  ● If a Gemini monster(s) you control would be destroyed by a card effect, you can destroy 1 other card you control instead.
target_text: -- Poly-Chemicritter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.EnableDualAttribute(c)
  	--atkup
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_FIELD)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCondition(aux.IsDualState)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCondition(aux.IsDualState)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	e2:SetOperation(s.repop)
  	c:RegisterEffect(e2)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local tc = eg:GetFirst()
  	if chk == 0 then
  		return tc:IsType(TYPE_DUAL) and tc ~= e:GetHandler()
  	end
  	Duel.SetTargetCard(tc)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_DUAL) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:GetFlagEffect(id) == 0
  end
  function s.desfilter(c, e, tp)
  	return c:IsControler(tp) and c:IsOnField() and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED + STATUS_BATTLE_DESTROYED)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.desfilter, tp, LOCATION_ONFIELD, 0, 1, nil, e, tp) and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
  		local g = eg:Filter(s.repfilter, nil, tp)
  		if g:GetCount() == 1 then
  			e:SetLabelObject(g:GetFirst())
  		else
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
  			local cg = g:Select(tp, 1, 1, nil)
  			e:SetLabelObject(cg:GetFirst())
  		end
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESREPLACE)
  		local tg = Duel.SelectMatchingCard(tp, s.desfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil, e, tp)
  		Duel.SetTargetCard(tg)
  		tg:GetFirst():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET + RESET_CHAIN, 0, 1)
  		tg:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED, true)
  		return true
  	else
  		return false
  	end
  end
  function s.repval(e, c)
  	return c == e:GetLabelObject()
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, id)
  	local tc = Duel.GetFirstTarget()
  	tc:SetStatus(STATUS_DESTROY_CONFIRMED, false)
  	Duel.Destroy(tc, REASON_EFFECT + REASON_REPLACE)
  end
  
  