roll.mcfunction 812 B

1234567891011121314151617181920212223
  1. # 丢骰子
  2. scoreboard players set $random_min mem 1
  3. scoreboard players set $random_max mem 20
  4. function lib:random
  5. # 20 / 5% 大成功:获得 1 金块
  6. execute if score $random mem matches 20 run function ltw:state/0/roll_dice/super_win
  7. # 18-19 / 10%:获得 3 金锭
  8. execute if score $random mem matches 18..19 run function ltw:state/0/roll_dice/win3
  9. # 15-17 / 15%:获得 2 金锭
  10. execute if score $random mem matches 15..17 run function ltw:state/0/roll_dice/win2
  11. # 10-14 / 25%:返还 1 金锭
  12. execute if score $random mem matches 10..14 run function ltw:state/0/roll_dice/win1
  13. # 2-9 / 40%:不返还
  14. execute if score $random mem matches 2..9 run function ltw:state/0/roll_dice/lose
  15. # 1 / 5% 大失败:归零
  16. execute if score $random mem matches 1 run function ltw:state/0/roll_dice/super_lose