Commit 1ae1f81f authored by oilloillo's avatar oilloillo

Update c999518.lua

修复冲突的SetCountLimit Code
parent cd442171
-- 幻光『叠光变换』
local M = c999518
local Mid = 999518
function M.initial_effect(c)
-- Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
-- add / remove counter
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCategory(CATEGORY_DRAW)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_SZONE)
e1:SetOperation(M.op)
c:RegisterEffect(e1)
-- to grave
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1, Mid+EFFECT_COUNT_CODE_DUEL)
e2:SetTarget(M.thTg)
e2:SetOperation(M.thOp)
c:RegisterEffect(e2)
-- cheat
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetDescription(aux.Stringid(Mid, 7))
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetRange(0xff)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1, Mid+EFFECT_COUNT_CODE_DUEL)
e3:SetCondition(M.chCon)
e3:SetOperation(M.chOp)
c:RegisterEffect(e3)
end
function M.changeCounter(tp, canCancel)
local ct1 = Nef.PLCounter.Get(tp, 999521)
local ct2 = Nef.PLCounter.Get(tp, 999522)
local ct3 = Nef.PLCounter.Get(tp, 999523)
local all = ct1 + ct2 + ct3
local operation = {
[0] = function() Nef.PLCounter.Add(tp, 999521, 1) end,
[1] = function() Nef.PLCounter.Add(tp, 999521, -1) end,
[2] = function() Nef.PLCounter.Add(tp, 999522, 1) end,
[3] = function() Nef.PLCounter.Add(tp, 999522, -1) end,
[4] = function() Nef.PLCounter.Add(tp, 999523, 1) end,
[5] = function() Nef.PLCounter.Add(tp, 999523, -1) end,
[6] = function() end,
}
local t = {}
if ct1 < 3 and all < 6 then table.insert(t, {desc = aux.Stringid(Mid, 0), op = operation[0]}) end
if ct2 < 3 and all < 6 then table.insert(t, {desc = aux.Stringid(Mid, 1), op = operation[2]}) end
if ct3 < 3 and all < 6 then table.insert(t, {desc = aux.Stringid(Mid, 2), op = operation[4]}) end
if ct1 > 0 then table.insert(t, {desc = aux.Stringid(Mid, 3), op = operation[1]}) end
if ct2 > 0 then table.insert(t, {desc = aux.Stringid(Mid, 4), op = operation[3]}) end
if ct3 > 0 then table.insert(t, {desc = aux.Stringid(Mid, 5), op = operation[5]}) end
if canCancel then table.insert(t, {desc = aux.Stringid(Mid, 6), op = operation[6]}) end
local opt = Duel.SelectOption(tp, Nef.unpackOneMember(t, "desc")) + 1
t[opt].op()
return opt ~= #t
end
function M.op(e,tp,eg,ep,ev,re,r,rp)
M.changeCounter(tp, false)
end
function M.thTg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk == 0 then
local c = e:GetHandler()
return c:IsLocation(LOCATION_GRAVE) and c:IsAbleToHand()
end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, e:GetHandler(), 1, nil, LOCATION_GRAE)
end
function M.thOp(e,tp,eg,ep,ev,re,r,rp)
local c = e:GetHandler()
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_GRAVE) then
Duel.SendtoHand(c, nil, REASON_EFFECT)
end
end
function M.chCon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount() == 1
end
function M.chOp(e,tp,eg,ep,ev,re,r,rp)
local ct = 3
local flag = true
while flag and ct > 0 do
flag = M.changeCounter(tp, true)
ct = ct - 1
end
-- 幻光『叠光变换』
local M = c999518
local Mid = 999518
function M.initial_effect(c)
-- Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
-- add / remove counter
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCategory(CATEGORY_DRAW)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_SZONE)
e1:SetOperation(M.op)
c:RegisterEffect(e1)
-- to grave
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1, Mid*10+1+EFFECT_COUNT_CODE_DUEL)
e2:SetTarget(M.thTg)
e2:SetOperation(M.thOp)
c:RegisterEffect(e2)
-- cheat
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetDescription(aux.Stringid(Mid, 7))
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CANNOT_DISABLE)
e3:SetRange(0xff)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1, Mid*10+2+EFFECT_COUNT_CODE_DUEL)
e3:SetCondition(M.chCon)
e3:SetOperation(M.chOp)
c:RegisterEffect(e3)
end
function M.changeCounter(tp, canCancel)
local ct1 = Nef.PLCounter.Get(tp, 999521)
local ct2 = Nef.PLCounter.Get(tp, 999522)
local ct3 = Nef.PLCounter.Get(tp, 999523)
local all = ct1 + ct2 + ct3
local operation = {
[0] = function() Nef.PLCounter.Add(tp, 999521, 1) end,
[1] = function() Nef.PLCounter.Add(tp, 999521, -1) end,
[2] = function() Nef.PLCounter.Add(tp, 999522, 1) end,
[3] = function() Nef.PLCounter.Add(tp, 999522, -1) end,
[4] = function() Nef.PLCounter.Add(tp, 999523, 1) end,
[5] = function() Nef.PLCounter.Add(tp, 999523, -1) end,
[6] = function() end,
}
local t = {}
if ct1 < 3 and all < 6 then table.insert(t, {desc = aux.Stringid(Mid, 0), op = operation[0]}) end
if ct2 < 3 and all < 6 then table.insert(t, {desc = aux.Stringid(Mid, 1), op = operation[2]}) end
if ct3 < 3 and all < 6 then table.insert(t, {desc = aux.Stringid(Mid, 2), op = operation[4]}) end
if ct1 > 0 then table.insert(t, {desc = aux.Stringid(Mid, 3), op = operation[1]}) end
if ct2 > 0 then table.insert(t, {desc = aux.Stringid(Mid, 4), op = operation[3]}) end
if ct3 > 0 then table.insert(t, {desc = aux.Stringid(Mid, 5), op = operation[5]}) end
if canCancel then table.insert(t, {desc = aux.Stringid(Mid, 6), op = operation[6]}) end
local opt = Duel.SelectOption(tp, Nef.unpackOneMember(t, "desc")) + 1
t[opt].op()
return opt ~= #t
end
function M.op(e,tp,eg,ep,ev,re,r,rp)
M.changeCounter(tp, false)
end
function M.thTg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk == 0 then
local c = e:GetHandler()
return c:IsLocation(LOCATION_GRAVE) and c:IsAbleToHand()
end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, e:GetHandler(), 1, nil, LOCATION_GRAE)
end
function M.thOp(e,tp,eg,ep,ev,re,r,rp)
local c = e:GetHandler()
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_GRAVE) then
Duel.SendtoHand(c, nil, REASON_EFFECT)
end
end
function M.chCon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount() == 1
end
function M.chOp(e,tp,eg,ep,ev,re,r,rp)
local ct = 3
local flag = true
while flag and ct > 0 do
flag = M.changeCounter(tp, true)
ct = ct - 1
end
end
\ No newline at end of file
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