Skip to content

Commit 8eb19a8

Browse files
authored
Unofficial card script fixes
- Evil Hero Infernal Prodigy (Anime): Its draw effect should trigger if sent to the GY in any way and should negate the drawn card's effects for that turn. - Exchanging Notes: Overhauled the script and fixed script errors. Should skip the BP only if a monster is exchanged. Any effects applied on the exchanged cards should disappear if they leave the hand. Also added various strings. - Judgment of Anubis (Anime): All of the damage should be inflicted to the opponent. Shouldn't be able to use it without any monsters to destroy on the field. - Link Recovery: Heavily simplify the script, prevent some potential script errors, and add a hint on the summoned card and the player. - One-on-One Fight: Have the turn player choose a monster that can attack. Add proper checks to prevent script errors if there isn't a monster to select on resolution. - Salamangreat Sparks: The equipped monster shouldn't have its ATK changed if it battles your monster. Update the Special Summoning effect and simplify the prompts. Also added various strings.
1 parent 7d518ef commit 8eb19a8

File tree

6 files changed

+181
-215
lines changed

6 files changed

+181
-215
lines changed

unofficial/c511000476.lua

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1+
--一騎討ち
12
--One-on-One Fight
23
local s,id=GetID()
34
function s.initial_effect(c)
45
--Activate
56
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
68
e1:SetType(EFFECT_TYPE_ACTIVATE)
79
e1:SetCode(EVENT_FREE_CHAIN)
10+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
811
e1:SetTarget(s.target)
912
e1:SetOperation(s.activate)
1013
c:RegisterEffect(e1)
1114
end
12-
function s.filter(c)
13-
return c:IsFaceup()
14-
end
1515
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
16-
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
17-
end
18-
function s.activate(e,tp,eg,ep,ev,re,r,rp)
19-
local g1=Duel.GetMatchingGroup(Card.IsFaceup,Duel.GetTurnPlayer(),LOCATION_MZONE,0,nil)
20-
local sg1=nil
21-
if #g1>0 then
22-
local tg=g1:GetMaxGroup(Card.GetAttack)
23-
sg1=tg:Select(Duel.GetTurnPlayer(),1,1,nil)
24-
Duel.HintSelection(sg1)
25-
end
26-
local g2=Duel.GetMatchingGroup(Card.IsFaceup,1-Duel.GetTurnPlayer(),LOCATION_MZONE,0,nil)
27-
local sg2=nil
28-
if #g2>0 then
29-
local tg=g2:GetMaxGroup(Card.GetAttack)
30-
sg2=tg:Select(1-Duel.GetTurnPlayer(),1,1,nil)
31-
Duel.HintSelection(sg2)
32-
end
33-
if #sg1>0 and #sg2>0 then
34-
Duel.CalculateDamage(sg1:GetFirst(),sg2:GetFirst())
16+
if chk==0 then
17+
local turn_player=Duel.GetTurnPlayer()
18+
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.CanAttack),turn_player,LOCATION_MZONE,0,1,nil)
19+
and Duel.IsExistingMatchingCard(Card.IsFaceup,turn_player,0,LOCATION_MZONE,1,nil)
3520
end
3621
end
22+
function s.activate(e,tp,eg,ep,ev,re,r,rp)
23+
local turn_player=Duel.GetTurnPlayer()
24+
local g1=Duel.GetMatchingGroup(aux.FaceupFilter(Card.CanAttack),turn_player,LOCATION_MZONE,0,nil)
25+
if #g1==0 then return end
26+
local g2=Duel.GetMatchingGroup(Card.IsFaceup,turn_player,0,LOCATION_MZONE,nil)
27+
if #g2==0 then return end
28+
Duel.Hint(HINT_SELECTMSG,turn_player,HINTMSG_SELF)
29+
local bc1=(g1:GetMaxGroup(Card.GetAttack):Select(turn_player,1,1,nil)):GetFirst()
30+
Duel.HintSelection(bc1)
31+
Duel.Hint(HINT_SELECTMSG,1-turn_player,HINTMSG_SELF)
32+
local bc2=(g2:GetMaxGroup(Card.GetAttack):Select(1-turn_player,1,1,nil)):GetFirst()
33+
Duel.HintSelection(bc2)
34+
Duel.CalculateDamage(bc1,bc2)
35+
end

