name: Friller
card_text: When a Fish, Sea Serpent, or Aqua-Type monster you control is targeted for an attack: You can banish this card from your Graveyard, then target the attacking monster; negate the attack, and if you do, that target loses 500 ATK until the end of the next turn. You can only use this effect of "Friller Rabca" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--disable attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_BE_BATTLE_TARGET)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.condition)
  	e1:SetCost(aux.bfgcost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local at = Duel.GetAttackTarget()
  	return at and at:IsControler(tp) and at:IsFaceup() and at:IsRace(RACE_FISH + RACE_SEASERPENT + RACE_AQUA)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local tg = Duel.GetAttacker()
  	if chkc then
  		return chkc == tg
  	end
  	if chk == 0 then
  		return tg:IsOnField() and tg:IsCanBeEffectTarget(e)
  	end
  	Duel.SetTargetCard(tg)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.NegateAttack()
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(-500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 2)
  		tc:RegisterEffect(e1)
  	end
  end
  
  
source_text: Friller
  When a Fish, Sea Serpent, or Aqua-Type monster you control is targeted for an attack: You can banish this card from your Graveyard, then target the attacking monster; negate the attack, and if you do, that target loses 500 ATK until the end of the next turn. You can only use this effect of "Friller Rabca" once per turn.
target_text: -- Friller
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--disable attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_BE_BATTLE_TARGET)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.condition)
  	e1:SetCost(aux.bfgcost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local at = Duel.GetAttackTarget()
  	return at and at:IsControler(tp) and at:IsFaceup() and at:IsRace(RACE_FISH + RACE_SEASERPENT + RACE_AQUA)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local tg = Duel.GetAttacker()
  	if chkc then
  		return chkc == tg
  	end
  	if chk == 0 then
  		return tg:IsOnField() and tg:IsCanBeEffectTarget(e)
  	end
  	Duel.SetTargetCard(tg)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.NegateAttack()
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(-500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 2)
  		tc:RegisterEffect(e1)
  	end
  end
  
  