name: Super-Electromagnetic
card_text: If you Tribute Summon this card by Tributing 1 of the following monsters, this card gets the appropriate effect:
  ● Batteryman D: Negate the effect of a Spell or Trap Card that targets this 1 card.
  ● Batteryman C: During battle between this attacking card and a Defense Position monster whose DEF is lower than the ATK of this card, inflict the difference as Battle Damage to your opponent.
  ● Batteryman AA: This card gains 1000 ATK.
external_ids: local CARD_ID_0 = 19733961 --Batteryman C
  local CARD_ID_1 = 55401221 --Batteryman D
  local CARD_ID_2 = 63142001 --Batteryman AA
  
lua: local CARD_ID_0 = 19733961 --Batteryman C
  local CARD_ID_1 = 55401221 --Batteryman D
  local CARD_ID_2 = 63142001 --Batteryman AA
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon success
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--tribute check
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_MATERIAL_CHECK)
  	e2:SetValue(s.valcheck)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  end
  function s.valcheck(e, c)
  	local g = c:GetMaterial()
  	local flag = 0
  	local tc = g:GetFirst()
  	while tc do
  		local code = tc:GetCode()
  		if code == CARD_ID_1 then
  			flag = bit.bor(flag, 0x1)
  		elseif code == CARD_ID_0 then
  			flag = bit.bor(flag, 0x2)
  		elseif code == CARD_ID_2 then
  			flag = bit.bor(flag, 0x4)
  		end
  		tc = g:GetNext()
  	end
  	e:GetLabelObject():SetLabel(flag)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsSummonType(SUMMON_TYPE_ADVANCE) and e:GetLabel() ~= 0
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local flag = e:GetLabel()
  	local c = e:GetHandler()
  	if bit.band(flag, 0x1) ~= 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e1:SetCode(EVENT_CHAIN_SOLVING)
  		e1:SetRange(LOCATION_MZONE)
  		e1:SetOperation(s.disop)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  	if bit.band(flag, 0x2) ~= 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_PIERCE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  	if bit.band(flag, 0x4) ~= 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(1000)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	if re:IsActiveType(TYPE_MONSTER) then
  		return
  	end
  	if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return
  	end
  	local g = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	if g:GetCount() == 1 and g:GetFirst() == e:GetHandler() then
  		Duel.NegateEffect(ev)
  	end
  end
  
  
source_text: Super-Electromagnetic
  If you Tribute Summon this card by Tributing 1 of the following monsters, this card gets the appropriate effect:
  ● Batteryman D: Negate the effect of a Spell or Trap Card that targets this 1 card.
  ● Batteryman C: During battle between this attacking card and a Defense Position monster whose DEF is lower than the ATK of this card, inflict the difference as Battle Damage to your opponent.
  ● Batteryman AA: This card gains 1000 ATK.
target_text: -- Super-Electromagnetic
  local CARD_ID_0 = 19733961 --Batteryman C
  local CARD_ID_1 = 55401221 --Batteryman D
  local CARD_ID_2 = 63142001 --Batteryman AA
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon success
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--tribute check
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_MATERIAL_CHECK)
  	e2:SetValue(s.valcheck)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  end
  function s.valcheck(e, c)
  	local g = c:GetMaterial()
  	local flag = 0
  	local tc = g:GetFirst()
  	while tc do
  		local code = tc:GetCode()
  		if code == CARD_ID_1 then
  			flag = bit.bor(flag, 0x1)
  		elseif code == CARD_ID_0 then
  			flag = bit.bor(flag, 0x2)
  		elseif code == CARD_ID_2 then
  			flag = bit.bor(flag, 0x4)
  		end
  		tc = g:GetNext()
  	end
  	e:GetLabelObject():SetLabel(flag)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsSummonType(SUMMON_TYPE_ADVANCE) and e:GetLabel() ~= 0
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local flag = e:GetLabel()
  	local c = e:GetHandler()
  	if bit.band(flag, 0x1) ~= 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e1:SetCode(EVENT_CHAIN_SOLVING)
  		e1:SetRange(LOCATION_MZONE)
  		e1:SetOperation(s.disop)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  	if bit.band(flag, 0x2) ~= 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_PIERCE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  	if bit.band(flag, 0x4) ~= 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(1000)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	if re:IsActiveType(TYPE_MONSTER) then
  		return
  	end
  	if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
  		return
  	end
  	local g = Duel.GetChainInfo(ev, CHAININFO_TARGET_CARDS)
  	if g:GetCount() == 1 and g:GetFirst() == e:GetHandler() then
  		Duel.NegateEffect(ev)
  	end
  end
  
  