Commit 7696a568 authored by nanahira's avatar nanahira

first

parents
# specials
The repo for storing special scripts for special rules.
## How to use
Pick your favorite rule, and put `special.lua` into your server's `expansions/script` directory.
function Auxiliary.PreloadUds()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetOperation(function(e)
for tp=0,1 do
for i=1,3 do
local tc=Duel.CreateToken(tp,46565218)
Duel.SendtoDeck(tc,nil,2,REASON_RULE)
end
local tc=Duel.CreateToken(tp,46565218)
Duel.SendtoHand(tc,nil,REASON_RULE)
local function atkfilter(c,atk,no_attack_check)
return c:IsFaceup() and c:IsAttackAbove(atk) and not c:IsHasEffect(EFFECT_REVERSE_UPDATE) and (no_attack_check or c:GetAttackAnnouncedCount()==0)
end
function con(atk,conf,no_attack_check)
return function(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentChain()==0 and (Duel.GetCurrentPhase()&(PHASE_MAIN1|PHASE_MAIN2))>0 and Duel.IsExistingMatchingCard(atkfilter,tp,LOCATION_MZONE,0,1,nil,atk,no_attack_check) and (not conf or conf(e,tp,eg,ep,ev,re,r,rp))
end
end
function op(atk,opf,no_attack_check)
return function(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF)
local g=Duel.SelectMatchingCard(tp,atkfilter,tp,LOCATION_MZONE,0,1,1,nil,atk,no_attack_check)
local tc=g:GetFirst()
local ex=Effect.CreateEffect(e:GetOwner())
ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetCode(EFFECT_UPDATE_ATTACK)
ex:SetValue(-atk)
ex:SetReset(0x1fe1000)
tc:RegisterEffect(ex,true)
Duel.Hint(HINT_CARD,0,46565218)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
opf(e,tp,eg,ep,ev,re,r,rp)
end
end
for tp=0,1 do
local e1=Effect.CreateEffect(tc)
e1:SetDescription(1108)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCountLimit(1,10000001)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(con(2020,function(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerCanDraw(tp,1)
end))
e1:SetOperation(op(2020,function(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
end))
Duel.RegisterEffect(e1,tp)
local e1=Effect.CreateEffect(tc)
e1:SetDescription(1113)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCountLimit(1,10000001)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(con(2020,function(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil)
end))
e1:SetOperation(op(2020,function(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPPO)
local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,2,nil)
for tc in aux.Next(g) do
local ex=Effect.CreateEffect(e:GetOwner())
ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetCode(EFFECT_UPDATE_ATTACK)
ex:SetValue(-2020)
ex:SetReset(0x1fe1000)
tc:RegisterEffect(ex)
end
end))
Duel.RegisterEffect(e1,tp)
local e1=Effect.CreateEffect(tc)
e1:SetDescription(1122)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCountLimit(1,10000001)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(con(1225,function(e,tp,eg,ep,ev,re,r,rp)
return true
end,true))
e1:SetOperation(op(1225,function(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(1-tp,math.max(Duel.GetLP(1-tp)-400,0))
end,true))
Duel.RegisterEffect(e1,tp)
local e1=Effect.CreateEffect(tc)
e1:SetDescription(1123)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCountLimit(1,10000001)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(con(1225,function(e,tp,eg,ep,ev,re,r,rp)
return true
end))
e1:SetOperation(op(1225,function(e,tp,eg,ep,ev,re,r,rp)
Duel.SetLP(tp,Duel.GetLP(tp)+2020)
end))
Duel.RegisterEffect(e1,tp)
end
end
e:Reset()
end)
Duel.RegisterEffect(e1,0)
end
#!/bin/bash
scp ./*.lua 10.198.6.32:~/ygopro-newyear/expansions/script/
function Auxiliary.PreloadUds()
local ex=Effect.GlobalEffect()
ex:SetType(EFFECT_TYPE_FIELD)
ex:SetCode(EFFECT_DECREASE_TRIBUTE)
ex:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_IGNORE_RANGE)
ex:SetTargetRange(0xff,0xff)
ex:SetTarget(function(e,c)
return not c:IsHasEffect(EFFECT_LIMIT_SUMMON_PROC) and not c:IsHasEffect(EFFECT_LIMIT_SET_PROC)
end)
ex:SetValue(0xff00ff)
Duel.RegisterEffect(ex,0)
local ex2=ex:Clone()
ex2:SetCode(EFFECT_DECREASE_TRIBUTE_SET)
Duel.RegisterEffect(ex2,0)
end
function Auxiliary._PreloadUds()
local _register=Card.RegisterEffect
Card.RegisterEffect=function(c,e,f)
local t=e:GetType()
if t&EFFECT_TYPE_IGNITION>0 then
e:SetCode(EVENT_FREE_CHAIN)
--[[if (e:GetCategory()&(CATEGORY_ATKCHANGE|CATEGORY_DEFCHANGE))>0 then
local pr,pr2=e:GetProperty()
e:SetProperty(pr|EFFECT_FLAG_DAMAGE_STEP,pr2)
end]]
e:SetHintTiming(0,0x1e0)
e:SetType(t&(~EFFECT_TYPE_IGNITION)|EFFECT_TYPE_QUICK_O)
local con=e:GetCondition() or aux.TRUE
e:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
return con(e,tp,eg,ep,ev,re,r,rp) and not e:GetHandler():IsStatus(STATUS_CHAINING)
end)
elseif t&EFFECT_TYPE_ACTIVATE>0 and not c:IsType(TYPE_TRAP) and not c:IsType(TYPE_QUICKPLAY) then
local oldcon=e:GetCondition() or aux.TRUE
local e1=e:Clone()
e:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return oldcon(e,tp,eg,ep,ev,re,r,rp) and (c:IsStatus(STATUS_SET_TURN) or (Duel.GetTurnPlayer()~=tp and not c:IsLocation(LOCATION_SZONE)))
end)
e1:SetType(t|EFFECT_TYPE_QUICK_O)
--[[if (e1:GetCategory()&(CATEGORY_ATKCHANGE|CATEGORY_DEFCHANGE))>0 or c:IsType(TYPE_EQUIP) then
local pr,pr2=e1:GetProperty()
e1:SetProperty(pr|EFFECT_FLAG_DAMAGE_STEP,pr2)
end]]
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return oldcon(e,tp,eg,ep,ev,re,r,rp) and not c:IsStatus(STATUS_SET_TURN) and (Duel.GetTurnPlayer()==tp or c:IsLocation(LOCATION_SZONE))
end)
_register(c,e1,f)
end
return _register(c,e,f)
end
end
#!/bin/bash
scp ./*.lua 10.198.6.32:~/ygopro-speed/expansions/script/
local activity_check_list=0
function Auxiliary.PreloadUds()
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetOperation(function(e)
for tp=0,1 do
local fc=Duel.CreateToken(tp,4064256)
Duel.MoveToField(fc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local dc=Duel.CreateToken(tp,32274490)
Duel.SendtoGrave(dc,REASON_RULE+REASON_RETURN)
local e1=Effect.CreateEffect(dc)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_FREE_CHAIN)
local function f(c)
return c:IsRace(RACE_ZOMBIE) and c:IsAbleToGrave()
--return true
end
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(f,tp,LOCATION_DECK,0,nil)
return (activity_check_list&(0x1<<tp))>0 and #g>0
end)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,32274490)
local g=Duel.GetMatchingGroup(f,tp,LOCATION_DECK,0,nil)
local tg=g:RandomSelect(tp,1)
Duel.SendtoGrave(tg,REASON_EFFECT)
e:Reset()
end)
Duel.RegisterEffect(e1,tp)
end
e:Reset()
end)
Duel.RegisterEffect(e1,0)
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROYED)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
for p=0,1 do
if eg:IsExists(function(c)
return c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==p
end,1,nil) then
activity_check_list=activity_check_list|(0x1<<p)
end
end
end)
Duel.RegisterEffect(e1,0)
end
#!/bin/bash
scp ./*.lua 10.198.6.32:~/ygopro-dead/expansions/script/
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