Skip to content

Commit dd4a3fa

Browse files
committed
updated Vengeful Dragon's Counterattack
1 parent f28d84e commit dd4a3fa

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

rush/c160302014.lua

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,51 @@
22
--Vengeful Dragon's Counterattack
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--Destroy 1 monster
5+
--Destroy 1 card on your opponent's field then draw 1 card
66
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
78
e1:SetCategory(CATEGORY_DESTROY)
89
e1:SetType(EFFECT_TYPE_ACTIVATE)
9-
e1:SetCode(EVENT_BATTLE_DESTROYED)
10+
e1:SetCode(EVENT_DESTROYED)
11+
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
1012
e1:SetCondition(s.condition)
13+
e1:SetCost(s.cost)
1114
e1:SetTarget(s.target)
12-
e1:SetOperation(s.activate)
15+
e1:SetOperation(s.operation)
1316
c:RegisterEffect(e1)
1417
end
15-
function s.cfilter(c,tp)
16-
return c:GetPreviousRaceOnField()&RACE_DRAGON>0 and (c:IsReason(REASON_BATTLE) and Duel.GetAttacker():IsControler(1-tp))
17-
and c:GetReasonPlayer()==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
18+
function s.filter(c,tp)
19+
return c:GetReasonPlayer()==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
20+
and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousRaceOnField()&RACE_DRAGON==RACE_DRAGON
21+
and c:IsReason(REASON_BATTLE) and Duel.GetAttacker():IsControler(1-tp)
1822
end
1923
function s.condition(e,tp,eg,ep,ev,re,r,rp)
20-
return eg:IsExists(s.cfilter,1,nil,tp)
24+
return eg:IsExists(s.filter,1,nil,tp)
25+
end
26+
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
27+
if chk==0 then
28+
return Duel.IsPlayerAffectedByEffect(tp,160023004) or Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,nil)
29+
end
2130
end
2231
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
23-
local at=Duel.GetAttacker()
24-
local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE)
25-
if chk==0 then return at:IsControler(1-tp) and at:IsRelateToBattle() and #g>0 and Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,nil) end
26-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
32+
local dg=Duel.GetMatchingGroup(Card.IsNotMaximumModeSide,tp,0,LOCATION_MZONE,nil)
33+
if chk==0 then return #dg>0 end
34+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,1,tp,LOCATION_MZONE)
2735
end
28-
function s.activate(e,tp,eg,ep,ev,re,r,rp)
29-
local tg=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,1,nil)
30-
if Duel.SendtoGrave(tg,REASON_COST)~=0 then
31-
local g=Duel.SelectMatchingCard(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil)
32-
g=g:AddMaximumCheck()
33-
if #g>0 then
34-
Duel.Destroy(g,REASON_EFFECT)
35-
end
36+
function s.operation(e,tp,eg,ep,ev,re,r,rp)
37+
--Requirement
38+
if not Duel.IsPlayerAffectedByEffect(tp,160023004) then
39+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
40+
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,1,nil)
41+
Duel.SendtoGrave(g,REASON_COST)
42+
end
43+
--Effect
44+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
45+
local dg=Duel.GetMatchingGroup(Card.IsNotMaximumModeSide,tp,0,LOCATION_MZONE,nil)
46+
if #dg>0 then
47+
local sg=dg:Select(tp,1,1,nil)
48+
local sg2=sg:AddMaximumCheck()
49+
Duel.HintSelection(sg2)
50+
Duel.Destroy(sg,REASON_EFFECT)
3651
end
37-
end
38-
function s.filter(c)
39-
return c:IsMonster() and not c:IsMaximumModeSide()
4052
end

0 commit comments

Comments
 (0)