unofficial/c511002446.lua

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
1-
--アヌビスの裁き
1+
--アヌビスの裁き (Anime)
2+
--Judgment of Anubis (Anime)
23
local s,id=GetID()
34
function s.initial_effect(c)
45
--Activate
56
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
68
e1:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY+CATEGORY_DAMAGE)
79
e1:SetType(EFFECT_TYPE_ACTIVATE)
810
e1:SetCode(EVENT_CHAINING)
9-
e1:SetCondition(s.condition)
11+
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and re:IsSpellEffect() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainDisablable(ev) end)
1012
e1:SetTarget(s.target)
1113
e1:SetOperation(s.activate)
1214
c:RegisterEffect(e1)
1315
end
14-
function s.condition(e,tp,eg,ep,ev,re,r,rp)
15-
return rp~=tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and Duel.IsChainDisablable(ev)
16-
end
1716
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
18-
if chk==0 then return true end
19-
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
20-
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
21-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
22-
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0)
23-
end
24-
function s.filter(c,tp)
25-
return c:IsPreviousControler(tp)
17+
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
18+
if chk==0 then return #g>0 end
19+
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,tp,0)
20+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0)
21+
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,g:GetSum(Card.GetAttack))
2622
end
2723
function s.activate(e,tp,eg,ep,ev,re,r,rp)
28-
Duel.NegateEffect(ev)
29-
local sg=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
30-
if Duel.Destroy(sg,REASON_EFFECT)>0 then
31-
local dg=Duel.GetOperatedGroup()
32-
local sg1=dg:Filter(Card.IsPreviousControler,nil,tp)
33-
local sg2=dg:Filter(Card.IsPreviousControler,nil,1-tp)
34-
local sum1=sg1:GetSum(Card.GetAttack)/2
35-
local sum2=sg2:GetSum(Card.GetAttack)/2
36-
Duel.Damage(tp,sum1,REASON_EFFECT,true)
37-
Duel.Damage(1-tp,sum2,REASON_EFFECT,true)
38-
Duel.RDComplete()
24+
if not Duel.NegateEffect(ev) then return end
25+
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
26+
if #g==0 then return end
27+
local dam=g:GetSum(Card.GetAttack)/2
28+
if Duel.Destroy(g,REASON_EFFECT)>0 and dam>0 then
29+
Duel.Damage(1-tp,dam,REASON_EFFECT)
3930
end
40-
end
31+
end

