Commit fc2cba7e authored by POLYMER's avatar POLYMER

fix

parent 2f6e9ef4
......@@ -102,7 +102,7 @@ function cm.nnfilter(c,ec)
return false
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
--[[local ag=Duel.GetMatchingGroup(cm.nnfilter,0,0xff,0xff,nil)
local ag=Duel.GetMatchingGroup(cm.nnfilter,0,0xff,0xff,nil)
local _TGetID=GetID
for ac in aux.Next(ag) do
local int=ac:GetOriginalCode()
......@@ -117,7 +117,7 @@ function cm.op(e,tp,eg,ep,ev,re,r,rp)
local ini=ac.initial_effect
if ini then ac.initial_effect(ac) end
end
GetID=_TGetID--]]
GetID=_TGetID
local c=e:GetHandler()
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil)
......
......@@ -148,7 +148,7 @@ function cm.initial_effect(c)
--Duel.SetFlagEffectLabel(sp,m,ct+1)
cm[sp]=cm[sp]+1
local tg=ng:RandomSelect(sp,1)
if tg:GetFirst():IsLocation(LOCATION_DECK+LOCATION_EXTRA) then Duel.ConfirmCards(sp,tg) end
if tg:GetFirst() and tg:GetFirst():IsLocation(LOCATION_DECK+LOCATION_EXTRA) then Duel.ConfirmCards(sp,tg) end
return tg
else
return _Select(g,sp,min,max,nc)
......@@ -401,4 +401,3 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if #ng1>0 then Duel.ConfirmCards(1-tp,ng1) end
if #ng2>0 then Duel.ConfirmCards(tp,ng2) end
end
\ No newline at end of file
pcall(dofile,"expansions/script/c11410000.lua")
\ No newline at end of file
......@@ -42,7 +42,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
local tc=g:GetFirst()
if tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (not tc:IsSSetable() or Duel.SelectYesNo(tp,Stringid(m,0))) then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
else
Duel.SSet(tp,tc)
end
......
......@@ -70,7 +70,7 @@ end
function c22348314.mfilter(c,fc)
return c:IsReason(REASON_DESTROY) and c:IsLocation(LOCATION_GRAVE)
return c:IsReason(REASON_DESTROY) and c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_MONSTER)
end
function c22348314.egfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT)
......
......@@ -37,6 +37,7 @@ function cm.initial_effect(c)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET)
e4:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCondition(c22348330.discon)
e4:SetTarget(c22348330.distg)
e4:SetOperation(c22348330.disop)
......
......@@ -31,7 +31,7 @@ end
function s.actarget(e,te,tp)
local tc=te:GetHandler()
e:SetLabelObject(te)
return tc:IsPosition(POS_FACEDOWN) and tc:IsLocation(LOCATION_MZONE) and te:GetValue()==id
return (te:GetValue()==id or te:GetValue()==id+1) and tc and tc:IsPosition(POS_FACEDOWN) and tc:IsLocation(LOCATION_MZONE)
end
function s.costop(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
......@@ -50,9 +50,9 @@ function s.setfilter(c,e,tp)
and c:IsSSetable()))
end
function s.setfilter2(c,e,tp,type)
return c:IsType(type) and (c:IsType(TYPE_MONSTER) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
return c:IsType(type) and ((c:IsType(TYPE_MONSTER) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE,tp)) or ((c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0)
and c:IsSSetable())
and c:IsSSetable()))
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
......@@ -92,10 +92,12 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
tc=sg:GetNext()
end
end
Duel.ResetFlagEffect(0,id)
local mg=tg:Filter(Card.IsType,nil,TYPE_MONSTER)
if #mg>0 then
local tc=mg:GetFirst()
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
--Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
local cregister=Card.RegisterEffect
Card.RegisterEffect=function(card,effect,flag)
if effect and (effect:IsHasType(EFFECT_TYPE_IGNITION) or effect:IsHasType(EFFECT_TYPE_TRIGGER_F) or effect:IsHasType(EFFECT_TYPE_TRIGGER_O) or effect:IsHasType(EFFECT_TYPE_QUICK_F) or effect:IsHasType(EFFECT_TYPE_QUICK_O)) then
......@@ -104,21 +106,46 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
if effect:IsHasType(EFFECT_TYPE_TRIGGER_O) then
effect:SetType(EFFECT_TYPE_QUICK_O)
effect:SetRange(LOCATION_MZONE)
local con=effect:GetCondition()
effect:SetCondition(
function(e,tp,eg,ep,ev,re,r,rp)
if not eg:IsContains(e:GetHandler()) then return false end
return not con or con(e,tp,eg,ep,ev,re,r,rp)
end)
end
if effect:IsHasType(EFFECT_TYPE_TRIGGER_F) then
effect:SetType(EFFECT_TYPE_QUICK_F)
effect:SetRange(LOCATION_MZONE)
local con=effect:GetCondition()
effect:SetCondition(
function(e,tp,eg,ep,ev,re,r,rp)
if not eg:IsContains(e:GetHandler()) then return false end
return not con or con(e,tp,eg,ep,ev,re,r,rp)
end)
end
--
prop=prop&(~EFFECT_FLAG_DELAY)
--if bit.band(prop,EFFECT_FLAG_DELAY)==EFFECT_FLAG_DELAY then
-- prop=bit.bxor(prop,EFFECT_FLAG_DELAY)
--end
prop=prop|EFFECT_FLAG_SET_AVAILABLE
--if bit.band(prop,EFFECT_FLAG_SET_AVAILABLE)==0 then
-- prop=prop+EFFECT_FLAG_SET_AVAILABLE
--end
--prop=prop&(~EFFECT_FLAG_DELAY)
if bit.band(prop,EFFECT_FLAG_DELAY)==EFFECT_FLAG_DELAY then
prop=bit.bxor(prop,EFFECT_FLAG_DELAY)
if Duel.GetFlagEffect(0,id)==0 then
Duel.RegisterFlagEffect(0,id,0,0,1)
--raise event
local e3=Effect.CreateEffect(card)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EVENT_CHAIN_END)
e3:SetLabelObject(card)
e3:SetOperation(s.op)
Duel.RegisterEffect(e3,card:GetControler())
end
end
--prop=prop|EFFECT_FLAG_SET_AVAILABLE
if bit.band(prop,EFFECT_FLAG_SET_AVAILABLE)==0 then
prop=prop+EFFECT_FLAG_SET_AVAILABLE
end
effect:SetProperty(prop)
--Debug.Message(effect:GetType())
--Debug.Message(effect:GetProperty())
--Debug.Message("--------")
effect:SetValue(id)
end
return cregister(card,effect,flag)
......@@ -198,12 +225,12 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
end
end]]
--
local type=0
if tg:FilterCount(Card.IsType,nil,TYPE_MONSTER)>0 then type=type+TYPE_MONSTER end
if tg:FilterCount(Card.IsType,nil,TYPE_SPELL)>0 then type=type+TYPE_SPELL end
if tg:FilterCount(Card.IsType,nil,TYPE_TRAP)>0 then type=type+TYPE_TRAP end
local stype=0
if tg:FilterCount(Card.IsType,nil,TYPE_MONSTER)>0 then stype=stype|TYPE_MONSTER end
if tg:FilterCount(Card.IsType,nil,TYPE_SPELL)>0 then stype=stype|TYPE_SPELL end
if tg:FilterCount(Card.IsType,nil,TYPE_TRAP)>0 then stype=stype|TYPE_TRAP end
local mft2,sft2=Duel.GetLocationCount(1-tp,LOCATION_MZONE),Duel.GetLocationCount(1-tp,LOCATION_SZONE)
local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.setfilter2),1-tp,LOCATION_GRAVE,0,nil,e,1-tp,type)
local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.setfilter2),1-tp,LOCATION_GRAVE,0,nil,e,1-tp,stype)
if #g2<=0 or not Duel.SelectYesNo(1-tp,aux.Stringid(id,2)) then return end
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SET)
local tg2=g2:SelectSubGroup(1-tp,s.gcheck,false,1,3,math.min(tg:FilterCount(Card.IsType,nil,TYPE_MONSTER),mft2),sft2,tg:FilterCount(Card.IsType,nil,TYPE_SPELL),tg:FilterCount(Card.IsType,nil,TYPE_TRAP))
......@@ -228,7 +255,8 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
local mg2=tg2:Filter(Card.IsType,nil,TYPE_MONSTER)
if #mg2>0 then
local tc=mg2:GetFirst()
Duel.SpecialSummonStep(tc,0,1-tp,1-tp,false,false,POS_FACEDOWN_DEFENSE)
--Duel.SpecialSummonStep(tc,0,1-tp,1-tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.SpecialSummon(tc,0,1-tp,1-tp,false,false,POS_FACEDOWN_DEFENSE)
if tc:IsSetCard(0x2e) then
local cregister=Card.RegisterEffect
Card.RegisterEffect=function(card,effect,flag)
......@@ -238,14 +266,36 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
if effect:IsHasType(EFFECT_TYPE_TRIGGER_O) then
effect:SetType(EFFECT_TYPE_QUICK_O)
effect:SetRange(LOCATION_MZONE)
local con=effect:GetCondition()
effect:SetCondition(
function(e,tp,eg,ep,ev,re,r,rp)
if not eg:IsContains(e:GetHandler()) then return false end
return not con or con(e,tp,eg,ep,ev,re,r,rp)
end)
end
if effect:IsHasType(EFFECT_TYPE_TRIGGER_F) then
effect:SetType(EFFECT_TYPE_QUICK_F)
effect:SetRange(LOCATION_MZONE)
local con=effect:GetCondition()
effect:SetCondition(
function(e,tp,eg,ep,ev,re,r,rp)
if not eg:IsContains(e:GetHandler()) then return false end
return not con or con(e,tp,eg,ep,ev,re,r,rp)
end)
end
--
if bit.band(prop,EFFECT_FLAG_DELAY)==EFFECT_FLAG_DELAY then
prop=bit.bxor(prop,EFFECT_FLAG_DELAY)
if Duel.GetFlagEffect(0,id)==0 then
Duel.RegisterFlagEffect(0,id,0,0,1)
--raise event
local e3=Effect.CreateEffect(card)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EVENT_CHAIN_END)
e3:SetLabelObject(card)
e3:SetOperation(s.op)
Duel.RegisterEffect(e3,card:GetControler())
end
end
if bit.band(prop,EFFECT_FLAG_SET_AVAILABLE)==0 then
prop=prop+EFFECT_FLAG_SET_AVAILABLE
......@@ -268,7 +318,7 @@ function s.setop(e,tp,eg,ep,ev,re,r,rp)
e2:SetOperation(s.rstop)
tc:RegisterEffect(e2)
end
Duel.SpecialSummonComplete()
--Duel.SpecialSummonComplete()
Duel.ConfirmCards(1-tp,tc)
end
end
......@@ -279,3 +329,61 @@ function s.rstop(e,tp,eg,ep,ev,re,r,rp)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
e:Reset()
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
Debug.Message("0")
local c=e:GetLabelObject()
Duel.RaiseEvent(c,EVENT_SPSUMMON_SUCCESS,e,REASON_EFFECT,e:GetHandlerPlayer(),0,0)
--[[
--reset&RaiseSingleEvent
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e2:SetTargetRange(1,1)
e2:SetTarget(s.actarget2)
e2:SetOperation(s.costop2)
Duel.RegisterEffect(e2,0)
--reset
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_ADJUST)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetOperation(s.rstop2)
Duel.RegisterEffect(e1,c:GetControler())
--
e1:SetLabelObject(e2)
e2:SetLabelObject(e1)]]
e:Reset()
end
function s.rstop2(e,tp,eg,ep,ev,re,r,rp)
Debug.Message("1")
if e:GetLabel()~=1 then e:SetLabel(1) return end
e:GetLabelObject():Reset()
e:Reset()
end
function s.actarget2(e,te,tp)
if not te then return end
return te:IsHasType(EFFECT_TYPE_TRIGGER_O) or te:IsHasType(EFFECT_TYPE_TRIGGER_F)
end
function s.costop2(e,tp,eg,ep,ev,re,r,rp)
local c=re:GetOwner()
Duel.RaiseEvent(c,EVENT_SPSUMMON_SUCCESS,e,REASON_EFFECT,e:GetHandlerPlayer(),0,0)
--reset&RaiseSingleEvent
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE)
e2:SetTargetRange(1,1)
e2:SetReset(RESET_CHAIN)
e2:SetTarget(s.actarget2)
e2:SetOperation(s.costop3)
Duel.RegisterEffect(e2,c:GetControler())
--
Debug.Message("2")
e:GetLabelObject():Reset()
e:Reset()
end
function s.costop3(e,tp,eg,ep,ev,re,r,rp)
local c=re:GetOwner()
Duel.RaiseSingleEvent(c,EVENT_SPSUMMON_SUCCESS,e,REASON_EFFECT,e:GetHandlerPlayer(),0,0)
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