Skip to content

Commit 00de4f8

Browse files
authored
Update "Forced Change"
Should only be usable when a monster the player controls is targeted by an opponent's Trap card/effect
1 parent 8b13ead commit 00de4f8

1 file changed

Lines changed: 17 additions & 20 deletions

File tree

unofficial/c511001740.lua

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
--強制変移
12
--Forced Change
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--change target
5+
--When a monster you control is targeted by the effect of an opponent's Trap Card: Target another appropriate monster you control; it becomes the new target.
56
local e1=Effect.CreateEffect(c)
67
e1:SetType(EFFECT_TYPE_ACTIVATE)
78
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
@@ -11,31 +12,27 @@ function s.initial_effect(c)
1112
e1:SetOperation(s.activate)
1213
c:RegisterEffect(e1)
1314
end
14-
function s.filter(c,tp)
15-
return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
16-
end
1715
function s.condition(e,tp,eg,ep,ev,re,r,rp)
18-
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
16+
if rp==tp or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) or not re:IsTrapEffect() then return false end
1917
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
20-
if not g then return false end
21-
return g:IsExists(s.filter,1,nil,tp)
18+
if not g or #g~=1 then return false end
19+
local tc=g:GetFirst()
20+
e:SetLabelObject(tc)
21+
return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE)
2222
end
23-
function s.filter2(c,re,rp,tf,ceg,cep,cev,cre,cr,crp,g)
24-
return tf(re,rp,ceg,cep,cev,cre,cr,crp,0,c) and not g:IsContains(c)
23+
function s.filter(c,ct)
24+
return Duel.CheckChainTarget(ct,c)
2525
end
2626
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
27-
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
28-
if not g then return false end
29-
local tf=re:GetTarget()
30-
local res,ceg,cep,cev,cre,cr,crp=Duel.CheckEvent(re:GetCode(),true)
31-
if chkc then return chkc~=e:GetLabelObject() and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and tf(re,rp,ceg,cep,cev,cre,cr,crp,0,chkc,g) end
32-
if chk==0 then return Duel.IsExistingTarget(s.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,re,rp,tf,ceg,cep,cev,cre,cr,crp,g) end
27+
local tc=e:GetLabelObject()
28+
if chkc then return chkc~=tc and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc,ev) end
29+
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,tc,ev) end
3330
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
34-
Duel.SelectTarget(tp,s.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,re,rp,tf,ceg,cep,cev,cre,cr,crp,g)
31+
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,tc,ev)
3532
end
3633
function s.activate(e,tp,eg,ep,ev,re,r,rp)
37-
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
38-
if g and g:GetFirst():IsRelateToEffect(e) then
39-
Duel.ChangeTargetCard(ev,g)
34+
local tc=Duel.GetFirstTarget()
35+
if tc:IsRelateToEffect(e) then
36+
Duel.ChangeTargetCard(ev,Group.FromCards(tc))
4037
end
41-
end
38+
end

0 commit comments

Comments
 (0)