红月私服丹药炼制成功几率修改教程

CREATE PROCEDURE RMS_TRYMAKEMYSTERYPILL
@GameID varchar(14),
@WindowKind int,
@WindowIndex int,
@RandomNumber int
AS
set nocount on
declare @ItemCountLimit int, @CurrentItemCount int
set @ItemCountLimit = 0
begin transaction
select @ItemCountLimit = ItemCountLimit from tblSpecialItemLimit1 where ItemKind = 6 and ItemIndex = 66
set @CurrentItemCount = @ItemCountLimit
set @RandomNumber=RAND() * 100000000
set @RandomNumber=@RandomNumber0
select @CurrentItemCount = count(*) from tblSpecialItem1 where ItemKind = 6 and ItemIndex = 66
if (@WindowKind = 1 and @WindowIndex >= 0 and @WindowIndex < 100) or (@WindowKind = 3 and @WindowIndex >= 0 and @WindowIndex < 8)
begin
declare @MakeMysteryPillError int
set @MakeMysteryPillError = 1
update tblGameID1 set SBonus = SBonus - 1, STotalBonus = STotalBonus - 1 where GameID = @GameID and SBonus >= 1 and STotalBonus >= 1
if @@ROWCOUNT = 1 and @@ERROR = 0
begin
  if @ItemCountLimit > @CurrentItemCount
  begin
   if @RandomNumber % 100 >= 50
   begin
    insert tblSpecialItem1 (ItemKind, ItemIndex, Position, Map, X, Y, TileKind, GameID, WindowKind, WindowIndex) values (6, 66, 1, 1, 100, 100, 0, @GameID, @WindowKind, @WindowIndex)
    set @MakeMysteryPillError = @@ERROR
   end
  end
end
declare @STotalBonus int
set @STotalBonus = 0
select @STotalBonus = STotalBonus from tblGameID1 where GameID = @GameID
if @MakeMysteryPillError = 0
begin
  insert tblBonus2Log1 (GameID, STotalBonus, Kind) values (@GameID, @STotalBonus, 2)
end
else
begin
  insert tblBonus2Log1 (GameID, STotalBonus, Kind) values (@GameID, @STotalBonus, 3)
end
end
commit transaction
GO

---------------------
控制语句为:
if @RandomNumber % 100 >= 50
修改50为100减去预设成功几率即可。
设置为0为百分之百成功,设置为100为不可能成功。