-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc52286175.lua
30 lines (30 loc) · 1.1 KB
/
c52286175.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
--Trap Reactor・Y FI
function c52286175.initial_effect(c)
--destroy&damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(52286175,0))
e1:SetCategory(CATEGORY_DAMAGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c52286175.condition)
e1:SetTarget(c52286175.target)
e1:SetOperation(c52286175.operation)
c:RegisterEffect(e1)
end
function c52286175.condition(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and ep~=tp
and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_TRAP)
end
function c52286175.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return re:GetHandler():IsDestructable() end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,800)
end
function c52286175.operation(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)~=0 then
Duel.Damage(1-tp,800,REASON_EFFECT)
end
end