Skip to content

Commit 3994301

Browse files
authored
Apparition
CATEGORY_DEFCHANGE + SET_HERO
1 parent e833e2a commit 3994301

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

official/c91392974.lua

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,58 @@
33
--Scripted by Larry126
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Special Summon 1 Level 4 or lower "Vision HERO" monster from your Deck
6+
--Special Summon 1 Level 4 or lower "Vision HERO" monster from your Deck, then you can halve the original ATK/DEF of 1 monster your opponent controls
77
local e1=Effect.CreateEffect(c)
88
e1:SetDescription(aux.Stringid(id,0))
9-
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE)
9+
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
1010
e1:SetType(EFFECT_TYPE_ACTIVATE)
11+
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
1112
e1:SetCode(EVENT_DESTROYED)
12-
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
1313
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
1414
e1:SetCondition(s.condition)
1515
e1:SetTarget(s.target)
16-
e1:SetOperation(s.operation)
16+
e1:SetOperation(s.activate)
1717
c:RegisterEffect(e1)
1818
end
19-
s.listed_series={SET_VISION_HERO}
20-
function s.cfilter(c,tp)
21-
return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE)
22-
and c:IsPreviousControler(tp) and c:IsPreviousSetCard(SET_HERO) and c:IsPreviousPosition(POS_FACEUP)
19+
s.listed_series={SET_HERO,SET_VISION_HERO}
20+
function s.confilter(c,tp)
21+
return c:IsPreviousSetCard(SET_HERO) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
22+
and c:IsReason(REASON_BATTLE|REASON_EFFECT)
2323
end
2424
function s.condition(e,tp,eg,ep,ev,re,r,rp)
25-
return eg:IsExists(s.cfilter,1,nil,tp)
25+
return eg:IsExists(s.confilter,1,nil,tp)
2626
end
2727
function s.spfilter(c,e,tp)
28-
return c:IsSetCard(SET_VISION_HERO) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
28+
return c:IsLevelBelow(4) and c:IsSetCard(SET_VISION_HERO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
2929
end
3030
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
3131
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
3232
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
3333
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
3434
end
35-
function s.operation(e,tp,eg,ep,ev,re,r,rp)
35+
function s.activate(e,tp,eg,ep,ev,re,r,rp)
3636
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
3737
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
3838
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
3939
if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0
4040
and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil)
4141
and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
42-
Duel.BreakEffect()
4342
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF)
44-
local tc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst()
43+
local sc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst()
44+
if not sc then return end
45+
Duel.HintSelection(sc)
46+
Duel.BreakEffect()
47+
--Its original ATK/DEF is halved
4548
local e1=Effect.CreateEffect(e:GetHandler())
4649
e1:SetType(EFFECT_TYPE_SINGLE)
50+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
4751
e1:SetCode(EFFECT_SET_BASE_ATTACK)
52+
e1:SetValue(sc:GetBaseAttack()/2)
4853
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
49-
e1:SetValue(tc:GetBaseAttack()/2)
50-
tc:RegisterEffect(e1)
51-
local e2=Effect.CreateEffect(e:GetHandler())
52-
e2:SetType(EFFECT_TYPE_SINGLE)
54+
sc:RegisterEffect(e1)
55+
local e2=e1:Clone()
5356
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
54-
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
55-
e2:SetValue(tc:GetBaseDefense()/2)
56-
tc:RegisterEffect(e2)
57+
e2:SetValue(sc:GetBaseDefense()/2)
58+
sc:RegisterEffect(e2)
5759
end
58-
end
60+
end

0 commit comments

Comments
 (0)