Commit 8fa9d4cc authored by 聖園ミカ's avatar 聖園ミカ 🐟

Replace c12847002.lua

parent d4fcb564
--星莲龙骑士-「红龙编年史」 --绝对毁灭的阎炮
local m=12847002 local s,id,o=GetID()
local cm=_G["c"..m] function s.initial_effect(c)
function cm.initial_effect(c) --Activate
c:EnableReviveLimit()
--spsummon condition
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_REMOVE+CATEGORY_TOGRAVE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--special summon rule --act in hand
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCost(s.cost)
e2:SetRange(LOCATION_EXTRA) e2:SetCondition(s.condition)
e2:SetCondition(cm.sprcon) e2:SetDescription(aux.Stringid(id,1))
e2:SetOperation(cm.sprop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e2)
--negate
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,1))
e4:SetCategory(CATEGORY_NEGATE+CATEGORY_POSITION+CATEGORY_ATKCHANGE)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_CHAINING)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_CANNOT_INACTIVATE)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCondition(cm.discon)
e4:SetTarget(cm.distg)
e4:SetOperation(cm.disop)
c:RegisterEffect(e4)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCategory(CATEGORY_DESTROY)
e3:SetCountLimit(1,m)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_MZONE)
e3:SetTarget(cm.target2)
e3:SetOperation(cm.operation2)
c:RegisterEffect(e3)
end
function cm.sprfilter(c)
return c:IsFaceup() and c:IsLevelAbove(8) and c:IsAbleToGraveAsCost() and c:IsRace(RACE_DRAGON)
end
function cm.sprfilter1(c,tp,g,sc)
local lv=c:GetLevel()
local atts=c:GetAttribute()
return g:IsExists(cm.sprfilter2,1,c,tp,c,sc,lv,atts)
end
function cm.sprfilter2(c,tp,mc,sc,lv,atts)
local sg=Group.FromCards(c,mc)
return c:IsLevel(lv) and not c:IsAttribute(atts)
and Duel.GetLocationCountFromEx(tp,tp,sg,sc)>0 and not c:IsOriginalCodeRule(mc:GetOriginalCodeRule())
end
function cm.sprcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(cm.sprfilter,tp,LOCATION_MZONE,0,nil)
return g:IsExists(cm.sprfilter1,1,nil,tp,g,c)
end end
function cm.sprop(e,tp,eg,ep,ev,re,r,rp,c) function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.sprfilter,tp,LOCATION_MZONE,0,nil) if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
local g1=g:FilterSelect(tp,cm.sprfilter1,1,1,nil,tp,g,c)
local mc=g1:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=g:FilterSelect(tp,cm.sprfilter2,1,1,mc,tp,mc,c,mc:GetLevel(),mc:GetAttribute())
g1:Merge(g2)
Duel.SendtoGrave(g1,REASON_COST)
end end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
function cm.discon(e,tp,eg,ep,ev,re,r,rp) return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetTurnPlayer()==tp
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) and bit.band(Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION),LOCATION_ONFIELD)~=0
end end
function cm.distg(e,tp,eg,ep,ev,re,r,rp,chk) function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil)
if re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_POSITION,eg,1,0,0) if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
Duel.SetChainLimit(aux.FALSE)
end end
end end
function cm.disop(e,tp,eg,ep,ev,re,r,rp) function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tc=re:GetHandler() local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil)
local res=0 if g:GetCount()>0 then
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) Duel.HintSelection(g)
and c:IsRelateToEffect(e) and c:IsFaceup() then local tc=g:GetFirst()
if tc:IsType(TYPE_MONSTER) then if Duel.Destroy(tc,REASON_EFFECT)==0 then
if Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE)==0 then Duel.Hint(HINT_CARD,0,id)
if Duel.Destroy(tc,REASON_EFFECT)==0 then res=1 end if Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)==0 then
end Duel.Hint(HINT_CARD,0,id)
else if Duel.SendtoGrave(tc,REASON_EFFECT)==0 then
tc:CancelToGrave() Duel.Hint(HINT_CARD,0,id)
if Duel.ChangePosition(tc,POS_FACEDOWN)==0 then Duel.SendtoGrave(tc,REASON_RULE,1-tp)
if Duel.Destroy(tc,REASON_EFFECT)==0 then res=1 end
end end
end end
if res==0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
c:RegisterEffect(e1)
end end
end end
end
function cm.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,0,1-tp,0)
end
function cm.operation2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_ONFIELD,nil)
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end end
\ No newline at end of file
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