Commit 2d2045d5 authored by salix5's avatar salix5 Committed by GitHub

fix: change dice (#1705)

Now the player will choose the index of the results, not the rolled
number.
parent 673e137e
......@@ -84,19 +84,20 @@ end
function c35772782.diceop(e,tp,eg,ep,ev,re,r,rp)
local cc=Duel.GetCurrentChain()
local cid=Duel.GetChainInfo(cc,CHAININFO_CHAIN_ID)
if c35772782[0]~=cid and Duel.SelectYesNo(tp,aux.Stringid(35772782,1)) then
if aux.dice_chain_id~=cid and Duel.SelectYesNo(tp,aux.Stringid(35772782,1)) then
Duel.Hint(HINT_CARD,0,35772782)
e:GetHandler():RegisterFlagEffect(35772782,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
local dc={Duel.GetDiceResult()}
local ac=1
local ct=bit.band(ev,0xff)+bit.rshift(ev,16)
local ct=(ev&0xff)+(ev>>16&0xff)
if ct>1 then
--choose the index of results
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(35772782,2))
local val,idx=Duel.AnnounceNumber(tp,table.unpack(dc,1,ct))
local val,idx=Duel.AnnounceNumber(tp,table.unpack(aux.idx_table,1,ct))
ac=idx+1
end
dc[ac]=7
Duel.SetDiceResult(table.unpack(dc))
c35772782[0]=cid
aux.dice_chain_id=cid
end
end
......@@ -16,19 +16,20 @@ end
function c39454112.diceop(e,tp,eg,ep,ev,re,r,rp)
local cc=Duel.GetCurrentChain()
local cid=Duel.GetChainInfo(cc,CHAININFO_CHAIN_ID)
if c39454112[0]~=cid and Duel.SelectYesNo(tp,aux.Stringid(39454112,0)) then
if aux.dice_chain_id~=cid and Duel.SelectYesNo(tp,aux.Stringid(39454112,0)) then
Duel.Hint(HINT_CARD,0,39454112)
local dc={Duel.GetDiceResult()}
local ac=1
local ct=bit.band(ev,0xff)+bit.rshift(ev,16)
local ct=(ev&0xff)+(ev>>16&0xff)
if ct>1 then
--choose the index of results
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(39454112,1))
local val,idx=Duel.AnnounceNumber(tp,table.unpack(dc,1,ct))
local val,idx=Duel.AnnounceNumber(tp,table.unpack(aux.idx_table,1,ct))
ac=idx+1
end
if dc[ac]==1 or dc[ac]==3 or dc[ac]==5 then dc[ac]=6
else dc[ac]=1 end
Duel.SetDiceResult(table.unpack(dc))
c39454112[0]=cid
aux.dice_chain_id=cid
end
end
......@@ -40,6 +40,10 @@ function bit.replace(r,v,field,width)
return (r&~(m<<f))|((v&m)<< f)
end
--the chain id of the results modified by EVENT_TOSS_DICE_NEGATE
Auxiliary.dice_chain_id=0
Auxiliary.idx_table=table.pack(1,2,3,4,5,6,7,8)
function Auxiliary.Stringid(code,id)
return code*16+id
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