Skip to content

Commit bbaaf06

Browse files
authored
Update "Ritual Ceremony"
- Prevent script errors - Added checks for non-revealed cards - Cleaned up card search functionality to filter for cards listed on the revealed ritual monster.
1 parent d512a60 commit bbaaf06

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

skill/c300302002.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,36 @@ function s.initial_effect(c)
44
aux.AddSkillProcedure(c,1,false,s.flipcon,s.flipop)
55
end
66
function s.flipcon(e,tp,eg,ep,ev,re,r,rp)
7-
--condition
8-
return aux.CanActivateSkill(tp) and Duel.IsExistingMatchingCard(s.cffilter,tp,LOCATION_HAND,0,1,nil)
9-
and Duel.GetFlagEffect(tp,id)==0
7+
--Condition check
8+
return aux.CanActivateSkill(tp) and Duel.IsExistingMatchingCard(s.ritualrevealfilter,tp,LOCATION_HAND,0,1,nil,tp) and not Duel.HasFlagEffect(tp,id)
109
end
11-
function s.cffilter(c)
12-
return c:IsRitualMonster()
10+
function s.ritualrevealfilter(c,tp)
11+
return c:IsRitualMonster() and not c:IsPublic() and Duel.IsExistingMatchingCard(s.ritspellthfilter,c:GetControler(),LOCATION_DECK,0,1,nil,c)
1312
end
14-
function s.ritfilter(c,tc)
15-
return c:IsRitualSpell() and Ritual.GetMatchingFilterFunction(c)(tc)
13+
function s.ritspellthfilter(c,tc)
14+
return c:IsRitualSpell() and tc:ListsCode(c:GetCode()) and c:IsAbleToHand()
1615
end
1716
function s.flipop(e,tp,eg,ep,ev,re,r,rp)
1817
Duel.Hint(HINT_SKILL_FLIP,tp,id|(1<<32))
1918
Duel.Hint(HINT_CARD,tp,id)
20-
--opd register
19+
--OPD register
2120
Duel.RegisterFlagEffect(tp,id,0,0,0)
22-
local g=Duel.SelectMatchingCard(tp,s.cffilter,tp,LOCATION_HAND,0,1,1,e:GetHandler())
21+
--Reveal 1 Ritual Monster in your hand
22+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
23+
local g=Duel.SelectMatchingCard(tp,s.ritualrevealfilter,tp,LOCATION_HAND,0,1,1,nil,tp)
2324
Duel.ConfirmCards(1-tp,g)
2425
local tc=g:GetFirst()
26+
--Add 1 Ritual Spell listed on that Ritual Monster
2527
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
26-
local sg=Duel.SelectMatchingCard(tp,s.ritfilter,tp,LOCATION_DECK,0,1,1,e:GetHandler(),tc)
27-
if #sg>0 then
28-
Duel.SendtoHand(sg,nil,REASON_EFFECT)
28+
local sg=Duel.SelectMatchingCard(tp,s.ritspellthfilter,tp,LOCATION_DECK,0,1,1,nil,tc)
29+
if #sg>0 and Duel.SendtoHand(sg,nil,REASON_EFFECT)>0 then
2930
Duel.ConfirmCards(1-tp,sg)
3031
Duel.ShuffleDeck(tp)
32+
--Place 1 card from your hand on the bottom of your Deck
3133
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
3234
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,1,nil)
3335
if #rg>0 then
36+
Duel.BreakEffect()
3437
Duel.SendtoDeck(rg,tp,SEQ_DECKBOTTOM,REASON_EFFECT)
3538
end
3639
end

0 commit comments

Comments
 (0)