Commit 6dff98bd authored by wyykak's avatar wyykak

replace math.random with Duel.GetRandomNumber

Signed-off-by: wyykak's avatarwyykak <wyy_1414@126.com>
parent 1fcecead
Pipeline #22036 passed with stage
in 1 minute and 19 seconds
...@@ -411,13 +411,6 @@ function Nef.GetFieldRightScale(tp) ...@@ -411,13 +411,6 @@ function Nef.GetFieldRightScale(tp)
end end
end end
-- function Nef.PendSummonLimitTarget(e,c,sump,sumtype,sumpos,targetp)
-- local c = nil
-- if e then c = e:GetHandler() end
-- return c and sumtype==SUMMON_TYPE_PENDULUM and _G["c" .. c:GetOriginalCode()].pend_filter==nil
-- and (c == Duel.GetFieldCard(tp,LOCATION_SZONE, 6) or c == Duel.GetFieldCard(tp,LOCATION_SZONE, 7))
-- end
function Nef.EnableDualAttributeSP(c) function Nef.EnableDualAttributeSP(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
...@@ -455,28 +448,10 @@ function Nef.GetDate() ...@@ -455,28 +448,10 @@ function Nef.GetDate()
return date.year, date.month, date.day return date.year, date.month, date.day
end end
function Nef.Log(message)
-- if AI and AI.Chat ~= nil then AI.Chat(message) end
end
function Nef.LogFormat(fmt, ...) function Nef.LogFormat(fmt, ...)
Debug.Message(string.format(fmt, ...)) Debug.Message(string.format(fmt, ...))
end end
function Nef.GetRandomCardCode(num, command)
-- local result = {}
-- local commandList = {
-- [0] = "Main",
-- [1] = "Extra"
-- }
-- local cardType = commandList[command]
-- for i=1,num do
-- local r = math.random(1,#CardList[cardType])
-- result[i] = CardList[cardType][r]
-- end
-- return result
end
function Nef.kangbazi(e,te) function Nef.kangbazi(e,te)
if te:IsActiveType(TYPE_MONSTER) and te:IsActivated() then if te:IsActiveType(TYPE_MONSTER) and te:IsActivated() then
local ec=te:GetOwner() local ec=te:GetOwner()
......
...@@ -148,9 +148,6 @@ end ...@@ -148,9 +148,6 @@ end
function this.op(e,tp) function this.op(e,tp)
this.isPicking=true this.isPicking=true
if Duel.GetTurnCount()==1 then
math.randomseed(this.seed3())
end
this.saveDeck(0) this.saveDeck(0)
this.saveDeck(1) this.saveDeck(1)
this.drawCount=Duel.GetFieldGroupCount(0,LOCATION_HAND,0) this.drawCount=Duel.GetFieldGroupCount(0,LOCATION_HAND,0)
...@@ -260,10 +257,10 @@ function this.ccGen(from,count) ...@@ -260,10 +257,10 @@ function this.ccGen(from,count)
end end
local g={} local g={}
for i=1,count do for i=1,count do
local temp=this.CardList[from][math.random(1,#this.CardList[from])] local temp=this.CardList[from][Duel.GetRandomNumber(1,#this.CardList[from])]
local at=this.CardList[from.."AliasTable"] local at=this.CardList[from.."AliasTable"]
if #at[temp]>1 then if #at[temp]>1 then
g[i]=at[temp][math.random(1,#at[temp])] g[i]=at[temp][Duel.GetRandomNumber(1,#at[temp])]
else else
g[i]=temp g[i]=temp
end end
...@@ -749,10 +746,10 @@ function this.picrandom(g) ...@@ -749,10 +746,10 @@ function this.picrandom(g)
for _,v in pairs(g) do for _,v in pairs(g) do
if this.CardList.MainAliasTable[v] then if this.CardList.MainAliasTable[v] then
local at=this.CardList.MainAliasTable local at=this.CardList.MainAliasTable
rg[#rg+1]=at[v][math.random(1,#at[v])] rg[#rg+1]=at[v][Duel.GetRandomNumber(1,#at[v])]
elseif this.CardList.ExtraAliasTable[v] then elseif this.CardList.ExtraAliasTable[v] then
local at=this.CardList.ExtraAliasTable local at=this.CardList.ExtraAliasTable
rg[#rg+1]=at[v][math.random(1,#at[v])] rg[#rg+1]=at[v][Duel.GetRandomNumber(1,#at[v])]
else else
rg[#rg+1]=v rg[#rg+1]=v
end end
...@@ -768,7 +765,7 @@ function this.sample(g,ct) ...@@ -768,7 +765,7 @@ function this.sample(g,ct)
if i>cct then if i>cct then
break break
end end
local idx=math.random(1,cct-i+1) local idx=Duel.GetRandomNumber(1,cct-i+1)
rg[#rg+1]=g[idx] rg[#rg+1]=g[idx]
if idx<cct-i+1 then if idx<cct-i+1 then
......
...@@ -26,13 +26,6 @@ end ...@@ -26,13 +26,6 @@ end
function c200305.activate(e,tp,eg,ep,ev,re,r,rp) function c200305.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c200305.filter,tp,LOCATION_DECK,0,nil) local g=Duel.GetMatchingGroup(c200305.filter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>0 then if g:GetCount()>0 then
--[[
local rand=math.random(1,g:GetCount())
local tc=g:GetFirst()
while rand>1 do
tc=g:GetNext()
rand=rand-1
end]]
tc=g:RandomSelect(tp,1) tc=g:RandomSelect(tp,1)
Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc) Duel.ConfirmCards(1-tp,tc)
......
...@@ -112,8 +112,6 @@ function cCardno.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -112,8 +112,6 @@ function cCardno.operation(e,tp,eg,ep,ev,re,r,rp)
local d1,d2=Duel.TossDice(tp,2) local d1,d2=Duel.TossDice(tp,2)
local dice = d1+d2 local dice = d1+d2
--math.randomseed(os.time())
--local dice = math.random(1,12)
Duel.Hint(HINT_NUMBER,tp,dice) Duel.Hint(HINT_NUMBER,tp,dice)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
......
...@@ -109,11 +109,8 @@ function cCardno.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -109,11 +109,8 @@ function cCardno.target(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function cCardno.operation(e,tp,eg,ep,ev,re,r,rp) function cCardno.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
--local d1,d2=Duel.TossDice(tp,2) local dice = Duel.GetRandomNumber(1,12)
--local dice = d1+d2
math.randomseed(os.time())
local dice = math.random(1,12)
Duel.Hint(HINT_NUMBER,tp,dice) Duel.Hint(HINT_NUMBER,tp,dice)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
......
...@@ -59,8 +59,7 @@ function c99999008.tg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -59,8 +59,7 @@ function c99999008.tg(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function c99999008.op(e,tp,eg,ep,ev,re,r,rp) function c99999008.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
math.randomseed(os.time()) local dice = Duel.GetRandomNumber(1,12)
local dice = math.random(1,12)
Duel.Hint(HINT_NUMBER,tp,dice) Duel.Hint(HINT_NUMBER,tp,dice)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
...@@ -102,8 +101,7 @@ function c99999008.thop1(e,tp,eg,ep,ev,re,r,rp) ...@@ -102,8 +101,7 @@ function c99999008.thop1(e,tp,eg,ep,ev,re,r,rp)
Duel.HintSelection(g) Duel.HintSelection(g)
g:GetFirst():AddCounter(0x1999,1) g:GetFirst():AddCounter(0x1999,1)
end end
math.randomseed(os.time()) local dice = Duel.GetRandomNumber(1,12)
local dice = math.random(1,12)
Duel.Hint(HINT_NUMBER,tp,dice) Duel.Hint(HINT_NUMBER,tp,dice)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
......
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