找回密码
 立即注册
查看: 141|回复: 2

[脚本] 丹药成功几率

[复制链接]

6

主题

15

回帖

323

积分

注册会员

积分
323
发表于 2024-5-1 15:59:55 | 显示全部楼层 |阅读模式
  1. CREATE PROCEDURE RMS_TRYMAKEMYSTERYPILL
  2. @GameID varchar(14),
  3. @WindowKind int,
  4. @WindowIndex int,
  5. @RandomNumber int
  6. AS

  7. set nocount on

  8. declare @ItemCountLimit int, @CurrentItemCount int
  9. set @ItemCountLimit = 0

  10. begin transaction

  11. select @ItemCountLimit = ItemCountLimit from tblSpecialItemLimit1 where ItemKind = 6 and ItemIndex = 66
  12. set @CurrentItemCount = @ItemCountLimit
  13. set @RandomNumber=RAND() * 100000000
  14. set @RandomNumber=@RandomNumber%100
  15. select @CurrentItemCount = count(*) from tblSpecialItem1 where ItemKind = 6 and ItemIndex = 66

  16. if (@WindowKind = 1 and @WindowIndex >= 0 and @WindowIndex < 100) or (@WindowKind = 3 and @WindowIndex >= 0 and @WindowIndex < 8)
  17. begin
  18. declare @MakeMysteryPillError int
  19. set @MakeMysteryPillError = 1
  20. update tblGameID1 set SBonus = SBonus - 1, STotalBonus = STotalBonus - 1 where GameID = @GameID and SBonus >= 1 and STotalBonus >= 1

  21. if @@ROWCOUNT = 1 and @@ERROR = 0
  22. begin
  23. if @ItemCountLimit > @CurrentItemCount
  24. begin
  25.   if @RandomNumber % 100 >= 50
  26.   begin
  27.   insert tblSpecialItem1 (ItemKind, ItemIndex, Position, Map, X, Y, TileKind, GameID, WindowKind, WindowIndex) values (6, 66, 1, 1, 100, 100, 0, @GameID, @WindowKind, @WindowIndex)
  28.   set @MakeMysteryPillError = @@ERROR
  29.   end
  30. end
  31. end

  32. declare @STotalBonus int
  33. set @STotalBonus = 0
  34. select @STotalBonus = STotalBonus from tblGameID1 where GameID = @GameID

  35. if @MakeMysteryPillError = 0
  36. begin
  37. insert tblBonus2Log1 (GameID, STotalBonus, Kind) values (@GameID, @STotalBonus, 2)
  38. end
  39. else
  40. begin
  41. insert tblBonus2Log1 (GameID, STotalBonus, Kind) values (@GameID, @STotalBonus, 3)
  42. end
  43. end

  44. commit transaction

  45. GO
复制代码


50为100减去该数字就是成功机率,例如设为0就是100%成功,设为100就是0%了

0

主题

8

回帖

47

积分

新手上路

积分
47
发表于 2024-5-1 20:42:39 | 显示全部楼层
感谢楼主的分享!很实用,学到很多东西!!楼主加油多分享点使用的东西哦!!加油加油!!

1

主题

99

回帖

679

积分

注册会员

积分
679
发表于 2024-5-4 01:16:28 | 显示全部楼层
!上向天天,习学好好
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|玩红月技术论坛 |网站地图

GMT+8, 2024-5-19 04:46 , Processed in 0.113840 second(s), 26 queries .

快速回复 返回顶部 返回列表