name: Cerulean
card_text: To Special Summon "Hamon, Lord of Striking Thunder" using its own procedure, you can also use face-down Spells you control. Once per turn, while you control an Attack Position "Hamon, Lord of Striking Thunder", you can negate any Spell/Trap effect activated by your opponent, then, change 1 "Hamon, Lord of Striking Thunder" you control to Defense Position. If a face-up "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder", or "Raviel, Lord of Phantasms" you control leaves the field: You take no damage this turn.
external_ids: local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  
lua: local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_2, CARD_ID_1, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--alternate summon proc
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(id)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(1, 0)
  	c:RegisterEffect(e2)
  	--negate
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DISABLE + CATEGORY_POSITION)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_CHAIN_SOLVING)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCondition(s.negcon)
  	e3:SetOperation(s.negop)
  	c:RegisterEffect(e3)
  	--damage protection
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e4:SetCode(EVENT_LEAVE_FIELD)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCondition(s.protcon)
  	e4:SetOperation(s.protop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_1) and c:IsAttackPos()
  end
  function s.negcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  		and rp == 1 - tp
  		and re:IsActiveType(TYPE_SPELL + TYPE_TRAP)
  		and Duel.IsChainDisablable(ev)
  		and not Duel.IsChainDisabled(ev)
  		and e:GetHandler():GetFlagEffect(id) <= 0
  end
  function s.negop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = re:GetHandler()
  	if Duel.SelectEffectYesNo(tp, c) then
  		Duel.Hint(HINT_CARD, 0, id)
  		if Duel.NegateEffect(ev) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_POSCHANGE)
  			local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  			Duel.HintSelection(g)
  			Duel.ChangePosition(g:GetFirst(), POS_FACEUP_DEFENSE)
  		end
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  	end
  end
  function s.protfilter(c, tp)
  	return c:IsPreviousLocation(LOCATION_ONFIELD)
  		and c:IsPreviousPosition(POS_FACEUP)
  		and c:IsPreviousControler(tp)
  		and (c:GetPreviousCodeOnField() == CARD_ID_1 or c:GetPreviousCodeOnField() == CARD_ID_2 or c:GetPreviousCodeOnField() == CARD_ID_0)
  end
  function s.protcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.protfilter, 1, nil, tp)
  end
  function s.protop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CHANGE_DAMAGE)
  	e1:SetTargetRange(1, 0)
  	e1:SetValue(0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  
  
source_text: Cerulean
  To Special Summon "Hamon, Lord of Striking Thunder" using its own procedure, you can also use face-down Spells you control. Once per turn, while you control an Attack Position "Hamon, Lord of Striking Thunder", you can negate any Spell/Trap effect activated by your opponent, then, change 1 "Hamon, Lord of Striking Thunder" you control to Defense Position. If a face-up "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder", or "Raviel, Lord of Phantasms" you control leaves the field: You take no damage this turn.
target_text: -- Cerulean
  local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_2, CARD_ID_1, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--alternate summon proc
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(id)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(1, 0)
  	c:RegisterEffect(e2)
  	--negate
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DISABLE + CATEGORY_POSITION)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_CHAIN_SOLVING)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCondition(s.negcon)
  	e3:SetOperation(s.negop)
  	c:RegisterEffect(e3)
  	--damage protection
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e4:SetCode(EVENT_LEAVE_FIELD)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCondition(s.protcon)
  	e4:SetOperation(s.protop)
  	c:RegisterEffect(e4)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_1) and c:IsAttackPos()
  end
  function s.negcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  		and rp == 1 - tp
  		and re:IsActiveType(TYPE_SPELL + TYPE_TRAP)
  		and Duel.IsChainDisablable(ev)
  		and not Duel.IsChainDisabled(ev)
  		and e:GetHandler():GetFlagEffect(id) <= 0
  end
  function s.negop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = re:GetHandler()
  	if Duel.SelectEffectYesNo(tp, c) then
  		Duel.Hint(HINT_CARD, 0, id)
  		if Duel.NegateEffect(ev) and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_POSCHANGE)
  			local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  			Duel.HintSelection(g)
  			Duel.ChangePosition(g:GetFirst(), POS_FACEUP_DEFENSE)
  		end
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  	end
  end
  function s.protfilter(c, tp)
  	return c:IsPreviousLocation(LOCATION_ONFIELD)
  		and c:IsPreviousPosition(POS_FACEUP)
  		and c:IsPreviousControler(tp)
  		and (c:GetPreviousCodeOnField() == CARD_ID_1 or c:GetPreviousCodeOnField() == CARD_ID_2 or c:GetPreviousCodeOnField() == CARD_ID_0)
  end
  function s.protcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.protfilter, 1, nil, tp)
  end
  function s.protop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CHANGE_DAMAGE)
  	e1:SetTargetRange(1, 0)
  	e1:SetValue(0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_NO_EFFECT_DAMAGE)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  
  