Skip to content

Commit b017aa2

Browse files
authored
Added new card script
1 parent 9028774 commit b017aa2

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

pre-release/c101303069.lua

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
--騒動
2+
--Riot
3+
--scripted by pyrQ
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--Return 1 face-down Defense Position monster on the field to the hand, then the player who added it to their hand can Special Summon 1 monster from their hand in face-down Defense Position
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
10+
e1:SetType(EFFECT_TYPE_ACTIVATE)
11+
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
12+
e1:SetCode(EVENT_FREE_CHAIN)
13+
e1:SetCountLimit(1,id)
14+
e1:SetTarget(s.rthtg)
15+
e1:SetOperation(s.rthop)
16+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMING_BATTLE_START|TIMINGS_CHECK_MONSTER_E)
17+
c:RegisterEffect(e1)
18+
--Change 1 face-down Defense Position monster on the field to Attack Position
19+
local e2=Effect.CreateEffect(c)
20+
e2:SetDescription(aux.Stringid(id,1))
21+
e2:SetCategory(CATEGORY_POSITION)
22+
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
23+
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
24+
e2:SetRange(LOCATION_GRAVE)
25+
e2:SetCountLimit(1,{id,1})
26+
e2:SetCondition(function(e,tp) return Duel.GetAttacker():IsControler(1-tp) end)
27+
e2:SetCost(Cost.SelfBanish)
28+
e2:SetTarget(s.postg)
29+
e2:SetOperation(s.posop)
30+
c:RegisterEffect(e2)
31+
end
32+
function s.rthfilter(c)
33+
return c:IsPosition(POS_FACEDOWN_DEFENSE) and c:IsAbleToHand()
34+
end
35+
function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk)
36+
if chk==0 then return Duel.IsExistingTarget(s.rthfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
37+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
38+
local tc=Duel.SelectTarget(tp,s.rthfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil):GetFirst()
39+
Duel.SetOperationInfo(0,CATEGORY_TOHAND,tc,1,tp,0)
40+
Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tc:GetOwner(),LOCATION_HAND)
41+
end
42+
function s.rthop(e,tp,eg,ep,ev,re,r,rp)
43+
local tc=Duel.GetFirstTarget()
44+
if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then
45+
local sp_player=tc:GetControler()
46+
Duel.ShuffleHand(sp_player)
47+
if Duel.GetLocationCount(sp_player,LOCATION_MZONE,sp_player)>0
48+
and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned,sp_player,LOCATION_HAND,0,1,nil,e,0,sp_player,false,false,POS_FACEDOWN_DEFENSE)
49+
and Duel.SelectYesNo(sp_player,aux.Stringid(id,2)) then
50+
Duel.Hint(HINT_SELECTMSG,sp_player,HINTMSG_SPSUMMON)
51+
local g=Duel.SelectMatchingCard(sp_player,Card.IsCanBeSpecialSummoned,sp_player,LOCATION_HAND,0,1,1,nil,e,0,sp_player,false,false,POS_FACEDOWN_DEFENSE)
52+
if #g>0 then
53+
Duel.BreakEffect()
54+
Duel.SpecialSummon(g,0,sp_player,sp_player,false,false,POS_FACEDOWN_DEFENSE)
55+
end
56+
end
57+
end
58+
end
59+
function s.posfilter(c)
60+
return c:IsPosition(POS_FACEDOWN_DEFENSE) and c:IsCanChangePosition()
61+
end
62+
function s.postg(e,tp,eg,ep,ev,re,r,rp,chk)
63+
if chk==0 then return Duel.IsExistingMatchingCard(s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
64+
Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,PLAYER_EITHER,LOCATION_MZONE)
65+
end
66+
function s.posop(e,tp,eg,ep,ev,re,r,rp)
67+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
68+
local g=Duel.SelectMatchingCard(tp,s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
69+
if #g>0 then
70+
Duel.HintSelection(g)
71+
Duel.ChangePosition(g,POS_FACEUP_ATTACK)
72+
end
73+
end

0 commit comments

Comments
 (0)