1+ -- 魔法大学
12-- Magical Academy
23-- scripted by: UnknownGuest
34-- fixed by MLD
45local s ,id = GetID ()
56function s .initial_effect (c )
6- -- Activate
7+ -- Special Summon 1 Spellcaster from your hand
78 local e1 = Effect .CreateEffect (c )
9+ e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
810 e1 :SetType (EFFECT_TYPE_ACTIVATE )
911 e1 :SetCode (EVENT_FREE_CHAIN )
10- e1 :SetHintTiming (0 ,TIMING_END_PHASE + TIMING_SUMMON )
12+ e1 :SetHintTiming (0 ,TIMING_END_PHASE | TIMING_SUMMON )
1113 e1 :SetCost (s .cost )
1214 e1 :SetTarget (s .target )
1315 e1 :SetOperation (s .activate )
1416 c :RegisterEffect (e1 )
1517end
16- function s .cfilter1 (c ,e ,tp )
17- return c :IsDiscardable () and Duel .IsExistingMatchingCard (s .cfilter2 ,tp ,LOCATION_HAND ,0 ,1 ,c ,e ,tp ,c )
18+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
19+ e :SetLabel (100 )
20+ return true
1821end
19- function s .cfilter2 (c ,e ,tp , c2 )
20- return c :IsDiscardable () and Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_HAND ,0 ,1 ,nil ,e ,tp , c2 , c )
22+ function s .costfilter (c ,e ,tp )
23+ return c :IsDiscardable (REASON_COST ) and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_HAND ,0 ,1 ,c ,e ,tp )
2124end
22- function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
23- if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter1 ,tp ,LOCATION_HAND ,0 ,1 ,nil ,e ,tp ) end
24- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_DISCARD )
25- local g1 = Duel .SelectMatchingCard (tp ,s .cfilter1 ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil ,e ,tp )
26- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_DISCARD )
27- local g2 = Duel .SelectMatchingCard (tp ,s .cfilter2 ,tp ,LOCATION_HAND ,0 ,1 ,1 ,g1 :GetFirst (),e ,tp ,g1 :GetFirst ())
28- g1 :Merge (g2 )
29- Duel .SendtoGrave (g1 ,REASON_DISCARD + REASON_COST )
25+ function s .spfilter (c ,e ,tp )
26+ if not (c :IsRace (RACE_SPELLCASTER ) and c :IsSummonableCard () and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )) then return false end
27+ local mi ,ma = c :GetTributeRequirement ()
28+ return (Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and mi == 0 ) or (ma >= mi and ma > 0 and Duel .CheckTribute (c ,mi ))
3029end
31- function s .filter (c ,e ,tp ,c2 ,c3 )
32- if c == c2 or c == c3 then return false end
33- if not c :IsRace (RACE_SPELLCASTER ) or not c :IsSummonableCard () or not c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ) then return false end
34- -- local mi,ma=c:GetTributeRequirement()
35- local mi ,ma
36- if c :GetLevel ()<= 4 then mi ,ma = 0 ,0
37- elseif c :GetLevel ()>= 7 then mi ,ma = 2 ,2
38- else mi ,ma = 1 ,1 end
39- return (Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and mi == 0 ) or (ma >= mi and ma > 0 and Duel .CheckTribute (c ,mi ))
30+ function s .rescon (sg ,e ,tp ,mg )
31+ return # sg == 2 and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_HAND ,0 ,1 ,sg ,e ,tp )
4032end
4133function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
42- if chk == 0 then return Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_HAND ,0 ,1 ,nil ,e ,tp ) end
43- Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_HAND )
34+ local c = e :GetHandler ()
35+ if chk == 0 then
36+ if e :GetLabel ()~= 0 then
37+ e :SetLabel (0 )
38+ local exc = c :IsLocation (LOCATION_HAND ) and c or nil
39+ local g = Duel .GetMatchingGroup (Card .IsDiscardable ,tp ,LOCATION_HAND ,0 ,exc )
40+ return # g >= 2 and aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,0 )
41+ else
42+ return Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_HAND ,0 ,1 ,e ,tp )
43+ end
44+ end
45+ if e :GetLabel ()~= 0 then
46+ e :SetLabel (0 )
47+ local exc = c :IsLocation (LOCATION_HAND ) and c or nil
48+ local g = Duel .GetMatchingGroup (Card .IsDiscardable ,tp ,LOCATION_HAND ,0 ,exc )
49+ local cost = aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,1 ,tp ,HINTMSG_DISCARD )
50+ Duel .SendtoGrave (cost ,REASON_DISCARD |REASON_COST )
51+ end
52+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_HAND )
4453end
4554function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
4655 local c = e :GetHandler ()
4756 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
48- local tc = Duel .SelectMatchingCard (tp ,s .filter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil ,e ,tp ):GetFirst ()
57+ local tc = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil ,e ,tp ):GetFirst ()
4958 if tc then
50- -- local mi,ma=c:GetTributeRequirement()
51- local mi ,ma
52- if tc :GetLevel ()<= 4 then mi ,ma = 0 ,0
53- elseif tc :GetLevel ()>= 7 then mi ,ma = 2 ,2
54- else mi ,ma = 1 ,1 end
59+ local mi ,ma = c :GetTributeRequirement ()
5560 if mi > 0 then
5661 local g = Duel .SelectTribute (tp ,tc ,mi ,ma )
5762 Duel .Release (g ,REASON_EFFECT )
@@ -62,45 +67,42 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
6267 e1 :SetType (EFFECT_TYPE_SINGLE )
6368 e1 :SetCode (EFFECT_UPDATE_LEVEL )
6469 e1 :SetValue (2 )
65- e1 :SetReset (RESET_EVENT + RESETS_STANDARD )
70+ e1 :SetReset (RESET_EVENT | RESETS_STANDARD )
6671 tc :RegisterEffect (e1 ,true )
6772 local e2 = e1 :Clone ()
6873 e2 :SetCode (EFFECT_UPDATE_ATTACK )
6974 e2 :SetValue (500 )
7075 tc :RegisterEffect (e2 ,true )
71- -- disable
76+ -- Negate opponent's Spell/Traps that target the Summoned monster
7277 local e3 = Effect .CreateEffect (c )
7378 e3 :SetType (EFFECT_TYPE_FIELD )
7479 e3 :SetCode (EFFECT_DISABLE )
7580 e3 :SetTargetRange (0 ,LOCATION_SZONE )
76- e3 :SetTarget (s .distg )
7781 e3 :SetLabelObject (tc )
78- e3 :SetReset (RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END )
82+ e3 :SetTarget (function (e ,c ) return c :IsHasCardTarget (e :GetLabelObject ) end )
83+ e3 :SetReset (RESET_PHASE |PHASE_END )
7984 Duel .RegisterEffect (e3 ,tp )
8085 local e4 = Effect .CreateEffect (c )
8186 e4 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
8287 e4 :SetCode (EVENT_CHAIN_SOLVING )
8388 e4 :SetOperation (s .disop )
8489 e4 :SetLabelObject (tc )
85- e4 :SetReset (RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END )
90+ e4 :SetReset (RESET_PHASE | PHASE_END )
8691 Duel .RegisterEffect (e4 ,tp )
8792 local e5 = Effect .CreateEffect (c )
8893 e5 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
8994 e5 :SetCode (EVENT_CHAINING )
9095 e5 :SetOperation (s .disop )
9196 e5 :SetLabelObject (tc )
92- e5 :SetReset (RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END )
97+ e5 :SetReset (RESET_PHASE | PHASE_END )
9398 Duel .RegisterEffect (e5 ,tp )
9499 Duel .SpecialSummonComplete ()
95100 end
96101end
97- function s .distg (e ,c )
98- return c :IsHasCardTarget (e :GetLabelObject ())
99- end
100102function s .disop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
101- if not re : IsActiveType ( TYPE_SPELL + TYPE_TRAP ) and re : GetHandler (): GetControler ( 1 - tp ) then return end
102- if not re :IsHasProperty (EFFECT_FLAG_CARD_TARGET ) then return end
103+ local tc = e : GetLabelObject ()
104+ if not ( re :IsSpellTrapEffect () and re : GetHandler (): IsControler ( 1 - tp ) and re : IsHasProperty (EFFECT_FLAG_CARD_TARGET ) ) then return end
103105 local g = Duel .GetChainInfo (ev ,CHAININFO_TARGET_CARDS )
104- if not g or not g :IsContains (e : GetLabelObject () ) or not Duel .IsChainDisablable (ev ) then return false end
106+ if not g or not g :IsContains (tc ) or not Duel .IsChainDisablable (ev ) then return false end
105107 Duel .NegateEffect (ev )
106108end
0 commit comments