Commit e5433ecb authored by wind2009's avatar wind2009

Merge remote-tracking branch 'upstream/master' into master

parents 38d2df6b b2bb47f8
......@@ -38,16 +38,14 @@ function c1372887.cfilter(c,tp)
return c:IsControler(1-tp) and not c:IsReason(REASON_DRAW) and c:IsPreviousLocation(LOCATION_DECK+LOCATION_GRAVE)
end
function c1372887.drcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c1372887.cfilter,1,nil,tp)
and (not re:IsHasType(EFFECT_TYPE_ACTIONS) or re:IsHasType(EFFECT_TYPE_CONTINUOUS))
return eg:IsExists(c1372887.cfilter,1,nil,tp) and not Duel.IsChainSolving()
end
function c1372887.drop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,1372887)
Duel.Draw(tp,1,REASON_EFFECT)
end
function c1372887.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c1372887.cfilter,1,nil,tp) and Duel.GetFlagEffect(tp,1372887)==0
and re:IsHasType(EFFECT_TYPE_ACTIONS) and not re:IsHasType(EFFECT_TYPE_CONTINUOUS)
return eg:IsExists(c1372887.cfilter,1,nil,tp) and Duel.IsChainSolving()
end
function c1372887.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,1372887,RESET_CHAIN,0,1)
......@@ -56,7 +54,8 @@ function c1372887.drcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,1372887)>0
end
function c1372887.drop2(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFlagEffect(tp,1372887)
Duel.ResetFlagEffect(tp,1372887)
Duel.Hint(HINT_CARD,0,1372887)
Duel.Draw(tp,1,REASON_EFFECT)
Duel.Draw(tp,ct,REASON_EFFECT)
end
--ドラゴンの秘宝
function c1435851.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetTarget(c1435851.target)
e1:SetOperation(c1435851.operation)
c:RegisterEffect(e1)
aux.AddEquipSpellEffect(c,true,true,c1435851.filter,c1435851.eqlimit)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
......@@ -21,13 +13,6 @@ function c1435851.initial_effect(c)
e3:SetCode(EFFECT_UPDATE_DEFENSE)
e3:SetValue(300)
c:RegisterEffect(e3)
--equip limit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_EQUIP_LIMIT)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(c1435851.eqlimit)
c:RegisterEffect(e4)
end
function c1435851.eqlimit(e,c)
return c:IsRace(RACE_DRAGON)
......
......@@ -48,14 +48,14 @@ function c23434538.filter(c,sp)
end
function c23434538.drcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c23434538.filter,1,nil,1-tp)
and (not re:IsHasType(EFFECT_TYPE_ACTIONS) or re:IsHasType(EFFECT_TYPE_CONTINUOUS))
and not Duel.IsChainSolving()
end
function c23434538.drop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
end
function c23434538.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c23434538.filter,1,nil,1-tp)
and re:IsHasType(EFFECT_TYPE_ACTIONS) and not re:IsHasType(EFFECT_TYPE_CONTINUOUS)
and Duel.IsChainSolving()
end
function c23434538.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,23434538,RESET_CHAIN,0,1)
......
--城壁壊しの大槍
function c242146.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetTarget(c242146.target)
e1:SetOperation(c242146.operation)
c:RegisterEffect(e1)
aux.AddEquipSpellEffect(c,true,true,Card.IsFaceup,nil)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
......@@ -16,26 +8,6 @@ function c242146.initial_effect(c)
e2:SetCondition(c242146.atkcon)
e2:SetValue(1500)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c242146.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c242146.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c242146.atkcon(e)
if Duel.GetCurrentPhase()~=PHASE_DAMAGE_CAL then return false end
......
......@@ -37,19 +37,6 @@ function c35199656.initial_effect(c)
e4:SetCondition(c35199656.damcon2)
e4:SetOperation(c35199656.damop2)
c:RegisterEffect(e4)
if not c35199656.global_check then
c35199656.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVING)
ge1:SetOperation(c35199656.count)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_SOLVED)
ge2:SetOperation(c35199656.reset)
Duel.RegisterEffect(ge2,0)
end
end
function c35199656.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......@@ -79,14 +66,8 @@ function c35199656.operation(e,tp,eg,ep,ev,re,r,rp)
end
end
end
function c35199656.count(e,tp,eg,ep,ev,re,r,rp)
c35199656.chain_solving=true
end
function c35199656.reset(e,tp,eg,ep,ev,re,r,rp)
c35199656.chain_solving=false
end
function c35199656.damcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp) and not c35199656.chain_solving
return eg:IsExists(Card.IsControler,1,nil,1-tp) and not Duel.IsChainSolving()
end
function c35199656.damop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,35199656)
......@@ -94,7 +75,7 @@ function c35199656.damop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(1-tp,ct*200,REASON_EFFECT)
end
function c35199656.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp) and c35199656.chain_solving
return eg:IsExists(Card.IsControler,1,nil,1-tp) and Duel.IsChainSolving()
end
function c35199656.regop(e,tp,eg,ep,ev,re,r,rp)
local ct=eg:FilterCount(Card.IsControler,nil,1-tp)
......
......@@ -38,25 +38,6 @@ function c47408488.initial_effect(c)
e4:SetTarget(c47408488.pltg)
e4:SetOperation(c47408488.plop)
c:RegisterEffect(e4)
if not c47408488.global_check then
c47408488.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_SOLVING)
ge1:SetOperation(c47408488.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_CHAIN_SOLVED)
ge2:SetOperation(c47408488.reset)
Duel.RegisterEffect(ge2,0)
end
end
function c47408488.checkop(e,tp,eg,ep,ev,re,r,rp)
c47408488.chain_solving=true
end
function c47408488.reset(e,tp,eg,ep,ev,re,r,rp)
c47408488.chain_solving=false
end
function c47408488.cfilter(c)
local type=c:GetOriginalType()
......@@ -64,13 +45,13 @@ function c47408488.cfilter(c)
return c:IsLocation(LOCATION_SZONE) and c:GetSequence()<5 and c:IsSetCard(0x1034) and bit.band(type,TYPE_MONSTER)~=0
end
function c47408488.ctcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c47408488.cfilter,1,nil) and not c47408488.chain_solving
return eg:IsExists(c47408488.cfilter,1,nil) and not Duel.IsChainSolving()
end
function c47408488.ctop1(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x6,1)
end
function c47408488.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c47408488.cfilter,1,nil) and c47408488.chain_solving
return eg:IsExists(c47408488.cfilter,1,nil) and Duel.IsChainSolving()
end
function c47408488.regop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(47408488,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
......
......@@ -92,7 +92,7 @@ function c53701259.lpcon(e,tp,eg,ep,ev,re,r,rp)
end
function c53701259.lpcon1(e,tp,eg,ep,ev,re,r,rp)
return c53701259.lpcon(e,tp,eg,ep,ev,re,r,rp)
and (not re:IsHasType(EFFECT_TYPE_ACTIONS) or re:IsHasType(EFFECT_TYPE_CONTINUOUS))
and not Duel.IsChainSolving()
end
function c53701259.lpop1(e,tp,eg,ep,ev,re,r,rp)
local lg=eg:Filter(c53701259.cfilter,nil,1-tp)
......@@ -101,7 +101,7 @@ function c53701259.lpop1(e,tp,eg,ep,ev,re,r,rp)
end
function c53701259.regcon(e,tp,eg,ep,ev,re,r,rp)
return c53701259.lpcon(e,tp,eg,ep,ev,re,r,rp)
and re:IsHasType(EFFECT_TYPE_ACTIONS) and not re:IsHasType(EFFECT_TYPE_CONTINUOUS)
and Duel.IsChainSolving()
end
function c53701259.regop(e,tp,eg,ep,ev,re,r,rp)
local lg=eg:Filter(c53701259.cfilter,nil,1-tp)
......
......@@ -63,7 +63,7 @@ function c60643553.lpcon1(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return eg:IsExists(c60643553.cfilter,1,nil,1-tp)
and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2 or (ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE))
and (not re:IsHasType(EFFECT_TYPE_ACTIONS) or re:IsHasType(EFFECT_TYPE_CONTINUOUS))
and not Duel.IsChainSolving()
end
function c60643553.lpop1(e,tp,eg,ep,ev,re,r,rp)
local lg=eg:Filter(c60643553.cfilter,nil,1-tp)
......@@ -75,7 +75,7 @@ function c60643553.regcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return eg:IsExists(c60643553.cfilter,1,nil,1-tp)
and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2 or (ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE))
and re:IsHasType(EFFECT_TYPE_ACTIONS) and not re:IsHasType(EFFECT_TYPE_CONTINUOUS)
and Duel.IsChainSolving()
end
function c60643553.regop(e,tp,eg,ep,ev,re,r,rp)
local lg=eg:Filter(c60643553.cfilter,nil,1-tp)
......
......@@ -84,7 +84,7 @@ function c66425726.filter(c,sp)
end
function c66425726.damcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c66425726.filter,1,nil,1-tp)
and (not re:IsHasType(EFFECT_TYPE_ACTIONS) or re:IsHasType(EFFECT_TYPE_CONTINUOUS))
and not Duel.IsChainSolving()
end
function c66425726.damop1(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,66425726)
......@@ -92,7 +92,7 @@ function c66425726.damop1(e,tp,eg,ep,ev,re,r,rp)
end
function c66425726.regcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c66425726.filter,1,nil,1-tp)
and re:IsHasType(EFFECT_TYPE_ACTIONS) and not re:IsHasType(EFFECT_TYPE_CONTINUOUS)
and Duel.IsChainSolving()
end
function c66425726.regop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(66425726,RESET_CHAIN,0,1)
......
......@@ -1524,6 +1524,60 @@ function Auxiliary.GiveUpNormalDraw(e,tp,property)
Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,FLAG_ID_NO_NORMAL_DRAW,RESET_PHASE+PHASE_DRAW,property,1)
end
---Add EFFECT_TYPE_ACTIVATE effect to Equip Spell Cards
---@param c Card
---@param is_self boolean
---@param is_opponent boolean
---@param filter function
---@param eqlimit function|nil
---@param pause? boolean
---@param skip_target? boolean
function Auxiliary.AddEquipSpellEffect(c,is_self,is_opponent,filter,eqlimit,pause,skip_target)
local value=(type(eqlimit)=="function") and eqlimit or 1
if pause==nil then pause=false end
if skip_target==nil then skip_target=false end
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET)
if not skip_target then
e1:SetTarget(Auxiliary.EquipSpellTarget(is_self,is_opponent,filter,eqlimit))
end
e1:SetOperation(Auxiliary.EquipSpellOperation(eqlimit))
if not pause then
c:RegisterEffect(e1)
end
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(value)
c:RegisterEffect(e2)
return e1
end
function Auxiliary.EquipSpellTarget(is_self,is_opponent,filter,eqlimit)
local loc1=is_self and LOCATION_MZONE or 0
local loc2=is_opponent and LOCATION_MZONE or 0
return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and (not eqlimit or eqlimit(e,chkc)) end
if chk==0 then return Duel.IsExistingTarget(filter,tp,loc1,loc2,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,filter,tp,loc1,loc2,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
end
function Auxiliary.EquipSpellOperation(eqlimit)
return function (e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() and (not eqlimit or eqlimit(e,tc)) then
Duel.Equip(tp,c,tc)
end
end
end
---If this face-up card would leave the field, banish it instead.
---@param c Card
---@param condition? function
......
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