Skip to content

Magician's Sense ​

  • Card ID: 120246088
  • Format: Rush Duel
  • Script: Rush/Scripts/c120246088.lua

Stats ​

FieldValue
Type0x4
ATK0
DEF0
Level/Rank/Link0x0
Race0x0
Attribute0x0
Category0x400

Card Text ​

text
[REQUIREMENT]	
When your opponent Normal or Special Summons a monster while you have 3 or more Spell Cards in your Graveyard.	
[EFFECT]	
Set up to 2 "Thousand Knives", "Dark Magic Attack", and/or "Dark Resonance Burst" from your Graveyard to your Spell & Trap Zone. Then, you take no battle damage from your opponent's Level 9 or lower monsters' attacks this turn.

Detected API Calls ​

Script ​

lua
local cm,m=GetID()
local list={120130040,120130041,120203027}
cm.name="魔术师的才华"
function cm.initial_effect(c)
	RD.AddCodeList(c,list)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_SUMMON_SUCCESS)
	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
	e1:SetCondition(cm.condition)
	e1:SetTarget(cm.target)
	e1:SetOperation(cm.activate)
	c:RegisterEffect(e1)
	local e2=e1:Clone()
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	c:RegisterEffect(e2)
end
--Activate
function cm.confilter1(c,tp)
	return c:IsType(TYPE_SPELL)
end
function cm.confilter2(c,tp)
	return c:GetSummonPlayer()==tp
end
function cm.setfilter(c)
	return c:IsCode(list[1],list[2],list[3]) and c:IsSSetable()
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
	return Duel.IsExistingMatchingCard(cm.confilter1,tp,LOCATION_GRAVE,0,3,nil)
		and eg:IsExists(cm.confilter2,1,nil,1-tp)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
		and Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_GRAVE,0,1,nil) end
	Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
	if RD.SelectAndSet(aux.NecroValleyFilter(cm.setfilter),tp,LOCATION_GRAVE,0,1,2,nil,e)~=0 then
		local e1=Effect.CreateEffect(e:GetHandler())
		e1:SetDescription(aux.Stringid(m,1))
		e1:SetType(EFFECT_TYPE_FIELD)
		e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
		e1:SetTargetRange(1,0)
		e1:SetCondition(cm.abdcon)
		e1:SetValue(1)
		e1:SetReset(RESET_PHASE+PHASE_END)
		Duel.RegisterEffect(e1,tp)
	end
end
function cm.abdcon(e)
	local tc=Duel.GetAttacker()
	return not tc:IsControler(e:GetHandlerPlayer()) and tc:IsLevelBelow(9)
end