Skip to content

Commit 686fc57

Browse files
authored
Update cards using EFFECT_TRAP_ACT_IN_HAND and EFFECT_QP_ACT_IN_NTPHAND (#889)
Update Red Reboot, Traptrix Holetaea, Ebon High Magician and Aid to the Doomed that require additional costs to be activated from the hand under specific circumstances
1 parent 266f82f commit 686fc57

File tree

4 files changed

+27
-41
lines changed

4 files changed

+27
-41
lines changed

official/c23002292.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ function s.initial_effect(c)
1717
e2:SetType(EFFECT_TYPE_SINGLE)
1818
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
1919
e2:SetDescription(aux.Stringid(id,2))
20+
e2:SetValue(function(e,c) e:SetLabel(1) end)
2021
c:RegisterEffect(e2)
22+
e1:SetLabelObject(e2)
2123
end
2224
function s.condition(e,tp,eg,ep,ev,re,r,rp)
2325
return rp~=tp and re:IsHasType(EFFECT_TYPE_ACTIVATE)
2426
and re:IsActiveType(TYPE_TRAP) and Duel.IsChainNegatable(ev)
2527
end
2628
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
27-
if chk==0 then return true end
28-
if e:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then
29-
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
29+
if chk==0 then e:GetLabelObject():SetLabel(0) return true end
30+
if e:GetLabelObject():GetLabel()>0 then
31+
e:GetLabelObject():SetLabel(0)
32+
Duel.PayLPCost(tp,Duel.GetLP(tp)//2)
3033
end
3134
end
3235
function s.setfilter(c)

official/c74577599.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ function s.initial_effect(c)
2121
e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
2222
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
2323
e2:SetDescription(aux.Stringid(id,2))
24+
e2:SetValue(function(e,c) e:SetLabel(1) end)
25+
e2:SetCondition(function(e) return Duel.IsExistingMatchingCard(s.spcostfilter,e:GetHandlerPlayer(),LOCATION_HAND,0,1,nil) end)
2426
c:RegisterEffect(e2)
27+
e1:SetLabelObject(e2)
2528
--Special Summon 1 "Traptrix" monster
2629
local e3=Effect.CreateEffect(c)
2730
e3:SetDescription(aux.Stringid(id,1))
@@ -42,9 +45,11 @@ function s.spcostfilter(c)
4245
return c:IsNormalTrap() and c:IsDiscardable()
4346
end
4447
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
45-
if not e:GetHandler():IsStatus(STATUS_SET_TURN) then return true end
46-
if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,nil) end
47-
Duel.DiscardHand(tp,s.spcostfilter,1,1,REASON_COST+REASON_DISCARD)
48+
if chk==0 then e:GetLabelObject():SetLabel(0) return true end
49+
if e:GetLabelObject():GetLabel()>0 then
50+
e:GetLabelObject():SetLabel(0)
51+
Duel.DiscardHand(tp,s.spcostfilter,1,1,REASON_COST+REASON_DISCARD)
52+
end
4853
end
4954
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
5055
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:IsHasType(EFFECT_TYPE_ACTIVATE)

official/c85551711.lua

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,18 @@ function s.initial_effect(c)
1313
e1:SetTargetRange(LOCATION_HAND,0)
1414
e1:SetDescription(aux.Stringid(id,2))
1515
e1:SetCondition(s.handcon)
16+
e1:SetValue(s.handvalue)
1617
c:RegisterEffect(e1)
1718
local e2=e1:Clone()
1819
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
1920
c:RegisterEffect(e2)
20-
local e3=e1:Clone()
21-
e3:SetCode(id)
22-
c:RegisterEffect(e3)
2321
--activate cost
2422
local e4=Effect.CreateEffect(c)
2523
e4:SetType(EFFECT_TYPE_FIELD)
2624
e4:SetCode(EFFECT_ACTIVATE_COST)
2725
e4:SetRange(LOCATION_MZONE)
2826
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
2927
e4:SetTargetRange(1,0)
30-
e4:SetCost(s.costchk)
3128
e4:SetTarget(s.costtg)
3229
e4:SetOperation(s.costop)
3330
c:RegisterEffect(e4)
@@ -44,17 +41,16 @@ function s.initial_effect(c)
4441
c:RegisterEffect(e5)
4542
end
4643
function s.handcon(e)
47-
return Duel.GetTurnPlayer()~=e:GetHandlerPlayer() and e:GetHandler():GetOverlayCount()~=0
44+
local tp=e:GetHandlerPlayer()
45+
return Duel.GetTurnPlayer()~=tp and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT)
46+
end
47+
function s.handvalue(e,rc,re)
48+
re:GetHandler():RegisterFlagEffect(id,RESET_CHAIN,0,1)
4849
end
4950
function s.costtg(e,te,tp)
5051
local tc=te:GetHandler()
5152
return Duel.GetTurnPlayer()~=e:GetHandlerPlayer()
52-
and tc:IsLocation(LOCATION_HAND) and tc:GetEffectCount(id)>0
53-
and ((tc:GetEffectCount(EFFECT_QP_ACT_IN_NTPHAND)<=tc:GetEffectCount(id) and tc:IsType(TYPE_QUICKPLAY))
54-
or (tc:GetEffectCount(EFFECT_TRAP_ACT_IN_HAND)<=tc:GetEffectCount(id) and tc:IsTrap()))
55-
end
56-
function s.costchk(e,te_or_c,tp)
57-
return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT)
53+
and tc:IsLocation(LOCATION_HAND) and tc:GetFlagEffect(id)>0
5854
end
5955
function s.costop(e,tp,eg,ep,ev,re,r,rp)
6056
Duel.Hint(HINT_CARD,0,id)

