This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc511005634.lua
158 lines (147 loc) · 5.6 KB
/
c511005634.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
--Arcana Force XII-THE HANGED MAN
--scripted GameMaster(GM)
local s,id=GetID()
function s.initial_effect(c)
--coin
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_COIN)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(s.cointg)
e1:SetOperation(s.coinop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e3)
end
function s.cointg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1)
end
function s.coinop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local res=0
if c:IsHasEffect(73206827) then
res=1-Duel.SelectOption(tp,60,61)
else res=Duel.TossCoin(tp,1) end
s.arcanareg(c,res)
end
function s.arcanareg(c,coin)
--coin effect
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(id,2))
e0:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e0:SetType(EFFECT_TYPE_IGNITION)
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SINGLE_RANGE)
e0:SetCode(EVENT_FREE_CHAIN)
e0:SetRange(LOCATION_MZONE)
e0:SetCountLimit(1)
e0:SetCondition(s.descon)
e0:SetTarget(s.destg555)
e0:SetOperation(s.desop555)
e0:SetReset(RESET_EVENT+RESETS_STANDARD_DISABLE)
c:RegisterEffect(e0)
--coin effect
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(s.descon2)
e1:SetTarget(s.destg2)
e1:SetOperation(s.desop2)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
c:RegisterFlagEffect(36690018,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,coin,63-coin)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
end
function s.filter555(c)
return c:IsDestructable()
end
function s.destg555(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
--self
local heads=e:GetHandler():GetFlagEffectLabel(36690018)==1
if heads then
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end
local c=e:GetHandler()
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.filter555,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,0)
Duel.RegisterFlagEffect(tp,id,RESET_EVENT+RESETS_STANDARD_DISABLE+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1)
else
--opponents
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end
local c=e:GetHandler()
if chk==0 then return Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE)>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.filter555,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetTargetPlayer(1-tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
Duel.RegisterFlagEffect(tp,id,RESET_EVENT+RESETS_STANDARD_DISABLE+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1)
end
end
function s.desop555(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then
Duel.Damage(p,tc:GetAttack(),REASON_EFFECT)
end
end
function s.descon2(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and Duel.GetFlagEffect(tp,id)==0
end
function s.destg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local heads=e:GetHandler():GetFlagEffectLabel(36690018)==1
if chkc then
if not chkc:IsLocation(LOCATION_MZONE) or chkc:IsFacedown() then return false end
if heads then return chkc:IsControler(tp)
else return chkc:IsControler(1-tp) end
end
if heads then
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end
local c=e:GetHandler()
if chk==0 then return true end
local gp
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_MZONE,0,1,1,nil)
gp=tp
Duel.RegisterFlagEffect(tp,id,RESET_EVENT+RESETS_STANDARD_DISABLE+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1)
else
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end
local c=e:GetHandler()
if chk==0 then return Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE)>0 end
g=Duel.SelectTarget(tp,Card.IsDestructable,tp,0,LOCATION_MZONE,1,1,nil)
gp=1-tp
Duel.RegisterFlagEffect(tp,id,RESET_EVENT+RESETS_STANDARD_DISABLE+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1)
end
if #g>0 then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,gp,g:GetFirst():GetAttack())
end
Duel.SetTargetParam(e:GetHandler():GetFlagEffectLabel(36690018))
end
function s.desop2(e,tp,eg,ep,ev,re,r,rp)
local heads=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)==1
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and (not tc:IsRelateToBattle()) then
if heads then
Duel.Damage(tp,tc:GetAttack(),REASON_EFFECT)
else
Duel.Damage(1-tp,tc:GetAttack(),REASON_EFFECT)
end
end
end