Commit e9452e66 authored by mercury233's avatar mercury233

add scripts WPP2

parent fc8f1439
--切り裂かれし闇
function c21862633.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21862633,0))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,21862633)
e2:SetCondition(c21862633.drcon)
e2:SetTarget(c21862633.drtg)
e2:SetOperation(c21862633.drop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--atk up
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(21862633,1))
e4:SetCategory(CATEGORY_ATKCHANGE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_ATTACK_ANNOUNCE)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,21862634)
e4:SetCondition(c21862633.atkcon)
e4:SetOperation(c21862633.atkop)
c:RegisterEffect(e4)
if not c21862633.global_check then
c21862633.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD)
ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE)
ge1:SetCode(EFFECT_MATERIAL_CHECK)
ge1:SetValue(c21862633.valcheck)
Duel.RegisterEffect(ge1,0)
end
end
function c21862633.valcheck(e,c)
local g=c:GetMaterial()
if g:IsExists(Card.IsType,1,nil,TYPE_NORMAL) then
c:RegisterFlagEffect(21862633,RESET_EVENT+0x4fe0000,0,1)
end
end
function c21862633.cfilter(c,tp)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsSummonPlayer(tp) and not c:IsType(TYPE_TOKEN)
end
function c21862633.drcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c21862633.cfilter,1,nil,tp)
end
function c21862633.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c21862633.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c21862633.atkcon(e,tp,eg,ep,ev,re,r,rp)
local a,at=Duel.GetBattleMonster(tp)
return a and at and (a:IsType(TYPE_NORMAL) and a:IsLevelAbove(5)
or a:GetFlagEffect(21862633)>0 and (a:IsSummonType(SUMMON_TYPE_RITUAL)
or a:IsSummonType(SUMMON_TYPE_FUSION)
or a:IsSummonType(SUMMON_TYPE_SYNCHRO)
or a:IsSummonType(SUMMON_TYPE_XYZ)))
end
function c21862633.atkop(e,tp,eg,ep,ev,re,r,rp)
local a,at=Duel.GetBattleMonster(tp)
if not a or not d or not a:IsRelateToBattle() or a:IsFacedown() or not at:IsRelateToBattle() or at:IsFacedown() then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetValue(at:GetAttack())
a:RegisterEffect(e1)
end
--真の光
function c62089826.initial_effect(c)
aux.AddCodeList(c,89631139)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--select effect
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(62089826,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMING_END_PHASE)
e2:SetCountLimit(1,62089826)
e2:SetTarget(c62089826.target)
e2:SetOperation(c62089826.operation)
c:RegisterEffect(e2)
--cannot be target
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(aux.TargetBoolFunction(Card.IsCode,89631139))
e3:SetValue(aux.tgoval)
c:RegisterEffect(e3)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(62089826,3))
e4:SetCategory(CATEGORY_TOGRAVE)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(c62089826.descon)
e4:SetTarget(c62089826.destg)
e4:SetOperation(c62089826.desop)
c:RegisterEffect(e4)
end
function c62089826.cfilter(c,code)
return c:IsCode(code) and (c:IsFaceup() or not c:IsOnField())
end
function c62089826.filter1(c,e,tp)
return c:IsCode(89631139) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c62089826.filter2(c,tp)
return aux.IsCodeListed(c,89631139) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable()
and not Duel.IsExistingMatchingCard(c62089826.cfilter,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,1,nil,c:GetCode())
end
function c62089826.target(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c62089826.filter1,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp)
local b2=Duel.IsExistingMatchingCard(c62089826.filter2,tp,LOCATION_DECK,0,1,nil,tp)
if chk==0 then return b1 or b2 end
local op=0
if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(62089826,1),aux.Stringid(62089826,2))
elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(62089826,1))
else
op=Duel.SelectOption(tp,aux.Stringid(62089826,2))+1
end
if op==0 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
else
e:SetCategory(0)
end
e:SetLabel(op)
end
function c62089826.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c62089826.filter1),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,c62089826.filter2,tp,LOCATION_DECK,0,1,1,nil,tp)
if g:GetCount()>0 then
Duel.SSet(tp,g:GetFirst())
end
end
end
function c62089826.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousSequence()<5
end
function c62089826.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function c62089826.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
--マジシャンズ・サルベーション
function c95477924.initial_effect(c)
aux.AddCodeList(c,46986414,38033121)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,95477924+EFFECT_COUNT_CODE_OATH)
e1:SetOperation(c95477924.activate)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(95477924,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,95477925)
e2:SetCondition(c95477924.spcon)
e2:SetTarget(c95477924.sptg)
e2:SetOperation(c95477924.spop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
function c95477924.setfilter(c)
return c:IsCode(48680970) and c:IsSSetable()
end
function c95477924.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c95477924.setfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(95477924,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local sg=g:Select(tp,1,1,nil)
Duel.SSet(tp,sg)
end
end
function c95477924.cfilter(c,tp)
return c:IsFaceup() and c:IsCode(46986414,38033121) and c:IsSummonPlayer(tp)
end
function c95477924.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c95477924.cfilter,1,nil,tp)
end
function c95477924.tgfilter(c,e,tp,g)
return g:IsContains(c) and Duel.IsExistingMatchingCard(c95477924.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetCode())
end
function c95477924.spfilter(c,e,tp,code)
return c:IsCode(46986414,38033121) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(code)
end
function c95477924.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=eg:Filter(c95477924.cfilter,nil,tp)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c95477924.tgfilter(chkc,e,tp,g) end
if chk==0 then return Duel.IsExistingTarget(c95477924.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e,tp,g)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
if g:GetCount()==1 then
Duel.SetTargetCard(g)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c95477924.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,e,tp,g)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c95477924.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
local code=tc:GetCode()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c95477924.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,code)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
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