-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc83555666.lua
34 lines (34 loc) · 1.23 KB
/
c83555666.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
--Ring of Destruction (pre-errata)
function c83555666.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1e1)
e1:SetTarget(c83555666.target)
e1:SetOperation(c83555666.activate)
c:RegisterEffect(e1)
end
function c83555666.filter(c)
return c:IsFaceup() and c:IsDestructable()
end
function c83555666.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c83555666.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c83555666.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c83555666.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0)
end
function c83555666.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local atk=tc:GetAttack()
if Duel.Destroy(tc,REASON_EFFECT)>0 then
Duel.Damage(1-tp,atk,REASON_EFFECT)
Duel.Damage(tp,atk,REASON_EFFECT)
end
end
end