name: Bloom
card_text: 1 "Melodious Maestra" monster + 1 "Melodious" monster
  Cannot be destroyed by battle or card effects, also you take no battle damage from attacks involving this card. If this card battles a Special Summoned monster, after damage calculation: You can inflict damage to your opponent equal to the difference between the original ATK of that opponent's monster and this card, and if you do, destroy that opponent's monster.
external_ids: local SETCARD_ID_0 = 0x9b --Melodious
  local SETCARD_ID_1 = 0x109b --Melodious
  
lua: local SETCARD_ID_0 = 0x9b --Melodious
  local SETCARD_ID_1 = 0x109b --Melodious
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_1), aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_1), true)
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	c:RegisterEffect(e2)
  	--avoid battle damage
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	c:RegisterEffect(e3)
  	--destroy
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_BATTLED)
  	e4:SetCondition(s.condition)
  	e4:SetTarget(s.target)
  	e4:SetOperation(s.operation)
  	c:RegisterEffect(e4)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return bc and bc:IsSummonType(SUMMON_TYPE_SPECIAL) and c:GetBaseAttack() ~= bc:GetBaseAttack()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetHandler():GetBattleTarget()
  	if chk == 0 then
  		return bc:IsRelateToBattle()
  	end
  	local atk = math.abs(e:GetHandler():GetBaseAttack() - bc:GetBaseAttack())
  	Duel.SetTargetCard(bc)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, atk)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, bc, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local bc = Duel.GetFirstTarget()
  	local atk = math.abs(e:GetHandler():GetBaseAttack() - bc:GetBaseAttack())
  	if bc:IsRelateToEffect(e) and bc:IsFaceup() and Duel.Damage(1 - tp, atk, REASON_EFFECT) ~= 0 then
  		Duel.Destroy(bc, REASON_EFFECT)
  	end
  end
  
  
source_text: Bloom
  1 "Melodious Maestra" monster + 1 "Melodious" monster
  Cannot be destroyed by battle or card effects, also you take no battle damage from attacks involving this card. If this card battles a Special Summoned monster, after damage calculation: You can inflict damage to your opponent equal to the difference between the original ATK of that opponent's monster and this card, and if you do, destroy that opponent's monster.
target_text: -- Bloom
  local SETCARD_ID_0 = 0x9b --Melodious
  local SETCARD_ID_1 = 0x109b --Melodious
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_1), aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_1), true)
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	c:RegisterEffect(e2)
  	--avoid battle damage
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	c:RegisterEffect(e3)
  	--destroy
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetCode(EVENT_BATTLED)
  	e4:SetCondition(s.condition)
  	e4:SetTarget(s.target)
  	e4:SetOperation(s.operation)
  	c:RegisterEffect(e4)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return bc and bc:IsSummonType(SUMMON_TYPE_SPECIAL) and c:GetBaseAttack() ~= bc:GetBaseAttack()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetHandler():GetBattleTarget()
  	if chk == 0 then
  		return bc:IsRelateToBattle()
  	end
  	local atk = math.abs(e:GetHandler():GetBaseAttack() - bc:GetBaseAttack())
  	Duel.SetTargetCard(bc)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, atk)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, bc, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local bc = Duel.GetFirstTarget()
  	local atk = math.abs(e:GetHandler():GetBaseAttack() - bc:GetBaseAttack())
  	if bc:IsRelateToEffect(e) and bc:IsFaceup() and Duel.Damage(1 - tp, atk, REASON_EFFECT) ~= 0 then
  		Duel.Destroy(bc, REASON_EFFECT)
  	end
  end
  
  