/
c84389640.lua
67 lines (67 loc) · 2.35 KB
/
c84389640.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
--窮鼠の進撃
function c84389640.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetDescription(aux.Stringid(84389640,0))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(TIMING_DAMAGE_STEP)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCondition(c84389640.condition)
e2:SetCost(c84389640.cost)
e2:SetTarget(c84389640.target)
e2:SetOperation(c84389640.operation)
c:RegisterEffect(e2)
end
function c84389640.condition(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
if phase~=PHASE_DAMAGE or Duel.IsDamageCalculated() then return false end
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
if not d then return false end
if d:IsControler(tp) then a,d=d,a end
e:SetLabelObject(d)
return a:IsFaceup() and a:IsLevelBelow(3) and a:IsType(TYPE_NORMAL) and a:IsRelateToBattle()
and d:IsFaceup() and d:IsRelateToBattle()
end
function c84389640.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(84389640)==0 and Duel.CheckLPCost(tp,100,true)
and e:GetLabelObject():IsAttackAbove(100) end
local lp=Duel.GetLP(tp)
local atk=e:GetLabelObject():GetAttack()
local maxc=math.min(atk,lp,25500)
maxc=math.floor(maxc/100)*100
local t={}
for i=1,maxc/100 do
t[i]=i*100
end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(84389640,1))
local pay=Duel.AnnounceNumber(tp,table.unpack(t))
Duel.PayLPCost(tp,pay,true)
e:SetLabel(pay)
e:GetHandler():RegisterFlagEffect(84389640,RESET_PHASE+PHASE_DAMAGE,0,1)
end
function c84389640.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tc=e:GetLabelObject()
if chkc then return chkc==tc end
if chk==0 then return tc:IsCanBeEffectTarget(e) end
Duel.SetTargetCard(tc)
end
function c84389640.operation(e,tp,eg,ep,ev,re,r,rp)
local bc=Duel.GetFirstTarget()
if not e:GetHandler():IsRelateToEffect(e) or not bc or not bc:IsRelateToEffect(e) or not bc:IsControler(1-tp) then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetOwnerPlayer(tp)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetValue(e:GetLabel()*-1)
bc:RegisterEffect(e1)
end