name: A.I.
card_text: Activate this card by targeting 1 "@Ignister" monster you control. That monster gains 800 ATK, also all monsters your opponent controls must attack that monster you control, if able. If this face-up card in its owner's Spell & Trap Zone has left the field because of an opponent's effect, and is now in the GY or banished: Draw 1 card. You can only use this effect of "A.I. Shadow" once per turn.
external_ids: local SETCARD_ID_0 = 0x135 --@Ignister
  
lua: local SETCARD_ID_0 = 0x135 --@Ignister
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetCondition(aux.dscon)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_TARGET)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetValue(800)
  	c:RegisterEffect(e2)
  	--must attack
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_MUST_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(0, LOCATION_MZONE)
  	e3:SetCondition(s.effcon)
  	c:RegisterEffect(e3)
  	--must attack monster
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_MUST_ATTACK_MONSTER)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTargetRange(0, LOCATION_MZONE)
  	e4:SetCondition(s.effcon)
  	e4:SetValue(s.atklimit)
  	c:RegisterEffect(e4)
  	--draw
  	local e5 = Effect.CreateEffect(c)
  	e5:SetCategory(CATEGORY_DRAW)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e5:SetCode(EVENT_TO_GRAVE)
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetCountLimit(1, id)
  	e5:SetCondition(s.drcon)
  	e5:SetTarget(s.drtg)
  	e5:SetOperation(s.drop)
  	c:RegisterEffect(e5)
  	local e6 = e5:Clone()
  	e6:SetCode(EVENT_REMOVE)
  	c:RegisterEffect(e6)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.cfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
  		c:SetCardTarget(tc)
  	end
  end
  function s.effcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFirstCardTarget() ~= nil
  end
  function s.atklimit(e, c)
  	return e:GetHandler():IsHasCardTarget(c)
  end
  function s.drcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) and rp == 1 - tp
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  end
  
  
source_text: A.I.
  Activate this card by targeting 1 "@Ignister" monster you control. That monster gains 800 ATK, also all monsters your opponent controls must attack that monster you control, if able. If this face-up card in its owner's Spell & Trap Zone has left the field because of an opponent's effect, and is now in the GY or banished: Draw 1 card. You can only use this effect of "A.I. Shadow" once per turn.
target_text: -- A.I.
  local SETCARD_ID_0 = 0x135 --@Ignister
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetCondition(aux.dscon)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_TARGET)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetValue(800)
  	c:RegisterEffect(e2)
  	--must attack
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_MUST_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(0, LOCATION_MZONE)
  	e3:SetCondition(s.effcon)
  	c:RegisterEffect(e3)
  	--must attack monster
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_MUST_ATTACK_MONSTER)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTargetRange(0, LOCATION_MZONE)
  	e4:SetCondition(s.effcon)
  	e4:SetValue(s.atklimit)
  	c:RegisterEffect(e4)
  	--draw
  	local e5 = Effect.CreateEffect(c)
  	e5:SetCategory(CATEGORY_DRAW)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e5:SetCode(EVENT_TO_GRAVE)
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetCountLimit(1, id)
  	e5:SetCondition(s.drcon)
  	e5:SetTarget(s.drtg)
  	e5:SetOperation(s.drop)
  	c:RegisterEffect(e5)
  	local e6 = e5:Clone()
  	e6:SetCode(EVENT_REMOVE)
  	c:RegisterEffect(e6)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.cfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.cfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.cfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
  		c:SetCardTarget(tc)
  	end
  end
  function s.effcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFirstCardTarget() ~= nil
  end
  function s.atklimit(e, c)
  	return e:GetHandler():IsHasCardTarget(c)
  end
  function s.drcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) and rp == 1 - tp
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  end
  
  