name: Assault
card_text: 1 Tuner + 1 or more non-Tuner monsters
  If this card is Synchro Summoned using a "Blackwing" monster as Material, it is treated as a Tuner while face-up on the field. Cannot be destroyed by card effects. You can target 1 "Blackwing" monster in your Graveyard; this card's Level becomes the same as that monster's. You can only use this effect of "Assault Blackwing - Onimaru the Divine Thunder" once per Duel. If this card that was Synchro Summoned using only Synchro Monsters attacks, this card gains 3000 ATK during the Damage Step only.
external_ids: local SETCARD_ID_0 = 0x33 --Blackwing
  
lua: local SETCARD_ID_0 = 0x33 --Blackwing
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--add type & attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCondition(s.tncon)
  	e1:SetOperation(s.tnop)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_MATERIAL_CHECK)
  	e2:SetValue(s.valcheck)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--lvchange
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetCountLimit(1, id + EFFECT_COUNT_CODE_DUEL)
  	e4:SetTarget(s.lvtg)
  	e4:SetOperation(s.lvop)
  	c:RegisterEffect(e4)
  end
  s.treat_itself_tuner = true
  function s.valcheck(e, c)
  	local flag = 0
  	local g = c:GetMaterial()
  	if g:IsExists(Card.IsSetCard, 1, nil, 0x33) then
  		flag = flag | 1
  	end
  	if g:GetCount() > 0 and not g:IsExists(s.mfilter, 1, nil) then
  		flag = flag | 2
  	end
  	e:GetLabelObject():SetLabel(flag)
  end
  function s.mfilter(c)
  	return not c:IsType(TYPE_SYNCHRO)
  end
  function s.tncon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO) and e:GetLabel() > 0
  end
  function s.tnop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if e:GetLabel() & 1 == 1 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetValue(TYPE_TUNER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e1)
  	end
  	if e:GetLabel() & 2 == 2 then
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e2:SetRange(LOCATION_MZONE)
  		e2:SetCode(EFFECT_UPDATE_ATTACK)
  		e2:SetCondition(s.atkcon)
  		e2:SetValue(3000)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e2)
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 1))
  	end
  end
  function s.atkcon(e)
  	local c = e:GetHandler()
  	local ph = Duel.GetCurrentPhase()
  	return (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and Duel.GetAttacker() == c
  end
  function s.lvfilter(c, lv)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsLevel(lv) and c:IsLevelAbove(1)
  end
  function s.lvtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.lvfilter(chkc, e:GetHandler():GetLevel())
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.lvfilter, tp, LOCATION_GRAVE, 0, 1, nil, e:GetHandler():GetLevel())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.lvfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e:GetHandler():GetLevel())
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_LEVEL)
  		e1:SetValue(tc:GetLevel())
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Assault
  1 Tuner + 1 or more non-Tuner monsters
  If this card is Synchro Summoned using a "Blackwing" monster as Material, it is treated as a Tuner while face-up on the field. Cannot be destroyed by card effects. You can target 1 "Blackwing" monster in your Graveyard; this card's Level becomes the same as that monster's. You can only use this effect of "Assault Blackwing - Onimaru the Divine Thunder" once per Duel. If this card that was Synchro Summoned using only Synchro Monsters attacks, this card gains 3000 ATK during the Damage Step only.
target_text: -- Assault
  local SETCARD_ID_0 = 0x33 --Blackwing
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--add type & attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCondition(s.tncon)
  	e1:SetOperation(s.tnop)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_MATERIAL_CHECK)
  	e2:SetValue(s.valcheck)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--lvchange
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetCountLimit(1, id + EFFECT_COUNT_CODE_DUEL)
  	e4:SetTarget(s.lvtg)
  	e4:SetOperation(s.lvop)
  	c:RegisterEffect(e4)
  end
  s.treat_itself_tuner = true
  function s.valcheck(e, c)
  	local flag = 0
  	local g = c:GetMaterial()
  	if g:IsExists(Card.IsSetCard, 1, nil, 0x33) then
  		flag = flag | 1
  	end
  	if g:GetCount() > 0 and not g:IsExists(s.mfilter, 1, nil) then
  		flag = flag | 2
  	end
  	e:GetLabelObject():SetLabel(flag)
  end
  function s.mfilter(c)
  	return not c:IsType(TYPE_SYNCHRO)
  end
  function s.tncon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO) and e:GetLabel() > 0
  end
  function s.tnop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if e:GetLabel() & 1 == 1 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetValue(TYPE_TUNER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e1)
  	end
  	if e:GetLabel() & 2 == 2 then
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e2:SetRange(LOCATION_MZONE)
  		e2:SetCode(EFFECT_UPDATE_ATTACK)
  		e2:SetCondition(s.atkcon)
  		e2:SetValue(3000)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		c:RegisterEffect(e2)
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, EFFECT_FLAG_CLIENT_HINT, 1, 0, aux.Stringid(id, 1))
  	end
  end
  function s.atkcon(e)
  	local c = e:GetHandler()
  	local ph = Duel.GetCurrentPhase()
  	return (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and Duel.GetAttacker() == c
  end
  function s.lvfilter(c, lv)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsLevel(lv) and c:IsLevelAbove(1)
  end
  function s.lvtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.lvfilter(chkc, e:GetHandler():GetLevel())
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.lvfilter, tp, LOCATION_GRAVE, 0, 1, nil, e:GetHandler():GetLevel())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.lvfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e:GetHandler():GetLevel())
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_LEVEL)
  		e1:SetValue(tc:GetLevel())
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  	end
  end
  
  