Commit a4f01c28 authored by POLYMER's avatar POLYMER

fix

parent 6e3ccd9d
......@@ -31,6 +31,45 @@ function cm.initial_effect(c)
e3:SetTarget(cm.sptg)
e3:SetOperation(cm.spop)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetCode(EFFECT_UPDATE_LEVEL)
e4:SetRange(LOCATION_MZONE)
e4:SetValue(cm.val)
c:RegisterEffect(e4)
if not cm.global_check then
cm.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetCondition(cm.checkcon)
ge1:SetOperation(cm.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function cm.checkfilter(c)
return aux.IsCodeListed(c,40020183) and c:IsType(TYPE_MONSTER) and not c:IsOriginalCodeRule(40020150)
end
function cm.checkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(cm.checkfilter,1,nil)
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cm.checkfilter,nil)
local tc=g:GetFirst()
while tc do
Duel.RegisterFlagEffect(tc:GetControler(),m,0,0,0)
tc=g:GetNext()
end
end
function cm.val(e,c)
local tp=c:GetControler()
local ct=Duel.GetFlagEffect(tp,m)
if ct>4 then
ct=4
end
return ct
end
function cm.thfilter(c)
return aux.IsCodeListed(c,40020183) and c:IsType(TYPE_MONSTER) and not c:IsCode(m) and c:IsAbleToHand()
......@@ -57,7 +96,8 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_COST) and re:IsActivated() and re:IsActiveType(TYPE_MONSTER) and not e:GetHandler():IsPublic()
return e:GetHandler():IsReason(REASON_EFFECT) and re:IsActiveType(TYPE_MONSTER) and not e:GetHandler():IsPublic() and e:GetHandler():IsPreviousPosition(POS_FACEUP)
and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......
......@@ -59,16 +59,15 @@ function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
if tc:IsFaceup() and tc:IsRelateToEffect(e) and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1400)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.BreakEffect()
local op=0
if (ft>0 or c:GetSequence()<5) and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,c) then
......@@ -86,7 +85,7 @@ function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (c==Duel.GetAttacker() or c==Duel.GetAttackTarget())
end
function cm.thfilter(c)
function cm.thfilter1(c)
return aux.IsCodeListed(c,40020183) and c:IsType(TYPE_SPELL+TYPE_TRAP) and not c:IsCode(m) and c:IsAbleToHand()
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -98,9 +97,9 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetDecktopGroup(tp,5)
if g:GetCount()>0 then
Duel.DisableShuffleCheck()
if g:IsExists(cm.thfilter,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,4)) then
if g:IsExists(cm.thfilter1,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,4)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:FilterSelect(tp,cm.thfilter,1,1,nil)
local sg=g:FilterSelect(tp,cm.thfilter1,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
......
......@@ -65,17 +65,16 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 then
local tg=g:GetMinGroup(Card.GetAttack)
if tg:GetCount()>1 then
if tg:GetCount()>1 and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local sg=tg:Select(tp,1,1,nil)
Duel.HintSelection(sg)
Duel.Destroy(sg,REASON_EFFECT)
else Duel.Destroy(tg,REASON_EFFECT) end
end
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.BreakEffect()
local op=0
if (ft>0 or c:GetSequence()<5) and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,c) then
......
......@@ -69,6 +69,7 @@ end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.BreakEffect()
......
--假面骑士 空我/升华天马
local m=40020160
local cm=_G["c"..m]
function cm.initial_effect(c)
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,40020183)
--change name
aux.EnableChangeCode(c,40020183,LOCATION_MZONE)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,m)
e1:SetCost(cm.descost)
e1:SetTarget(cm.destg)
e1:SetOperation(cm.desop)
e1:SetCountLimit(1,id)
e1:SetCost(s.descost)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetCondition(cm.descon)
e2:SetCondition(s.descon)
c:RegisterEffect(e2)
--negate spell
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(m,3))
e5:SetDescription(aux.Stringid(id,3))
e5:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCode(EVENT_CHAINING)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1,m+1)
e5:SetCondition(cm.negcon)
e5:SetTarget(cm.negtg)
e5:SetOperation(cm.negop)
e5:SetCountLimit(1)
e5:SetCondition(s.negcon)
e5:SetTarget(s.negtg)
e5:SetOperation(s.negop)
c:RegisterEffect(e5)
if not cm.global_check then
cm.global_check=true
if not s.global_check then
s.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(cm.checkop)
ge1:SetOperation(s.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
if tc:GetReasonEffect() and tc:GetReasonEffect():IsHasType(EFFECT_TYPE_ACTIONS) and aux.IsCodeListed(tc:GetReasonEffect():GetHandler(),40020183) then
tc:RegisterFlagEffect(40020183,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,4))
tc:RegisterFlagEffect(40020183,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,4))
end
tc=eg:GetNext()
end
end
function cm.fselect(g,tp,sc)
function s.fselect(g,tp,sc)
local atk=0
local matk=0
local tc=g:GetFirst()
......@@ -66,24 +65,24 @@ function cm.fselect(g,tp,sc)
end
return matk>=2600
end
function cm.costfilter(c,tp)
function s.costfilter(c,tp)
return aux.IsCodeListed(c,40020183) and c:IsAbleToRemoveAsCost()
end
function cm.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.costfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,e:GetHandler(),tp) end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,e:GetHandler(),tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,cm.costfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,e:GetHandler(),tp)
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,e:GetHandler(),tp)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function cm.desfilter(c)
function s.desfilter(c)
return c:IsType(TYPE_MONSTER) and not c:IsAttack(0) and c:IsFaceup()
end
function cm.thfilter(c,e,tp,ec)
return c:IsCode(40020183) and c:IsLevelAbove(5) and c:IsAbleToHand() and ec:IsCanBeSpecialSummoned(e,0,tp,false,false)
function s.thfilter(c,e,tp,ec,ft)
return (ft>0 or c:GetSequence()<5) and c:IsCode(40020183) and c:IsLevelAbove(5) and c:IsAbleToHand() and ec:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and cm.desfilter(chkc) end
local mg=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil)
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and s.desfilter(chkc) end
local mg=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil)
if chk==0 then
local mgck=0
local tc=mg:GetFirst()
......@@ -98,11 +97,11 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
return mgck==1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=mg:SelectSubGroup(tp,cm.fselect,false,1,99,tp,c)
local g=mg:SelectSubGroup(tp,s.fselect,false,1,99,tp,c)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
......@@ -110,33 +109,33 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if tg:GetCount()>0 and Duel.Destroy(tg,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.BreakEffect()
local op=0
if (ft>0 or c:GetSequence()<5) and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,c) then
op=Duel.SelectOption(tp,aux.Stringid(m,1),aux.Stringid(m,2))
if Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,c,ft) then
op=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))
end
if op==0 then Duel.SendtoGrave(c,REASON_DISCARD) end
if op==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local thc=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),e,tp,c):GetFirst()
local thc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),e,tp,c):GetFirst()
if thc and Duel.SendtoHand(thc,nil,REASON_EFFECT)~=0 then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end
end
end
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and ep~=tp
end
function cm.negcon(e,tp,eg,ep,ev,re,r,rp)
function s.negcon(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or e:GetHandler():GetFlagEffect(40020183)==0 then return false end
return ep~=tp and re:IsActiveType(TYPE_SPELL) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
end
function cm.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function cm.negop(e,tp,eg,ep,ev,re,r,rp)
function s.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
......
......@@ -77,6 +77,7 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.BreakEffect()
......
......@@ -104,6 +104,7 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
......@@ -137,6 +138,7 @@ function cm.descon(e,tp,eg,ep,ev,re,r,rp)
end
function cm.negcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or e:GetHandler():GetFlagEffect(40020183)==0 then return false end
return Duel.IsChainNegatable(ev) and not c:IsStatus(STATUS_BATTLE_DESTROYED)
and re:GetHandler()~=c and re:IsActiveType(TYPE_MONSTER)
......
......@@ -66,6 +66,7 @@ function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local g=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil)
if Duel.Destroy(g,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
Duel.BreakEffect()
......@@ -88,14 +89,14 @@ function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (c==Duel.GetAttacker() or c==Duel.GetAttackTarget())
end
function cm.thfilter(c)
function cm.thfilter1(c)
return c:IsFaceupEx() and aux.IsCodeListed(c,40020183) and c:IsAbleToHand() and not c:IsCode(m)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and cm.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and cm.thfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(cm.thfilter1,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
local g=Duel.SelectTarget(tp,cm.thfilter1,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -80,6 +80,7 @@ function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function cm.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.NegateSummon(eg)
Duel.Destroy(eg,REASON_EFFECT)
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_HAND) then
......@@ -111,7 +112,7 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if #g>0 then
Duel.HintSelection(g)
Duel.Destroy(g,REASON_EFFECT)
if e:GetHandler():GetFlagEffect(40020183)==0 then
if e:GetHandler():GetFlagEffect(40020183)>0 then
Duel.BreakEffect()
Duel.SetLP(1-tp,math.ceil(Duel.GetLP(1-tp)/2))
end
......
......@@ -140,8 +140,8 @@ function s.geop(e,tp,eg,ep,ev,re,r,rp)
s[0]=Duel.CreateToken(0,id)
s[1]=Duel.CreateToken(1,id)
if KOISHI_CHECK then
s[0]:SetCardData(CARDDATA_TYPE,TYPE_QUICKPLAY+TYPE_SPELL)
s[1]:SetCardData(CARDDATA_TYPE,TYPE_QUICKPLAY+TYPE_SPELL)
s[0]:SetCardData(CARDDATA_TYPE,TYPE_TRAP)
s[1]:SetCardData(CARDDATA_TYPE,TYPE_TRAP)
end
e:Reset()
end
......@@ -222,7 +222,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if Duel.GetTurnPlayer()==tp then
if chk==0 then return
--Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) and
Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp) end
e:SetCategory(CATEGORY_SEARCH+CATEGORY_TOGRAVE)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
......
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