roll.mcfunction 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # 丢骰子
  2. scoreboard players set $random_min mem 1
  3. scoreboard players set $random_max mem 20
  4. function lib:random
  5. # 20 大成功:获得 2 金块
  6. execute if score $random mem matches 20 run function ltw:state/0/roll_dice/super_win
  7. # 19-16 / 20% 成功:返还 1 金锭
  8. execute if score $random mem matches 16..19 run function ltw:state/0/roll_dice/win
  9. # 15-2 / 70% 失败:不返还
  10. execute if score $random mem matches 2..15 run function ltw:state/0/roll_dice/lose
  11. # 1 大失败:归零
  12. execute if score $random mem matches 1 run function ltw:state/0/roll_dice/super_lose
  13. # 老板大成功,玩家非大成功/玩家大失败,老板非大失败:玩家失去所有金粒,被丢出赌博房
  14. # execute if score $random mem matches 20 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"老板丢出了 ",{"text":"大成功","color":"dark_purple","bold":true}," ,你丢出了 ",{"text":"大失败","color":"dark_purple","bold":true}," ,你是超级非酋,你失去了所有金粒,被丢出了赌博房!"]
  15. # execute if score $random mem matches 20 if score @s temp matches 2..19 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"老板丢出了 ",{"text":"大成功","color":"dark_purple","bold":true}," ,你失去了所有金粒,被丢出了赌博房!"]
  16. # execute if score $random mem matches 2..19 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"dark_purple","bold":true},"你丢出了 ",{"text":"大失败","color":"dark_purple","bold":true}," ,你失去了所有金粒,被丢出了赌博房!"]
  17. # execute if score $random mem matches 20 if score @s temp matches 1..19 run function ltw:state/0/roll_dice/super_lose
  18. # execute if score $random mem matches 2..19 if score @s temp matches 1 run function ltw:state/0/roll_dice/super_lose
  19. # 玩家大成功,老板非大成功/老板大失败,玩家非大失败:玩家获得3金块
  20. # execute if score $random mem matches 1 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"你丢出了 ",{"text":"大成功","color":"gold","bold":true}," ,老板丢出了 ",{"text":"大失败","color":"gold","bold":true}," ,你是超级欧皇,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
  21. # execute if score $random mem matches 2..19 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"你丢出了 ",{"text":"大成功","color":"gold","bold":true}," ,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
  22. # execute if score $random mem matches 1 if score @s temp matches 2..19 run tellraw @s ["",{"text":">> ","color":"gold","bold":true},"老板丢出了 ",{"text":"大失败","color":"gold","bold":true}," ,你获得了 ",{"text":"3金块","color":"gold","bold":true} ," !"]
  23. # execute if score $random mem matches 1 if score @s temp matches 2..20 run function ltw:state/0/roll_dice/super_win
  24. # execute if score $random mem matches 2..19 if score @s temp matches 20 run function ltw:state/0/roll_dice/super_win
  25. # 老板比玩家大:无事发生
  26. # execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem > @s temp run tellraw @s ["",{"text":">> ","color":"dark_red","bold":true},"老板的点数比你大,你输了,你失去了 ",{"text":"1金锭","color":"dark_red","bold":true} ," !"]
  27. # execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem > @s temp run function ltw:state/0/roll_dice/lose
  28. # 玩家比老板大:获得18金粒
  29. # execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem < @s temp run tellraw @s ["",{"text":">> ","color":"dark_green","bold":true},"你的点数比老板大,你赢了,你获得了",{"text":"1金锭","color":"dark_green","bold":true} ," !"]
  30. # execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem < @s temp run function ltw:state/0/roll_dice/win
  31. # 老板和玩家一样大:玩家获得9金粒
  32. # execute if score $random mem matches 20 if score @s temp matches 20 run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你和老板一样欧,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
  33. # execute if score $random mem matches 2..19 if score @s temp matches 2..19 if score $random mem = @s temp run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你的点数和老板一样大,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
  34. # execute if score $random mem matches 1 if score @s temp matches 1 run tellraw @s ["",{"text":">> ","color":"green","bold":true},"你和老板一样非,你们平局了,你拿回了 ",{"text":"1金锭","color":"green","bold":true} ," !"]
  35. # execute if score $random mem = @s temp run function ltw:state/0/roll_dice/draw