Commit 66eb67ce authored by 聖園ミカ's avatar 聖園ミカ 🐟

byd

parent 046043bb
No preview for this file type
expansions/pics/33701500.jpg

16.3 KB | W: | H:

expansions/pics/33701500.jpg

13.9 KB | W: | H:

expansions/pics/33701500.jpg
expansions/pics/33701500.jpg
expansions/pics/33701500.jpg
expansions/pics/33701500.jpg
  • 2-up
  • Swipe
  • Onion skin
--【背景音台】POP TEAM EPIC - old
--function c33701499.initial_effect(c)
--card,code,oathcount,bgmHintID(卡片,卡号,契约回合,音乐提示)
--card,code,oathcount,bgmHintID(<cardname>,<cardID>,<contractTurn>,<BGMFileName>)
--bgmhandle(c,33701499,6,1)
--end
function bgmhandle(c,code,count,bgmid,con,cost,tg,op)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
if con then e0:SetCondition(con) end
e0:SetCost((cost and {cost} or {function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if bgmid then Duel.Hint(HINT_MUSIC,0,aux.Stringid(code,bgmid)) end
end})[1])
if tg then e0:SetTarget(tg) end
if op then e0:SetOperation(op) end
--indes
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_FZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetValue(1)
--Cannot activate
local e3 = Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_FZONE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_CANNOT_NEGATE)
e3:SetTargetRange(1, 0)
e3:SetValue(function(e,re,tp)
return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE) end)
--cannot set
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_SSET)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetRange(LOCATION_FZONE)
e4:SetTargetRange(1, 0)
e4:SetTarget(function(e,c)
return c:IsType(TYPE_FIELD) end)
c:RegisterEffect(e4)
--Auto oath count
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_FZONE)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer() end)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetFlagEffect(1082946)==0 then
c:RegisterFlagEffect(1082946,RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,count)
c:SetTurnCounter(0)
end
local ct=c:GetTurnCounter()
ct=ct+1
c:SetTurnCounter(ct)
if ct>=count then
Duel.Destroy(c,REASON_RULE)
c:ResetFlagEffect(1082946)
end end)
c:RegisterEffect(e0)
c:RegisterEffect(e1)
c:RegisterEffect(e2)
c:RegisterEffect(e3)
c:RegisterEffect(e4)
_G["c"..code][c] = e1
end
\ No newline at end of file
--【背景音台】POP TEAM EPIC
function c33701500.initial_effect(c)
--card,code,oathcount,bgmHintID(卡片,卡号,契约回合,音乐提示)
--card,code,oathcount,bgmHintID(<cardname>,<cardID>,<contractTurn>,<BGMFileName>)
bgmhandle(c,33701500,6,1)
local s,id=GetID()
if not GLITCHYLIB_LOADED then
Duel.LoadScript("glitchylib_vsnemo.lua")
end
function bgmhandle(c,code,count,bgmid,con,cost,tg,op)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
if con then e0:SetCondition(con) end
e0:SetCost((cost and {cost} or {function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if bgmid then Duel.Hint(HINT_MUSIC,0,aux.Stringid(code,bgmid)) end
end})[1])
if tg then e0:SetTarget(tg) end
if op then e0:SetOperation(op) end
--indes
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_FZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetValue(1)
--Cannot activate
local e3 = Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_FZONE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CANNOT_DISABLE)
e3:SetTargetRange(1, 0)
e3:SetValue(function(e,re,tp)
return re:GetHandler():IsType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE) end)
--cannot set
local e4 = Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_SSET)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetRange(LOCATION_FZONE)
e4:SetTargetRange(1, 0)
e4:SetTarget(function(e,c)
return c:IsType(TYPE_FIELD) end)
c:RegisterEffect(e4)
--Auto oath count
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_FZONE)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer() end)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetFlagEffect(1082946)==0 then
c:RegisterFlagEffect(1082946,RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,count)
c:SetTurnCounter(0)
end
local ct=c:GetTurnCounter()
ct=ct+1
c:SetTurnCounter(ct)
if ct>=count then
Duel.Destroy(c,REASON_RULE)
c:ResetFlagEffect(1082946)
end end)
c:RegisterEffect(e0)
c:RegisterEffect(e1)
c:RegisterEffect(e2)
c:RegisterEffect(e3)
c:RegisterEffect(e4)
_G["c"..code][c] = e1
if not TYPE_SOUNDSTAGE then
Duel.LoadScript("glitchylib_soundstage.lua")
end
function s.initial_effect(c)
--[[Template to add a Sound Stage procedure
1) Card the procedure will be registered to
2) Activation effect of the card (must be EFFECT_TYPE_ACTIVATE)
3) ID of the card
4) Contract turns of the card
5) Description string ID that contains the name of the music file that plays when the card is activated (aux.Stringid is called by passing the arguments (3) and (5))
aux.AddSoundStageProc(c,卡片发动效果,卡号,契约回合数,音乐文件名CDB提示ID)
]]
aux.AddSoundStageProc(c,c:Activation(),id,6,1)
end
\ No newline at end of file
EFFECT_NO_RECOVER = 33720228 --Affected player cannot gain LP by card effects
aux.EnabledRegisteredEffectMods={}
--EFFECT TABLES
function Auxiliary.CheckAlreadyRegisteredEffects()
if aux.CheckAlreadyRegisteredEffectsFlag then return end
aux.CheckAlreadyRegisteredEffectsFlag=true
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
e1:SetCode(EVENT_PREDRAW)
e1:OPT()
e1:SetOperation(function(e)
local g=Duel.Group(aux.TRUE,0,LOCATION_ALL,LOCATION_ALL,nil)
for tc in aux.Next(g) do
if not global_card_effect_table[tc] then
local code=tc:GetOriginalCode()
Duel.SetMetatable(tc, _G["c"..code])
tc:ReplaceEffect(CARD_CYBER_HARPIE_LADY,0,0)
tc:SetStatus(STATUS_EFFECT_REPLACED,false)
local s=getmetatable(c)
s.initial_effect(tc)
end
end
end)
Duel.RegisterEffect(e1,0)
end
function Effect.GLGetTargetRange(e)
if not global_target_range_effect_table[e] then return false,false end
local s=global_target_range_effect_table[e][1]
local o=global_target_range_effect_table[e][2]
return s,o
end
--Global Card Effect Table
function Card.GetEffects(c)
local eset=global_card_effect_table[c]
if not eset then return {} end
-- local ct=#eset
-- for i = 1,ct do
-- local e=eset[i]
-- if e and e:WasReset(c) then
-- table.remove(global_card_effect_table[c],i)
-- end
-- end
return global_card_effect_table[c]
end
if not global_card_effect_table_global_check then
global_card_effect_table_global_check=true
global_card_effect_table={}
......@@ -9,10 +58,53 @@ if not global_card_effect_table_global_check then
table.insert(global_card_effect_table[self],e)
local code=e:GetCode()
local selfp,oppo=e:GLGetTargetRange()
local condition,cost,tg,op,val=e:GetCondition(),e:GetCost(),e:GetTarget(),e:GetOperation(),e:GetValue()
--Damage Replacement Effects (necessary for cards like Sepialife - Passive On Pink)
if code==EFFECT_REVERSE_DAMAGE or code==EFFECT_REFLECT_DAMAGE then
if code==EFFECT_REVERSE_DAMAGE then
local newcon = function(e)
local tp=e:GetHandlerPlayer()
return (not condition or condition(e)) and not aux.IsChangedDamage and not aux.IsReplacedDamage
end
e:SetCondition(newcon)
--Fix interaction between EFFECT_NO_RECOVER and damage-recovery swap effects (such as Muscle Medic)
if aux.EnabledRegisteredEffectMods[EFFECT_NO_RECOVER] then
local newval = function(e,re,r,rp,rc)
local res0=val
if type(val)=="function" then
res0=val(e,re,r,rp,rc)
end
if aux.IsDamageFunctionCalled then
return res0
end
local tp=e:GetHandlerPlayer()
local dam0,dam1=Duel.GetBattleDamage(0),Duel.GetBattleDamage(1)
local p=dam0>0 and 0 or dam1>0 and 1 or nil
if not p then return res0 end
local eset={Duel.IsPlayerAffectedByEffect(p,EFFECT_NO_RECOVER)}
if #eset==0 then
return res0
else
if (selfp==0 and p==tp) or (oppo==0 and p==1-tp) then return res0 end
for _,ce in ipairs(eset) do
local res=ce:Evaluate(p,0,r)
if res then
return false
end
end
return res0
end
end
e:SetValue(newval)
end
elseif code==EFFECT_REFLECT_DAMAGE then
local newcon = function(...)
return (not condition or condition(...)) and not aux.IsChangedDamage and not aux.IsReplacedDamage
end
......@@ -99,6 +191,7 @@ if not global_card_effect_table_global_check then
end
end
if aux.PreventSecondRegistration then return end
return self.register_global_card_effect_table(self,e,forced)
end
end
......@@ -116,11 +209,20 @@ if not global_duel_effect_table_global_check then
local condition,cost,tg,op,val=e:GetCondition(),e:GetCost(),e:GetTarget(),e:GetOperation(),e:GetValue()
--Damage Replacement Effects
if code==EFFECT_REVERSE_DAMAGE or code==EFFECT_REFLECT_DAMAGE then
if code==EFFECT_REVERSE_DAMAGE then
local newcon = function(e,...)
local tp=e:GetHandlerPlayer()
return (not condition or condition(...)) and not aux.IsChangedDamage and not aux.IsReplacedDamage
and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_NO_RECOVER)
end
e:SetCondition(newcon)
elseif code==EFFECT_REFLECT_DAMAGE then
local newcon = function(...)
return (not condition or condition(...)) and not aux.IsChangedDamage and not aux.IsReplacedDamage
end
e:SetCondition(newcon)
elseif code==EFFECT_CHANGE_DAMAGE then
local newcon = function(...)
return (not condition or condition(...)) and not aux.IsReplacedDamage
......@@ -202,6 +304,7 @@ if not global_duel_effect_table_global_check then
end
end
if aux.PreventSecondRegistration then return end
return Duel.register_global_duel_effect_table(e,tp)
end
end
\ No newline at end of file
--Library for Sound Stage Cards
TYPE_SOUNDSTAGE = 0x2000000000
FLAG_SOUNDSTAGE_CONTRACT = 1082946
--Handle card type overwriting
Auxiliary.SoundStage={}
local get_type, get_orig_type, get_prev_type_field, get_active_type, is_active_type, get_reason, get_fusion_type, get_synchro_type, get_xyz_type, get_link_type, get_ritual_type =
Card.GetType, Card.GetOriginalType, Card.GetPreviousTypeOnField, Effect.GetActiveType, Effect.IsActiveType, Card.GetReason, Card.GetFusionType, Card.GetSynchroType, Card.GetXyzType, Card.GetLinkType, Card.GetRitualType
Card.GetType=function(c,scard,sumtype,p)
local tpe=scard and get_type(c,scard,sumtype,p) or get_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Card.GetOriginalType=function(c)
local tpe=get_orig_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Card.GetPreviousTypeOnField=function(c)
local tpe=get_prev_type_field(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Effect.GetActiveType=function(e)
local tpe=get_active_type(e)
local c = e:GetType()&0x7f0>0 and e:GetHandler() or e:GetOwner()
if not (e:IsHasType(EFFECT_TYPE_ACTIVATE) and c:IsType(TYPE_PENDULUM)) and c:IsType(TYPE_SOUNDSTAGE) then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Effect.IsActiveType=function(e,typ)
return e:GetActiveType()&typ>0
end
Card.GetReason=function(c)
local rs=get_reason(c)
local rc=c:GetReasonCard()
if rc and Auxiliary.SoundStage[rc] then
rs=rs|REASON_DRIVE
end
return rs
end
Card.GetFusionType=function(c)
local tpe=get_fusion_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Card.GetSynchroType=function(c)
local tpe=get_synchro_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Card.GetXyzType=function(c)
local tpe=get_xyz_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Card.GetLinkType=function(c)
local tpe=get_link_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
Card.GetRitualType=function(c)
local res=get_ritual_type(c)
if Auxiliary.SoundStage[c] then
tpe=(tpe&(~TYPE_FIELD))|TYPE_SOUNDSTAGE
end
return tpe
end
function Auxiliary.AddOrigSoundStageType(c)
Auxiliary.SoundStage[c]=true
end
--Add Sound Stage procedure
function Auxiliary.AddSoundStageProc(c,e,id,count,bgmid)
Auxiliary.SoundStage[c]=true
if id and bgmid then
local cost=e:GetCost()
e:SetCost(function(_e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not cost or cost(_e,tp,eg,ep,ev,re,r,rp,chk) end
Duel.Hint(HINT_MUSIC,0,aux.Stringid(id,bgmid))
end)
end
--Cannot be destroyed
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE|EFFECT_FLAG_CANNOT_DISABLE|EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_FZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE)
e2:SetValue(1)
c:RegisterEffect(e2)
--Cannot be replaced by activating/Setting Field Spells
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET|EFFECT_FLAG_CANNOT_DISABLE|EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(1,0)
e3:SetValue(function(_e,re,tp)
return re:GetHandler():IsType(TYPE_FIELD|TYPE_SOUNDSTAGE) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_SSET)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET|EFFECT_FLAG_CANNOT_DISABLE|EFFECT_FLAG_UNCOPYABLE)
e4:SetRange(LOCATION_FZONE)
e4:SetTargetRange(1,0)
e4:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_FIELD|TYPE_SOUNDSTAGE))
c:RegisterEffect(e4)
--Send to GY after contract expiration
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
e6:SetCode(EVENT_PHASE|PHASE_END)
e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE|EFFECT_FLAG_UNCOPYABLE)
e6:SetCountLimit(1)
e6:SetRange(LOCATION_FZONE)
e6:SetOperation(aux.SoundStageSelfToGY(count))
c:RegisterEffect(e6)
--Modify TCG/OCG cards (see e5)
if not aux.SoundStageModCheck then
aux.SoundStageModCheck=true
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
ge1:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
ge1:SetCode(EVENT_PREDRAW)
ge1:OPT()
ge1:SetOperation(aux.SoundStageMod)
Duel.RegisterEffect(ge1,0)
end
return e6
end
Auxiliary.SoundStageModCodes={
[73468603]=173468603; --Set Rotation
[47404795]=147404795; --Abyss Actor - Super Producer
[87498729]=187498729; --Fallen of the Tistina
[30676200]=130676200; --Hero of the Ashened City
[86239173]=186239173; --Horned Saurus
[30680659]=130680659; --Water Enchantress of the Temple
[30453613]=130453613; --Awakening of Veidos
[25964547]=125964547; --Dream Mirror Hypnagogia
[65305978]=165305978; --Fire King Sanctuary
[49568943]=149568943; --Vaylantz World - Shinra Bansho
[75952542]=175952542; --Vaylantz World - Konig Wissen
}
function Auxiliary.SoundStageMod(e,tp)
local g=Duel.GetMatchingGroup(function(c) return aux.SoundStageModCodes[c:GetOriginalCode()] end,0,LOCATION_ALL,LOCATION_ALL,nil)
for tc in aux.Next(g) do
local code=tc:GetOriginalCode()
local modcode=aux.SoundStageModCodes[code]
tc:ReplaceEffect(modcode,0,0)
end
end
function Card.IsCanPlaceInFieldZone(c,placing_player,receiving_player)
receiving_player = receiving_player or placing_player
local fc=Duel.GetFieldGroup(receiving_player,LOCATION_FZONE,0):GetFirst()
if fc and fc:IsOriginalType(TYPE_SOUNDSTAGE) then
return false
end
return true
end
function Auxiliary.SoundStageSelfToGY(count)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetFlagEffect(FLAG_SOUNDSTAGE_CONTRACT)==0 then
c:RegisterFlagEffect(FLAG_SOUNDSTAGE_CONTRACT,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_END,0,count)
c:SetTurnCounter(0)
end
local ct=c:GetTurnCounter()
ct=ct+1
c:SetTurnCounter(ct)
if ct>=count then
Duel.SendtoGrave(c,nil,REASON_RULE)
end
end
end
......@@ -2,10 +2,22 @@ GLITCHYLIB_LOADED = true
self_reference_effect = nil
self_reference_tp = nil
Duel.LoadScript("glitchylib_regeff.lua")
--Glitchylib imports
EFFECT_CHANGE_RECOVER = 1508
--Modified functions
local duel_recover, duel_damage, aux_damcon1 = Duel.Recover, Duel.Damage, Auxiliary.damcon1
Duel.Recover = function(p,v,r,...)
aux.IsRecoverFunctionCalled=true
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_NO_RECOVER)}) do
if e:Evaluate(p,v,r,...) then
aux.IsRecoverFunctionCalled=false
return 0
end
end
if Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER) then
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER)}) do
local val=e:GetValue()
......@@ -13,26 +25,41 @@ Duel.Recover = function(p,v,r,...)
if aux.GetValueType(val)~="number" then
val=val(e,r,v)
end
return duel_recover(p,val,r,...)
local res=duel_recover(p,val,r,...)
aux.IsRecoverFunctionCalled=false
return res
end
end
else
return duel_recover(p,v,r,...)
local res=duel_recover(p,v,r,...)
aux.IsRecoverFunctionCalled=false
return res
end
end
Duel.Damage = function(p,v,r,...)
aux.IsDamageFunctionCalled=true
if Duel.IsPlayerAffectedByEffect(p,EFFECT_REVERSE_DAMAGE) and Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER) then
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_NO_RECOVER)}) do
if e:Evaluate(p,v,r,...) then
return 0
end
end
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_CHANGE_RECOVER)}) do
local val=e:GetValue()
if val and (aux.GetValueType(val)=="number" or val(e,r|REASON_RDAMAGE,v)) then
if aux.GetValueType(val)~="number" then
val=val(e,r|REASON_RDAMAGE,v)
end
return duel_damage(p,val,r,...)
local res=duel_damage(p,val,r,...)
aux.IsDamageFunctionCalled=false
return res
end
end
else
return duel_damage(p,v,r,...)
local res=duel_damage(p,v,r,...)
aux.IsDamageFunctionCalled=false
return res
end
end
Auxiliary.damcon1 = function(e,tp,eg,ep,ev,re,r,rp)
......@@ -52,13 +79,18 @@ Auxiliary.damcon1 = function(e,tp,eg,ep,ev,re,r,rp)
if ex and (cp==tp or cp==PLAYER_ALL) and not rd and takedamcheck then
return true
end
ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER)
return ex and (cp==tp or cp==PLAYER_ALL) and rr and takedamcheck
local recovercheck=true
for _,e in ipairs({Duel.IsPlayerAffectedByEffect(p,EFFECT_NO_RECOVER)}) do
if e:Evaluate(ep,ev,r) then
recovercheck=false
break
end
end
return ex and (cp==tp or cp==PLAYER_ALL) and rr and recovercheck and takedamcheck
end
--Glitchylib imports
EFFECT_CHANGE_RECOVER = 1508
--Rating types
RATING_LEVEL = 0x1
......@@ -93,6 +125,7 @@ RESETS_STANDARD_ACTIVATION = RESETS_STANDARD&~(RESET_TOFIELD|RESET_LEAVE|RESET
--timings
RELEVANT_TIMINGS = TIMINGS_CHECK_MONSTER|TIMING_MAIN_END|TIMING_END_PHASE
RELEVANT_BATTLE_TIMINGS = TIMING_BATTLE_PHASE|TIMING_BATTLE_END|TIMING_ATTACK|TIMING_BATTLE_START|TIMING_BATTLE_STEP_END
--win
WIN_REASON_CUSTOM = 0xff
......@@ -113,6 +146,8 @@ ARCHE_FUSION = 0x46
CARD_ANCIENT_PIXIE_DRAGON = 4179255
CARD_BLACK_AND_WHITE_WAVE = 31677606
CARD_BLUEEYES_SPIRIT = 59822133
CARD_CYBER_DRAGON = 70095154
CARD_CYBER_HARPIE_LADY = 80316585
CARD_DESPAIR_FROM_THE_DARK = 71200730
CARD_EHERO_BLAZEMAN = 63060238
CARD_MONSTER_REBORN = 83764718
......@@ -121,7 +156,7 @@ CARD_NUMBER_39_UTOPIA = 84013237
CARD_ROTA = 32807846
CARD_UMI = 22702055
LOCATION_ALL = LOCATION_DECK|LOCATION_HAND|LOCATION_MZONE|LOCATION_SZONE|LOCATION_GRAVE|LOCATION_REMOVED|LOCATION_EXTRA
LOCATION_ALL = LOCATION_DECK|LOCATION_HAND|LOCATION_MZONE|LOCATION_SZONE|LOCATION_GRAVE|LOCATION_REMOVED|LOCATION_EXTRA|LOCATION_OVERLAY
LOCATION_GB = LOCATION_GRAVE|LOCATION_REMOVED
MAX_RATING = 14
......@@ -182,6 +217,7 @@ COUNTER_SPARKLE = 0x443
TOKEN_BELKA = 33730163
TOKEN_DESPERADO_HEART = 33720101
TOKEN_MONSTER_UNIVERSE = 33720246
TOKEN_STRELKA = 33730162
......@@ -993,11 +1029,11 @@ function Duel.Bounce(g)
return ct,#cg,cg
end
function Duel.ShuffleIntoDeck(g,p,loc,seq,r)
function Duel.ShuffleIntoDeck(g,p,loc,seq,r,...)
if not loc then loc=LOCATION_DECK|LOCATION_EXTRA end
if not seq then seq=SEQ_DECKSHUFFLE end
if not r then r=REASON_EFFECT end
local ct=Duel.SendtoDeck(g,p,seq,r)
local ct=Duel.SendtoDeck(g,p,seq,r,...)
if ct>0 then
if seq==SEQ_DECKSHUFFLE then
aux.AfterShuffle(g)
......@@ -1524,6 +1560,108 @@ function Card.GlitchyGetPreviousColumnGroup(c,left,right,without_center)
end
end
--Continuous Effects
function Auxiliary.RegisterMaxxCEffect(c,id,p,range,event,cond,outchainop,inchainop,flaglabel,reset,flagreset,label)
local rct,flagrct=1,1
if type(reset)=="table" then
rct=reset[2]
reset=reset[1]
end
if type(flagreset)=="table" then
flagrct=flagreset[2]
flagreset=flagreset[1]
end
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD|EFFECT_TYPE_CONTINUOUS)
e2:SetCode(event)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(aux.OutsideChainMaxxCCondition(cond))
e2:SetOperation(outchainop)
if label then
e2:SetLabel(label)
end
if reset then
e2:SetReset(reset,rct)
end
if p then
Duel.RegisterEffect(e2,p)
else
e2:SetRange(range)
c:RegisterEffect(e2)
end
--
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS|EFFECT_TYPE_FIELD)
e3:SetCode(event)
e3:SetCondition(aux.InsideChainMaxxCCondition(cond))
e3:SetOperation(aux.RegisterMaxxCFlag(id,flaglabel,flagreset,flagrct))
if label then
e3:SetLabel(label)
end
if reset then
e3:SetReset(reset,rct)
end
if p then
Duel.RegisterEffect(e3,p)
else
e3:SetRange(range)
c:RegisterEffect(e3)
end
--
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS|EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_CHAIN_SOLVED)
e4:SetCondition(aux.MaxxCFlagCondition(id,cond))
e4:SetOperation(aux.ResolvedChainMaxxCOperation(id,inchainop))
if label then
e4:SetLabel(label)
end
if reset then
e4:SetReset(reset,rct)
end
if p then
Duel.RegisterEffect(e4,p)
else
e4:SetRange(range)
c:RegisterEffect(e4)
end
return e2,e3,e4
end
function Auxiliary.OutsideChainMaxxCCondition(cond)
return function(e,tp,eg,ep,ev,re,r,rp)
return (not cond or cond(e,tp,eg,ep,ev,re,r,rp)) and not Duel.IsChainSolving()
end
end
function Auxiliary.InsideChainMaxxCCondition(cond)
return function(e,tp,eg,ep,ev,re,r,rp)
return (not cond or cond(e,tp,eg,ep,ev,re,r,rp)) and Duel.IsChainSolving()
end
end
function Auxiliary.RegisterMaxxCFlag(id,flaglabel,reset,rct)
if not reset then reset=0 end
local resets=RESET_CHAIN|reset
return function(e,tp,eg,ep,ev,re,r,rp)
local lab=0
if flaglabel then
lab=flaglabel(e,tp,eg,ep,ev,re,r,rp)
end
Duel.RegisterFlagEffect(tp,id,resets,0,rct,lab)
end
end
function Auxiliary.MaxxCFlagCondition(id)
return function(e,tp,eg,ep,ev,re,r,rp)
return (not cond or cond(e,tp,eg,ep,ev,re,r,rp)) and Duel.PlayerHasFlagEffect(tp,id)
end
end
function Auxiliary.ResolvedChainMaxxCOperation(id,op)
return function(e,tp,eg,ep,ev,re,r,rp)
local n=Duel.GetFlagEffect(tp,id)
op(e,tp,eg,ep,ev,re,r,rp,n)
Duel.ResetFlagEffect(tp,id)
end
end
--Counters
RELEVANT_REMOVE_EVENT_COUNTERS = {0x100e}
COUNTED_COUNTERS_FOR_REMOVE_EVENT = {}
......@@ -1642,9 +1780,6 @@ end
function Effect.Desc(e,id,...)
local x = {...}
local c=e:GetOwner()
if aux.GetValueType(aux.EffectBeingApplied)=="Effect" and aux.GetValueType(aux.ProxyEffect)=="Effect" and aux.ProxyEffect:GetOwner()==c then
c=aux.EffectBeingApplied:GetOwner()
end
local code = #x>0 and x[1] or c:GetOriginalCode()
if id<16 then
return e:SetDescription(aux.Stringid(code,id))
......@@ -1653,9 +1788,6 @@ function Effect.Desc(e,id,...)
end
end
function Card.AskPlayer(c,tp,desc)
if aux.GetValueType(aux.EffectBeingApplied)=="Effect" and aux.GetValueType(aux.ProxyEffect)=="Effect" and aux.ProxyEffect:GetHandler()==c then
c=aux.EffectBeingApplied:GetHandler()
end
local string = desc<=15 and aux.Stringid(c:GetOriginalCode(),desc) or desc
return Duel.SelectYesNo(tp,string)
end
......@@ -1709,7 +1841,7 @@ function Auxiliary.Option(id,tp,desc,...)
return sel
end
function Duel.RegisterHint(p,flag,reset,rct,id,desc,prop)
function Duel.RegisterHint(p,flag,reset,rct,id,desc,prop,refeff)
if not reset then reset=PHASE_END end
if not rct then rct=1 end
if not prop then prop=0 end
......@@ -1717,12 +1849,24 @@ function Duel.RegisterHint(p,flag,reset,rct,id,desc,prop)
e:Desc(desc,id)
e:SetType(EFFECT_TYPE_FIELD)
e:SetProperty(EFFECT_FLAG_CLIENT_HINT|EFFECT_FLAG_CANNOT_DISABLE|EFFECT_FLAG_PLAYER_TARGET|prop)
e:SetCode(EFFECT_FLAG_EFFECT|id)
e:SetCode(EFFECT_FLAG_EFFECT|flag)
e:SetTargetRange(1,0)
if refeff then
e:SetLabelObject(refeff)
e:SetCondition(aux.ResetHintCondition)
end
e:SetReset(RESET_PHASE|reset,rct)
Duel.RegisterEffect(e,p)
return e
end
function Auxiliary.ResetHintCondition(e)
local refeff=e:GetLabelObject()
if not refeff then
e:Reset()
return false
end
return true
end
--EDOPro Imports
function Auxiliary.BitSplit(v)
......@@ -2040,6 +2184,10 @@ function Effect.SetRelevantTimings(e,extra_timings)
if not extra_timings then extra_timings=0 end
return e:SetHintTiming(extra_timings,RELEVANT_TIMINGS|extra_timings)
end
function Effect.SetRelevantBattleTimings(e,extra_timings)
if not extra_timings then extra_timings=0 end
return e:SetHintTiming(extra_timings,RELEVANT_BATTLE_TIMINGS|extra_timings)
end
--Labels
......@@ -2054,6 +2202,19 @@ function Effect.SetLabelPair(e,l1,l2)
e:SetLabel(o1,l2)
end
end
function Effect.SetSpecificLabel(e,l,pos)
if not pos then pos=1 end
local tab={e:GetLabel()}
if #tab<pos then
for i=1,pos-#tab-1 do
table.insert(tab,0)
end
table.insert(tab,l)
else
tab[pos]=l
end
e:SetLabel(table.unpack(tab))
end
function Effect.GetSpecificLabel(e,pos)
if not pos then pos=1 end
local tab={e:GetLabel()}
......@@ -2681,7 +2842,8 @@ function Duel.IsEndPhase(tp)
end
function Duel.GetNextPhaseCount(ph,p)
if Duel.GetCurrentPhase()==ph and (not p or Duel.GetTurnPlayer()==p) then
if not ph and not p then return 1 end
if (not ph or Duel.GetCurrentPhase()==ph) and (not p or Duel.GetTurnPlayer()==p) then
return 2
else
return 1
......@@ -3184,8 +3346,12 @@ function Card.UpdateATKDEF(c,atk,def,reset,rc,range,cond,prop,desc)
end
--Protections
function Card.CannotBeDestroyedByBattle(c,val,cond,reset,rc,range,prop,desc)
local typ = EFFECT_TYPE_SINGLE
function Card.CannotBeDestroyedByBattle(c,val,cond,reset,rc,range,prop,desc,forced,typ)
if not typ and c:IsOriginalType(TYPE_EQUIP) and not range then
typ = EFFECT_TYPE_EQUIP
else
typ = typ or EFFECT_TYPE_SINGLE
end
local donotdisable=false
local rc = rc and rc or c
......@@ -3226,7 +3392,7 @@ function Card.CannotBeDestroyedByBattle(c,val,cond,reset,rc,range,prop,desc)
e:SetProperty(prop)
end
c:RegisterEffect(e)
c:RegisterEffect(e,forced)
return e
end
......@@ -3234,6 +3400,7 @@ end
--Protections: Immunity
UNAFFECTED_OTHER = 0x1
UNAFFECTED_OPPO = 0x2
UNAFFECTED_OTHER_EQUIP = 0x100
function Auxiliary.imother(e,te)
return e:GetOwner()~=te:GetOwner()
......@@ -3241,14 +3408,24 @@ end
function Auxiliary.imoval(e,te)
return e:GetOwnerPlayer()~=te:GetOwnerPlayer()
end
function Auxiliary.imothereq(e,te)
local owner,affecting_owner=e:GetOwner(),te:GetOwner()
return owner~=affecting_owner and affecting_owner~=owner:GetEquipTarget()
end
Auxiliary.UnaffectedProtections={
[UNAFFECTED_OTHER] = aux.imother;
[UNAFFECTED_OPPO] = aux.imoval;
[UNAFFECTED_OTHER_EQUIP] = aux.imothereq;
}
function Card.Unaffected(c,immunity,cond,reset,rc,range,prop,desc)
local typ = EFFECT_TYPE_SINGLE
if not reset and not range then
function Card.Unaffected(c,immunity,cond,reset,rc,range,prop,desc,forced,typ)
if not typ and c:IsOriginalType(TYPE_EQUIP) and not range then
typ = EFFECT_TYPE_EQUIP
else
typ = typ or EFFECT_TYPE_SINGLE
end
if typ==EFFECT_TYPE_SINGLE and not reset and not range then
range = c:GetOriginalType()&TYPE_FIELD>0 and LOCATION_FZONE or c:GetOriginalType()&TYPE_ST>0 and LOCATION_SZONE or LOCATION_MZONE
end
......@@ -3272,6 +3449,10 @@ function Card.Unaffected(c,immunity,cond,reset,rc,range,prop,desc)
end
local e=Effect.CreateEffect(rc)
if desc then
e:SetDescription(desc)
prop=prop|EFFECT_FLAG_CLIENT_HINT
end
e:SetType(typ)
if range then
prop=prop|EFFECT_FLAG_SINGLE_RANGE
......@@ -3293,7 +3474,7 @@ function Card.Unaffected(c,immunity,cond,reset,rc,range,prop,desc)
e:SetProperty(prop)
end
c:RegisterEffect(e)
c:RegisterEffect(e,forced)
return e
end
......@@ -3301,6 +3482,12 @@ end
--Location Check
EFFECT_CARD_HAS_RESOLVED = 47987298
function Auxiliary.AlreadyInRangeCondition(e,re,se)
local se=e and e:GetLabelObject():GetLabelObject() or se
return function(c,...)
return se==nil or re~=se
end
end
function Auxiliary.AlreadyInRangeFilter(e,f,se)
local se=e and e:GetLabelObject():GetLabelObject() or se
return function(c,...)
......@@ -3568,6 +3755,17 @@ function Auxiliary.DiscardCost(f,min,max,exc)
Duel.DiscardHand(tp,aux.DiscardFilter(f,true),min,max,REASON_COST|REASON_DISCARD,exc)
end
end
function Auxiliary.PayLPCost(lp)
if not lp then lp=1000 end
return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,lp) end
Duel.PayLPCost(tp,lp)
end
end
function Auxiliary.PayHalfLPCost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
----Self as Cost
function Auxiliary.BanishFacedownSelfCost(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -4142,5 +4340,3 @@ Card.GetLocation = function(c)
end
return locs
end
\ No newline at end of file
Duel.LoadScript("glitchylib_regeff.lua")
\ 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