Skip to content

Commit 023fe9c

Browse files
Beetletoplarry126
andauthored
Add "D/D Zero Surveyor" script (#869)
Co-authored-by: Larry126 <28985622+larry126@users.noreply.github.com>
1 parent 53bcb7d commit 023fe9c

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

unofficial/c511027675.lua

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
--DディーDディーゼロ・サーベイヤー
2+
--D/D Zero Surveyor
3+
--Made by Beetron-1 Beetletop
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--Reduce effect damage so that you have 100LP left
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
10+
e1:SetCode(EVENT_CHAINING)
11+
e1:SetRange(LOCATION_HAND)
12+
e1:SetCost(s.cost)
13+
e1:SetCondition(s.condition)
14+
e1:SetOperation(s.operation)
15+
c:RegisterEffect(e1)
16+
end
17+
function s.cost(e,tp,eg,ev,ep,re,r,rp,chk)
18+
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
19+
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
20+
end
21+
function s.condition(e,tp,eg,ev,ep,re,r,rp)
22+
local lp=Duel.GetLP(tp)
23+
if lp<100 then return false end
24+
local e1=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_DAMAGE)
25+
local e2=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_RECOVER)
26+
local rd=e1 and not e2
27+
local rr=not e1 and e2
28+
local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE)
29+
if ex and (cp==tp or cp==PLAYER_ALL) and not rd
30+
and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_NO_EFFECT_DAMAGE) and lp<=cv then
31+
return true
32+
end
33+
ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER)
34+
return ex and (cp==tp or cp==PLAYER_ALL) and rr
35+
and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_NO_EFFECT_DAMAGE) and lp<=cv
36+
end
37+
function s.operation(e,tp,eg,ep,ev,re,r,rp,val,r,rc)
38+
local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
39+
local e1=Effect.CreateEffect(e:GetHandler())
40+
e1:SetType(EFFECT_TYPE_FIELD)
41+
e1:SetCode(EFFECT_CHANGE_DAMAGE)
42+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
43+
e1:SetTargetRange(1,1)
44+
e1:SetLabel(cid)
45+
e1:SetValue(s.damval)
46+
e1:SetReset(RESET_CHAIN)
47+
Duel.RegisterEffect(e1,tp)
48+
end
49+
function s.damval(e,re,val,r,rp,rc)
50+
local cc=Duel.GetCurrentChain()
51+
if cc==0 or (r&REASON_EFFECT)==0 then return val end
52+
local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
53+
if cid==e:GetLabel() then return Duel.GetLP(e:GetHandlerPlayer())-100
54+
else return val end
55+
end

0 commit comments

Comments
 (0)