Skip to content

Commit

Permalink
"Puppet Master" fix
Browse files Browse the repository at this point in the history
Should check that the targets are still Fiend monsters on resolution.
  • Loading branch information
pyrQ authored Dec 2, 2023
1 parent f1b5b0c commit 78cdb2d
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions official/c41442341.lua
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
--死霊操りしパペットマスター
--Puppet Master

local s,id=GetID()
function s.initial_effect(c)
--When tribute summoned, special summon 2 fiend monsters from GY
--Special Summon 2 Fiend monsters from your GY
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCondition(s.spcon)
e1:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_TRIBUTE) end)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_TRIBUTE)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,2000) end
Duel.PayLPCost(tp,2000)
end
function s.filter(c,e,tp)
function s.spfilter(c,e,tp)
return c:IsRace(RACE_FIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetControler()==tp and chkc:GetLocation()==LOCATION_GRAVE and s.filter(chkc,e,tp) end
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,2,nil,e,tp) end
and Duel.GetLocationCount(tp,LOCATION_MZONE)>=2
and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,2,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,2,2,nil,e,tp)
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,2,2,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local fg=g:Filter(Card.IsRelateToEffect,nil,e)
if #fg>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
if #fg>1 and ft==1 then fg=fg:Select(tp,1,1,nil) end
for tc in aux.Next(fg) do
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
--Cannot attack this turn
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(3206)
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local tg=Duel.GetTargetCards(e):Match(Card.IsRace,nil,RACE_FIEND)
if #tg==0 or (#tg>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then return end
if #tg>1 and ft==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
tg=tg:Select(tp,1,1,nil)
end
for tc in tg:Iter() do
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
--Cannot attack this turn
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(3206)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_END)
tc:RegisterEffect(e1)
end
end
Duel.SpecialSummonComplete()
end
end

0 comments on commit 78cdb2d

Please sign in to comment.