Commit 409af086 authored by Huangnan's avatar Huangnan

fix

parent 182cc140
Pipeline #39847 failed with stages
in 2 minutes and 35 seconds
--稻妻 神里绫华 --稻妻 托马
local s,id=GetID() local s,id=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--pendulum summon --pendulum summon
aux.EnablePendulumAttribute(c) aux.EnablePendulumAttribute(c)
--to hand --to hand
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
...@@ -87,26 +87,13 @@ function s.filter2(c,e,tp,m,f,gc,chkf) ...@@ -87,26 +87,13 @@ function s.filter2(c,e,tp,m,f,gc,chkf)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,true) and c:CheckFusionMaterial(m,gc,chkf) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,true) and c:CheckFusionMaterial(m,gc,chkf)
and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end end
function s.mtfilter2(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() and c:IsCanBeFusionMaterial() and c:IsFaceup()
end
function s.fcheck(tp,sg,fc)
return sg:FilterCount(Card.IsControler,nil,1-tp)<=1
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
local mg1=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_PZONE,0,nil) local mg1=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_PZONE,0,nil)
if Duel.GetFlagEffect(tp,11600036)>0 then mg1:AddCard(c)
local mg3=Duel.GetMatchingGroup(s.mtfilter2,tp,0,LOCATION_MZONE,nil) local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,c,chkf)
mg1:Merge(mg3)
end
aux.FCheckAdditional=s.fcheck
aux.GCheckAdditional=nil
local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
aux.FCheckAdditional=nil
aux.GCheckAdditional=nil
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
...@@ -126,15 +113,8 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp) ...@@ -126,15 +113,8 @@ function s.disop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp local chkf=tp
if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end
local mg1=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_PZONE,0,nil,e) local mg1=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_HAND+LOCATION_MZONE+LOCATION_PZONE,0,nil,e)
if Duel.GetFlagEffect(tp,11600036)>0 then mg1:AddCard(c)
local mg3=Duel.GetMatchingGroup(s.mtfilter2,tp,0,LOCATION_MZONE,nil) local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,c,chkf)
mg1:Merge(mg3)
end
aux.FCheckAdditional=s.fcheck
aux.GCheckAdditional=nil
local sg1=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
aux.FCheckAdditional=nil
aux.GCheckAdditional=nil
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
......
...@@ -11,7 +11,7 @@ function s.initial_effect(c) ...@@ -11,7 +11,7 @@ function s.initial_effect(c)
e0:SetOperation(s.operation) e0:SetOperation(s.operation)
c:RegisterEffect(e0) c:RegisterEffect(e0)
end end
function s.syncheckadditional(c,level) function s.syncheckadditional(level)
return function(g) return function(g)
local sum = g:GetSum(Card.GetLevel) local sum = g:GetSum(Card.GetLevel)
return sum <= level return sum <= level
...@@ -37,7 +37,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -37,7 +37,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp)
if tc then if tc then
local level=tc:GetLevel() local level=tc:GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
aux.GCheckAdditional=s.syncheckadditional(tc,level) aux.GCheckAdditional=s.syncheckadditional(level)
local sg=mg:SelectSubGroup(tp,s.syncheck,false,1,4,tp,tc) local sg=mg:SelectSubGroup(tp,s.syncheck,false,1,4,tp,tc)
aux.GCheckAdditional=nil aux.GCheckAdditional=nil
if sg then if sg then
......
...@@ -34,7 +34,7 @@ function cm.initial_effect(c) ...@@ -34,7 +34,7 @@ function cm.initial_effect(c)
local e4=Effect.CreateEffect(c) local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,5)) e4:SetDescription(aux.Stringid(m,5))
e4:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES) e4:SetCategory(CATEGORY_TOGRAVE)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetProperty(EFFECT_FLAG_DELAY)
...@@ -47,7 +47,7 @@ function cm.initial_effect(c) ...@@ -47,7 +47,7 @@ function cm.initial_effect(c)
end end
function cm.condition(e,tp,eg,ep,ev,re,r,rp) function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) return Duel.IsChainNegatable(ev)
end end
function cm.cfilter(c) function cm.cfilter(c)
return c:IsSetCard(0x820) return c:IsSetCard(0x820)
...@@ -64,6 +64,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -64,6 +64,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and ec:IsRelateToEffect(re) then if Duel.NegateActivation(ev) and ec:IsRelateToEffect(re) then
ec:CancelToGrave() ec:CancelToGrave()
if Duel.Remove(ec,POS_FACEUP,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then if Duel.Remove(ec,POS_FACEUP,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local tc=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil):GetFirst() local tc=Duel.SelectMatchingCard(tp,cm.cfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,1,1,nil):GetFirst()
if tc then if tc then
...@@ -73,47 +74,6 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -73,47 +74,6 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function cm.effilter(c,tp)
return c:IsRace(RACE_AQUA)
end
function cm.effcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.effilter,1,nil,tp)
end
function cm.effilter2(c,tp)
return c:IsRace(RACE_AQUA)
end
function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(cm.effilter2,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
Duel.SelectTarget(tp,cm.effilter2,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,1,nil)
end
function cm.activate2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE)
e7:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e7:SetRange(LOCATION_MZONE)
e7:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e7:SetValue(1)
tc:RegisterEffect(e7)
local e8=e7:Clone()
e8:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
tc:RegisterEffect(e8)
local e9=e7:Clone()
e9:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e9)
if Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,4))
local zc=Duel.SelectMatchingCard(tp,cm.cfilter,tp,0,LOCATION_MZONE,1,1,nil):GetFirst()
Duel.HintSelection(Group.FromCards(zc))
zc:RegisterFlagEffect(18700544,RESET_PHASE+PHASE_END,0,1)
end
end
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp) function cm.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
import os
import sys
from sqlite3 import connect
def read_cdb(file, str_, _id = -1):
conn = connect(file)
try:
cursor = conn.cursor()
if int(_id) > -1:
cursor.execute(f"SELECT datas.*, texts.* FROM datas, texts WHERE datas.id = texts.id and ( datas.id={_id}) ")
else:
cursor.execute("select * from datas,texts where datas.id=texts.id")
rows = cursor.fetchall()
conn.close()
if str_ == "rows":
return rows
except Exception as e:
print(f"读取文件时出错: {str(e)}")
conn.close()
return []
def change_cdb(row, file):
opend = False
try:
conn = connect(file)
opend = True
cursor = conn.cursor()
cursor.execute(f"INSERT OR REPLACE INTO datas VALUES({row[0]}, {row[1]}, {row[2]}, {row[3]}, {row[4]}, {row[5]}, {row[6]}, {row[7]}, {row[8]}, {row[9]}, {row[10]});")
cursor.execute(f"INSERT OR REPLACE INTO texts VALUES({row[11]}, '{row[12]}', '{row[13]}', '{row[14]}', '{row[15]}', '{row[16]}', '{row[17]}', '{row[18]}', '{row[19]}', '{row[20]}', '{row[21]}', '{row[22]}', '{row[23]}', '{row[24]}', '{row[25]}', '{row[26]}', '{row[27]}', '{row[28]}', '{row[29]}');")
conn.commit()
conn.close()
return True
except Exception as e:
print(f"写入卡片ID {row[0]} 时出错: {str(e)}")
if opend:
conn.close()
return False
def merge_all_cdbs(source_folder):
# 检查源文件夹是否存在
if not os.path.exists(source_folder):
print(f"错误: 源文件夹 '{source_folder}' 不存在")
return
# 创建目标文件路径(上级目录的FINALE.cdb)
target_file = os.path.join(os.path.dirname(source_folder), 'FINALE.cdb')
# 检查目标文件是否存在
if not os.path.exists(target_file):
print(f"错误: 目标文件 '{target_file}' 不存在")
return
success_count = 0
error_count = 0
total_cards = 0
processed_cards = 0
# 遍历源文件夹中的所有cdb文件
cdb_files = [f for f in os.listdir(source_folder) if f.endswith('.cdb')]
total_files = len(cdb_files)
print(f"找到 {total_files} 个CDB文件需要处理")
for index, filename in enumerate(cdb_files, 1):
if filename.lower() == 'finale.cdb':
continue
source_file = os.path.join(source_folder, filename)
print(f"\n[{index}/{total_files}] 正在处理: {filename}")
try:
# 读取源文件中的所有数据
rows = read_cdb(source_file, "rows")
if not rows:
print(f"警告: {filename} 中没有找到数据")
continue
# 将每行数据写入目标文件
card_count = 0
success_cards = 0
for row in rows:
processed_cards += 1
if change_cdb(row, target_file):
success_cards += 1
card_count += 1
total_cards += card_count
print(f"成功处理: {filename} (共 {card_count} 张卡,成功 {success_cards} 张)")
success_count += 1
except Exception as e:
print(f"处理 {filename} 时出错: {str(e)}")
error_count += 1
print(f"\n合并完成!")
print(f"成功处理: {success_count}/{total_files} 个文件")
print(f"处理失败: {error_count} 个文件")
print(f"总共处理: {total_cards} 张卡,成功写入: {processed_cards} 张")
if __name__ == '__main__':
# 获取当前脚本所在目录
script_dir = os.path.dirname(os.path.abspath(__file__))
# 默认使用脚本所在目录下的source_folder
source_folder = os.path.join(script_dir, 'source_folder')
# 如果命令行提供了参数,则使用参数作为源文件夹
if len(sys.argv) > 1:
source_folder = sys.argv[1]
print(f"开始合并CDB文件到FINALE.cdb")
print(f"源文件夹: {source_folder}")
merge_all_cdbs(source_folder)
\ 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