name: Maliss
card_text: You can activate this card the turn it was Set, by banishing 1 face-up "Maliss" monster you control. Special Summon 1 of your "Maliss" monsters that is banished or in your GY, then if you control a "Maliss" Link Monster, you can gain LP equal to the original ATK of that Special Summoned monster. You can only activate 1 "Maliss <C> GWC-06" per turn.
external_ids: local SETCARD_ID_0 = 0x1bf --Maliss
  
lua: local SETCARD_ID_0 = 0x1bf --Maliss
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_RECOVER)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--act in set turn
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 2))
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetValue(id)
  	e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCondition(s.condition)
  	e2:SetCost(s.cost)
  	c:RegisterEffect(e2)
  end
  function s.spfilter(c, e, tp, res)
  	return c:IsFaceupEx()
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 or res and Duel.GetMZoneCount(tp, res) > 0)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local res = e:GetHandler():IsHasEffect(EFFECT_TRAP_ACT_IN_SET_TURN, tp)
  	if chk == 0 then
  		return res and res:GetOwner() == c and res:GetValue() == id or Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, nil, e, tp, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_GRAVE + LOCATION_REMOVED)
  end
  function s.lpfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_LINK) and c:IsFaceup()
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter), tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, 1, nil, e, tp, nil)
  	local tc = g:GetFirst()
  	if
  		tc
  		and Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP) ~= 0
  		and Duel.IsExistingMatchingCard(s.lpfilter, tp, LOCATION_MZONE, 0, 1, nil)
  		and tc:GetBaseAttack() ~= 0
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 3))
  	then
  		Duel.BreakEffect()
  		Duel.Recover(tp, tc:GetBaseAttack(), REASON_EFFECT)
  	end
  end
  function s.cfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup() and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, nil, e, tp, c)
  end
  function s.condition(e)
  	return e:GetHandler():IsStatus(STATUS_SET_TURN) and e:GetHandler():IsLocation(LOCATION_ONFIELD)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  
  
source_text: Maliss
  You can activate this card the turn it was Set, by banishing 1 face-up "Maliss" monster you control. Special Summon 1 of your "Maliss" monsters that is banished or in your GY, then if you control a "Maliss" Link Monster, you can gain LP equal to the original ATK of that Special Summoned monster. You can only activate 1 "Maliss <C> GWC-06" per turn.
target_text: -- Maliss
  local SETCARD_ID_0 = 0x1bf --Maliss
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_RECOVER)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--act in set turn
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 2))
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetValue(id)
  	e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
  	e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCondition(s.condition)
  	e2:SetCost(s.cost)
  	c:RegisterEffect(e2)
  end
  function s.spfilter(c, e, tp, res)
  	return c:IsFaceupEx()
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 or res and Duel.GetMZoneCount(tp, res) > 0)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local res = e:GetHandler():IsHasEffect(EFFECT_TRAP_ACT_IN_SET_TURN, tp)
  	if chk == 0 then
  		return res and res:GetOwner() == c and res:GetValue() == id or Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, nil, e, tp, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_GRAVE + LOCATION_REMOVED)
  end
  function s.lpfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_LINK) and c:IsFaceup()
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter), tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, 1, nil, e, tp, nil)
  	local tc = g:GetFirst()
  	if
  		tc
  		and Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP) ~= 0
  		and Duel.IsExistingMatchingCard(s.lpfilter, tp, LOCATION_MZONE, 0, 1, nil)
  		and tc:GetBaseAttack() ~= 0
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 3))
  	then
  		Duel.BreakEffect()
  		Duel.Recover(tp, tc:GetBaseAttack(), REASON_EFFECT)
  	end
  end
  function s.cfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup() and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_GRAVE + LOCATION_REMOVED, 0, 1, nil, e, tp, c)
  end
  function s.condition(e)
  	return e:GetHandler():IsStatus(STATUS_SET_TURN) and e:GetHandler():IsLocation(LOCATION_ONFIELD)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  
  