Skip to content

Commit 2a5f3ff

Browse files
authored
Update "Miracle Draw"
-Should be an optional effect -Other small fixes
1 parent 5baae36 commit 2a5f3ff

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

‎unofficial/c511000472.lua‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
--奇跡のドロー!
12
--Miracle Draw
23
local s,id=GetID()
34
function s.initial_effect(c)
@@ -6,42 +7,42 @@ function s.initial_effect(c)
67
e1:SetType(EFFECT_TYPE_ACTIVATE)
78
e1:SetCode(EVENT_FREE_CHAIN)
89
c:RegisterEffect(e1)
9-
--draw check
10+
--During each Draw Phase, you can declare the card name of the card(s) that will be drawn. If the drawn card(s) is the declared card(s), inflict 1000 damage to your opponent. Otherwise, you take 1000 damage.
1011
local e2=Effect.CreateEffect(c)
1112
e2:SetDescription(aux.Stringid(id,0))
12-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
13+
e2:SetCategory(CATEGORY_DAMAGE)
14+
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
1315
e2:SetCode(EVENT_PREDRAW)
1416
e2:SetRange(LOCATION_SZONE)
15-
e2:SetCondition(s.drcon)
17+
e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end)
1618
e2:SetTarget(s.drtg)
1719
e2:SetOperation(s.drop)
1820
c:RegisterEffect(e2)
1921
end
20-
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
21-
return tp==Duel.GetTurnPlayer() and Duel.GetDrawCount(tp)>0
22-
end
2322
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
24-
if chk==0 then return true end
23+
local c=e:GetHandler()
24+
if chk==0 then return Duel.GetDrawCount(tp)>0 end
2525
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
2626
local ac=Duel.AnnounceCard(tp)
27-
e:GetHandler():SetHint(CHINT_CARD,ac)
27+
c:SetHint(CHINT_CARD,ac)
2828
Duel.SetTargetParam(ac)
2929
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,ANNOUNCE_CARD)
30+
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_EITHER,1000)
3031
end
3132
function s.drop(e,tp,eg,ep,ev,re,r,rp)
32-
if not e:GetHandler():IsRelateToEffect(e) then return end
33+
local c=e:GetHandler()
34+
if not c:IsRelateToEffect(e) or Duel.GetDrawCount(tp)==0 then return end
3335
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
34-
local e1=Effect.CreateEffect(e:GetHandler())
36+
local e1=Effect.CreateEffect(c)
3537
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
3638
e1:SetProperty(EFFECT_FLAG_DELAY)
3739
e1:SetCode(EVENT_DRAW)
3840
e1:SetOperation(s.damop)
3941
e1:SetLabel(ac)
40-
e1:SetReset(RESET_PHASE+PHASE_DRAW)
42+
e1:SetReset(RESET_PHASE|PHASE_DRAW)
4143
Duel.RegisterEffect(e1,tp)
4244
end
4345
function s.damop(e,tp,eg,ep,ev,re,r,rp)
44-
if ep~=tp then return end
4546
local hg=eg:Filter(Card.IsLocation,nil,LOCATION_HAND)
4647
if #hg==0 then return end
4748
Duel.ConfirmCards(1-ep,hg)
@@ -51,4 +52,4 @@ function s.damop(e,tp,eg,ep,ev,re,r,rp)
5152
Duel.Damage(tp,1000,REASON_EFFECT)
5253
end
5354
Duel.ShuffleHand(ep)
54-
end
55+
end

0 commit comments

Comments
 (0)