/
c82103466.lua
120 lines (120 loc) · 3.96 KB
/
c82103466.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
--蛇神ゲー
function c82103466.initial_effect(c)
c:EnableReviveLimit()
--connot special summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e0)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(82103466,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_DESTROYED)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c82103466.spcon)
e1:SetCost(c82103466.spcost)
e1:SetTarget(c82103466.sptg)
e1:SetOperation(c82103466.spop)
c:RegisterEffect(e1)
--cannot be target
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(1)
c:RegisterEffect(e2)
--disable and atk down
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,LOCATION_MZONE)
e3:SetCondition(c82103466.adcon)
e3:SetTarget(c82103466.adtg)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_DISABLE_EFFECT)
c:RegisterEffect(e4)
local e5=e3:Clone()
e5:SetCode(EFFECT_SET_ATTACK_FINAL)
e5:SetValue(c82103466.atkval)
c:RegisterEffect(e5)
--atk up
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_ATKCHANGE)
e6:SetType(EFFECT_TYPE_QUICK_O)
e6:SetRange(LOCATION_MZONE)
e6:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e6:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e6:SetCondition(c82103466.atkcon)
e6:SetTarget(c82103466.atktg)
e6:SetOperation(c82103466.atkop)
c:RegisterEffect(e6)
end
function c82103466.cfilter(c,tp)
return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
and ((c:IsReason(REASON_BATTLE) and Duel.GetAttacker():IsControler(1-tp))
or (c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp))
end
function c82103466.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c82103466.cfilter,1,nil,tp)
end
function c82103466.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
function c82103466.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c82103466.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)~=0 then
c:CompleteProcedure()
end
end
function c82103466.adcon(e)
local c=e:GetHandler()
return Duel.GetAttacker()==c and c:GetBattleTarget()
and (Duel.GetCurrentPhase()==PHASE_DAMAGE or Duel.GetCurrentPhase()==PHASE_DAMAGE_CAL)
end
function c82103466.adtg(e,c)
return c==e:GetHandler():GetBattleTarget()
end
function c82103466.atkval(e,c)
return math.ceil(c:GetBaseAttack()/2)
end
function c82103466.atkcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c==Duel.GetAttacker() or c==Duel.GetAttackTarget()
end
function c82103466.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,c)
if g:GetCount()==0 then return false end
local g1,atk=g:GetMaxGroup(Card.GetBaseAttack)
return not c:IsAttack(atk)
end
end
function c82103466.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,c)
if g:GetCount()==0 then return end
local g1,atk=g:GetMaxGroup(Card.GetBaseAttack)
if c:IsRelateToEffect(e) and c:IsFaceup() and atk>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e1:SetValue(atk)
c:RegisterEffect(e1)
end
end