name: 相乗り
card_text: このカード名のカードは1ターンに1枚しか発動できない。
  1:このターン、相手がドロー以外の方法でデッキ・墓地からカードを手札に加える度に、自分はデッキから1枚ドローする。
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_TO_HAND)
  	e1:SetCondition(s.drcon1)
  	e1:SetOperation(s.drop1)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e2:SetCode(EVENT_TO_HAND)
  	e2:SetCondition(s.regcon)
  	e2:SetOperation(s.regop)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e3:SetCode(EVENT_CHAIN_SOLVED)
  	e3:SetCondition(s.drcon2)
  	e3:SetOperation(s.drop2)
  	e3:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.cfilter(c, tp)
  	return c:IsControler(1 - tp) and not c:IsReason(REASON_DRAW) and c:IsPreviousLocation(LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.drcon1(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp) and not Duel.IsChainSolving()
  end
  function s.drop1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, id)
  	Duel.Draw(tp, 1, REASON_EFFECT)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp) and Duel.IsChainSolving()
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.RegisterFlagEffect(tp, id, RESET_CHAIN, 0, 1)
  end
  function s.drcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFlagEffect(tp, id) > 0
  end
  function s.drop2(e, tp, eg, ep, ev, re, r, rp)
  	local ct = Duel.GetFlagEffect(tp, id)
  	Duel.ResetFlagEffect(tp, id)
  	Duel.Hint(HINT_CARD, 0, id)
  	Duel.Draw(tp, ct, REASON_EFFECT)
  end
  
  
source_text: 相乗り
  このカード名のカードは1ターンに1枚しか発動できない。
  1:このターン、相手がドロー以外の方法でデッキ・墓地からカードを手札に加える度に、自分はデッキから1枚ドローする。
target_text: -- 相乗り
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_TO_HAND)
  	e1:SetCondition(s.drcon1)
  	e1:SetOperation(s.drop1)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e2:SetCode(EVENT_TO_HAND)
  	e2:SetCondition(s.regcon)
  	e2:SetOperation(s.regop)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e3:SetCode(EVENT_CHAIN_SOLVED)
  	e3:SetCondition(s.drcon2)
  	e3:SetOperation(s.drop2)
  	e3:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.cfilter(c, tp)
  	return c:IsControler(1 - tp) and not c:IsReason(REASON_DRAW) and c:IsPreviousLocation(LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.drcon1(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp) and not Duel.IsChainSolving()
  end
  function s.drop1(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, id)
  	Duel.Draw(tp, 1, REASON_EFFECT)
  end
  function s.regcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp) and Duel.IsChainSolving()
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.RegisterFlagEffect(tp, id, RESET_CHAIN, 0, 1)
  end
  function s.drcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetFlagEffect(tp, id) > 0
  end
  function s.drop2(e, tp, eg, ep, ev, re, r, rp)
  	local ct = Duel.GetFlagEffect(tp, id)
  	Duel.ResetFlagEffect(tp, id)
  	Duel.Hint(HINT_CARD, 0, id)
  	Duel.Draw(tp, ct, REASON_EFFECT)
  end
  
  