name: Goddess
card_text: Your opponent cannot target "Valkyrie" monsters you control with card effects, also they cannot be destroyed by your opponent's card effects. Once per turn: You can declare 1 card name, then target 1 Set card your opponent controls; reveal the Set card, and if it was the declared card, banish it. Otherwise, banish 1 card you control.
external_ids: local SETCARD_ID_0 = 0x122 --Valkyrie
  
lua: local SETCARD_ID_0 = 0x122 --Valkyrie
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--cannot be target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(s.indesval)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetCountLimit(1)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  end
  function s.indesval(e, re, rp)
  	return rp ~= e:GetHandlerPlayer()
  end
  function s.rmfilter(c)
  	return c:IsFacedown() and c:IsAbleToRemove()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(1 - tp) and chkc:IsOnField() and s.rmfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.rmfilter, tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEDOWN)
  	local g = Duel.SelectTarget(tp, s.rmfilter, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CODE)
  	local ac = Duel.AnnounceCard(tp)
  	Duel.SetTargetParam(ac)
  	Duel.SetOperationInfo(0, CATEGORY_ANNOUNCE, nil, 0, tp, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local ac = Duel.GetChainInfo(0, CHAININFO_TARGET_PARAM)
  	local tc = Duel.GetFirstTarget()
  	if not (e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFacedown()) then
  		return
  	end
  	Duel.ConfirmCards(tp, tc)
  	if tc:IsCode(ac) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	else
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemove, tp, LOCATION_ONFIELD, 0, 1, 1, nil)
  		if #g > 0 then
  			Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Goddess
  Your opponent cannot target "Valkyrie" monsters you control with card effects, also they cannot be destroyed by your opponent's card effects. Once per turn: You can declare 1 card name, then target 1 Set card your opponent controls; reveal the Set card, and if it was the declared card, banish it. Otherwise, banish 1 card you control.
target_text: -- Goddess
  local SETCARD_ID_0 = 0x122 --Valkyrie
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--cannot be target
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(s.indesval)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetCountLimit(1)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  end
  function s.indesval(e, re, rp)
  	return rp ~= e:GetHandlerPlayer()
  end
  function s.rmfilter(c)
  	return c:IsFacedown() and c:IsAbleToRemove()
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(1 - tp) and chkc:IsOnField() and s.rmfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.rmfilter, tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEDOWN)
  	local g = Duel.SelectTarget(tp, s.rmfilter, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CODE)
  	local ac = Duel.AnnounceCard(tp)
  	Duel.SetTargetParam(ac)
  	Duel.SetOperationInfo(0, CATEGORY_ANNOUNCE, nil, 0, tp, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local ac = Duel.GetChainInfo(0, CHAININFO_TARGET_PARAM)
  	local tc = Duel.GetFirstTarget()
  	if not (e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFacedown()) then
  		return
  	end
  	Duel.ConfirmCards(tp, tc)
  	if tc:IsCode(ac) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	else
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  		local g = Duel.SelectMatchingCard(tp, Card.IsAbleToRemove, tp, LOCATION_ONFIELD, 0, 1, 1, nil)
  		if #g > 0 then
  			Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  		end
  	end
  end
  
  