unofficial/c511004431.lua

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,77 @@
1+
--青春の交換日記
12
--Exchanging Notes
2-
--cleaned up by MLD
33
local s,id=GetID()
4+
local SET_GUTSMASTER=0x526
45
function s.initial_effect(c)
5-
--activate
6+
--Activate
67
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_DRAW+CATEGORY_TOHAND)
710
e1:SetType(EFFECT_TYPE_ACTIVATE)
811
e1:SetCode(EVENT_FREE_CHAIN)
9-
e1:SetCondition(s.condition)
12+
e1:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_GUTSMASTER),tp,LOCATION_MZONE,0,1,nil) end)
1013
e1:SetTarget(s.target)
1114
e1:SetOperation(s.operation)
1215
c:RegisterEffect(e1)
1316
end
14-
s.listed_series={0x526}
15-
function s.condition(e,tp,eg,ev,ep,re,r,rp)
16-
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,0x526),tp,LOCATION_MZONE,0,1,nil)
17-
end
17+
s.listed_series={SET_GUTSMASTER}
1818
function s.target(e,tp,eg,ev,ep,re,r,rp,chk)
1919
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
2020
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
2121
end
2222
function s.operation(e,tp,eg,ev,ep,re,r,rp)
23-
if Duel.Draw(tp,2,REASON_EFFECT)==2 then
24-
local g=Duel.GetOperatedGroup()
25-
Duel.SendtoHand(g,1-tp,REASON_EFFECT)
23+
if Duel.Draw(tp,2,REASON_EFFECT)~=2 then return end
24+
local sg=nil
25+
local g=Duel.GetOperatedGroup()
26+
if Duel.SendtoHand(g,1-tp,REASON_EFFECT)>0 then
27+
Duel.ShuffleHand(1-tp)
2628
local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
29+
Duel.BreakEffect()
2730
Duel.ConfirmCards(tp,hg)
28-
local sg=hg:Select(tp,2,2,nil)
29-
Duel.SendtoHand(sg,tp,REASON_EFFECT)
30-
g:Merge(sg)
31-
g:KeepAlive()
32-
local e1=Effect.CreateEffect(e:GetHandler())
33-
e1:SetType(EFFECT_TYPE_FIELD)
34-
e1:SetCode(EFFECT_SKIP_BP)
35-
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
36-
e1:SetTargetRange(1,0)
37-
e1:SetReset(RESET_PHASE+PHASE_END)
38-
Duel.RegisterEffect(e1,tp)
39-
local e2=Effect.CreateEffect(e:GetHandler())
40-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
41-
e2:SetCode(EVENT_PHASE+PHASE_END)
42-
e2:SetLabelObject(g1)
43-
e2:SetCountLimit(1)
44-
e2:SetReset(RESET_PHASE+PHASE_END)
45-
e2:SetOperation(s.retop)
46-
Duel.RegisterEffect(e2,tp)
47-
local tg=sg:Filter(Card.IsMonster,nil)
48-
local gc=tg:GetFirst()
49-
while gc do
50-
local e1=Effect.CreateEffect(e:GetHandler())
31+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
32+
sg=hg:Select(tp,2,2,nil)
33+
if #sg>0 then
34+
Duel.SendtoHand(sg,tp,REASON_EFFECT)
35+
Duel.ShuffleHand(tp)
36+
end
37+
end
38+
local c=e:GetHandler()
39+
local exch_g=g+sg
40+
local mon_g=exch_g:Filter(Card.IsMonster,nil)
41+
if #mon_g>0 then
42+
for tc in mon_g:Iter() do
43+
--If a monster(s) was exchanged by this effect, they cannot be Normal or Special Summoned
44+
local e1=Effect.CreateEffect(c)
5145
e1:SetType(EFFECT_TYPE_SINGLE)
5246
e1:SetCode(EFFECT_CANNOT_SUMMON)
53-
e1:SetReset(RESET_PHASE+PHASE_END)
54-
gc:RegisterEffect(e1)
47+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
48+
tc:RegisterEffect(e1)
5549
local e2=e1:Clone()
5650
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
57-
gc:RegisterEffect(e2)
58-
gc=tg:GetNext()
51+
tc:RegisterEffect(e2)
5952
end
53+
--Skip this turn's Battle Phase
54+
local e3=Effect.CreateEffect(c)
55+
e3:SetDescription(aux.Stringid(id,1))
56+
e3:SetType(EFFECT_TYPE_FIELD)
57+
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
58+
e3:SetCode(EFFECT_SKIP_BP)
59+
e3:SetTargetRange(1,0)
60+
e3:SetReset(RESET_PHASE|PHASE_END)
61+
Duel.RegisterEffect(e3,Duel.GetTurnPlayer())
6062
end
61-
end
62-
function s.retop(e,tp,eg,ep,ev,re,r,rp)
63-
local g=e:GetLabelObject()
64-
if g and #g>0 then
65-
Duel.SendtoHand(g,nil,REASON_EFFECT)
63+
if #exch_g>0 then
64+
--Cards exchanged by this effect are returned to their owner's hand during the End Phase of this turn
65+
aux.DelayedOperation(exch_g,PHASE_END,id,e,tp,s.thop,nil,nil,nil,aux.Stringid(id,2))
6666
end
67-
g:DeleteGroup()
6867
end
68+
function s.thop(ag)
69+
local turn_player=Duel.GetTurnPlayer()
70+
local ag1,ag2=ag:Split(Card.IsOwner,nil,turn_player)
71+
if #ag1>0 then
72+
Duel.SendtoHand(ag1,turn_player,REASON_EFFECT)
73+
end
74+
if #ag2>0 then
75+
Duel.SendtoHand(ag2,1-turn_player,REASON_EFFECT)
76+
end
77+
end

unofficial/c511009738.lua

