Skip to content

Commit

Permalink
"Oneiros, the Dream Mirror Tormentor" fix
Browse files Browse the repository at this point in the history
Fixed an issue where its Special Summoning effect would fail if the player didn't have an available Extra Monster Zone or Main Monster Zone that a Link Monster is pointing to on resolution.
  • Loading branch information
pyrQ authored Nov 26, 2023
1 parent 94b78bc commit af16bb4
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions official/c37678339.lua
Original file line number Diff line number Diff line change
@@ -1,73 +1,60 @@
--夢魔鏡の魘魔-ネイロス
--Oneiros, the Dream Mirror Faeking
--Oneiros, the Dream Mirror Tormentor
--Scripted by senpaizuri

local s,id=GetID()
function s.initial_effect(c)
--Fusion summon procedure
Fusion.AddProcMixN(c,true,true,s.ffilter,2)
--Must be properly summoned before reviving
c:EnableReviveLimit()
--Also treated as a DARK monster on the field
--Fusion Summon procedure
Fusion.AddProcMixN(c,true,true,s.ffilter,2)
--Also treated as LIGHT-Attrbute while on the field
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_ADD_ATTRIBUTE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(ATTRIBUTE_LIGHT)
c:RegisterEffect(e1)
--Negate the effect of opponent's activated monster effect
--Negate the activated effect of an opponent's monster
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DISABLE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.negcon)
e2:SetTarget(s.negtg)
e2:SetOperation(s.negop)
e2:SetCountLimit(1,id)
e2:SetOperation(function(e,tp,eg,ep,ev) Duel.NegateEffect(ev) end)
c:RegisterEffect(e2)
--Special summon 1 "Oneiros, the Dream Mirror Erlking" from extra deck
--Special Summon 1 "Oneiros, the Dream Mirror Erlking" from your Extra Deck
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,{id,1})
e3:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
e3:SetCondition(s.spcon)
e3:SetCost(s.spcost)
e3:SetCost(aux.selfreleasecost)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
e3:SetCountLimit(1,{id,1})
e3:SetHintTiming(0,TIMING_END_PHASE)
c:RegisterEffect(e3)
end
s.listed_series={SET_DREAM_MIRROR}
s.listed_names={35187185,CARD_DREAM_MIRROR_JOY,CARD_DREAM_MIRROR_TERROR}
s.listed_series={0x131}

function s.ffilter(c,fc,sumtype,sp,sub,mg,sg)
return c:IsSetCard(0x131,fc,sumtype,sp) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or not sg:IsExists(Card.IsAttribute,1,c,c:GetAttribute(),fc,sumtype,sp))
end
function s.cfilter(c,code)
return c:IsFaceup() and c:IsCode(code)
return c:IsSetCard(SET_DREAM_MIRROR,fc,sumtype,sp) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or not sg:IsExists(Card.IsAttribute,1,c,c:GetAttribute(),fc,sumtype,sp))
end
function s.negcon(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_MONSTER) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil,CARD_DREAM_MIRROR_TERROR)
return re:IsMonsterEffect() and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_DREAM_MIRROR_TERROR),tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function s.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil,CARD_DREAM_MIRROR_JOY)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_DREAM_MIRROR_JOY),tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
end
function s.spfilter(c,e,tp)
return c:IsCode(35187185) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
Expand All @@ -78,10 +65,9 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
end

0 comments on commit af16bb4

Please sign in to comment.