name: Reptilianne
card_text: If this card is in your hand and all monsters you control are face-up Reptile monsters (min. 1): You can target 1 face-up monster your opponent controls; change its ATK to 0, and if you do, Special Summon this card, then take damage equal to that monster's original ATK. If this card is sent to the GY as Synchro Material: You can target up to 2 face-up monsters on the field; change their ATK to 0. You can only use 1 "Reptilianne Lamia" effect per turn, and only once that turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_SPECIAL_SUMMON + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--atk
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.atkcon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsFacedown() or not c:IsRace(RACE_REPTILE)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, LOCATION_MZONE, 0)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > 0 and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.spfilter(c)
  	return aux.nzatk(c) and c:GetBaseAttack() > 0
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.spfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.IsExistingTarget(s.spfilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	local atk = g:GetFirst():GetBaseAttack()
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, tp, atk)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local atk = math.max(tc:GetBaseAttack(), 0)
  		if c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) ~= 0 and atk > 0 then
  			Duel.BreakEffect()
  			Duel.Damage(tp, atk, REASON_EFFECT)
  		end
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_SYNCHRO
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and aux.nzatk(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.nzatk, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, aux.nzatk, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 2, nil)
  end
  function s.tgfilter(c, e)
  	return c:IsFaceup() and c:IsRelateToEffect(e)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(s.tgfilter, nil, e)
  	local tc = g:GetFirst()
  	while tc do
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		tc = g:GetNext()
  	end
  end
  
  
source_text: Reptilianne
  If this card is in your hand and all monsters you control are face-up Reptile monsters (min. 1): You can target 1 face-up monster your opponent controls; change its ATK to 0, and if you do, Special Summon this card, then take damage equal to that monster's original ATK. If this card is sent to the GY as Synchro Material: You can target up to 2 face-up monsters on the field; change their ATK to 0. You can only use 1 "Reptilianne Lamia" effect per turn, and only once that turn.
target_text: -- Reptilianne
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_SPECIAL_SUMMON + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  	--atk
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.atkcon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsFacedown() or not c:IsRace(RACE_REPTILE)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetFieldGroup(tp, LOCATION_MZONE, 0)
  	return Duel.GetFieldGroupCount(tp, LOCATION_MZONE, 0) > 0 and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.spfilter(c)
  	return aux.nzatk(c) and c:GetBaseAttack() > 0
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.spfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and Duel.IsExistingTarget(s.spfilter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	local atk = g:GetFirst():GetBaseAttack()
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, tp, atk)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local atk = math.max(tc:GetBaseAttack(), 0)
  		if c:IsRelateToEffect(e) and Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) ~= 0 and atk > 0 then
  			Duel.BreakEffect()
  			Duel.Damage(tp, atk, REASON_EFFECT)
  		end
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_SYNCHRO
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and aux.nzatk(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.nzatk, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, aux.nzatk, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 2, nil)
  end
  function s.tgfilter(c, e)
  	return c:IsFaceup() and c:IsRelateToEffect(e)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(s.tgfilter, nil, e)
  	local tc = g:GetFirst()
  	while tc do
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		tc = g:GetNext()
  	end
  end
  
  