Commit 1066bf88 authored by JoyJ's avatar JoyJ

update TimeTwisters rule

parent 983c3821
while :
do
R=$(od -A n -t d -N 4 /dev/urandom)
echo $R
echo "_G.RANDOMSEED = $R" > random.lua
read -p "" -t 0.1 > /dev/null
done
--【请务必先pm start random.sh】
--【或者nohup random.sh也可以】
--村规决斗:时空乱流EX
--双方每个回合的回合时间都会随机变化,从30~300秒不等。
--开局时,双方将1张【所罗门的律法书】(23471572)从卡组外除外。这张卡不在除外状态的场合立刻除外。
--这张【所罗门的律法书】得到以下效果:
--每个对方的结束阶段发动。掷1个骰子。
--1:跳过自己的下个抽卡阶段。
--2:跳过自己的下个准备阶段。
--3:跳过自己的下个主要阶段1。
--4:跳过自己的下个主要阶段2。
--5:跳过自己的下个战斗阶段。
--6:跳过自己的下个回合。
--这个效果从T2开始发动和处理。
--细则:投掷到6的场合,会因为未经过结束阶段而跳过1次投掷。
CUNGUI = {}
function Auxiliary.PreloadUds()
--adjust
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_ADJUST)
e1:SetCountLimit(1)
e1:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
if not CUNGUI.InitRandomSeed then
CUNGUI.InitRandomSeed = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
--adjust
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetCountLimit(1)
e2:SetOperation(CUNGUI.AdjustOperationTT)
Duel.RegisterEffect(e2,0)
end
function CUNGUI.AdjustOperationTT(e,tp,eg,ep,ev,re,r,rp)
local tm = math.random(30,300)
Duel.Hint(HINT_NUMBER,tp,tm)
Duel.ResetTimeLimit(0,tm)
tm = math.random(30,300)
Duel.ResetTimeLimit(1,tm)
Duel.Hint(HINT_NUMBER,1,tm)
end
CUNGUI.RuleCards=Group.CreateGroup()
function CUNGUI.AdjustOperation2(e,tp,eg,ep,ev,re,r,rp)
if (CUNGUI.RuleCards:Filter(Card.IsLocation,nil,LOCATION_REMOVED):GetCount()~=2) then
Duel.Remove(CUNGUI.RuleCards,POS_FACEUP,REASON_RULE)
end
end
function CUNGUI.RegisterRuleEffect(c)
--skip phase
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66666004,4))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_REMOVED)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1)
e2:SetCondition(CUNGUI.condition)
e2:SetOperation(CUNGUI.operation)
c:RegisterEffect(e2)
end
function CUNGUI.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()>1 and Duel.GetTurnPlayer()~=tp
end
function CUNGUI.operation(e,tp,eg,ep,ev,re,r,rp)
local dice=Duel.TossDice(tp,1)
local code=EFFECT_SKIP_DP
if dice==2 then code=EFFECT_SKIP_SP end
if dice==3 then code=EFFECT_SKIP_M1 end
if dice==4 then code=EFFECT_SKIP_BP end
if dice==5 then code=EFFECT_SKIP_M2 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(code)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_END,2)
if dice==6 then
e1:SetCode(EFFECT_SKIP_TURN)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
e1:SetTargetRange(0,1)
Duel.RegisterEffect(e1,1-tp)
else
Duel.RegisterEffect(e1,tp)
end
end
function CUNGUI.AdjustOperation(e,tp,eg,ep,ev,re,r,rp)
if not CUNGUI.INIT then
CUNGUI.INIT = true
local card1 = Duel.CreateToken(0,23471572)
local card2 = Duel.CreateToken(1,23471572)
CUNGUI.RegisterRuleEffect(card1)
CUNGUI.RegisterRuleEffect(card2)
CUNGUI.RuleCards:AddCard(card1)
CUNGUI.RuleCards:AddCard(card2)
Duel.Remove(card1,POS_FACEUP,REASON_RULE)
Duel.Remove(card2,POS_FACEUP,REASON_RULE)
end
--return
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetOperation(CUNGUI.AdjustOperation2)
Duel.RegisterEffect(e2,0)
e:Reset()
end
\ No newline at end of file
--村规决斗:缝合大师
--开局时,双方将1张融合(24094653)从卡组外表侧表示除外。
--这场决斗中这张卡不是表侧表示除外的场合,这张卡表侧表示除外。
--这张卡得到以下效果。
--1回合1次,自己主要阶段才能处理这个效果。
--把手卡中任意数量的怪兽送去墓地,可以把额外卡组中最多1只怪兽送去墓地。
--把1只【三眼小男巫】从卡组外特殊召唤到场上(视为正规召唤)
--这个效果特殊召唤的【三眼小男巫】得到那些怪兽的全部效果;原本攻击力·防御力是那些怪兽攻防的平均值。
--这些效果和攻防数值即使离场后也会持续。
--另外,额外选的卡是超量怪兽卡的场合,把那些卡作为超量素材叠放。
CUNGUI = {}
CUNGUI.RuleCardCode=24094653
function Auxiliary.PreloadUds()
--adjust
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_ADJUST)
e1:SetOperation(CUNGUI.AdjustOperation)
Duel.RegisterEffect(e1,0)
end
function CUNGUI.AdjustOperation()
if not CUNGUI.RandomSeedInit then
CUNGUI.RandomSeedInit = true
Duel.LoadScript("random.lua")
math.randomseed(_G.RANDOMSEED)
for i=1,10 do math.random(1000) end
end
if not CUNGUI.RuleCardInit then
CUNGUI.RuleCardInit = true
CUNGUI.RegisterCardRule(0)
CUNGUI.RegisterCardRule(1)
end
if not CUNGUI.DrawInit then
CUNGUI.DrawInit = true
--Duel.Draw(1,1,REASON_RULE)
end
if CUNGUI.RuleCard[0] and (not CUNGUI.RuleCard[0]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[0]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[0],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[1] and (not CUNGUI.RuleCard[1]:IsLocation(LOCATION_REMOVED) or not CUNGUI.RuleCard[1]:IsFaceup()) then
Duel.Remove(CUNGUI.RuleCard[1],POS_FACEUP,REASON_RULE)
end
if CUNGUI.RuleCard[0] and not CUNGUI.RuleCard[0]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[0],POS_FACEUP)
end
if CUNGUI.RuleCard[1] and not CUNGUI.RuleCard[1]:IsFaceup() then
Duel.ChangePosition(CUNGUI.RuleCard[1],POS_FACEUP)
end
end
CUNGUI.RuleCard={}
function CUNGUI.RegisterCardRule(tp)
local c=Duel.CreateToken(tp,CUNGUI.RuleCardCode)
Duel.Remove(c,POS_FACEUP,REASON_RULE)
CUNGUI.RuleCard[tp]=c
--forbid
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66666004,4))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_REMOVED)
e1:SetCondition(CUNGUI.rulecond)
e1:SetTarget(CUNGUI.ruletg)
e1:SetOperation(CUNGUI.ruleop)
c:RegisterEffect(e1)
end
function CUNGUI.rulecond(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) and Duel.GetCurrentChain()<1 and Duel.GetTurnPlayer()==tp
and Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_HAND, 0, 2, nil, TYPE_MONSTER)
end
function CUNGUI.ruletg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.Hint(HINT_CARD,1-tp,e:GetHandler():GetCode())
end
function CUNGUI.ruleop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsType,tp,LOCATION_HAND,0,2,99,nil,TYPE_MONSTER)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=Duel.SelectMatchingCard(tp,Card.IsType,tp,LOCATION_EXTRA,0,0,1,nil,TYPE_MONSTER)
if #g==0 then return end
g:Merge(g2)
local atk=0
local def=0
for gc in aux.Next(g) do
atk = atk + gc:GetAttack()
def = def + (gc:GetDefense() or 0)
end
atk = atk / #g
def = def / #g
Duel.SendtoGrave(g,REASON_RULE)
local tc=Duel.CreateToken(tp,53539634)
for c in aux.Next(g) do
local tce=_G["c"..c:GetOriginalCode()]
if tce and tce.initial_effect then
tce.initial_effect(tc)
end
end
if Duel.SpecialSummon(tc, 0, tp, tp, 0, 0, POS_FACEUP)>0 then
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetValue(atk)
tc:RegisterEffect(e1)
e1=e1:Clone()
e1:SetCode(EFFECT_SET_BASE_DEFENSE)
e1:SetValue(def)
tc:RegisterEffect(e1)
if #g2>0 and g2:GetFirst():IsType(TYPE_XYZ) then
--add type
e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_ADD_TYPE)
e1:SetValue(TYPE_XYZ)
tc:RegisterEffect(e1)
Duel.Overlay(tc,g)
end
tc:CompleteProcedure()
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