name: Marincess
card_text: When a "Marincess" Link Monster you control destroys an opponent's monster by battle: Inflict damage to your opponent equal to the Link Rating of that monster you control x 400, then, if you destroyed an opponent's Link Monster by that battle while you controlled a Link-2 or higher "Marincess" monster, inflict damage to your opponent equal to that destroyed monster's Link Rating x 500. You can only activate 1 "Marincess Current" per turn. If you control a Link-3 or higher "Marincess" monster, you can activate this card from your hand.
external_ids: local SETCARD_ID_0 = 0x12b --Marincess
  
lua: local SETCARD_ID_0 = 0x12b --Marincess
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_BATTLE_DESTROYING)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--act in hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
  	e2:SetCondition(s.handcon)
  	c:RegisterEffect(e2)
  end
  function s.afilter(c, tp)
  	return c:IsControler(tp) and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_LINK)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return eg:IsExists(s.afilter, 1, nil, tp)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLinkAbove(2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local a = eg:Filter(s.afilter, nil, tp):GetFirst()
  	local bc = a:GetBattleTarget()
  	local dam = a:GetLink()
  	if dam < 0 then
  		dam = 0
  	end
  	Duel.Damage(1 - tp, dam * 400, REASON_EFFECT)
  	if Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) and bc:IsType(TYPE_LINK) then
  		local dam1 = bc:GetLink()
  		Duel.BreakEffect()
  		Duel.Damage(1 - tp, dam1 * 500, REASON_EFFECT)
  	end
  end
  function s.hcfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLinkAbove(3)
  end
  function s.handcon(e)
  	return Duel.IsExistingMatchingCard(s.hcfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, nil)
  end
  
  
source_text: Marincess
  When a "Marincess" Link Monster you control destroys an opponent's monster by battle: Inflict damage to your opponent equal to the Link Rating of that monster you control x 400, then, if you destroyed an opponent's Link Monster by that battle while you controlled a Link-2 or higher "Marincess" monster, inflict damage to your opponent equal to that destroyed monster's Link Rating x 500. You can only activate 1 "Marincess Current" per turn. If you control a Link-3 or higher "Marincess" monster, you can activate this card from your hand.
target_text: -- Marincess
  local SETCARD_ID_0 = 0x12b --Marincess
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_BATTLE_DESTROYING)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--act in hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
  	e2:SetCondition(s.handcon)
  	c:RegisterEffect(e2)
  end
  function s.afilter(c, tp)
  	return c:IsControler(tp) and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_LINK)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return eg:IsExists(s.afilter, 1, nil, tp)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLinkAbove(2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local a = eg:Filter(s.afilter, nil, tp):GetFirst()
  	local bc = a:GetBattleTarget()
  	local dam = a:GetLink()
  	if dam < 0 then
  		dam = 0
  	end
  	Duel.Damage(1 - tp, dam * 400, REASON_EFFECT)
  	if Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil) and bc:IsType(TYPE_LINK) then
  		local dam1 = bc:GetLink()
  		Duel.BreakEffect()
  		Duel.Damage(1 - tp, dam1 * 500, REASON_EFFECT)
  	end
  end
  function s.hcfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLinkAbove(3)
  end
  function s.handcon(e)
  	return Duel.IsExistingMatchingCard(s.hcfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, nil)
  end
  
  