-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathc160014058.lua
51 lines (51 loc) · 1.69 KB
/
c160014058.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
--ジョインテック・イグニッション
--Jointech Ignition
--scripted by YoshiDuels
local s,id=GetID()
function s.initial_effect(c)
--Prevent a monster from destruction by battle
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttackTarget()
local ac=Duel.GetAttacker()
return tc and tc:IsFaceup() and tc:IsControler(tp) and ac:IsControler(1-tp)
and tc:IsRace(RACE_MACHINE) and tc:IsAttribute(ATTRIBUTE_EARTH)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local tg=Duel.GetAttackTarget()
if chk==0 then return tg:IsControler(tp) and tg:IsOnField() end
Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,tg,1,tp,0)
end
function s.filter(c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsLevelAbove(7)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
--Effect
local tc=Duel.GetAttackTarget()
if tc and tc:IsRelateToBattle() and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_PHASE|PHASE_DAMAGE)
tc:RegisterEffect(e1,true)
if Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
local tg=Group.CreateGroup()
tg:AddCard(Duel.GetAttacker())
tg=tg:AddMaximumCheck()
Duel.Destroy(tg,REASON_EFFECT)
end
end
end