Commit 4251f035 authored by mercury233's avatar mercury233 Committed by GitHub

add count limit for player effect (#1668)

* fix & update EFFECT_EXTRA_PENDULUM_SUMMON

* update Palace of the Elemental Lords
parent e5e84bb8
......@@ -31,24 +31,15 @@ function c18214905.costfilter(c)
return c:IsSetCard(0x400d) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
end
function c18214905.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c18214905.costfilter,tp,loc,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=Duel.SelectMatchingCard(tp,c18214905.costfilter,tp,loc,0,1,1,nil):GetFirst()
if tc:IsLocation(LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
Duel.SendtoGrave(tc,REASON_COST)
end
......
......@@ -26,24 +26,15 @@ function c19036557.costfilter(c,tp)
and Duel.IsExistingMatchingCard(c19036557.thfilter,tp,LOCATION_DECK,0,1,c)
end
function c19036557.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c19036557.costfilter,tp,loc,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=Duel.SelectMatchingCard(tp,c19036557.costfilter,tp,loc,0,1,1,nil,tp):GetFirst()
if tc:IsLocation(LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
Duel.SendtoGrave(tc,REASON_COST)
end
......
......@@ -93,6 +93,7 @@ function c29432356.penop(e,tp,eg,ep,ev,re,r,rp)
e2:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCountLimit(1,29432356)
e2:SetValue(c29432356.pendvalue)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
......
......@@ -94,7 +94,7 @@ function c31531170.pendop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
if #g==0 then return end
if ce then
Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode())
ce:Reset()
ce:UseCountLimit(tp)
else
aux.PendulumChecklist=aux.PendulumChecklist|(0x1<<tp)
end
......
......@@ -105,6 +105,7 @@ function c34884015.expop(e,tp,eg,ep,ev,re,r,rp)
e1:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetCountLimit(1,29432356)
e1:SetValue(aux.TRUE)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
......
......@@ -28,24 +28,15 @@ function c45702014.costfilter(c)
return c:IsSetCard(0x400d) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
end
function c45702014.setcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c45702014.costfilter,tp,loc,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=Duel.SelectMatchingCard(tp,c45702014.costfilter,tp,loc,0,1,1,nil):GetFirst()
if tc:IsLocation(LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
Duel.SendtoGrave(tc,REASON_COST)
end
......
......@@ -26,24 +26,15 @@ function c46425662.costfilter(c)
return c:IsSetCard(0x400d) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
end
function c46425662.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c46425662.costfilter,tp,loc,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=Duel.SelectMatchingCard(tp,c46425662.costfilter,tp,loc,0,1,1,nil):GetFirst()
if tc:IsLocation(LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
Duel.SendtoGrave(tc,REASON_COST)
end
......
......@@ -33,13 +33,9 @@ function c61557074.initial_effect(c)
e5:SetCode(61557074)
e5:SetRange(LOCATION_FZONE)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetCountLimit(1)
e5:SetTargetRange(1,0)
e5:SetCondition(c61557074.condition)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetProperty(EFFECT_FLAG_CLIENT_HINT)
c:RegisterEffect(e6)
end
function c61557074.atkval(e,c)
return Duel.GetMatchingGroup(Card.IsType,e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil,TYPE_MONSTER):GetClassCount(Card.GetAttribute)*200
......@@ -76,6 +72,3 @@ end
function c61557074.skipcon(e)
return Duel.GetTurnCount()~=e:GetLabel()
end
function c61557074.condition(e)
return e:GetHandler():GetFlagEffect(61557074)==0
end
......@@ -29,24 +29,15 @@ function c71797713.regfilter(c,attr)
return c:IsSetCard(0x400d) and bit.band(c:GetOriginalAttribute(),attr)~=0
end
function c71797713.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c71797713.costfilter,tp,loc,0,2,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c71797713.costfilter,tp,loc,0,2,2,e:GetHandler())
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
local flag=0
if g:IsExists(c71797713.regfilter,1,nil,ATTRIBUTE_EARTH+ATTRIBUTE_WIND) then flag=bit.bor(flag,0x1) end
......
......@@ -26,24 +26,15 @@ function c72819261.costfilter(c,tp)
and Duel.IsExistingMatchingCard(c72819261.filter,tp,LOCATION_DECK,0,1,c)
end
function c72819261.sgcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c72819261.costfilter,tp,loc,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=Duel.SelectMatchingCard(tp,c72819261.costfilter,tp,loc,0,1,1,nil,tp):GetFirst()
if tc:IsLocation(LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
Duel.SendtoGrave(tc,REASON_COST)
end
......
......@@ -26,24 +26,15 @@ function c83032858.costfilter(c)
return c:IsSetCard(0x400d) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
end
function c83032858.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local fg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,61557074)}) do
fg:AddCard(pe:GetHandler())
end
local fe=Duel.IsPlayerAffectedByEffect(tp,61557074)
local loc=LOCATION_HAND
if fg:GetCount()>0 then loc=LOCATION_HAND+LOCATION_DECK end
if fe then loc=LOCATION_HAND+LOCATION_DECK end
if chk==0 then return Duel.IsExistingMatchingCard(c83032858.costfilter,tp,loc,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local tc=Duel.SelectMatchingCard(tp,c83032858.costfilter,tp,loc,0,1,1,nil):GetFirst()
if tc:IsLocation(LOCATION_DECK) then
local fc=nil
if fg:GetCount()==1 then
fc=fg:GetFirst()
else
fc=fg:Select(tp,1,1,nil)
end
Duel.Hint(HINT_CARD,0,fc:GetCode())
fc:RegisterFlagEffect(61557074,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,0)
Duel.Hint(HINT_CARD,0,61557074)
fe:UseCountLimit(tp)
end
Duel.SendtoGrave(tc,REASON_COST)
end
......
......@@ -1865,7 +1865,7 @@ function Auxiliary.PendOperation()
if not g then return end
if ce then
Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode())
ce:Reset()
ce:UseCountLimit(tp)
else
Auxiliary.PendulumChecklist=Auxiliary.PendulumChecklist|(0x1<<tp)
end
......
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