I Hate Snatch Steal

During the End Phase: you can destroy this card and if you do, draw 1 card.
Must first be xyz summoned by using 2 "Magician" Pendulum cards and 1 level 7 or higher Spellcaster-Type monster you control as the xyz materials. If this card leaves the field: you can draw 1 card, then if that card is a Spellcaster-Type monster, you can reveal it and draw 1 more card. You can only use these effects of "Azura the Esper of Hidden Power" once per turn each. *During either player's turn: you can send other 1 monster from your hand or your side of the field to the graveyard; choose 1 monster from either player's extra deck whose level/rank is equal or different by 1 to the sent monster's level/rank on the fieid. Until the End Phase, this card gains ATK equal to half that monster's ATK but battle damage it inflicts from direct attacks is halved and once during this turn it can activate that monster's effect as its effect. *You can activate this card's effect by detaching 1 less xyz material then required.

Note: magician Pendulum cards doesn't mean "magician pendulum monsters" it means they can be face-up anywhere on your field.

The bug I'm having is although the game seemingly knows when you can summon Azura based on the summoning circle icon on the extra deck, once you do you can dupe the game into summoning her with only 2 materials if you click them in a certain order.

For example I control gagaga magician at LV8, Dragon Pit Magician in the monster zone, and time-gazer magician (anime) in the P zone. I can legally summon Azura here, but only if I use gagaga magician as the level 7 or higher Spellcaster. However if I click Dragonpit magician first, I illegally summon Azura with just 2 materials after clicking time gazer.

Here is the script:

e1's functions are where the bug is


Here's the fixed function:
function c249000235.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c249000235.spfilter2,tp,LOCATION_MZONE,0,nil)
return (not c:IsFaceup()) and g:GetCount() > 0 and Duel.IsExistingMatchingCard(c249000235.spfilter1,tp,LOCATION_ONFIELD,0,2,nil,g:GetFirst())
function c249000235.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g1=Duel.GetMatchingGroup(c249000235.spfilter1,tp,LOCATION_ONFIELD,0,nil,nil)
local g2=Duel.GetMatchingGroup(c249000235.spfilter2,tp,LOCATION_MZONE,0,nil)
local m1=false
local m2=false
local m3=false
local mg=Group.CreateGroup()
local sg=Group.CreateGroup()
while not (m1 and m3 and m3) do
for i=1,3 do
local mcg=sg:Select(tp,1,1,nil)
local cc=mcg:GetFirst()
if cc:IsLocation(LOCATION_MZONE) and c249000235.spfilter2(cc) then m1=true
elseif cc:IsLocation(LOCATION_ONFIELD) and c249000235.spfilter1(cc,nil) and m2==false then m2=true
elseif cc:IsLocation(LOCATION_ONFIELD) and c249000235.spfilter1(cc,nil) then m3=true end
File Attachment(s):
c249000235.lua (8kb) downloaded 0 time(s).

You cannot view/download attachments. Try to login or register.