Commit 703dad6a authored by POLYMER's avatar POLYMER

fix

parent ec7faa0f
No preview for this file type
No preview for this file type
--nezha, invader of dragon palace
--21.12.15
local m=11451419
local cm=_G["c"..m]
function cm.initial_effect(c)
c:SetUniqueOnField(1,1,m)
c:EnableReviveLimit()
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--special summon rule
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
e2:SetRange(LOCATION_EXTRA)
e2:SetTargetRange(POS_FACEUP_ATTACK,0)
e2:SetCondition(cm.rule)
c:RegisterEffect(e2)
--cannot be link material
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e3:SetValue(1)
c:RegisterEffect(e3)
--control
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,0))
e4:SetCategory(CATEGORY_DESTROY+CATEGORY_CONTROL)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(cm.condition)
e4:SetTarget(cm.target)
e4:SetOperation(cm.operation)
c:RegisterEffect(e4)
--must attack
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e5)
--cannotchange
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
c:RegisterEffect(e6)
--return
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(m,1))
e7:SetCategory(CATEGORY_TODECK)
e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e7:SetCode(EVENT_BATTLED)
e7:SetRange(LOCATION_MZONE)
e7:SetTarget(cm.target2)
e7:SetOperation(cm.operation2)
c:RegisterEffect(e7)
end
function cm.sprfilter(c)
return c:IsFaceup() and c:IsSetCard(0x6978) and c:IsType(TYPE_MONSTER)
end
function cm.rule(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and Duel.IsExistingMatchingCard(cm.sprfilter,0,LOCATION_MZONE,LOCATION_MZONE,1,nil)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.sprfilter,tp,LOCATION_MZONE,0,1,nil) and not Duel.IsExistingMatchingCard(cm.sprfilter,tp,0,LOCATION_MZONE,1,nil)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local c=e:GetHandler()
local g=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_DECK,0,1,1,nil,0x6978)
if #g>0 then Duel.Destroy(g,REASON_EFFECT) end
if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.GetControl(e:GetHandler(),1-tp) end
end
function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk)
local bc=e:GetHandler():GetBattleTarget()
if chk==0 then return Duel.GetAttackTarget()~=nil and bc:IsSetCard(0x6978) end
end
function cm.operation2(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoDeck(e:GetHandler(),nil,0,REASON_EFFECT)
end
\ No newline at end of file
......@@ -27,7 +27,7 @@ end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local tg=g:Select(tp,1,5,nil)
local tdc=Duel.SendtoDeck(tg,nil,2,REASON_EFFECT)
if tdc>=1 then
......@@ -45,7 +45,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
if tdc>=5 and Duel.GetMatchingGroup(s.thft,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil):GetCount()>1 then
local thg=Duel.GetMatchingGroup(s.thft,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=thg:Select(tp,1,5,nil)
local sg=thg:Select(tp,1,2,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
......
......@@ -32,30 +32,63 @@ function c9911391.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
if chk==0 then return true end
end
function c9911391.spfilter(c,e,tp)
return c:IsSetCard(0xc956) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c9911391.sgselect(g,tp)
local mg=Duel.GetMatchingGroup(Card.IsCanBeXyzMaterial,tp,LOCATION_MZONE,0,nil,nil)
mg:Merge(g)
return Duel.IsExistingMatchingCard(c9911391.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg)
end
function c9911391.xyzfilter(c,mg)
return c:IsSetCard(0xc956) and c:IsXyzSummonable(mg)
end
function c9911391.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c9911391.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
local ct=0
if Duel.GetDecktopGroup(tp,4):FilterCount(Card.IsAbleToRemoveAsCost,nil,POS_FACEDOWN)==4
and Duel.GetMZoneCount(tp)>=1 then ct=1 end
if Duel.GetDecktopGroup(tp,8):FilterCount(Card.IsAbleToRemoveAsCost,nil,POS_FACEDOWN)==8
and Duel.GetMZoneCount(tp)>=2 and not Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=2 end
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
return Duel.IsPlayerCanDraw(tp,1) and #g>=3
return ct>0 and Duel.IsPlayerCanSpecialSummonCount(tp,2) and g:CheckSubGroup(c9911391.sgselect,1,ct,tp)
end
local op=0
if Duel.IsPlayerCanDraw(tp,2) and #g>=6 then
if ct==1 or #g==1 then
op=Duel.SelectOption(tp,aux.Stringid(9911391,0))
elseif g:CheckSubGroup(c9911391.sgselect,1,1,tp) then
op=Duel.SelectOption(tp,aux.Stringid(9911391,0),aux.Stringid(9911391,1))
else
op=Duel.SelectOption(tp,aux.Stringid(9911391,0))
op=Duel.SelectOption(tp,aux.Stringid(9911391,1))+1
end
Duel.DisableShuffleCheck()
local rg=Duel.GetDecktopGroup(tp,4+op*4)
Duel.Remove(rg,POS_FACEDOWN,REASON_COST)
e:SetLabel(op+1)
Duel.SetTargetParam(op+1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,op+1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c9911391.activate(e,tp,eg,ep,ev,re,r,rp)
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
Duel.RegisterFlagEffect(tp,9911392,RESET_PHASE+PHASE_END,0,1)
end
local g=Duel.GetMatchingGroup(c9911391.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
local ct=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
if #g<ct or Duel.GetMZoneCount(tp)<ct then return end
if ct==2 and Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,c9911391.sgselect,false,1,ct,tp)
if not sg or #sg==0 or Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)==0 then return end
Duel.AdjustAll()
local xyzg=Duel.GetMatchingGroup(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,nil,nil)
if xyzg:GetCount()>0 then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
Duel.XyzSummon(tp,xyz,nil)
end
end
function c9911391.dtcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,9911392)==0
......@@ -65,9 +98,6 @@ function c9911391.dtcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return c:IsPreviousLocation(LOCATION_HAND+LOCATION_ONFIELD) and c:IsAbleToRemoveAsCost() end
Duel.Remove(c,POS_FACEUP,REASON_COST)
end
function c9911391.dtfilter(c)
return c:IsPublic() and c:IsDiscardable(REASON_EFFECT)
end
function c9911391.dttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckRemoveOverlayCard(tp,1,0,1,REASON_EFFECT) end
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