Commit bf2d0b2d authored by salix5's avatar salix5

Merge pull request #14 from nekrozar/patch-4

new card YZ09
parents ecc9ccf1 948e49ef
--ガガガヘッド
function c67120578.initial_effect(c)
--summon with no tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(67120578,0))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c67120578.ntcon)
e1:SetOperation(c67120578.ntop)
c:RegisterEffect(e1)
--summon success
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(67120578,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetTarget(c67120578.sptg)
e2:SetOperation(c67120578.spop)
c:RegisterEffect(e2)
--effect gain
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCondition(c67120578.efcon)
e3:SetOperation(c67120578.efop)
c:RegisterEffect(e3)
end
function c67120578.ntcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
return minc==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0
and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
end
function c67120578.ntop(e,tp,eg,ep,ev,re,r,rp,c)
--change base attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetReset(RESET_EVENT+0xff0000)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(4)
c:RegisterEffect(e1)
end
function c67120578.spfilter(c,e,tp)
return c:IsSetCard(0x54) and not c:IsCode(67120578) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c67120578.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c67120578.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c67120578.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
local ct=math.min(2,Duel.GetLocationCount(tp,LOCATION_MZONE))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c67120578.spfilter,tp,LOCATION_GRAVE,0,1,ct,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,g:GetCount(),0,0)
end
function c67120578.spop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=tg:Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c67120578.splimtg)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetValue(1)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_END)
e2:SetTarget(c67120578.splimit)
Duel.RegisterEffect(e2,tp)
end
function c67120578.splimtg(e,c)
return not c:IsSetCard(0x54)
end
function c67120578.splimit(e,c,sump,sumtype,sumpos,targetp,se)
return sumtype~=SUMMON_TYPE_XYZ
end
function c67120578.efcon(e,tp,eg,ep,ev,re,r,rp)
return r==REASON_XYZ
end
function c67120578.efop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=c:GetReasonCard()
local e1=Effect.CreateEffect(rc)
e1:SetDescription(aux.Stringid(67120578,2))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c67120578.drcon)
e1:SetTarget(c67120578.drtg)
e1:SetOperation(c67120578.drop)
e1:SetReset(RESET_EVENT+0x1fe0000)
rc:RegisterEffect(e1,true)
if not rc:IsType(TYPE_EFFECT) then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_ADD_TYPE)
e2:SetValue(TYPE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
rc:RegisterEffect(e2,true)
end
end
function c67120578.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ
end
function c67120578.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c67120578.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
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