name: Dragunity
card_text: When your opponent activates a Spell/Trap Card while you control a "Dragunity" Synchro Monster: Negate the activation, and if you do, banish that card, then if you control a Level 10 "Dragunity" monster, you can have 1 "Dragunity" monster you control gain 100 ATK for each face-up card that is currently banished. You can only activate 1 "Dragunity Oubliette" per turn.
external_ids: local SETCARD_ID_0 = 0x29 --Dragunity
  
lua: local SETCARD_ID_0 = 0x29 --Dragunity
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_REMOVE + CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(aux.nbtg)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SYNCHRO)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return ep == 1 - tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.cfilter(c)
  	return s.atkfilter(c) and c:IsLevel(10)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Remove(eg, POS_FACEUP, REASON_EFFECT) ~= 0 and eg:GetFirst():IsLocation(LOCATION_REMOVED) then
  		local ct = Duel.GetMatchingGroupCount(Card.IsFaceup, tp, LOCATION_REMOVED, LOCATION_REMOVED, nil)
  		if Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) and ct > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  			local g = Duel.SelectMatchingCard(tp, s.atkfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  			Duel.HintSelection(g)
  			local tc = g:GetFirst()
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(ct * 100)
  			tc:RegisterEffect(e1)
  		end
  	end
  end
  
  
source_text: Dragunity
  When your opponent activates a Spell/Trap Card while you control a "Dragunity" Synchro Monster: Negate the activation, and if you do, banish that card, then if you control a Level 10 "Dragunity" monster, you can have 1 "Dragunity" monster you control gain 100 ATK for each face-up card that is currently banished. You can only activate 1 "Dragunity Oubliette" per turn.
target_text: -- Dragunity
  local SETCARD_ID_0 = 0x29 --Dragunity
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_REMOVE + CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(aux.nbtg)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SYNCHRO)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return ep == 1 - tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.cfilter(c)
  	return s.atkfilter(c) and c:IsLevel(10)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Remove(eg, POS_FACEUP, REASON_EFFECT) ~= 0 and eg:GetFirst():IsLocation(LOCATION_REMOVED) then
  		local ct = Duel.GetMatchingGroupCount(Card.IsFaceup, tp, LOCATION_REMOVED, LOCATION_REMOVED, nil)
  		if Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) and ct > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  			local g = Duel.SelectMatchingCard(tp, s.atkfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  			Duel.HintSelection(g)
  			local tc = g:GetFirst()
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UPDATE_ATTACK)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(ct * 100)
  			tc:RegisterEffect(e1)
  		end
  	end
  end
  
  