Commit 515d61f8 authored by mercury233's avatar mercury233 Committed by GitHub

fix setting operations for coping effect (#3106)

parent a6e3a8d0
......@@ -9,6 +9,7 @@ function s.initial_effect(c)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.cfilter(c)
......@@ -37,22 +38,29 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if op==1 then
e:SetCategory(0)
e:SetProperty(0)
e:SetOperation(s.protect)
elseif op==2 then
e:SetCategory(CATEGORY_CONTROL)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetOperation(s.control)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g=Duel.SelectTarget(tp,s.tfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
else
e:SetCategory(0)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetOperation(s.tattack)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,a)
end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
s.protect(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
s.control(e,tp,eg,ep,ev,re,r,rp)
elseif op==3 then
s.tattack(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.protect(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
......
......@@ -10,6 +10,7 @@ function s.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.filter(c,tp)
......@@ -24,8 +25,15 @@ end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local op=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))
if op==0 then e:SetOperation(s.endthism1)
else e:SetOperation(s.skipnxtm1) end
e:SetLabel(op)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==0 then
s.endthism1(e,tp,eg,ep,ev,re,r,rp)
elseif op==1 then
s.skipnxtm1(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.endthism1(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
......
......@@ -7,6 +7,7 @@ function c25311006.initial_effect(c)
e1:SetCountLimit(1,25311006+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c25311006.condition)
e1:SetTarget(c25311006.target)
e1:SetOperation(c25311006.operation)
c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(25311006,ACTIVITY_CHAIN,c25311006.chainfilter)
end
......@@ -42,27 +43,35 @@ function c25311006.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EFFECT)
local op=Duel.SelectOption(tp,table.unpack(ops))
e:SetLabel(opval[op])
if opval[op]==1 then
e:SetCategory(CATEGORY_DRAW)
e:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e:SetOperation(c25311006.draw)
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
elseif opval[op]==2 then
e:SetCategory(CATEGORY_CONTROL)
e:SetProperty(0)
e:SetOperation(c25311006.control)
local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE):Filter(Card.IsControlerCanBeChanged,nil)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
elseif opval[op]==3 then
e:SetCategory(CATEGORY_TODECK)
e:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e:SetOperation(c25311006.todeck)
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,1-tp,LOCATION_HAND)
end
end
function c25311006.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
c25311006.draw(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
c25311006.control(e,tp,eg,ep,ev,re,r,rp)
elseif op==3 then
c25311006.todeck(e,tp,eg,ep,ev,re,r,rp)
end
end
function c25311006.draw(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
......
......@@ -9,6 +9,7 @@ function c40456412.initial_effect(c)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCondition(c40456412.condition)
e1:SetTarget(c40456412.target)
e1:SetOperation(c40456412.operation)
c:RegisterEffect(e1)
end
function c40456412.cfilter(c)
......@@ -50,23 +51,27 @@ function c40456412.target(e,tp,eg,ep,ev,re,r,rp,chk)
if e:IsCostChecked() then
Duel.RegisterFlagEffect(tp,40456412+op,RESET_PHASE+PHASE_END,0,1)
end
e:SetLabel(op)
if op==1 then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA)
if e:IsCostChecked() then
e:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
end
e:SetOperation(c40456412.spop)
elseif op==2 then
if e:IsCostChecked() then
e:SetCategory(0)
end
e:SetOperation(c40456412.psop)
else
if e:IsCostChecked() then
e:SetCategory(0)
end
e:SetOperation(c40456412.ssop)
end
end
function c40456412.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
c40456412.spop(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
c40456412.psop(e,tp,eg,ep,ev,re,r,rp)
elseif op==3 then
c40456412.ssop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c40456412.spop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -6,6 +6,7 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(s.tg)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
end
function s.filter(c,e,tp)
......@@ -24,13 +25,13 @@ function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
and Duel.IsExistingTarget(s.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp)
if chk==0 then return b1 or b2 end
local op=aux.SelectFromOptions(tp,{b1,aux.Stringid(id,0)},{b2,aux.Stringid(id,1)})
e:SetLabel(op)
if op==1 then
if e:IsCostChecked() then
e:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e:SetProperty(0)
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
end
e:SetOperation(s.sop)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
else
......@@ -39,7 +40,6 @@ function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.RegisterFlagEffect(tp,id+o,RESET_PHASE+PHASE_END,0,1)
end
e:SetOperation(s.dop)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local tc=Duel.SelectTarget(tp,s.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp):GetFirst()
local atk=tc:GetBaseAttack()
......@@ -47,6 +47,14 @@ function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk)
end
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
s.sop(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
s.dop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.sop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst()
......
......@@ -21,6 +21,7 @@ function s.initial_effect(c)
e2:SetCountLimit(1,id)
e2:SetCondition(s.gycon)
e2:SetTarget(s.gytg)
e2:SetOperation(s.gyop)
c:RegisterEffect(e2)
end
function s.fscon(e,tp,eg,ep,ev,re,r,rp)
......@@ -109,17 +110,24 @@ function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk)
and g:GetClassCount(Card.GetCode)>1
if chk==0 then return b1 or b2 end
local op=aux.SelectFromOptions(tp,{b1,aux.Stringid(id,2)},{b2,aux.Stringid(id,3)})
e:SetLabel(op)
if op==1 then
e:SetCategory(CATEGORY_TOHAND)
e:SetOperation(s.tohand)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0)
else
e:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
e:SetOperation(s.banish)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,c,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK+LOCATION_GRAVE)
end
end
function s.gyop(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
s.tohand(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
s.banish(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.tohand(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end
......
......@@ -11,6 +11,7 @@ function s.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.cfilter(c)
......@@ -46,17 +47,23 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
e:SetLabel(op)
if op==1 then
e:SetCategory(0)
e:SetOperation(s.mvop)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=aux.SelectTargetFromFieldFirst(tp,s.mfilter,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,1,nil,tp,0)
else
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
e:SetOperation(s.spop)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.sfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
s.mvop(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
s.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.mvop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e)
......
......@@ -8,6 +8,7 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
s.fusion_effect=true
......@@ -50,6 +51,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
{b1,aux.Stringid(id,1)},
{b2,aux.Stringid(id,2)})
end
e:SetLabel(op)
if op==1 then
if e:IsCostChecked() then
Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
......@@ -57,14 +59,20 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
e:SetOperation(s.fsop)
elseif op==2 then
if e:IsCostChecked() then
Duel.RegisterFlagEffect(tp,id+o,RESET_PHASE+PHASE_END,0,1)
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
e:SetOperation(s.thop)
end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
s.fsop(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
s.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.fsop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -6,6 +6,7 @@ function c82768499.initial_effect(c)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(c82768499.target)
e1:SetOperation(c82768499.operation)
c:RegisterEffect(e1)
end
function c82768499.desfilter(c)
......@@ -28,21 +29,27 @@ function c82768499.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
else
op=Duel.SelectOption(tp,aux.Stringid(82768499,1))+1
end
e:SetLabel(op)
if op==0 then
e:SetCategory(CATEGORY_DESTROY)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
e:SetOperation(c82768499.desop)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
else
e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e:SetProperty(0)
local g=Duel.GetMatchingGroup(c82768499.thfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,nil)
e:SetOperation(c82768499.thop)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_EXTRA)
end
end
function c82768499.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==0 then
c82768499.desop(e,tp,eg,ep,ev,re,r,rp)
elseif op==1 then
c82768499.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c82768499.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end
......
......@@ -5,16 +5,17 @@ function c83880087.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_DISABLED)
e1:SetTarget(c83880087.target)
e1:SetOperation(c83880087.operation)
c:RegisterEffect(e1)
--remove overlay replace
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(83880087,2))
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE)
e1:SetRange(LOCATION_GRAVE)
e1:SetCondition(c83880087.rcon)
e1:SetOperation(c83880087.rop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(83880087,2))
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(c83880087.rcon)
e2:SetOperation(c83880087.rop)
c:RegisterEffect(e2)
end
function c83880087.filter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x107f)
......@@ -28,16 +29,23 @@ function c83880087.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
else
op=Duel.SelectOption(tp,aux.Stringid(83880087,0))
end
e:SetLabel(op)
if op==0 then
e:SetCategory(0)
e:SetProperty(0)
e:SetOperation(c83880087.endop)
else
e:SetCategory(CATEGORY_ATKCHANGE)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c83880087.filter,tp,LOCATION_MZONE,0,1,1,nil)
e:SetOperation(c83880087.atkop)
end
end
function c83880087.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==0 then
c83880087.endop(e,tp,eg,ep,ev,re,r,rp)
elseif op==1 then
c83880087.atkop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c83880087.endop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -9,6 +9,7 @@ function s.initial_effect(c)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
......@@ -24,20 +25,28 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
{b1,aux.Stringid(id,1)},
{b2,aux.Stringid(id,2)},
{true,aux.Stringid(id,3)})
e:SetLabel(op)
if op==1 then
e:SetCategory(CATEGORY_POSITION)
e:SetOperation(s.defense)
Duel.SetOperationInfo(0,CATEGORY_POSITION,a,1,0,0)
elseif op==2 then
e:SetCategory(CATEGORY_TOHAND)
e:SetOperation(s.rtohand)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,d,1,0,0)
else
e:SetCategory(CATEGORY_DESTROY)
e:SetOperation(s.destroy)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,Group.FromCards(a,d),2,0,0)
end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local op=e:GetLabel()
if op==1 then
s.defense(e,tp,eg,ep,ev,re,r,rp)
elseif op==2 then
s.rtohand(e,tp,eg,ep,ev,re,r,rp)
elseif op==3 then
s.destroy(e,tp,eg,ep,ev,re,r,rp)
end
end
function s.defense(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
if tc:IsRelateToBattle() then Duel.ChangePosition(tc,POS_FACEUP_DEFENSE) end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment