name: Assault
card_text: Tribute 1 Synchro Monster; Special Summon 1 "/Assault Mode" monster from your hand whose name includes the Tributed monster's name. (This is treated as a Special Summon with "Assault Mode Activate".) During your Main Phase: You can banish this card from your GY; Set 1 "Assault Mode Activate" directly from your hand or Deck. It can be activated this turn. You can only use each effect of "Assault Mode Zero" once per turn.
external_ids: local CARD_ID_0 = 80280737 --Assault Mode Activate
  local SETCARD_ID_0 = 0x104f --/Assault
  
lua: local CARD_ID_0 = 80280737 --Assault Mode Activate
  local SETCARD_ID_0 = 0x104f --/Assault
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.settg)
  	e2:SetOperation(s.setop)
  	c:RegisterEffect(e2)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	return true
  end
  function s.filter1(c, e, tp)
  	return c:IsType(TYPE_SYNCHRO) and Duel.GetMZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_HAND, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.filter2(c, e, tp, tcode)
  	return c:IsSetCard(SETCARD_ID_0) and c.assault_name == tcode and c:IsCanBeSpecialSummoned(e, SUMMON_VALUE_ASSAULT_MODE, tp, false, true)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() ~= 1 then
  			return false
  		end
  		e:SetLabel(0)
  		return Duel.CheckReleaseGroup(tp, s.filter1, 1, nil, e, tp)
  	end
  	local rg = Duel.SelectReleaseGroup(tp, s.filter1, 1, 1, nil, e, tp)
  	Duel.SetTargetParam(rg:GetFirst():GetCode())
  	Duel.Release(rg, REASON_COST)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	local code = Duel.GetChainInfo(0, CHAININFO_TARGET_PARAM)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local tc = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp, code):GetFirst()
  	if tc and Duel.SpecialSummon(tc, SUMMON_VALUE_ASSAULT_MODE, tp, tp, false, true, POS_FACEUP) > 0 then
  		tc:CompleteProcedure()
  	end
  end
  function s.setfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsSSetable()
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.setfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil)
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SET)
  	local tc = Duel.SelectMatchingCard(tp, s.setfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, 1, nil):GetFirst()
  	if tc and Duel.SSet(tp, tc) ~= 0 then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetDescription(aux.Stringid(id, 2))
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
  		e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
  		tc:RegisterEffect(e2)
  	end
  end
  
  
source_text: Assault
  Tribute 1 Synchro Monster; Special Summon 1 "/Assault Mode" monster from your hand whose name includes the Tributed monster's name. (This is treated as a Special Summon with "Assault Mode Activate".) During your Main Phase: You can banish this card from your GY; Set 1 "Assault Mode Activate" directly from your hand or Deck. It can be activated this turn. You can only use each effect of "Assault Mode Zero" once per turn.
target_text: -- Assault
  local CARD_ID_0 = 80280737 --Assault Mode Activate
  local SETCARD_ID_0 = 0x104f --/Assault
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.settg)
  	e2:SetOperation(s.setop)
  	c:RegisterEffect(e2)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	return true
  end
  function s.filter1(c, e, tp)
  	return c:IsType(TYPE_SYNCHRO) and Duel.GetMZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_HAND, 0, 1, nil, e, tp, c:GetCode())
  end
  function s.filter2(c, e, tp, tcode)
  	return c:IsSetCard(SETCARD_ID_0) and c.assault_name == tcode and c:IsCanBeSpecialSummoned(e, SUMMON_VALUE_ASSAULT_MODE, tp, false, true)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() ~= 1 then
  			return false
  		end
  		e:SetLabel(0)
  		return Duel.CheckReleaseGroup(tp, s.filter1, 1, nil, e, tp)
  	end
  	local rg = Duel.SelectReleaseGroup(tp, s.filter1, 1, 1, nil, e, tp)
  	Duel.SetTargetParam(rg:GetFirst():GetCode())
  	Duel.Release(rg, REASON_COST)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	local code = Duel.GetChainInfo(0, CHAININFO_TARGET_PARAM)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local tc = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp, code):GetFirst()
  	if tc and Duel.SpecialSummon(tc, SUMMON_VALUE_ASSAULT_MODE, tp, tp, false, true, POS_FACEUP) > 0 then
  		tc:CompleteProcedure()
  	end
  end
  function s.setfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsSSetable()
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.setfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil)
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SET)
  	local tc = Duel.SelectMatchingCard(tp, s.setfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, 1, nil):GetFirst()
  	if tc and Duel.SSet(tp, tc) ~= 0 then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetDescription(aux.Stringid(id, 2))
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
  		e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_QP_ACT_IN_SET_TURN)
  		tc:RegisterEffect(e2)
  	end
  end
  
  