Commit 54395996 authored by POLYMER's avatar POLYMER

fix

parent faa6ac56
......@@ -2,7 +2,7 @@
--the old library (c10199990.lua and c10199991.lua) has gone out of service, becuase it has become a SHIT MOUNTAIN, hard for reading.
--any problems, you can call me: QQ/VX 852415212, PLZ note sth. about YGO while you add me, otherwise I will reject your friend request.
local Version_Number = "2023.08.04"
local Version_Number = "2023.09.12"
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Constant <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
......@@ -582,7 +582,11 @@ function s.create_category_list()
["Self"] = { "Select Your Card(s)", 0, HINTMSG_SELF, 0, 0, { s.dummy_operate, 1, sg } },
["Opponent"] = { "Select Your Card(s)", 0, HINTMSG_OPPO, 0, 0, { s.dummy_operate, 1, sg } },
["Target"] = { "Select Target(s)", 0, HINTMSG_TARGET, 0, 0, { s.dummy_operate, 1, sg } },
["GainEffect"] = { "Select Target(s)", 0, HINTMSG_TARGET, { 10032958, 0 } }
["GainEffect"] = { "Select Target(s)", 0, HINTMSG_TARGET, { 10032958, 0 } },
["FusionSummonMaterial"] = { "Select Special Summon Material(s)", 0, HINTMSG_FMATERIAL },
["SynchroSummonMaterial"] = { "Select Special Summon Material(s)", 0, HINTMSG_SMATERIAL },
["XyzSummonMaterial"] = { "Select Special Summon Material(s)", 0, HINTMSG_XFMATERIAL },
["LinkSummonMaterial"] = { "Select Special Summon Material(s)", 0, HINTMSG_LMATERIAL }
}
end
......@@ -658,7 +662,7 @@ function s.create_buff_list()
["!BeUsedAsMaterial4XyzSummon"] = { EFFECT_CANNOT_BE_XYZ_MATERIAL },
["!BeUsedAsLinkMaterial"] = { EFFECT_CANNOT_BE_LINK_MATERIAL },
["!BeUsedAsMaterial4LinkSummon"] = { EFFECT_CANNOT_BE_LINK_MATERIAL },
["!BeUsedAsMaterial4SpecialSummon"] = { { "!BeUsedAsMaterial4FusionSummon", "!BeUsedAsMaterial4SynchroSummon", "!BeUsedAsMaterial4XyzSummon", "!BeUsedAsMaterial4LinkSummon" } },
["!BeUsedAsMaterial4SpecialSummon"] = { { "!BeUsedAsFusionMaterial", "!BeUsedAsMaterial4SynchroSummon", "!BeUsedAsMaterial4XyzSummon", "!BeUsedAsMaterial4LinkSummon" } },
["!BeUsedAsMaterial4Fusion/Synchro/Xyz/LinkSummon"] = { { "!BeUsedAsMaterial4FusionSummon", "!BeUsedAsMaterial4SynchroSummon", "!BeUsedAsMaterial4XyzSummon", "!BeUsedAsMaterial4LinkSummon" } },
["!BeBattleTarget"] = { EFFECT_CANNOT_BE_BATTLE_TARGET, false, aux.imval1, nil, nil, EFFECT_FLAG_IGNORE_IMMUNE },
["!BeEffectTarget"] = { EFFECT_CANNOT_BE_EFFECT_TARGET, false, nil, nil, nil, EFFECT_FLAG_IGNORE_IMMUNE },
......@@ -3772,11 +3776,11 @@ function s.do_cost_or_target_or_operation(e, tp, eg, ep, ev, re, r, rp, current_
end
end
--case9 do operate
Scl.Last_Selected_Group:Clear()
Scl.Last_Selected_Group:Merge(mandatory_group)
local total_sel_group2 = total_sel_group:Clone()
total_sel_group2:Merge(mandatory_group)
if need_operate then
Scl.Last_Selected_Group:Clear()
Scl.Last_Selected_Group:Merge(current_sel_group)
if not s.operate_selected_cost_or_operat_objects(mandatory_group, total_sel_group2, category_str, replace_operation, reason, e, tp, eg, ep, ev, re, r, rp) then
return false
end
......@@ -5661,7 +5665,42 @@ end
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Card&Group<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--Using to replace function Scl.CheckSubGroup
--If you want to check a few cards, Scl.CheckSubGroup is effective, but if you want to check more cards, use Scl.CheckSubGroup will stuck your ygopro, even crash it.
--Commonly using in a synchro/xyz/link summon that can use cards in hand/GY/Deck as materials.
--filter_obj can be follow formats: first_filter, {first_filter} or {first_filter, final_filter}
--first_filter: If the checking group don't suit first_filter(g, ...), it will directly return false
--final_filter (default == aux.TRUE): If the checking group don't suit final_filter(g, ...), it will continue add new cards into the checking group to do the next check.
-->> return successfully
function Scl.RecursionGroupCheck(card_obj, filter_obj, minct, maxct, ...)
filter_obj = type(filter_obj) == "table" and filter_obj or { filter_obj }
local first_filter, final_filter = table.unpack(filter_obj)
final_filter = final_filter or aux.TRUE
local mg = Scl.Mix2Group(card_obj)
return mg:IsExists(s.recursion_group_check_filter, 1, nil, { }, mg, first_filter, final_filter, minct, maxct, ...)
end
function s.recursion_group_check_filter(c, checked_cards, mg, first_filter, final_filter, minct, maxct, ...)
local sg = Scl.Mix2Group(c, checked_cards)
local checked_cards2 = Scl.Group2CardList(sg)
local res
--case0 not suit first_filter
if not first_filter(sg, ...) then
return false
end
--case1 more cards
if #sg > maxct then
return false
end
--case2 less cards
if #sg < minct then
return mg:IsExists(s.recursion_group_check_filter, 1, sg, checked_cards2, mg, first_filter, final_filter, minct, maxct, ...)
end
--case3 not suit final_filter
if not final_filter(sg, ...) then
return mg:IsExists(s.recursion_group_check_filter, 1, sg, checked_cards2, mg, first_filter, final_filter, minct, maxct, ...)
end
return true
end
--Get the xyz materials attach on the obj before obj leaves the field.
--//return xyz materials group
function Scl.GetPreviousXyzMaterials(obj)
......@@ -6018,6 +6057,7 @@ end
--can call some scl's custom functions in the procedure, like extra synchro material, dark synchro, custom level synchro, custom synchro material action, and so on
--return summon effect
function Scl.AddSynchroProcedure(c, f1, f2, f3, f4, minc, maxc, gc)
maxc = maxc or 99
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetDescription(1164)
......@@ -6129,6 +6169,7 @@ function s.SynMixOperation(f1, f2, f3, f4, minct, maxc, gc)
local res
--case 1, Summon Effect Custom
if Scl.CustomSynchroMaterialAction then
Debug.Message("1231414")
res = Scl.CustomSynchroMaterialAction(mg, c, e, tp)
Scl.CustomSynchroMaterialAction = nil
--case 2, Summon Procedure Custom
......@@ -6367,7 +6408,9 @@ function s.XyzLevelFreeOperationAlter(f, gf, minct, maxct, alterf, desc, op)
return function(e, tp, eg, ep, ev, re, r, rp, c, og, min, max)
local res
local mg = e:GetLabelObject()
mg = mg or og
s.XExtraMaterialCount(mg, c, tp)
Debug.Message(22333)
if not Scl.CustomXyzMaterialAction and not c.scl_custom_xyz_material_action then
res = aux.XyzLevelFreeOperationAlter(f, gf, 1, maxct, alterf, desc, op)(e, tp, eg, ep, ev, re, r, rp, c, og, min, max)
else
......
......@@ -125,7 +125,8 @@ function cm.retcon(e,tp,eg,ep,ev,re,r,rp)
end
function cm.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if Duel.GetCurrentPhase()~=e:GetLabel() then
local ph,ph2=Duel.GetCurrentPhase(),e:GetLabel()
if ph~=ph2 and (ph<=PHASE_MAIN1 or ph>=PHASE_MAIN2 or ph2<=PHASE_MAIN1 or ph2>=PHASE_MAIN2) then
Duel.SendtoHand(tc,1-tp,REASON_EFFECT)
end
end
\ No newline at end of file
......@@ -4,33 +4,33 @@ local cm=_G["c"..m]
function cm.initial_effect(c)
--eff
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(22348318,1))
e1:SetDescription(aux.Stringid(22348317,1))
e1:SetCategory(CATEGORY_HANDES+CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(2,22348318)
e1:SetCondition(c22348318.effcon)
e1:SetTarget(c22348318.efftg)
e1:SetOperation(c22348318.effop)
e1:SetCountLimit(2,22348317)
e1:SetCondition(c22348317.effcon)
e1:SetTarget(c22348317.efftg)
e1:SetOperation(c22348317.effop)
c:RegisterEffect(e1)
end
function c22348318.effcon(e,tp,eg,ep,ev,re,r,rp)
function c22348317.effcon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsOnField() and re:GetHandler():IsRelateToEffect(re) and (re:IsActiveType(TYPE_MONSTER)
or (re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and not re:IsHasType(EFFECT_TYPE_ACTIVATE)))
end
function c22348318.drfilter(c)
function c22348317.drfilter(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsDiscardable()
end
function c22348318.remfilter(c)
function c22348317.remfilter(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsAbleToRemove()
end
function c22348318.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
function c22348317.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local loc=e:GetActivateLocation()
local b1=loc==LOCATION_HAND and Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(c22348318.drfilter,tp,LOCATION_HAND,0,1,c) and c:IsDiscardable()
local b2=loc==LOCATION_GRAVE and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(c22348318.remfilter,tp,LOCATION_GRAVE,0,1,c) and re:GetHandler():IsDestructable()
local b1=loc==LOCATION_HAND and Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(c22348317.drfilter,tp,LOCATION_HAND,0,1,c) and c:IsDiscardable()
local b2=loc==LOCATION_GRAVE and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(c22348317.remfilter,tp,LOCATION_GRAVE,0,1,c) and re:GetHandler():IsDestructable()
if chk==0 then return b1 or b2 end
if b1 then
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
......@@ -43,18 +43,18 @@ function c22348318.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c22348318.effop(e,tp,eg,ep,ev,re,r,rp)
function c22348317.effop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsLocation(LOCATION_HAND) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,c22348318.drfilter,tp,LOCATION_HAND,0,1,1,c)
local g=Duel.SelectMatchingCard(tp,c22348317.drfilter,tp,LOCATION_HAND,0,1,1,c)
g:AddCard(c)
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT+REASON_DISCARD)~=0 then
Duel.Draw(tp,1,REASON_EFFECT)
end
elseif c:IsLocation(LOCATION_GRAVE) then
if re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT) then
local trg=Duel.GetMatchingGroup(c22348318.remfilter,tp,LOCATION_GRAVE,0,c)
local trg=Duel.GetMatchingGroup(c22348317.remfilter,tp,LOCATION_GRAVE,0,c)
if trg:GetCount()>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsLocation(LOCATION_GRAVE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
......
......@@ -13,9 +13,48 @@ function cm.initial_effect(c)
e2:SetCode(EVENT_REMOVE)
e2:SetOperation(cm.op)
c:RegisterEffect(e2)
if not GC_Adjust then
GC_Adjust=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD)
ge1:SetCode(EFFECT_SUMMON_COST)
ge1:SetTargetRange(0xff,0xff)
ge1:SetOperation(cm.check)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
ge1:SetCode(EFFECT_SPSUMMON_COST)
Duel.RegisterEffect(ge2,0)
local ge3=Effect.CreateEffect(c)
ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge3:SetCode(EVENT_SUMMON_SUCCESS)
ge3:SetOperation(cm.reset)
Duel.RegisterEffect(ge3,0)
local ge4=ge3:Clone()
ge4:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(ge4,0)
local ge5=ge3:Clone()
ge5:SetCode(EVENT_SUMMON_NEGATED)
Duel.RegisterEffect(ge5,0)
local ge6=ge3:Clone()
ge6:SetCode(EVENT_SPSUMMON_NEGATED)
Duel.RegisterEffect(ge6,0)
local ge7=ge3:Clone()
ge7:SetCode(EVENT_CHAIN_SOLVING)
ge7:SetOperation(cm.check)
Duel.RegisterEffect(ge7,0)
local ge8=ge3:Clone()
ge8:SetCode(EVENT_CHAIN_SOLVED)
Duel.RegisterEffect(ge8,0)
end
end
function cm.check(e,tp,eg,ep,ev,re,r,rp)
GC_Check=true
end
function cm.reset(e,tp,eg,ep,ev,re,r,rp)
GC_Check=false
end
function cm.filter(c)
return c:GetOriginalCodeRule()==m and c:IsFaceup()
return c:IsCode(m) and c:IsFaceup()
end
function cm.spfilter(c,e,tp)
return c:IsSetCard(0x3531) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
......@@ -59,11 +98,15 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
e4:SetOperation(cm.recop)
e4:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e4)
elseif Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_CARD,0,m)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end
else
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_ADJUST)
e5:SetRange(LOCATION_REMOVED)
e5:SetCondition(cm.spcon)
e5:SetOperation(cm.spop)
e5:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e5,true)
end
end
function cm.cfilter1(c,tp)
......@@ -115,3 +158,15 @@ function cm.recop(e,tp,eg,ep,ev,re,r,rp)
Duel.Recover(tp,200,REASON_EFFECT)
Duel.Damage(1-tp,200,REASON_EFFECT)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return not GC_Check
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_REMOVED,0,1,e:GetHandler()) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_CARD,0,m)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end
end
e:Reset()
end
......@@ -6,7 +6,7 @@ function cm.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_LIMIT_ZONE)
e1:SetHintTiming(TIMING_STANDBY_PHASE,TIMING_STANDBY_PHASE+TIMING_MAIN_END)
e1:SetHintTiming(TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE,TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE+TIMING_MAIN_END+TIMING_END_PHASE)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
......
......@@ -17,10 +17,11 @@ function cm.initial_effect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_LIMIT_ZONE)
e2:SetHintTiming(TIMING_STANDBY_PHASE,TIMING_STANDBY_PHASE+TIMING_END_PHASE)
e2:SetTarget(cm.target2)
e2:SetOperation(cm.activate2)
e2:SetValue(cm.zones)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
......
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