name: Dragonic
card_text: All "Dracoslayer" monsters on the field gain 300 ATK/DEF. You can only use each of the following effects of "Dragonic Pendulum" once per turn. If a Dragon "Dracoslayer" monster you control activates its effect (except during the Damage Step): You can target 1 card on the field; destroy it. If this card on the field is destroyed: You can either add to your hand or Special Summon 1 "Dracoslayer" or "Dracoverlord" monster from your Deck.
external_ids: local SETCARD_ID_0 = 0xc7 --Dracoslayer
  
lua: local SETCARD_ID_0 = 0xc7 --Dracoslayer
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk&def
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--destroy
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_DESTROY)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetCondition(s.descon)
  	e4:SetTarget(s.destg)
  	e4:SetOperation(s.desop)
  	c:RegisterEffect(e4)
  	--to hand or spsummon
  	local e5 = Effect.CreateEffect(c)
  	e5:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetCode(EVENT_DESTROYED)
  	e5:SetProperty(EFFECT_FLAG_DELAY)
  	e5:SetCountLimit(1, id + 1)
  	e5:SetCondition(s.tscon)
  	e5:SetTarget(s.tstg)
  	e5:SetOperation(s.tsop)
  	c:RegisterEffect(e5)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local rc = re:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER) and rp == tp and rc:IsSetCard(SETCARD_ID_0) and rc:IsRace(RACE_DRAGON) and rc:IsLocation(LOCATION_MZONE) and re:GetActivateLocation() == LOCATION_MZONE
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  function s.tscon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.tsfilter(c, e, tp)
  	if not (c:IsSetCard(SETCARD_ID_0, 0xda) and c:IsType(TYPE_MONSTER)) then
  		return false
  	end
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	return c:IsAbleToHand() or (ft > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false))
  end
  function s.tstg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tsfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.tsop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = Duel.SelectMatchingCard(tp, s.tsfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	local tc = g:GetFirst()
  	if tc then
  		if tc:IsAbleToHand() and (not tc:IsCanBeSpecialSummoned(e, 0, tp, false, false) or ft <= 0 or Duel.SelectOption(tp, 1190, 1152) == 0) then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		else
  			Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  
source_text: Dragonic
  All "Dracoslayer" monsters on the field gain 300 ATK/DEF. You can only use each of the following effects of "Dragonic Pendulum" once per turn. If a Dragon "Dracoslayer" monster you control activates its effect (except during the Damage Step): You can target 1 card on the field; destroy it. If this card on the field is destroyed: You can either add to your hand or Special Summon 1 "Dracoslayer" or "Dracoverlord" monster from your Deck.
target_text: -- Dragonic
  local SETCARD_ID_0 = 0xc7 --Dracoslayer
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk&def
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--destroy
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_DESTROY)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_CHAINING)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetCondition(s.descon)
  	e4:SetTarget(s.destg)
  	e4:SetOperation(s.desop)
  	c:RegisterEffect(e4)
  	--to hand or spsummon
  	local e5 = Effect.CreateEffect(c)
  	e5:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetCode(EVENT_DESTROYED)
  	e5:SetProperty(EFFECT_FLAG_DELAY)
  	e5:SetCountLimit(1, id + 1)
  	e5:SetCondition(s.tscon)
  	e5:SetTarget(s.tstg)
  	e5:SetOperation(s.tsop)
  	c:RegisterEffect(e5)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local rc = re:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER) and rp == tp and rc:IsSetCard(SETCARD_ID_0) and rc:IsRace(RACE_DRAGON) and rc:IsLocation(LOCATION_MZONE) and re:GetActivateLocation() == LOCATION_MZONE
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  function s.tscon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.tsfilter(c, e, tp)
  	if not (c:IsSetCard(SETCARD_ID_0, 0xda) and c:IsType(TYPE_MONSTER)) then
  		return false
  	end
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	return c:IsAbleToHand() or (ft > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false))
  end
  function s.tstg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tsfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.tsop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = Duel.SelectMatchingCard(tp, s.tsfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	local tc = g:GetFirst()
  	if tc then
  		if tc:IsAbleToHand() and (not tc:IsCanBeSpecialSummoned(e, 0, tp, false, false) or ft <= 0 or Duel.SelectOption(tp, 1190, 1152) == 0) then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		else
  			Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  
  