name: Frightfur
card_text: 1 "Edge Imp" monster + 1 "Fluffal" monster
  If this card is Fusion Summoned: You can destroy 1 card on both players' fields. Once per turn (Quick Effect): You can target 1 Fusion Monster you control; send 1 "Frightfur" card from your Deck or Extra Deck to the GY, except "Frightfur Cruel Whale", and if you do, the targeted monster gains ATK equal to half of its original ATK until the end of this turn.
external_ids: local SETCARD_ID_0 = 0xad --Frightfur
  local SETCARD_ID_1 = 0xc3 --Edge
  local SETCARD_ID_2 = 0xa9 --Fluffal
  
lua: local SETCARD_ID_0 = 0xad --Frightfur
  local SETCARD_ID_1 = 0xc3 --Edge
  local SETCARD_ID_2 = 0xa9 --Fluffal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_2), aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_2), true)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCondition(s.descon)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--atk
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOGRAVE + CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(TIMING_DAMAGE_STEP, TIMING_DAMAGE_STEP + TIMING_END_PHASE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(aux.dscon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g1 = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, 0, nil)
  	local g2 = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_ONFIELD, nil)
  	if chk == 0 then
  		return g1:GetCount() > 0 and g2:GetCount() > 0
  	end
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g1, 2, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g1 = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, 0, nil)
  	local g2 = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_ONFIELD, nil)
  	if g1:GetCount() > 0 and g2:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		local dg1 = g1:Select(tp, 1, 1, nil)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		local dg2 = g2:Select(tp, 1, 1, nil)
  		dg1:Merge(dg2)
  		if dg1:GetCount() == 2 then
  			Duel.HintSelection(dg1)
  			Duel.Destroy(dg1, REASON_EFFECT)
  		end
  	end
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:GetBaseAttack() > 0
  end
  function s.tgfilter(c)
  	return c:IsSetCard(SETCARD_ID_2) and not c:IsCode(id) and c:IsAbleToGrave()
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.atkfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.atkfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK + LOCATION_EXTRA, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.atkfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK + LOCATION_EXTRA, 0, 1, 1, nil)
  	local gc = g:GetFirst()
  	if gc and Duel.SendtoGrave(gc, REASON_EFFECT) ~= 0 and gc:IsLocation(LOCATION_GRAVE) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		local atk = tc:GetBaseAttack()
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(math.ceil(atk / 2))
  		tc:RegisterEffect(e1)
  	end
  end
  
  
source_text: Frightfur
  1 "Edge Imp" monster + 1 "Fluffal" monster
  If this card is Fusion Summoned: You can destroy 1 card on both players' fields. Once per turn (Quick Effect): You can target 1 Fusion Monster you control; send 1 "Frightfur" card from your Deck or Extra Deck to the GY, except "Frightfur Cruel Whale", and if you do, the targeted monster gains ATK equal to half of its original ATK until the end of this turn.
target_text: -- Frightfur
  local SETCARD_ID_0 = 0xad --Frightfur
  local SETCARD_ID_1 = 0xc3 --Edge
  local SETCARD_ID_2 = 0xa9 --Fluffal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_2), aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_2), true)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCondition(s.descon)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  	--atk
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOGRAVE + CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetHintTiming(TIMING_DAMAGE_STEP, TIMING_DAMAGE_STEP + TIMING_END_PHASE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(aux.dscon)
  	e2:SetTarget(s.atktg)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g1 = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, 0, nil)
  	local g2 = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_ONFIELD, nil)
  	if chk == 0 then
  		return g1:GetCount() > 0 and g2:GetCount() > 0
  	end
  	g1:Merge(g2)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g1, 2, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g1 = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, 0, nil)
  	local g2 = Duel.GetMatchingGroup(aux.TRUE, tp, 0, LOCATION_ONFIELD, nil)
  	if g1:GetCount() > 0 and g2:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		local dg1 = g1:Select(tp, 1, 1, nil)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  		local dg2 = g2:Select(tp, 1, 1, nil)
  		dg1:Merge(dg2)
  		if dg1:GetCount() == 2 then
  			Duel.HintSelection(dg1)
  			Duel.Destroy(dg1, REASON_EFFECT)
  		end
  	end
  end
  function s.atkfilter(c)
  	return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:GetBaseAttack() > 0
  end
  function s.tgfilter(c)
  	return c:IsSetCard(SETCARD_ID_2) and not c:IsCode(id) and c:IsAbleToGrave()
  end
  function s.atktg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.atkfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.atkfilter, tp, LOCATION_MZONE, 0, 1, nil) and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK + LOCATION_EXTRA, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.atkfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK + LOCATION_EXTRA, 0, 1, 1, nil)
  	local gc = g:GetFirst()
  	if gc and Duel.SendtoGrave(gc, REASON_EFFECT) ~= 0 and gc:IsLocation(LOCATION_GRAVE) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		local atk = tc:GetBaseAttack()
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e1:SetValue(math.ceil(atk / 2))
  		tc:RegisterEffect(e1)
  	end
  end
  
  