Lines changed: 32 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,72 @@
11
--リンク・リカバリー
22
--Link Recovery
3-
--fixed by Larry126 & MLD
43
local s,id=GetID()
54
function s.initial_effect(c)
65
--Activate
76
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
88
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW)
9-
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
109
e1:SetType(EFFECT_TYPE_ACTIVATE)
10+
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
1111
e1:SetCode(EVENT_FREE_CHAIN)
1212
e1:SetTarget(s.target)
1313
e1:SetOperation(s.activate)
1414
c:RegisterEffect(e1)
1515
end
16-
function s.filter(c,e,tp)
16+
function s.spfilter(c,e,tp)
1717
return c:IsLinkMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
1818
end
1919
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
20-
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end
20+
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end
2121
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
22-
and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
22+
and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
2323
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
24-
local tc=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst()
24+
local tc=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst()
2525
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tc,1,tp,LOCATION_GRAVE)
2626
local ct=tc:GetLink()-Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE,nil)
2727
if ct>0 then
2828
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,ct)
2929
end
30+
Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,1)
3031
end
3132
function s.activate(e,tp,eg,ep,ev,re,r,rp)
3233
local tc=Duel.GetFirstTarget()
33-
if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
34-
local c=e:GetHandler()
34+
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
3535
local ct=tc:GetLink()-Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE,nil)
3636
if ct>0 then
3737
Duel.Draw(1-tp,ct,REASON_EFFECT)
3838
end
39-
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1)
39+
local c=e:GetHandler()
40+
--You cannot conduct your Battle Phase the turn the Special Summoned monster is used as material for a Link Summon
4041
local e1=Effect.CreateEffect(c)
41-
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
42+
e1:SetDescription(aux.Stringid(id,1))
43+
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
44+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
4245
e1:SetCode(EVENT_BE_MATERIAL)
43-
e1:SetCondition(s.con)
44-
e1:SetOperation(s.op)
45-
Duel.RegisterEffect(e1,tp)
46+
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return r==REASON_LINK end)
47+
e1:SetOperation(s.cannotbpop)
48+
e1:SetReset(RESET_EVENT|RESETS_STANDARD&~(RESET_TOGRAVE|RESET_REMOVE|RESET_LEAVE))
49+
tc:RegisterEffect(e1,true)
50+
--This card cannot be used as material for a Link Summon the turn that you conduct your Battle Phase
4651
local e2=Effect.CreateEffect(c)
47-
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
48-
e2:SetCode(EVENT_LEAVE_FIELD_P)
49-
e2:SetLabelObject(e1)
50-
e2:SetOperation(s.checkop)
51-
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
52-
tc:RegisterEffect(e2)
53-
local e3=Effect.CreateEffect(c)
54-
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
55-
e3:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
56-
e3:SetCountLimit(1)
57-
e3:SetLabelObject(tc)
58-
e3:SetCondition(s.startcon)
59-
e3:SetOperation(s.startop)
60-
Duel.RegisterEffect(e3,tp)
61-
e1:SetLabelObject(e3)
52+
e2:SetType(EFFECT_TYPE_SINGLE)
53+
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
54+
e2:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
55+
e2:SetCondition(function() return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)>0 end)
56+
e2:SetValue(1)
57+
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
58+
tc:RegisterEffect(e2,true)
6259
end
6360
end
64-
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
65-
if e:GetLabelObject() then
66-
e:GetLabelObject():SetLabel(1)
67-
end
68-
end
69-
function s.con(e,tp,eg,ep,ev,re,r,rp)
70-
if r==REASON_LINK and e:GetLabelObject() then
71-
return e:GetLabel()==1
72-
else
73-
e:Reset()
74-
if e:GetLabelObject() and not e:GetLabelObject():IsDeleted() then
75-
e:GetLabelObject():Reset()
76-
end
77-
return false
78-
end
79-
end
80-
function s.op(e,tp,eg,ep,ev,re,r,rp)
61+
function s.cannotbpop(e,tp,eg,ep,ev,re,r,rp)
62+
e:Reset()
63+
--You cannot conduct your Battle Phase this turn
8164
local e1=Effect.CreateEffect(e:GetHandler())
65+
e1:SetDescription(aux.Stringid(id,2))
8266
e1:SetType(EFFECT_TYPE_FIELD)
67+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
8368
e1:SetCode(EFFECT_CANNOT_BP)
84-
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
8569
e1:SetTargetRange(1,0)
86-
e1:SetReset(RESET_PHASE+PHASE_END)
70+
e1:SetReset(RESET_PHASE|PHASE_END)
8771
Duel.RegisterEffect(e1,tp)
88-
e:SetLabel(0)
89-
e:Reset()
90-
e:GetLabelObject():Reset()
91-
end
92-
function s.startcon(e,tp,eg,ep,ev,re,r,rp)
93-
local tc=e:GetLabelObject()
94-
if not tc or tc:GetFlagEffect(id)==0 then e:Reset() return false end
95-
return Duel.GetTurnPlayer()==tp
96-
end
97-
function s.startop(e,tp,eg,ep,ev,re,r,rp)
98-
local tc=e:GetLabelObject()
99-
local e1=Effect.CreateEffect(e:GetHandler())
100-
e1:SetType(EFFECT_TYPE_SINGLE)
101-
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
102-
e1:SetValue(1)
103-
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
104-
tc:RegisterEffect(e1,true)
105-
end
72+
end

0 commit comments

Comments
 (0)