unofficial/c511000427.lua

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,21 @@ function s.initial_effect(c)
1717
e2:SetCode(EFFECT_QP_ACT_IN_NTPHAND)
1818
e2:SetRange(LOCATION_HAND)
1919
e2:SetDescription(aux.Stringid(id,0))
20-
e2:SetCondition(s.actcon)
20+
e2:SetValue(function(e,c) e:SetLabel(1) end)
21+
e2:SetCondition(function(e) return Duel.IsExistingMatchingCard(Card.IsDiscardable,e:GetHandlerPlayer(),LOCATION_HAND,0,2,c) end)
2122
c:RegisterEffect(e2)
2223
e1:SetLabelObject(e2)
2324
end
2425
function s.condition(e,tp,eg,ep,ev,re,r,rp)
2526
return eg:IsExists(Card.IsPreviousControler,1,nil,tp)
2627
end
2728
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
28-
local c=e:GetHandler()
29-
if chk==0 then
30-
if c:GetFlagEffect(id)==0 or Duel.IsTurnPlayer(tp) then
31-
e:SetLabel(0)
32-
return true
33-
elseif c:GetFlagEffect(id)>0 and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,2,c) then
34-
e:SetLabel(1)
35-
return true
36-
end
37-
end
38-
if e:GetLabel()==1 then
39-
e:SetLabel(0)
40-
Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_COST+REASON_DISCARD,c)
29+
if chk==0 then e:GetLabelObject():SetLabel(0) return true end
30+
if e:GetLabelObject():GetLabel()>0 then
31+
e:GetLabelObject():SetLabel(0)
32+
Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_COST+REASON_DISCARD,e:GetHandler())
4133
end
4234
end
4335
function s.activate(e,tp,eg,ep,ev,re,r,rp)
4436
Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
4537
end
46-
function s.actcon(e)
47-
local c=e:GetHandler()
48-
if Duel.IsExistingMatchingCard(Card.IsDiscardable,e:GetHandlerPlayer(),LOCATION_HAND,0,2,c) then
49-
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
50-
return true
51-
else
52-
c:ResetFlagEffect(id)
53-
return false
54-
end
55-
end

0 commit comments

Comments
 (0)