Commit f145f0ce authored by IamIpanda's avatar IamIpanda

Add pico

parent cc12bf67
Pipeline #41979 passed with stages
in 58 seconds
......@@ -2,3 +2,6 @@
ygopro-scripts-define
.gitignore
.gitmodules
script-merged
script-merged/*
pics/
--明夕何夕
local s,id,o=GetID()
function s.initial_effect(c,setid)
-- move
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(s.movtg)
e1:SetOperation(s.movop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1)
e2:SetCost(s.thcost)
e2:SetTarget(s.thtg(setid))
e2:SetOperation(s.thop(setid))
c:RegisterEffect(e2)
-- force equip
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_EQUIP)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(s.eqcon)
e3:SetTarget(s.eqtg)
e3:SetOperation(s.eqop)
c:RegisterEffect(e3)
-- no target
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e4:SetValue(aux.indoval)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e5:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e5:SetValue(aux.tgoval)
c:RegisterEffect(e5)
end
function s.filter(c)
return c:IsSetCard(0x150) or c:IsCode(86120751) or c:IsCode(97973962)
end
function s.movtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsOnField() and s.filter(c) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,nil)
end
function s.movop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetFirstTarget()
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local te0=Effect.CreateEffect(c)
te0:SetCode(EFFECT_CHANGE_TYPE)
te0:SetType(EFFECT_TYPE_SINGLE)
te0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
te0:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
te0:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(te0)
-- guess set id
local tcc=tc:GetCode()
local setid=nil
if tcc==9505425 or tcc==35877582 then setid=0xf4 -- 召唤兽
elseif tcc==86120751 or tcc==97973962 then setid=0x6e -- 魔导
elseif tcc==72498838 or tcc==8660395 then setid=0x128 -- 魔女术
elseif tcc==9482987 or tcc==34755994 then setid=0x12a -- 恩底
elseif tcc==36099130 or tcc==61272280 then setid=nil -- 绝火
end
-- gain effect
s.initial_effect(tc,setid)
end
function s.thfilter(c)
return c:IsDiscardable() and c:IsRace(RACE_SPELLCASTER)
end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,s.desfilter,1,1,REASON_COST+REASON_DISCARD)
end
function s.thfilter(setid)
return function(c,e,tp)
return c:IsSetCard(setid) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
end
function s.thfilter2(setid)
return function(c)
return c:IsSetCard(setid) and c:IsType(TYPE_SPELL)
end
end
function s.thtg(setid)
return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter(setid),tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
end
function s.thop(setid)
return function(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.thfilter(setid),tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
if not e:GetHandler():IsSummonableCard() then
local tg=Duel.GetMatchingGroup(s.thfilter2(setid),tp,LOCATION_DECK,0,nil)
if #tg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
local tc2=tg:Select(tp,1,1):GetFirst()
Duel.SSet(tp,tc2)
end
end
end
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
end
-- 纠罪巧 色孽
local s,id,o=GetID()
function s.initial_effect(c)
aux.EnablePendulumAttribute(c,false)
c:RegisterFlagEffect(1314,0,0,1)
-- Activate
local e1=Effect.CreateEffect(c)
e1:SetHintTiming(TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE,TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE+TIMING_MAIN_END+TIMING_BATTLE_START+TIMING_ATTACK+TIMING_BATTLE_END+TIMING_END_PHASE)
e1:SetRange(LOCATION_PZONE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(0,EFFECT_FLAG2_COF)
e1:SetCondition(s.accon)
e1:SetCost(s.accost)
e1:SetTarget(s.actg)
e1:SetOperation(s.acop)
c:RegisterEffect(e1)
-- Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(1153)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.setcon)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
-- Force draw 3
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetType(EFFECT_TYPE_QUICK_F)
e3:SetCode(EVENT_CHAINING)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e3:SetRange(LOCATION_PZONE)
e3:SetCondition(s.collectcon)
e3:SetCost(s.collectcost)
e3:SetOperation(s.collectop)
c:RegisterEffect(e3)
-- Equip
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_EQUIP)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_HAND)
e4:SetCondition(s.eqcon)
e4:SetCost(s.eqcost)
e4:SetOperation(s.eqop)
c:RegisterEffect(e4)
-- Link
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,2))
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetCode(EVENT_FLIP)
e5:SetRange(LOCATION_MZONE)
e5:SetCost(s.lkcost)
e5:SetOperation(s.lkop)
e4:SetLabelObject(e5)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEDOWN,true)
c:RegisterFlagEffect(1153,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function s.accon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(1153)==0
end
function s.accost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,900) end
Duel.PayLPCost(tp,900)
end
function s.acfilter(c)
return not c:IsPosition(POS_FACEUP_DEFENSE) and c:IsCanChangePosition()
end
function s.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(s.acfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(s.acfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function s.acop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.acfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()>0 then
Duel.ChangePosition(g,POS_FACEUP_DEFENSE)
end
end
function s.collectcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return rc:IsSetCard(0x1d4) and rc:IsLocation(LOCATION_PZONE) and
ep==tp and re:GetCategory()==CATEGORY_SEARCH+CATEGORY_TOHAND
end
function s.collectcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,900) end
Duel.PayLPCost(tp,900)
end
function s.collectop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeChainOperation(ev,s.collectop2)
end
function s.collectfilter(c)
return c:IsSetCard(0x1d4) and c:IsAbleToHand()
end
function s.collectop2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.collectfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>=3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,3,3,nil)
Duel.ConfirmCards(1-tp,sg)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
function s.eqfilter(c)
return c:IsFaceup() and c:IsSetCard(0x1d4) and c:IsType(TYPE_MONSTER) and c:IsLevelBelow(9)
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
return (not e:GetHandler():IsPublic()) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
c:RegisterEffect(e1)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local tc=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc and Duel.Equip(tp,c,tc,true) then
-- equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(function(e,c) return e:GetLabelObject()==c end)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
-- leave field
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_REDIRECT)
e2:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e2)
-- gain effect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(c.eftg)
e3:SetLabelObject(e:GetLabelObject())
c:RegisterEffect(e3)
-- change level
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_CHANGE_LEVEL)
e4:SetValue(6)
c:RegisterEffect(e4)
end
end
function s.eftg(e,c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x1d4) and c:GetEquipGroup():IsContains(e:GetHandler())
end
function s.lkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,LOCATION_ONFIELD,0,0x71,1,REASON_COST) end
Duel.RemoveCounter(tp,LOCATION_ONFIELD,0,0x71,1,REASON_COST)
end
function s.lkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local mg=Duel.GetMatchingGroup(aux.LConditionFilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,nil,nil,e)
local g=Duel.GetMatchingGroup(Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,nil,mg,c)
if g:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.LinkSummon(tp,sg:GetFirst(),mg,c)
end
end
if not Auxiliary.PendulumPatched then
-- After set, ygopro will treat it as a normal pendulum scale with position = POS_FACEDOWN
-- that will make player can pendulum summon even if it's set. This code check if scale is facedown.
Auxiliary.originPendCondition = Auxiliary.PendCondition
function Auxiliary.PendCondition(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
if rpz==nil or c==rpz then return false end
if Card.IsPosition(c,POS_FACEDOWN) or Card.IsPosition(rpz,POS_FACEDOWN) then return false end
return Auxiliary.originPendCondition(e,c,og)
end
-- ygocore will directly return TYPE_PENDULUM + TYPE_SPELL if a card is in PZONE
-- no matther what effect you register on it. so we have to hook it inner lua.
Card.originGetType = Card.GetType
Card.originIsType = Card.IsType
function Card.GetType(c)
if c:GetFlagEffect(1314)>0 and c:IsLocation(LOCATION_PZONE) then return TYPE_PENDULUM+TYPE_TRAP end
return Card.originGetType(c)
end
-- It's the same as real Card.IsType, but calls inner ygocore won't be hooked by previous definition.
-- So we have to hook it.
function Card.IsType(c,t)
return c:GetType()&t>0
end
-- I skip the material type check here. If you need it you can mask it in another block.
Auxiliary.PendulumPatched = true
end
-- 纠罪巧 纳垢
local s,id,o=GetID()
local token_id=172016325
function s.initial_effect(c)
aux.EnablePendulumAttribute(c,false)
c:RegisterFlagEffect(1314,0,0,1)
-- Activate
local e1=Effect.CreateEffect(c)
e1:SetHintTiming(TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE,TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE+TIMING_MAIN_END+TIMING_BATTLE_START+TIMING_ATTACK+TIMING_BATTLE_END+TIMING_END_PHASE)
e1:SetRange(LOCATION_PZONE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(0,EFFECT_FLAG2_COF)
e1:SetCondition(s.accon)
e1:SetCost(s.accost)
e1:SetOperation(s.acop)
c:RegisterEffect(e1)
-- Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(1153)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.setcon)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
-- Force special summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetType(EFFECT_TYPE_QUICK_F)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e3:SetRange(LOCATION_PZONE)
e3:SetCondition(s.spcon)
e3:SetCost(s.spcost)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
-- Equip
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_EQUIP)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_HAND)
e4:SetCondition(s.eqcon)
e4:SetCost(s.eqcost)
e4:SetOperation(s.eqop)
c:RegisterEffect(e4)
-- Link
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,2))
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetCode(EVENT_FLIP)
e5:SetRange(LOCATION_MZONE)
e5:SetCost(s.sscost)
e5:SetOperation(s.ssop)
e4:SetLabelObject(e5)
end
function s.accon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(1153)==0
end
function s.accost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,900) end
Duel.PayLPCost(tp,900)
end
function s.acfilter(e,c)
return c:IsType(TYPE_MONSTER)
end
function s.acop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
-- indestructable battle
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e1:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_MONSTER))
e1:SetValue(1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
-- immune effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetTarget(s.acfilter)
e2:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e2:SetValue(1)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEDOWN,true)
c:RegisterFlagEffect(1153,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return re~=e
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,900) end
Duel.PayLPCost(tp,900)
end
function s.spfilter(c,tp)
return c:IsSetCard(0x1d4) and c:IsControler(tp)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Group.FilterCount(eg,s.spfilter,nil,tp)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
for c in aux.Next(Group.Filter(eg,Card.IsSetCard,nil,0x1d4)) do
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(Card.IsCode),tp,LOCATION_DECK+LOCATION_HAND+LOCATION_GRAVE,0,nil,c:GetCode())
local ft=#g
local lt=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft>lt then ft=lt end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
if ft>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,ft,ft,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
if c:IsPosition(POS_FACEDOWN) then
Duel.ConfirmCards(1-tp,c)
end
end
end
end
function s.eqfilter(c)
return c:IsFaceup() and c:IsSetCard(0x1d4) and c:IsType(TYPE_MONSTER) and c:IsLevelBelow(9)
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
return (not e:GetHandler():IsPublic()) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
c:RegisterEffect(e1)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local tc=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc and Duel.Equip(tp,c,tc,true) then
-- equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(function(e,c) return e:GetLabelObject()==c end)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
-- leave field
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_REDIRECT)
e2:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e2)
-- gain effect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(c.eftg)
e3:SetLabelObject(e:GetLabelObject())
c:RegisterEffect(e3)
-- change level
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_CHANGE_LEVEL)
e4:SetValue(7)
c:RegisterEffect(e4)
end
end
function s.eftg(e,c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x1d4) and c:GetEquipGroup():IsContains(e:GetHandler())
end
function s.sscost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,LOCATION_ONFIELD,0,0x71,1,REASON_COST) end
Duel.RemoveCounter(tp,LOCATION_ONFIELD,0,0x71,1,REASON_COST)
end
function s.ssop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,token_id,0,TYPES_TOKEN_MONSTER,2000,2000,1,RACE_FIEND,ATTRIBUTE_DARK) then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local fid=e:GetHandler():GetFieldID()
local g=Group.CreateGroup()
for i=1,ft do
local token=Duel.CreateToken(tp,token_id)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
g:AddCard(token)
end
Duel.SpecialSummonComplete()
end
if not Auxiliary.PendulumPatched then
-- After set, ygopro will treat it as a normal pendulum scale with position = POS_FACEDOWN
-- that will make player can pendulum summon even if it's set. This code check if scale is facedown.
Auxiliary.originPendCondition = Auxiliary.PendCondition
function Auxiliary.PendCondition(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
if rpz==nil or c==rpz then return false end
if Card.IsPosition(c,POS_FACEDOWN) or Card.IsPosition(rpz,POS_FACEDOWN) then return false end
return Auxiliary.originPendCondition(e,c,og)
end
-- ygocore will directly return TYPE_PENDULUM + TYPE_SPELL if a card is in PZONE
-- no matther what effect you register on it. so we have to hook it inner lua.
Card.originGetType = Card.GetType
Card.originIsType = Card.IsType
function Card.GetType(c)
if c:GetFlagEffect(1314)>0 and c:IsLocation(LOCATION_PZONE) then return TYPE_PENDULUM+TYPE_TRAP end
return Card.originGetType(c)
end
-- It's the same as real Card.IsType, but calls inner ygocore won't be hooked by previous definition.
-- So we have to hook it.
function Card.IsType(c,t)
return c:GetType()&t>0
end
-- I skip the material type check here. If you need it you can mask it in another block.
Auxiliary.PendulumPatched = true
end
-- 纠罪巧 恐虐
local s,id,o=GetID()
function s.initial_effect(c)
aux.EnablePendulumAttribute(c,false)
c:RegisterFlagEffect(1314,0,0,1)
-- Activate
local e1=Effect.CreateEffect(c)
e1:SetHintTiming(TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE,TIMING_DRAW_PHASE+TIMING_STANDBY_PHASE+TIMING_MAIN_END+TIMING_BATTLE_START+TIMING_ATTACK+TIMING_BATTLE_END+TIMING_END_PHASE)
e1:SetRange(LOCATION_PZONE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(0,EFFECT_FLAG2_COF)
e1:SetCondition(s.accon)
e1:SetCost(s.accost)
e1:SetOperation(s.acop)
c:RegisterEffect(e1)
-- Set
local e2=Effect.CreateEffect(c)
e2:SetDescription(1153)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.setcon)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
--Pos Change
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_SET_POSITION)
e3:SetRange(LOCATION_PZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(s.posfilter)
e3:SetValue(POS_FACEUP_ATTACK)
c:RegisterEffect(e3)
-- Must Attack
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_MUST_ATTACK)
e4:SetRange(LOCATION_PZONE)
e4:SetTargetRange(LOCATION_MZONE,0)
e4:SetTarget(s.posfilter)
c:RegisterEffect(e4)
-- ATK up
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_ATKCHANGE)
e5:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e5:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e5:SetRange(LOCATION_PZONE)
e5:SetCondition(s.atkcon)
e5:SetCost(s.atkcost)
e5:SetOperation(s.atkop)
c:RegisterEffect(e5)
-- Equip
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(id,1))
e6:SetCategory(CATEGORY_EQUIP)
e6:SetType(EFFECT_TYPE_QUICK_O)
e6:SetCode(EVENT_FREE_CHAIN)
e6:SetRange(LOCATION_HAND)
e6:SetCondition(s.eqcon)
e6:SetCost(s.eqcost)
e6:SetOperation(s.eqop)
c:RegisterEffect(e6)
-- Waaaaaaaaaaaagh
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(id,2))
e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e7:SetCode(EVENT_FLIP)
e7:SetRange(LOCATION_MZONE)
e7:SetCost(s.battlecost)
e7:SetOperation(s.battleop)
e6:SetLabelObject(e7)
end
function s.accon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(1153)==0 and Duel.IsAbleToEnterBP()
end
function s.accost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,900) end
Duel.PayLPCost(tp,900)
end
function s.acop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_BP_TWICE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetReset(RESET_PHASE+PHASE_BATTLE,1)
Duel.RegisterEffect(e1,tp)
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEDOWN,true)
c:RegisterFlagEffect(1153,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
function s.posfilter(e,c)
return c:IsFaceup() and c:IsSetCard(0x1d4) and c:IsType(TYPE_MONSTER)
end
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
local p=e:GetHandler():GetControler()
local ac=Duel.GetAttacker()
local bc=Duel.GetAttackTarget()
if bc==nil or ac==nil then return false end
if ac:IsControler(1-p) then ac,bc=bc,ac end
return ac:IsSetCard(0x1d4)
end
function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,900) end
Duel.PayLPCost(tp,900)
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local p=e:GetHandler():GetControler()
local tc=Duel.GetAttacker()
local bc=Duel.GetAttackTarget()
if tc:IsControler(1-p) then tc,bc=bc,tc end
if tc:IsRelateToBattle() and tc:IsFaceup() and bc:IsRelateToBattle() and bc:IsFaceup() then
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(Card.GetDefense(tc))
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
e2:SetValue(0)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(tc)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BATTLED)
e3:SetOperation(s.posop)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3)
end
end
function s.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToBattle() then
Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE)
end
end
function s.eqfilter(c)
return c:IsFaceup() and c:IsSetCard(0x1d4) and c:IsType(TYPE_MONSTER) and c:IsLevelBelow(9)
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
return (not e:GetHandler():IsPublic()) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_PUBLIC)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
c:RegisterEffect(e1)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local tc=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc and Duel.Equip(tp,c,tc,true) then
-- equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(function(e,c) return e:GetLabelObject()==c end)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
-- leave field
local e2=Effect.CreateEffect(tc)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_REDIRECT)
e2:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e2)
-- gain effect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(c.eftg)
e3:SetLabelObject(e:GetLabelObject())
c:RegisterEffect(e3)
-- change level
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_EQUIP)
e6:SetCode(EFFECT_CHANGE_LEVEL)
e6:SetValue(8)
c:RegisterEffect(e6)
end
end
function s.eftg(e,c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x1d4) and c:GetEquipGroup():IsContains(e:GetHandler())
end
function s.battlecost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,LOCATION_ONFIELD,0,0x71,1,REASON_COST) end
Duel.RemoveCounter(tp,LOCATION_ONFIELD,0,0x71,1,REASON_COST)
end
function s.battleop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetCurrentPhase()>=PHASE_BATTLE or not Duel.IsAbleToEnterBP() then return end
local p=Duel.GetTurnPlayer()
Duel.SkipPhase(p,PHASE_DRAW,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_STANDBY,RESET_PHASE+PHASE_END,1)
Duel.SkipPhase(p,PHASE_MAIN1,RESET_PHASE+PHASE_END,1)
for tc in aux.Next(Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)) do
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
if not Auxiliary.PendulumPatched then
-- After set, ygopro will treat it as a normal pendulum scale with position = POS_FACEDOWN
-- that will make player can pendulum summon even if it's set. This code check if scale is facedown.
Auxiliary.originPendCondition = Auxiliary.PendCondition
function Auxiliary.PendCondition(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
if rpz==nil or c==rpz then return false end
if Card.IsPosition(c,POS_FACEDOWN) or Card.IsPosition(rpz,POS_FACEDOWN) then return false end
return Auxiliary.originPendCondition(e,c,og)
end
-- ygocore will directly return TYPE_PENDULUM + TYPE_SPELL if a card is in PZONE
-- no matther what effect you register on it. so we have to hook it inner lua.
Card.originGetType = Card.GetType
Card.originIsType = Card.IsType
function Card.GetType(c)
if c:GetFlagEffect(1314)>0 and c:IsLocation(LOCATION_PZONE) then return TYPE_PENDULUM+TYPE_TRAP end
return Card.originGetType(c)
end
-- It's the same as real Card.IsType, but calls inner ygocore won't be hooked by previous definition.
-- So we have to hook it.
function Card.IsType(c,t)
return c:GetType()&t>0
end
-- I skip the material type check here. If you need it you can mask it in another block.
Auxiliary.PendulumPatched = true
end
This diff is collapsed.
-- (纠罪巧)纳垢灵
local s,id,o=GetID()
function s.initial_effect(c)
end
-- 少女的晚祷
local s,id,o=GetID()
function s.initial_effect(c)
local e1=aux.AddRitualProcEqual2(c,s.ritual_filter,LOCATION_GRAVE+LOCATION_DECK,nil,nil,true)
e1:SetCondition(s.rscon)
e1:SetCost(s.rscost)
c:RegisterEffect(e1)
--destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetRange(LOCATION_GRAVE)
e2:SetTarget(s.reptg)
e2:SetValue(s.repval)
e2:SetOperation(s.repop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
function s.ritual_filter(c)
return c:IsType(TYPE_RITUAL) and c:IsAttribute(ATTRIBUTE_DARK)
end
function s.rscon(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
return #g==1 and tc:IsRace(RACE_SPELLCASTER)
end
function s.rscost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,800) end
Duel.PayLPCost(tp,800)
end
function s.repfilter(c,tp)
return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER) and c:IsLocation(LOCATION_MZONE) and c:GetZone()==4
and c:IsControler(tp) and c:IsReason(REASON_EFFECT+REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(s.repfilter,1,nil,tp) end
return Duel.SelectEffectYesNo(tp,e:GetHandler(),96)
end
function s.repval(e,c)
return s.repfilter(c,e:GetHandlerPlayer())
end
function s.repop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rse=e:GetLabelObject()
if c:IsRelateToEffect(e) and Duel.SSet(tp,c)~=0 then
end
end
--糾罪都市-エニアポリス
local s,id,o=GetID()
function s.initial_effect(c)
print("Init card!")
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,id)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
--to hand
local custom_code=aux.RegisterMergedDelayedEvent_ToSingleCard(c,id,EVENT_FLIP)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(custom_code)
e3:SetRange(LOCATION_FZONE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,id+o)
e3:SetCondition(s.pthcon)
e3:SetTarget(s.pthtg)
e3:SetOperation(s.pthop)
c:RegisterEffect(e3)
--damage
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DAMAGE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_FZONE)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCountLimit(1)
e4:SetTarget(s.damtg)
e4:SetOperation(s.damop)
c:RegisterEffect(e4)
end
function s.thfilter(c)
return c:IsFaceup() and c:IsSetCard(0x1d4) and c:GetOriginalType()&TYPE_PENDULUM~=0
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(tp) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_ONFIELD,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_ONFIELD,0,1,99,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetTargetsRelateToChain()
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
end
function s.pthfilter(c,tp)
return c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x1d4) and c:IsControler(tp) and c:IsFaceup()
and (Duel.CheckLocation(tp,LOCATION_PZONE,0)
or Duel.CheckLocation(tp,LOCATION_PZONE,1)
or c:IsAbleToHand())
end
function s.pthcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.pthfilter,1,nil,tp)
and Duel.IsMainPhase()
end
function s.pthtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=eg:Filter(s.pthfilter,nil,tp)
if chk==0 then return #g>0 end
Duel.SetTargetCard(g)
end
function s.pthop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(s.pthfilter,nil,tp)
local mg=g:Filter(Card.IsRelateToChain,nil)
if mg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local og=mg:Select(tp,1,1,nil)
local tc=og:GetFirst()
local b1=Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)
local b2=tc:IsAbleToHand()
local op=aux.SelectFromOptions(tp,
{b1,aux.Stringid(id,3),1},
{b2,aux.Stringid(id,4),2})
if op==1 then
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
else
Duel.HintSelection(og)
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
end
function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if Duel.GetCounter(tp,1,0,0x71)>0 then
local dam=Duel.GetCounter(tp,1,0,0x71)*900
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(dam)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
end
end
function s.ctfilter(c)
return c:GetCounter(0x71)>0
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.ctfilter,tp,LOCATION_ONFIELD,0,nil)
local tc=g:GetFirst()
local rmct=0
while tc do
local ct=tc:GetCounter(0x71)
rmct=rmct+ct
tc:RemoveCounter(tp,0x71,ct,REASON_EFFECT)
tc=g:GetNext()
end
if rmct>0 then
Duel.Damage(1-tp,rmct*900,REASON_EFFECT)
end
end
--光と闇の竜王
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddFusionProcFun2(c,s.mfilter1,s.mfilter2,true)
c:EnableReviveLimit()
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(aux.fuslimit)
c:RegisterEffect(e0)
--
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_ADD_ATTRIBUTE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(ATTRIBUTE_DARK)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_NEGATE)
e2:SetType(EFFECT_TYPE_QUICK_F)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCondition(s.negcon)
e2:SetTarget(s.negtg)
e2:SetOperation(s.negop)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.mfilter1(c)
return c:IsFusionAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(8) and c:IsRace(RACE_DRAGON)
end
function s.mfilter2(c)
return c:IsFusionAttribute(ATTRIBUTE_DARK) and c:IsLevel(8) and c:IsRace(RACE_DRAGON)
end
function s.negcon(e,tp,eg,ep,ev,re,r,rp)
return (re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:IsActiveType(TYPE_MONSTER))
end
function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(id)==0 end
if c:IsHasEffect(EFFECT_REVERSE_UPDATE) then
c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
end
function s.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFacedown() or not c:IsRelateToEffect(e) or c:GetAttack()<1000 or c:GetDefense()<1000
or c:IsStatus(STATUS_BATTLE_DESTROYED) then
return
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e1:SetValue(-1000)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e2)
if not c:IsHasEffect(EFFECT_REVERSE_UPDATE) and Duel.GetCurrentChain()==ev+1 then
Duel.NegateActivation(ev)
end
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return rp==1-tp and c:IsPreviousControler(tp)
end
function s.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp)
and s.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
\ No newline at end of file
--誇りと魂の龍
local s,id,o=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--
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)
--
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetCondition(s.condition)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetCondition(s.atkcon)
e3:SetValue(2500)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e4)
end
function s.condition(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,0,LOCATION_GRAVE)>=25
end
function s.atkcon(e)
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_GRAVE,0)>=25
end
\ No newline at end of file
function disable_extra_areas()
-- Disable extra areas
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetCondition(aux.TRUE)
e1:SetValue(0x200020)
Duel.RegisterEffect(e1,0)
end
function delay_first_turn()
-- No draw card in Turn 2
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DRAW_COUNT)
e1:SetCondition(aux.TRUE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetValue(0)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,0)
-- No Battle Phase in Turn 2
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BP)
Duel.RegisterEffect(e2,0)
-- Disable any effect
local e3= Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetTargetRange(LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED, LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
e3:SetTarget(aux.TRUE)
e3:SetCode(EFFECT_DISABLE)
e3:SetReset(RESET_PHASE+PHASE_END,1)
Duel.RegisterEffect(e3,0)
end
function calculate_extra_fields()
local lp=Duel.GetLP(0)
if lp<8000-16 and lp>=8000-16-64 then
local d=8000-16-lp
Duel.SetLP(0,8000)
Duel.SetLP(1,8000)
return 8000-16-lp
end
return 0
end
local extra_fields=calculate_extra_fields()
if extra_fields>0 then
if extra_fields&1==1 then
delay_first_turn()
end
if extra_fields&16==16 then
disable_extra_areas()
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