赞 | 0 |
VIP | 46 |
好人卡 | 26 |
积分 | 6 |
经验 | 76056 |
最后登录 | 2024-10-4 |
在线时间 | 2657 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 633
- 在线时间
- 2657 小时
- 注册时间
- 2010-6-28
- 帖子
- 1361
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 我的米呀 于 2011-12-26 20:26 编辑
- #【【源地址:www.rpgrevolution.com/】】
- module SlotMachine
- #在游戏中使用方法:在事件中的脚本里写上$scene = Scene_Slots.new后触发本事件使用。
- # This is how much gold is required to play the game.玩一次花的钱。
- GOLD_TAKEN_AWAY_PER_TRY = 50
-
- # These are the icons in every slot. Each slot will have these icons, but引用的ICON图像
- # in a shuffled order. You may repeat icons so they are more common to appear.
- SLOT_ICONS = [215, 215, 215, 215, 215, 215, 168, 168, 168, 168, 168, 172, 172, 172, 172, 169, 169, 169, 173, 194]
-
- # This sound effect will play every change.拉动扳手使老虎机转起来的声音。
- CHANGE_SE = "Cursor"
-
- # This sound effect will play if you lose.输掉的声音
- LOSER_SE = "Buzzer2"
-
- # This sound effect will play if you win.赢得声音
- WINNER_SE = "Applause"
-
- SLOT_WIN = [] # Don't Touch不要改这里。
-
- # Below are configurations for win possibilities. The script will check if the这里是设定赢的形式,如果不会修改请勿动。
- # middle three icons are the same as the ids you put in below. The fourth第四个数字是当产生这种图案时赢的钱的数目。
- # number is how much gold they will win for this.
-
- SLOT_WIN[0] = [194, 194, 194, 20000] # SLOT_WIN[id] = [icon, icon, icon, winnings]
-
- SLOT_WIN[1] = [215, 215, 215, 75] # SLOT_WIN[id] = [icon, icon, icon, winnings]
-
- SLOT_WIN[2] = [168, 168, 168, 100]
-
- SLOT_WIN[3] = [172, 172, 172, 300]
-
- SLOT_WIN[4] = [169, 169, 169, 500]
-
- SLOT_WIN[5] = [173, 173, 173, 750]
-
- end
- #===============================================================================
- # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.如果你不会脚本就别动下面的脚本!!!!!!
- #===============================================================================
- class Array
-
- def shuffle
- na = self.dup
- (na.length-1).downto(1) do |i|
- s = rand(i)
- na[i], na[s] = na[s], na[i]
- end
- return na
- end
- end
-
- class Window_Slots < Window_Base
-
- include SlotMachine
-
- def initialize
- super(180, 100, 184, 184)
- refresh
- end
-
- def refresh
- draw_icon($game_system.slot1[0], 10, 10)
- draw_icon($game_system.slot1[1], 10, 65)
- draw_icon($game_system.slot1[2], 10, 120)
- draw_icon($game_system.slot2[0], 60, 10)
- draw_icon($game_system.slot2[1], 60, 65)
- draw_icon($game_system.slot2[2], 60, 120)
- draw_icon($game_system.slot3[0], 110, 10)
- draw_icon($game_system.slot3[1], 110, 65)
- draw_icon($game_system.slot3[2], 110, 120)
- end
-
- def roll
- slot1roll, slot2roll, slot3roll = rand(15) + 5, rand(15) + 5, rand(15) + 5
- slot1moves, slot2moves, slot3moves = 0, 0, 0
- loop do
- self.contents.clear
- slot1moves += 1 unless slot1moves == slot1roll
- slot2moves += 1 unless slot2moves == slot2roll
- slot3moves += 1 unless slot3moves == slot3roll
- draw_icon($game_system.slot1[0], 10, 10)
- draw_icon($game_system.slot1[1], 10, 65)
- draw_icon($game_system.slot1[2], 10, 120)
- draw_icon($game_system.slot2[0], 60, 10)
- draw_icon($game_system.slot2[1], 60, 65)
- draw_icon($game_system.slot2[2], 60, 120)
- draw_icon($game_system.slot3[0], 110, 10)
- draw_icon($game_system.slot3[1], 110, 65)
- draw_icon($game_system.slot3[2], 110, 120)
- stuff1 = $game_system.slot1[$game_system.slot1.size - 1]
- stuff2 = $game_system.slot2[$game_system.slot2.size - 1]
- stuff3 = $game_system.slot3[$game_system.slot3.size - 1]
- unless slot1moves == slot1roll
- $game_system.slot1.delete_at($game_system.slot1.size - 1)
- $game_system.slot1.insert(0, stuff1)
- RPG::SE.new(CHANGE_SE, 80, 100).play
- end
- unless slot2moves == slot2roll
- $game_system.slot2.delete_at($game_system.slot2.size - 1)
- $game_system.slot2.insert(0, stuff2)
- RPG::SE.new(CHANGE_SE, 80, 100).play
- end
- unless slot3moves == slot3roll
- $game_system.slot3.delete_at($game_system.slot3.size - 1)
- $game_system.slot3.insert(0, stuff3)
- RPG::SE.new(CHANGE_SE, 80, 100).play
- end
- Graphics.wait(5)
- break if slot1moves == slot1roll && slot2moves == slot2roll && slot3moves == slot3roll
- end
- $won_gold = 0
- for i in 0..(SLOT_WIN.size - 1)
- next unless SLOT_WIN[i][0] == $game_system.slot1[0] and SLOT_WIN[i][1] == $game_system.slot2[0] and SLOT_WIN[i][2] == $game_system.slot3[0]
- $game_party.gain_gold(SLOT_WIN[i][3])
- $won_gold += SLOT_WIN[i][3]
- self.contents.clear
- draw_icon($game_system.slot1[0], 10, 10)
- draw_icon($game_system.slot1[1], 10, 65, false)
- draw_icon($game_system.slot1[2], 10, 120, false)
- draw_icon($game_system.slot2[0], 60, 10)
- draw_icon($game_system.slot2[1], 60, 65, false)
- draw_icon($game_system.slot2[2], 60, 120, false)
- draw_icon($game_system.slot3[0], 110, 10)
- draw_icon($game_system.slot3[1], 110, 65, false)
- draw_icon($game_system.slot3[2], 110, 120, false)
- $resultslot = true
- end
- for i in 0...(SLOT_WIN.size - 1)
- next unless SLOT_WIN[i][0] == $game_system.slot1[1] and SLOT_WIN[i][1] == $game_system.slot2[1] and SLOT_WIN[i][2] == $game_system.slot3[1]
- $game_party.gain_gold(SLOT_WIN[i][3])
- $won_gold += SLOT_WIN[i][3]
- self.contents.clear
- draw_icon($game_system.slot1[0], 10, 10, false)
- draw_icon($game_system.slot1[1], 10, 65)
- draw_icon($game_system.slot1[2], 10, 120, false)
- draw_icon($game_system.slot2[0], 60, 10, false)
- draw_icon($game_system.slot2[1], 60, 65)
- draw_icon($game_system.slot2[2], 60, 120, false)
- draw_icon($game_system.slot3[0], 110, 10, false)
- draw_icon($game_system.slot3[1], 110, 65)
- draw_icon($game_system.slot3[2], 110, 120, false)
- $resultslot = true
- end
- for i in 0...(SLOT_WIN.size - 1)
- next unless SLOT_WIN[i][0] == $game_system.slot1[2] and SLOT_WIN[i][1] == $game_system.slot2[2] and SLOT_WIN[i][2] == $game_system.slot3[2]
- $game_party.gain_gold(SLOT_WIN[i][3])
- $won_gold += SLOT_WIN[i][3]
- self.contents.clear
- draw_icon($game_system.slot1[0], 10, 10, false)
- draw_icon($game_system.slot1[1], 10, 65, false)
- draw_icon($game_system.slot1[2], 10, 120)
- draw_icon($game_system.slot2[0], 60, 10, false)
- draw_icon($game_system.slot2[1], 60, 65, false)
- draw_icon($game_system.slot2[2], 60, 120)
- draw_icon($game_system.slot3[0], 110, 10, false)
- draw_icon($game_system.slot3[1], 110, 65, false)
- draw_icon($game_system.slot3[2], 110, 120)
- $resultslot = true
- end
- for i in 0...(SLOT_WIN.size - 1)
- next unless SLOT_WIN[i][0] == $game_system.slot1[0] and SLOT_WIN[i][1] == $game_system.slot2[1] and SLOT_WIN[i][2] == $game_system.slot3[2]
- $game_party.gain_gold(SLOT_WIN[i][3])
- $won_gold += SLOT_WIN[i][3]
- self.contents.clear
- draw_icon($game_system.slot1[0], 10, 10)
- draw_icon($game_system.slot1[1], 10, 65, false)
- draw_icon($game_system.slot1[2], 10, 120, false)
- draw_icon($game_system.slot2[0], 60, 10, false)
- draw_icon($game_system.slot2[1], 60, 65)
- draw_icon($game_system.slot2[2], 60, 120, false)
- draw_icon($game_system.slot3[0], 110, 10, false)
- draw_icon($game_system.slot3[1], 110, 65, false)
- draw_icon($game_system.slot3[2], 110, 120)
- $resultslot = true
- end
- for i in 0...(SLOT_WIN.size - 1)
- next unless SLOT_WIN[i][0] == $game_system.slot1[2] and SLOT_WIN[i][1] == $game_system.slot2[1] and SLOT_WIN[i][2] == $game_system.slot3[0]
- $game_party.gain_gold(SLOT_WIN[i][3])
- $won_gold += SLOT_WIN[i][3]
- self.contents.clear
- draw_icon($game_system.slot1[0], 10, 10, false)
- draw_icon($game_system.slot1[1], 10, 65, false)
- draw_icon($game_system.slot1[2], 10, 120)
- draw_icon($game_system.slot2[0], 60, 10, false)
- draw_icon($game_system.slot2[1], 60, 65)
- draw_icon($game_system.slot2[2], 60, 120, false)
- draw_icon($game_system.slot3[0], 110, 10)
- draw_icon($game_system.slot3[1], 110, 65, false)
- draw_icon($game_system.slot3[2], 110, 120, false)
- $resultslot = true
- end
- $resultslot = false if $result.nil? && $resultslot != true
- end
- end
- class Game_System
-
- include SlotMachine
-
- attr_accessor :slot1, :slot2, :slot3
-
- alias jet8911_initialize initialize
- def initialize
- jet8911_initialize
- @slot1 = SLOT_ICONS.shuffle
- @slot2 = @slot1.shuffle
- @slot3 = @slot2.shuffle
- end
- end
- class Scene_Slots < Scene_Base
-
- include SlotMachine
-
- def start
- super
- create_menu_background
- @slot_window = Window_Slots.new
- @help_window = Window_Help.new
- @help_window.set_text("将金钱掷于你的运气吧!只需 " + GOLD_TAKEN_AWAY_PER_TRY.to_s + Vocab.gold + "!", 1)
- @play_again = Window_Command.new(150, ["玩", "不玩"])
- @play_again.active = true
- @play_again.x = 196
- @play_again.y = 300
- @gold_window = Window_Gold.new(0, 360)
- end
-
- def terminate
- super
- dispose_menu_background
- @slot_window.dispose
- @help_window.dispose
- @play_again.dispose
- @gold_window.dispose
- end
-
- def update
- super
- @play_again.update if @play_again.active
- if Input.trigger?(Input::C)
- if @play_again.active
- case @play_again.index
- when 0
- if $game_party.gold >= GOLD_TAKEN_AWAY_PER_TRY
- $game_party.lose_gold(GOLD_TAKEN_AWAY_PER_TRY)
- @gold_window.refresh
- @play_again.active = false
- @slot_window.roll
- case $resultslot
- when true
- @help_window.set_text("恭喜!你赢了 " + $won_gold.to_s + Vocab.gold + "!", 1)
- @gold_window.refresh
- RPG::SE.new(WINNER_SE, 80, 100).play
- $resultslot = false
- when false
- @help_window.set_text("抱歉,你输了!", 1)
- RPG::SE.new(LOSER_SE, 80, 100).play
- end
- else
- @help_window.set_text("你没有足够的 " + Vocab.gold + " !", 1)
- end
- when 1
- $scene = Scene_Map.new
- end
- else
- @help_window.set_text("将金钱掷于你的运气吧!只需 " + GOLD_TAKEN_AWAY_PER_TRY.to_s + Vocab.gold + "!", 1)
- @play_again.active = true
- end
- elsif Input.trigger?(Input::B)
- $scene = Scene_Map.new
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|