设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
楼主: frantice
打印 上一主题 下一主题

[RM脚本] 脚本以及工程预留帖

 关闭 [复制链接]

Lv2.观梦者

梦石
0
星屑
280
在线时间
1374 小时
注册时间
2005-10-16
帖子
5113

贵宾

11
发表于 2006-7-17 23:07:49 | 只看该作者
这几个点出来的小图不错~~{/dy}
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

堕落天使

梦石
0
星屑
55
在线时间
73 小时
注册时间
2005-10-22
帖子
337
12
发表于 2006-7-17 23:26:37 | 只看该作者
好东西,特别是第二个,醒目一下~
厌世了……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

查无此人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2006-5-8
帖子
1399
13
 楼主| 发表于 2006-7-18 16:55:30 | 只看该作者
7月18日更新第3楼

7月18日 更新
脚本名:自动战斗选项
作者:Thousand Dragoon Link 和 Sir_KnightDragoon
出处:同上
说明:一个很简单的脚本,就是在“战斗”“逃跑”指令旁边加上个“自动战斗”的选项,选择后全体队员自动普通攻击一回合。
用法:插入到Main前
补充:如果冲突了什么什么的,自己斟酌着整吧。^0^

  1. #==============================================================================
  2. # | Auto_Battle
  3. #------------------------------------------------------------------------------
  4. # 作者 Thousand Dragoon Link 和 Sir_KnightDragoon

  5. #==============================================================================
  6. class Scene_Battle
  7. #--------------------------------------------------------------------------
  8. # 刷新同伴指令
  9. #--------------------------------------------------------------------------
  10. def update_phase2
  11. if Input.trigger?(Input::C)
  12. case @party_command_window.index
  13. when 0 # 战斗
  14. # 是否播放SE
  15. $game_system.se_play($data_system.decision_se)
  16. start_phase3
  17. when 1 # 逃跑
  18. # 不能逃跑时
  19. if $game_temp.battle_can_escape == false
  20. $game_system.se_play($data_system.buzzer_se)
  21. return
  22. end
  23. $game_system.se_play($data_system.decision_se)
  24. update_phase2_escape
  25. when 2 #自动战斗
  26. $game_system.se_play($data_system.decision_se)
  27. update_phase2_auto
  28. end
  29. return
  30. end
  31. end
  32. #--------------------------------------------------------------------------
  33. # 自动战斗指令刷新
  34. #--------------------------------------------------------------------------
  35. def update_phase2_auto
  36. loop do
  37. if @actor_index == $game_party.actors.size-1
  38. start_phase4
  39. return
  40. end
  41. @actor_index += 1
  42. $game_party.actors[@actor_index].current_action.kind = 0
  43. $game_party.actors[@actor_index].current_action.basic = 0
  44. $game_party.actors[@actor_index].current_action.decide_random_target_for_actor
  45. end
  46. end
  47. end

  48. class Window_PartyCommand < Window_Selectable
  49. #--------------------------------------------------------------------------
  50. # 目标初始化
  51. #--------------------------------------------------------------------------
  52. def initialize
  53. super(0, 0, 640, 64)
  54. self.contents = Bitmap.new(width - 32, height - 32)
  55. self.back_opacity = 160
  56. self.contents.font.name = "黑体"
  57. self.contents.font.size = 18
  58. @commands = ["战斗", "逃跑", "自动战斗"]
  59. @item_max = 3
  60. @column_max = 3
  61. draw_item(0, normal_color)
  62. draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
  63. draw_item(2, normal_color)
  64. self.active = false
  65. self.visible = false
  66. self.index = 0
  67. end
  68. #--------------------------------------------------------------------------
  69. def draw_item(index, color)
  70. self.contents.font.color = color
  71. rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
  72. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  73. self.contents.draw_text(rect, @commands[index], 1)
  74. end
  75. #--------------------------------------------------------------------------
  76. # 刷新光标
  77. #--------------------------------------------------------------------------
  78. def update_cursor_rect
  79. self.cursor_rect.set(80 + index * 160, 0, 128, 32)
  80. end
  81. end

复制代码
KRKR + NS 学习中..........
回复 支持 反对

使用道具 举报

Lv1.梦旅人

查无此人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2006-5-8
帖子
1399
14
 楼主| 发表于 2006-7-18 16:56:14 | 只看该作者
7月18日更新

整合商店界面脚本
来源:同上
由于是多人合作的结果,所以明天一一把作者列出。
介绍:一个比较漂亮的商店界面,如果拓展下功能加入图片之类的话就能形成更灵活
      的界面(比如放进小2的图片什么之类的)
说明:脚本很长很长,事实上工作原理很简单。

PART1
  1. #==============================================================================
  2. # ■ Window_Base
  3. #------------------------------------------------------------------------------
  4. # 添加两种颜色
  5. #==============================================================================

  6. class Window_Base < Window
  7. # --------------------------------
  8. def up_color
  9.   return Color.new(74, 210, 74)
  10. end
  11. # --------------------------------
  12. def down_color
  13.   return Color.new(170, 170, 170)
  14. end
  15. end

  16. #==============================================================================
  17. # | Window_ShopCommand
  18. #------------------------------------------------------------------------------
  19. #==============================================================================

  20. class Window_ShopCommand < Window_Selectable
  21. #--------------------------------------------------------------------------
  22. # 初始化
  23. #--------------------------------------------------------------------------
  24. def initialize
  25.   super(0, 64, 428, 64)
  26.   self.contents = Bitmap.new(width - 32, height - 32)
  27.   self.contents.font.name = "宋体"
  28.   self.contents.font.size = 18
  29.   self.opacity = 130
  30.   @item_max = 4
  31.   @column_max = 4
  32.   @commands = ["购买", "卖出", "装备", "取消"]
  33.   refresh
  34.   self.index = 0
  35. end
  36. #--------------------------------------------------------------------------
  37. # 刷新
  38. #--------------------------------------------------------------------------
  39. def refresh
  40.   self.contents.clear
  41.   for i in 0...@item_max
  42.     draw_item(i)
  43.   end
  44. end
  45. #--------------------------------------------------------------------------
  46. # 描绘物品
  47. #     
  48. #--------------------------------------------------------------------------
  49. def draw_item(index)
  50.   x = 4 + index * 107
  51.   self.contents.draw_text(x, 0, 128, 32, @commands[index])
  52. end
  53. end

  54. #==============================================================================
  55. # ■ Window_Help
  56. #--------------------
  57. # 一个新的窗口
  58. #==============================================================================

  59. class Window_Help2 < Window_Base
  60. #--------------------------------------------------------------------------
  61. # ●初始化
  62. #--------------------------------------------------------------------------
  63. def initialize
  64.   super(80, 70, 480, 64)
  65.   self.contents = Bitmap.new(width - 32, height - 32)
  66.   self.contents.font.name = "宋体"
  67.   self.contents.font.size = 17
  68.   self.opacity = 130
  69. end
  70. #--------------------------------------------------------------------------
  71. def set_text(text, align = 0)
  72.   if text != @text or align != @align
  73.     self.contents.clear
  74.     self.contents.font.color = normal_color
  75.     self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  76.     @text = text
  77.     @align = align
  78.     @actor = nil
  79.   end
  80.   self.visible = true
  81. end

  82. #--------------------------------------------------------------------------
  83. def set_actor(actor)
  84.   if actor != @actor
  85.     self.contents.clear
  86.     draw_actor_name(actor, 4, 0)
  87.     draw_actor_state(actor, 140, 0)
  88.     draw_actor_hp(actor, 284, 0)
  89.     draw_actor_sp(actor, 460, 0)
  90.     @actor = actor
  91.     @text = nil
  92.     self.visible = true
  93.   end
  94. end

  95. #--------------------------------------------------------------------------
  96. def set_enemy(enemy)
  97.   text = enemy.name
  98.   state_text = make_battler_state_text(enemy, 112, false)
  99.   if state_text != ""
  100.     text += "  " + state_text
  101.   end
  102.   set_text(text, 1)
  103. end
  104. end

  105. #==============================================================================
  106. # ■ Window_Gold
  107. #------------------------------------------------------------------------------
  108. # 新的金钱窗口
  109. #==============================================================================

  110. class Window_Gold2 < Window_Base

  111. #--------------------------------------------------------------------------
  112. def initialize
  113.   super(0, 0, 160, 64)
  114.   self.contents = Bitmap.new(width - 32, height - 32)
  115.   self.contents.font.name = "宋体"
  116.   self.contents.font.size = 18
  117.   self.opacity = 130
  118.   refresh
  119. end

  120. #--------------------------------------------------------------------------
  121. def refresh
  122.   self.contents.clear
  123.   cx = contents.text_size($data_system.words.gold).width
  124.   self.contents.font.color = normal_color
  125.   self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
  126.   self.contents.font.color = system_color
  127.   self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  128. end
  129. end

  130. #==============================================================================
  131. # ■ Window_Equipment
  132. #------------------------------------------------------------------------------
  133. # 强化装备窗口
  134. #==============================================================================

  135. class Window_Equipment < Window_Base

  136. #--------------------------------------------------------------------------
  137. def initialize
  138.   super(240, 8, 160, 64)
  139.   self.contents = Bitmap.new(width - 32, height - 32)
  140.   self.contents.font.name = "宋体"
  141.   self.contents.font.size = 17
  142.   self.opacity = 130
  143.   refresh
  144. end

  145. #--------------------------------------------------------------------------
  146. def refresh
  147.   self.contents.clear
  148.   self.contents.font.color = normal_color
  149.   self.contents.draw_text(28, 0, 96, 32, " 装备")   
  150. end
  151. end

  152. ############新的装备左窗口################

  153. class Window_EquipLeft2 < Window_Base
  154. # --------------------------------
  155. attr_accessor :mode
  156. attr_accessor :changes
  157. # --------------------------------
  158. def initialize(actor)
  159.   super(0, 130, 320, 260)
  160.   self.contents = Bitmap.new(width - 32, height - 32)
  161.   self.contents.font.name = "宋体"
  162.   self.contents.font.size = 17
  163.   self.opacity = 130
  164.   self.z += 100
  165.   @actor = actor
  166.   @mode = 0
  167.   @changes = [0, 0, 0, 0, 0, 0, 0, 0]
  168.   @elem_text = ""
  169.   @stat_text = ""
  170.   refresh
  171. end
  172. # --------------------------------
  173. def refresh
  174.   self.contents.clear
  175.   draw_actor_name(@actor, 4, 0)
  176.   draw_actor_level(@actor, 140, 0)
  177.   draw_actor_parameter(@actor, 4, 18, 0)
  178.   draw_actor_parameter(@actor, 4, 36, 1)
  179.   draw_actor_parameter(@actor, 4, 54, 2)
  180.   draw_actor_parameter(@actor, 4, 72, 3)

  181.   draw_actor_parameter(@actor, 4, 90, 4)
  182.   draw_actor_parameter(@actor, 4, 108, 5)
  183.   draw_actor_parameter(@actor, 4, 126, 6)
  184.   if @mode == 0
  185.     self.contents.font.color = up_color
  186.     self.contents.draw_text(4, 144, 200, 32, "攻击")
  187.   end
  188.   if @mode == 1
  189.     self.contents.font.color = up_color
  190.     self.contents.draw_text(4, 144, 200, 32, "防御")
  191.   end
  192.   self.contents.font.color = normal_color
  193.   self.contents.draw_text(12, 162, 220, 32, @elem_text)
  194.   self.contents.draw_text(12, 198, 220, 32, @stat_text)
  195.   if @new_atk != nil
  196.     self.contents.font.color = system_color
  197.     self.contents.draw_text(160, 18, 40, 32, "  =", 1)
  198.     if @changes[0] == 0
  199.       self.contents.font.color = normal_color
  200.     elsif @changes[0] == -1
  201.       self.contents.font.color = down_color
  202.     else
  203.       self.contents.font.color = up_color
  204.     end
  205.     self.contents.draw_text(200, 18, 36, 32, @new_atk.to_s, 2)
  206.   end
  207.   if @new_pdef != nil
  208.     self.contents.font.color = system_color
  209.     self.contents.draw_text(160, 36, 40, 32, "  =", 1)
  210.     if @changes[1] == 0
  211.       self.contents.font.color = normal_color
  212.     elsif @changes[1] == -1
  213.       self.contents.font.color = down_color
  214.     else
  215.       self.contents.font.color = up_color
  216.     end
  217.     self.contents.draw_text(200, 36, 36, 32, @new_pdef.to_s, 2)
  218.   end
  219.   if @new_mdef != nil
  220.     self.contents.font.color = system_color
  221.     self.contents.draw_text(160, 54, 40, 32, "  =", 1)
  222.     if @changes[2] == 0
  223.       self.contents.font.color = normal_color
  224.     elsif @changes[2] == -1
  225.       self.contents.font.color = down_color
  226.     else
  227.       self.contents.font.color = up_color
  228.     end
  229.     self.contents.draw_text(200, 54, 36, 32, @new_mdef.to_s, 2)
  230.   end
  231.   if @new_str != nil
  232.     self.contents.font.color = system_color
  233.     self.contents.draw_text(160, 72, 40, 32, "  =", 1)
  234.     if @changes[3] == 0
  235.       self.contents.font.color = normal_color
  236.     elsif @changes[3] == -1
  237.       self.contents.font.color = down_color
  238.     else
  239.       self.contents.font.color = up_color
  240.     end
  241.     self.contents.draw_text(200, 72, 36, 32, @new_str.to_s, 2)
  242.   end
  243.    if @new_dex != nil
  244.     self.contents.font.color = system_color
  245.     self.contents.draw_text(160, 90, 40, 32, "  =", 1)
  246.     if @changes[4] == 0
  247.       self.contents.font.color = normal_color
  248.     elsif @changes[4] == -1
  249.       self.contents.font.color = down_color
  250.     else
  251.       self.contents.font.color = up_color
  252.     end
  253.     self.contents.draw_text(200, 90, 36, 32, @new_dex.to_s, 2)
  254.   end
  255.     if @new_agi != nil
  256.     self.contents.font.color = system_color
  257.     self.contents.draw_text(160, 108, 40, 32, "  =", 1)
  258.     if @changes[5] == 0
  259.       self.contents.font.color = normal_color
  260.     elsif @changes[5] == -1
  261.       self.contents.font.color = down_color
  262.     else
  263.       self.contents.font.color = up_color
  264.     end
  265.     self.contents.draw_text(200, 108, 36, 32, @new_agi.to_s, 2)
  266.   end
  267.     if @new_int != nil
  268.     self.contents.font.color = system_color
  269.     self.contents.draw_text(160, 126, 40, 32, "  =", 1)
  270.     if @changes[6] == 0
  271.       self.contents.font.color = normal_color
  272.     elsif @changes[6] == -1
  273.       self.contents.font.color = down_color
  274.     else
  275.       self.contents.font.color = up_color
  276.     end
  277.     self.contents.draw_text(200, 126, 36, 32, @new_int.to_s, 2)
  278.   end
  279. end
  280. # --------------------------------
  281. def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
  282.   new_agi, new_int, new_eva, elem_text, stat_text)
  283.   flag = false
  284.   if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
  285.     flag = true
  286.   end
  287.   if new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
  288.     flag = true
  289.   end
  290.    if new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
  291.     flag = true
  292.   end
  293.     @new_atk = new_atk
  294.     @new_pdef = new_pdef
  295.     @new_mdef = new_mdef
  296.     @new_str = new_str
  297.     @new_dex = new_dex
  298.     @new_agi = new_agi
  299.     @new_int = new_int
  300.     @new_eva = new_eva
  301.     @elem_text = elem_text
  302.     @stat_text = stat_text
  303.     if flag
  304.       refresh
  305.     end
  306. end
  307. end

  308. #==============================================================================
  309. # ■ Window_EquipRight
  310. #------------------------------------------------------------------------------
  311. # 新的装备右窗口
  312. #==============================================================================

  313. class Window_EquipRight2 < Window_Selectable

  314. #--------------------------------------------------------------------------
  315. def initialize(actor)
  316.   super(320, 130, 320, 260)
  317.   self.contents = Bitmap.new(width - 32, height - 32)
  318.   self.contents.font.name = "宋体"
  319.   self.contents.font.size = 17
  320.   self.opacity = 130
  321.   @actor = actor
  322.   refresh
  323.   self.index = 0
  324. end

  325. #--------------------------------------------------------------------------
  326. def item
  327.   return @data[self.index]
  328. end

  329. #--------------------------------------------------------------------------
  330. def refresh
  331.   self.contents.clear
  332.   @data = []
  333.   @data.push($data_weapons[@actor.weapon_id])
  334.   @data.push($data_armors[@actor.armor1_id])
  335.   @data.push($data_armors[@actor.armor2_id])
  336.   @data.push($data_armors[@actor.armor3_id])
  337.   @data.push($data_armors[@actor.armor4_id])
  338.   @item_max = @data.size
  339.   self.contents.font.color = system_color
  340.   self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  341.   self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  342.   self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  343.   self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  344.   self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  345.   draw_item_name(@data[0], 92, 32 * 0)
  346.   draw_item_name(@data[1], 92, 32 * 1)
  347.   draw_item_name(@data[2], 92, 32 * 2)
  348.   draw_item_name(@data[3], 92, 32 * 3)
  349.   draw_item_name(@data[4], 92, 32 * 4)
  350. end

  351. #--------------------------------------------------------------------------
  352. def update_help
  353.   @help_window.set_text(self.item == nil ? "" : self.item.description)
  354. end
  355. end

  356. ############新的装备物品窗口################3
  357. class Window_EquipItem2 < Window_Selectable
  358. # --------------------------------
  359. def initialize(actor, equip_type)
  360.   super(100, 390, 428, 64)
  361.   self.opacity = 130
  362.   @actor = actor
  363.   @equip_type = equip_type
  364.   @column_max = 2
  365.   refresh
  366.   self.active = false
  367.   self.index = -1
  368. end

  369. #--------------------------------------------------------------------------
  370. def item
  371.   return @data[self.index]
  372. end

  373. #--------------------------------------------------------------------------
  374. def refresh
  375.   if self.contents != nil
  376.     self.contents.dispose
  377.     self.contents = nil
  378.   end
  379.   @data = []

  380.   if @equip_type == 0
  381.     weapon_set = $data_classes[@actor.class_id].weapon_set
  382.     for i in 1...$data_weapons.size
  383.       if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  384.         @data.push($data_weapons[i])
  385.       end
  386.     end
  387.   end

  388.   if @equip_type != 0
  389.     armor_set = $data_classes[@actor.class_id].armor_set
  390.     for i in 1...$data_armors.size
  391.       if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  392.         if $data_armors[i].kind == @equip_type-1
  393.           @data.push($data_armors[i])
  394.         end
  395.       end
  396.     end
  397.   end

  398.   @data.push(nil)

  399.   @item_max = @data.size
  400.   self.contents = Bitmap.new(width - 32, row_max * 32)
  401.   self.contents.font.name = "宋体"
  402.   self.contents.font.size = 17
  403.   for i in 0...@item_max-1
  404.     draw_item(i)
  405.   end
  406. end

  407. #--------------------------------------------------------------------------
  408. def draw_item(index)
  409.   item = @data[index]
  410.   x = 4 + index % 2 * (182 + 32)
  411.   y = index / 2 * 32
  412.   case item
  413.   when RPG::Weapon
  414.     number = $game_party.weapon_number(item.id)
  415.   when RPG::Armor
  416.     number = $game_party.armor_number(item.id)
  417.   end
  418.   bitmap = RPG::Cache.icon(item.icon_name)
  419.   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  420.   self.contents.font.color = normal_color
  421.   self.contents.font.name = "宋体"
  422.   self.contents.font.size = 17
  423.   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  424.   self.contents.draw_text(x + 132, y, 16, 32, ":", 1)
  425.   self.contents.draw_text(x + 140, y, 24, 32, number.to_s, 2)
  426. end

  427. #--------------------------------------------------------------------------
  428. def update_help
  429.   @help_window.set_text(self.item == nil ? "" : self.item.description)
  430. end
  431. end
复制代码




KRKR + NS 学习中..........
回复 支持 反对

使用道具 举报

Lv1.梦旅人

月下可怜人

梦石
0
星屑
50
在线时间
10 小时
注册时间
2005-11-23
帖子
4085

第1届短篇游戏比赛亚军

15
发表于 2006-7-18 17:17:44 | 只看该作者
那个天气非常不错,谢谢,收了。
纵然千里外,我等雁归来。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

16
发表于 2006-7-18 18:29:31 | 只看该作者
不错诶…………{/cy}{/cy}
天气那个能显示在图片之上吗?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

查无此人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2006-5-8
帖子
1399
17
 楼主| 发表于 2006-7-18 22:33:50 | 只看该作者
接上7月18日更新的商店整合脚本

PART2
  1. #==============================================================================
  2. # | Window_ShopBuy
  3. #------------------------------------------------------------------------------
  4. # 商店购买窗口
  5. #==============================================================================

  6. class Window_ShopBuy < Window_Selectable

  7. #--------------------------------------------------------------------------
  8. def initialize(shop_goods)
  9.   super(0, 130, 320, 260)
  10.   self.opacity = 130
  11.   @shop_goods = shop_goods
  12.   refresh
  13.   self.index = 0
  14. end

  15. #--------------------------------------------------------------------------
  16. def item
  17.   return @data[self.index]
  18. end

  19. #--------------------------------------------------------------------------
  20. def refresh
  21.   if self.contents != nil
  22.     self.contents.dispose
  23.     self.contents = nil
  24.   end
  25.   @data = []
  26.   for goods_item in @shop_goods
  27.     case goods_item[0]
  28.     when 0
  29.       item = $data_items[goods_item[1]]
  30.     when 1
  31.       item = $data_weapons[goods_item[1]]
  32.     when 2
  33.       item = $data_armors[goods_item[1]]
  34.     end
  35.     if item != nil
  36.       @data.push(item)
  37.     end
  38.   end

  39.   @item_max = @data.size
  40.   if @item_max > 0
  41.     self.contents = Bitmap.new(width - 32, row_max * 32)
  42.     self.contents.font.name = "宋体"
  43.     self.contents.font.size = 18
  44.     for i in 0...@item_max
  45.       draw_item(i)
  46.     end
  47.   end
  48. end

  49. #--------------------------------------------------------------------------
  50. def draw_item(index)
  51.   item = @data[index]

  52.   case item
  53.   when RPG::Item
  54.     number = $game_party.item_number(item.id)
  55.   when RPG::Weapon
  56.     number = $game_party.weapon_number(item.id)
  57.   when RPG::Armor
  58.     number = $game_party.armor_number(item.id)
  59.   end

  60.   if item.price <= $game_party.gold and number < 99
  61.     self.contents.font.color = normal_color
  62.   else
  63.     self.contents.font.color = disabled_color
  64.   end
  65.   x = 4
  66.   y = index * 32
  67.   rect = Rect.new(x, y, self.width - 32, 32)
  68.   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  69.   bitmap = RPG::Cache.icon(item.icon_name)
  70.   opacity = self.contents.font.color == normal_color ? 255 : 128
  71.   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  72.   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  73.   self.contents.draw_text(x + 190, y, 88, 32, item.price.to_s, 2)
  74. end

  75. #--------------------------------------------------------------------------
  76. def update_help
  77.   @help_window.set_text(self.item == nil ? "" : self.item.description)
  78. end
  79. end





  80. #==============================================================================
  81. # | Window_ShopSell
  82. #------------------------------------------------------------------------------
  83. # 商店卖出窗口
  84. #==============================================================================

  85. class Window_ShopSell < Window_Selectable

  86. #--------------------------------------------------------------------------
  87. def initialize
  88.   super(320, 130, 320, 260)
  89.   self.opacity = 130
  90.   @column_max = 1
  91.   refresh
  92.   self.index = 0
  93. end

  94. #--------------------------------------------------------------------------
  95. def item
  96.   return @data[self.index]
  97. end

  98. #--------------------------------------------------------------------------
  99. def refresh
  100.   if self.contents != nil
  101.     self.contents.dispose
  102.     self.contents = nil
  103.   end
  104.   @data = []
  105.   for i in 1...$data_items.size
  106.     if $game_party.item_number(i) > 0
  107.       @data.push($data_items[i])
  108.     end
  109.   end
  110.   for i in 1...$data_weapons.size
  111.     if $game_party.weapon_number(i) > 0
  112.       @data.push($data_weapons[i])
  113.     end
  114.   end
  115.   for i in 1...$data_armors.size
  116.     if $game_party.armor_number(i) > 0
  117.       @data.push($data_armors[i])
  118.     end
  119.   end

  120.   @item_max = @data.size
  121.   if @item_max > 0
  122.     self.contents = Bitmap.new(width - 32, row_max * 32)
  123.     self.contents.font.name = "宋体"
  124.     self.contents.font.size = 18
  125.     for i in 0...@item_max
  126.       draw_item(i)
  127.     end
  128.   end
  129. end

  130. #--------------------------------------------------------------------------
  131. def draw_item(index)
  132.   item = @data[index]
  133.   case item
  134.   when RPG::Item
  135.     number = $game_party.item_number(item.id)
  136.   when RPG::Weapon
  137.     number = $game_party.weapon_number(item.id)
  138.   when RPG::Armor
  139.     number = $game_party.armor_number(item.id)
  140. end

  141.   if item.price > 0
  142.     self.contents.font.color = normal_color
  143.   else
  144.     self.contents.font.color = disabled_color
  145.   end
  146.   x = 4 + index % 1 * (288 + 32)
  147.   y = index / 1 * 32
  148.   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  149.   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  150.   bitmap = RPG::Cache.icon(item.icon_name)
  151.   opacity = self.contents.font.color == normal_color ? 255 : 128
  152.   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  153.   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  154.   self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  155.   self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  156. end

  157. #--------------------------------------------------------------------------
  158. def update_help
  159.   @help_window.set_text(self.item == nil ? "" : self.item.description)
  160. end

  161. end


  162. #==============================================================================
  163. # | Window_ShopNumber
  164. #------------------------------------------------------------------------------
  165. # 商店数值输入窗口
  166. #==============================================================================

  167. class Window_ShopNumber < Window_Base

  168. #--------------------------------------------------------------------------
  169. def initialize
  170.   super(0, 130, 320, 260)
  171.   self.contents = Bitmap.new(width - 32, height - 32)
  172.   self.contents.font.name = "宋体"
  173.   self.contents.font.size = 18
  174.   self.opacity = 130
  175.   @item = nil
  176.   @max = 1
  177.   @price = 0
  178.   @number = 1
  179. end

  180. #--------------------------------------------------------------------------
  181. def set(item, max, price)
  182.   @item = item
  183.   @max = max
  184.   @price = price
  185.   @number = 1
  186.   refresh
  187. end

  188. #--------------------------------------------------------------------------
  189. def number
  190.   return @number
  191. end

  192. #--------------------------------------------------------------------------
  193. def refresh
  194.   self.contents.clear
  195.   draw_item_name(@item, 4, 96)
  196.   self.contents.font.color = normal_color
  197.   self.contents.draw_text(182, 128, 32, 32, "×")
  198.   self.contents.draw_text(154, 128, 24, 32, @number.to_s, 2)
  199.   self.cursor_rect.set(304, 96, 32, 32)

  200.   domination = $data_system.words.gold
  201.   cx = contents.text_size(domination).width
  202.   total_price = @price * @number
  203.   self.contents.font.color = normal_color
  204.   self.contents.draw_text(-50, 160, 328-cx-2, 32, total_price.to_s, 2)
  205.   self.contents.font.color = system_color
  206.   self.contents.draw_text(282-cx, 160, cx, 32, domination, 2)
  207. end

  208. #--------------------------------------------------------------------------
  209. def update
  210.   super
  211.   if self.active

  212.     if Input.repeat?(Input::RIGHT) and @number < @max
  213.       $game_system.se_play($data_system.cursor_se)
  214.       @number += 1
  215.       refresh
  216.     end

  217.     if Input.repeat?(Input::LEFT) and @number > 1
  218.       $game_system.se_play($data_system.cursor_se)
  219.       @number -= 1
  220.       refresh
  221.     end

  222.     if Input.repeat?(Input::UP) and @number < @max
  223.       $game_system.se_play($data_system.cursor_se)
  224.       @number = [@number + 10, @max].min
  225.       refresh
  226.     end

  227.     if Input.repeat?(Input::DOWN) and @number > 1
  228.       $game_system.se_play($data_system.cursor_se)
  229.       @number = [@number - 10, 1].max
  230.       refresh
  231.     end
  232.   end
  233. end
  234. end

  235. #==============================================================================
  236. # | Window_ShopStatus
  237. #------------------------------------------------------------------------------
  238. #  商店状态窗口~这个在论坛上可以找到(一段不好的往事。)……
  239. #  在人物行走的基础上强化了所有属性变化的显示(就是当时我当时说的应该强化的那
  240. #  一部分,可惜在这个脚本发现之前我就已经拼出来这个效果了55555555……)
  241. #  部分字没有翻译,自己搜索下是什么意思。
  242. #==============================================================================

  243. class Window_ShopStatus < Window_Base

  244. #--------------------------------------------------------------------------
  245. def initialize
  246.   super(320, 130, 320, 260)
  247.   self.contents = Bitmap.new(width - 32, height - 32)
  248.   self.contents.font.name = "宋体"
  249.   self.contents.font.size = 18
  250.   self.opacity = 130
  251.   @sprite1 = nil
  252.   @sprite2 = nil
  253.   @sprite3 = nil
  254.   @sprite4 = nil
  255.   @walk = [false, false, false, false]
  256.   @count = 0
  257.   @item = nil
  258.   refresh
  259. end

  260. #--------------------------------------------------------------------------
  261. def refresh
  262.   self.contents.clear
  263.   if @sprite1 != nil
  264.     @sprite1.dispose
  265.     @sprite1 = nil
  266.   end
  267.   if @sprite2 != nil
  268.     @sprite2.dispose
  269.     @sprite2 = nil
  270.   end
  271.   if @sprite3 != nil
  272.     @sprite3.dispose
  273.     @sprite3 = nil
  274.   end
  275.   if @sprite4 != nil
  276.     @sprite4.dispose
  277.     @sprite4 = nil
  278.   end
  279.   self.contents.font.name = "宋体"
  280.   self.contents.font.size = 18
  281.   if @item == nil
  282.     return
  283.   end
  284.   case @item
  285.   when RPG::Item
  286.     number = $game_party.item_number(@item.id)
  287.   when RPG::Weapon
  288.     number = $game_party.weapon_number(@item.id)
  289.   when RPG::Armor
  290.     number = $game_party.armor_number(@item.id)
  291.   end
  292.   self.contents.font.color = system_color
  293.   self.contents.draw_text(4, -8, 200, 32, "已装备:")
  294.   self.contents.font.color = normal_color
  295.   self.contents.draw_text(204, -8, 32, 32, number.to_s, 2)
  296.   if @item.is_a?(RPG::Item)
  297.     @walk = [false, false, false, false]
  298.     return
  299.   end
  300.   for i in 0...$game_party.actors.size
  301.     actor = $game_party.actors[i]
  302.     if @item.is_a?(RPG::Weapon)
  303.       item1 = $data_weapons[actor.weapon_id]
  304.     elsif @item.kind == 0
  305.       item1 = $data_armors[actor.armor1_id]
  306.     elsif @item.kind == 1
  307.       item1 = $data_armors[actor.armor2_id]
  308.     elsif @item.kind == 2
  309.       item1 = $data_armors[actor.armor3_id]
  310.     else
  311.       item1 = $data_armors[actor.armor4_id]
  312.     end
  313.     if not actor.equippable?(@item)
  314.       @walk[i] = false
  315.       draw_actor_graphic(actor, 330, 194 + 64 * i, i, 0)
  316.       self.contents.font.name = "宋体"
  317.       self.contents.font.size = 18
  318.       self.contents.font.color = normal_color
  319.       self.contents.draw_text(32, 26 + (54 * i), 150, 32, "无法装备")
  320.     end
  321.     if actor.equippable?(@item)
  322.       @walk[i] = true
  323.       draw_actor_graphic(actor, 330, 144 + 64 * i, i, 1)
  324.         atk1 = 0
  325.         atk2 = 0
  326.         eva1 = 0
  327.         eva2 = 0
  328.         str1 = 0
  329.         str2 = 0
  330.         dex1 = 0
  331.         dex2 = 0
  332.         agi1 = 0
  333.         agi2 = 0
  334.         int1 = 0
  335.         int2 = 0
  336.         pdf1 = 0
  337.         pdf2 = 0
  338.         mdf1 = 0
  339.         mdf2 = 0
  340.         eva1 = 0
  341.         eva2 = 0
  342.         str1 = item1 != nil ? item1.str_plus : 0
  343.         str2 = @item != nil ? @item.str_plus : 0
  344.         dex1 = item1 != nil ? item1.dex_plus : 0
  345.         dex2 = @item != nil ? @item.dex_plus : 0
  346.         agi1 = item1 != nil ? item1.agi_plus : 0
  347.         agi2 = @item != nil ? @item.agi_plus : 0
  348.         int1 = item1 != nil ? item1.int_plus : 0
  349.         int2 = @item != nil ? @item.int_plus : 0
  350.         pdf1 = item1 != nil ? item1.pdef : 0
  351.         pdf2 = @item != nil ? @item.pdef : 0
  352.         mdf1 = item1 != nil ? item1.mdef : 0
  353.         mdf2 = @item != nil ? @item.mdef : 0
  354.       if @item.is_a?(RPG::Weapon)
  355.         atk1 = item1 != nil ? item1.atk : 0
  356.         atk2 = @item != nil ? @item.atk : 0
  357.       end
  358.       if @item.is_a?(RPG::Armor)
  359.         eva1 = item1 != nil ? item1.eva : 0
  360.         eva2 = @item != nil ? @item.eva : 0
  361.       end
  362.       str_change = str2 - str1
  363.       dex_change = dex2 - dex1
  364.       agi_change = agi2 - agi1
  365.       int_change = int2 - int1
  366.       pdf_change = pdf2 - pdf1
  367.       mdf_change = mdf2 - mdf1
  368.       atk_change = atk2 - atk1
  369.       eva_change = eva2 - eva1
  370.       if item1 == nil
  371.         name1 = ""
  372.       else
  373.         name1 = item1.name
  374.       end
  375.       if @item == nil
  376.         name2 = ""
  377.       else
  378.         name2 = @item.name
  379.       end
  380.       if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  381.       pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  382.       eva_change == 0 && name1 != name2
  383.         self.contents.font.name = "宋体"
  384.         self.contents.font.size = 18
  385.         self.contents.font.color = normal_color
  386.         self.contents.draw_text(32, 26 + (54 * i), 150, 32, "没有改变")
  387.       end
  388.       if name1 == name2
  389.         self.contents.font.name = "宋体"
  390.         self.contents.font.size = 18
  391.         self.contents.font.color = normal_color
  392.         self.contents.draw_text(32, 26 + (54 * i), 200, 32, "已装备")
  393.       end
  394.       self.contents.font.name = "宋体"
  395.       self.contents.font.size = 16
  396.       self.contents.font.color = normal_color
  397.       if @item.is_a?(RPG::Weapon) && atk_change != 0
  398.         self.contents.draw_text(32, 10 + (54 * i), 32, 32, "ATK")
  399.       end
  400.       if @item.is_a?(RPG::Armor) && eva_change != 0
  401.         self.contents.draw_text(32, 10 + (54 * i), 32, 32, "EVA")
  402.       end
  403.       if pdf_change != 0
  404.         self.contents.draw_text(32, 26 + (54 * i), 32, 32, "PDF")
  405.       end
  406.       if mdf_change != 0
  407.         self.contents.draw_text(32, 42 + (54 * i), 32, 32, "MDF")
  408.       end
  409.       if str_change != 0
  410.         self.contents.draw_text(112, 10 + (54 * i), 32, 32, "STR")
  411.       end
  412.       if dex_change != 0
  413.         self.contents.draw_text(112, 26 + (54 * i), 32, 32, "DEX")
  414.       end
  415.       if agi_change != 0
  416.         self.contents.draw_text(112, 42 + (54 * i), 32, 32, "AGI")
  417.       end
  418.       if str_change != 0
  419.         self.contents.draw_text(192, 10 + (54 * i), 32, 32, "INT")
  420.       end
  421.       if @item.is_a?(RPG::Weapon) && atk_change > 0
  422.         self.contents.font.color = up_color
  423.         s = atk_change.abs.to_s
  424.         self.contents.draw_text(60, 10 + (54 * i), 4, 32, "+")
  425.         self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
  426.       end
  427.       if @item.is_a?(RPG::Weapon) && atk_change < 0
  428.         self.contents.font.color = down_color
  429.         s = atk_change.abs.to_s
  430.         self.contents.draw_text(60, 10 + (54 * i), 4, 32, "-")
  431.         self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
  432.       end
  433.       if @item.is_a?(RPG::Armor) && eva_change > 0
  434.         self.contents.font.color = up_color
  435.         s = eva_change.abs.to_s
  436.         self.contents.draw_text(60, 10 + (54 * i), 4, 32, "+")
  437.         self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
  438.       end
  439.       if @item.is_a?(RPG::Armor) && eva_change < 0
  440.         self.contents.font.color = down_color
  441.         s = eva_change.abs.to_s
  442.         self.contents.draw_text(60, 10 + (54 * i), 4, 32, "-")
  443.         self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
  444.       end
  445.       if pdf_change > 0
  446.         self.contents.font.color = up_color
  447.         s = pdf_change.abs.to_s
  448.         self.contents.draw_text(60, 26 + (54 * i), 4, 32, "+")
  449.         self.contents.draw_text(62, 26 + (54 * i), 24, 32, s, 2)
  450.       end
  451.       if pdf_change < 0
  452.         self.contents.font.color = down_color
  453.         s = pdf_change.abs.to_s
  454.         self.contents.draw_text(60, 26 + (54 * i), 4, 32, "-")
  455.         self.contents.draw_text(62, 26 + (54 * i), 24, 32, s, 2)
  456.       end
  457.       if mdf_change > 0
  458.         self.contents.font.color = up_color
  459.         s = mdf_change.abs.to_s
  460.         self.contents.draw_text(60, 42 + (54 * i), 4, 32, "+")
  461.         self.contents.draw_text(62, 42 + (54 * i), 24, 32, s, 2)
  462.       end
  463.       if mdf_change < 0
  464.         self.contents.font.color = down_color
  465.         s = mdf_change.abs.to_s
  466.         self.contents.draw_text(60, 42 + (54 * i), 4, 32, "-")
  467.         self.contents.draw_text(62, 42 + (54 * i), 24, 32, s, 2)
  468.       end
  469.       if str_change > 0
  470.         self.contents.font.color = up_color
  471.         s = str_change.abs.to_s
  472.         self.contents.draw_text(140, 10 + (54 * i), 4, 32, "+")
  473.         self.contents.draw_text(142, 10 + (54 * i), 24, 32, s, 2)
  474.       end
  475.       if str_change < 0
  476.         self.contents.font.color = down_color
  477.         s = str_change.abs.to_s
  478.         self.contents.draw_text(140, 10 + (54 * i), 4, 32, "-")
  479.         self.contents.draw_text(142, 10 + (54 * i), 24, 32, s, 2)
  480.       end
  481.       if dex_change > 0
  482.         self.contents.font.color = up_color
  483.         s = dex_change.abs.to_s
  484.         self.contents.draw_text(140, 26 + (54 * i), 4, 32, "+")
  485.         self.contents.draw_text(142, 26 + (54 * i), 24, 32, s, 2)
  486.       end
  487.       if dex_change < 0
  488.         self.contents.font.color = down_color
  489.         s = dex_change.abs.to_s
  490.         self.contents.draw_text(140, 26 + (54 * i), 4, 32, "-")
  491.         self.contents.draw_text(142, 26 + (54 * i), 24, 32, s, 2)
  492.       end
  493.       if agi_change > 0
  494.         self.contents.font.color = up_color
  495.         s = agi_change.abs.to_s
  496.         self.contents.draw_text(140, 42 + (54 * i), 4, 32, "+")
  497.         self.contents.draw_text(142, 42 + (54 * i), 24, 32, s, 2)
  498.       end
  499.       if agi_change < 0
  500.         self.contents.font.color = down_color
  501.         s = agi_change.abs.to_s
  502.         self.contents.draw_text(140, 42 + (54 * i), 4, 32, "-")
  503.         self.contents.draw_text(142, 42 + (54 * i), 24, 32, s, 2)
  504.       end
  505.       if int_change > 0
  506.         self.contents.font.color = up_color
  507.         s = int_change.abs.to_s
  508.         self.contents.draw_text(220, 10 + (54 * i), 4, 32, "+")
  509.         self.contents.draw_text(222, 10 + (54 * i), 24, 32, s, 2)
  510.       end
  511.       if int_change < 0
  512.         self.contents.font.color = down_color
  513.         s = int_change.abs.to_s
  514.         self.contents.draw_text(220, 10 + (54 * i), 4, 32, "-")
  515.         self.contents.draw_text(222, 10 + (54 * i), 24, 32, s, 2)
  516.       end
  517.     end
  518.   end
  519. end
  520. # ---------------------------------------
  521. def item=(item)
  522.   if @item != item
  523.     @item = item
  524.     refresh
  525.   end
  526. end
  527. # ---------------------------------------
  528. def draw_actor_graphic(actor, x, y, id, tone_id)
  529.   if id == 0
  530.     @v1 = Viewport.new(330, 164, 32, 48)
  531.     @v1.z = 9998
  532.     @sprite1 = Sprite.new(@v1)
  533.     @sprite1.bitmap = RPG::Cache.character(actor.character_name,
  534.     actor.character_hue)
  535.     if tone_id == 0
  536.       @sprite1.tone = Tone.new(0, 0, 0, 255)
  537.     else
  538.       @sprite1.tone = Tone.new(0, 0, 0, 0)
  539.     end
  540.     @sprite1.visible = true
  541.   end
  542.    if id == 1
  543.     @v2 = Viewport.new(330, 218, 32, 48)
  544.     @v2.z = 9999
  545.     @sprite2 = Sprite.new(@v2)
  546.     @sprite2.bitmap = RPG::Cache.character(actor.character_name,
  547.     actor.character_hue)
  548.     if tone_id == 0
  549.       @sprite2.tone = Tone.new(0, 0, 0, 255)
  550.     else
  551.       @sprite2.tone = Tone.new(0, 0, 0, 0)
  552.     end
  553.     @sprite2.visible = true
  554.   end
  555.    if id == 2
  556.     @v3 = Viewport.new(330, 272, 32, 48)
  557.     @v3.z = 9999
  558.     @sprite3 = Sprite.new(@v3)
  559.     @sprite3.bitmap = RPG::Cache.character(actor.character_name,
  560.     actor.character_hue)
  561.     if tone_id == 0
  562.       @sprite3.tone = Tone.new(0, 0, 0, 255)
  563.     else
  564.       @sprite3.tone = Tone.new(0, 0, 0, 0)
  565.     end
  566.     @sprite3.visible = true
  567.   end
  568.   if id == 3
  569.     @v4 = Viewport.new(330, 326, 32, 48)
  570.     @v4.z = 9999
  571.     @sprite4 = Sprite.new(@v4)
  572.     @sprite4.bitmap = RPG::Cache.character(actor.character_name,
  573.     actor.character_hue)
  574.     if tone_id == 0
  575.       @sprite4.tone = Tone.new(0, 0, 0, 255)
  576.     else
  577.       @sprite4.tone = Tone.new(0, 0, 0, 0)
  578.     end
  579.     @sprite4.visible = true
  580.   end
  581. end
  582. # ---------------------------------------
  583. def update
  584.   super
  585.   @count += 1
  586.   for i in [email protected]
  587.       if @walk[i] == false
  588.       case i
  589.         when 0
  590.           if @sprite1 != nil
  591.           @sprite1.ox = 0
  592.           end
  593.         when 1
  594.           if @sprite2 != nil
  595.           @sprite2.ox = 0
  596.           end
  597.         when 2
  598.           if @sprite3 != nil
  599.           @sprite3.ox = 0
  600.           end
  601.         when 3
  602.           if @sprite4 != nil
  603.           @sprite4.ox = 0
  604.           end
  605.         end
  606.       end
  607.     end
  608.   if @count == 0
  609.     for i in [email protected]
  610.       if @walk[i] == true
  611.       case i
  612.       when 0
  613.         if @sprite1 != nil
  614.         @sprite1.ox = 0
  615.         end
  616.       when 1
  617.         if @sprite2 != nil
  618.         @sprite2.ox = 0
  619.         end
  620.       when 2
  621.         if @sprite3 != nil
  622.         @sprite3.ox = 0
  623.         end
  624.       when 3
  625.         if @sprite4 != nil
  626.         @sprite4.ox = 0
  627.           end
  628.         end
  629.       end
  630.     end
  631.   end
  632.   if @count == 5
  633.     for i in [email protected]
  634.       if @walk[i] == true
  635.       case i
  636.       when 0
  637.         if @sprite1 != nil
  638.         @sprite1.ox = 32
  639.         end
  640.       when 1
  641.         if @sprite2 != nil
  642.         @sprite2.ox = 32
  643.         end
  644.       when 2
  645.         if @sprite3 != nil
  646.         @sprite3.ox = 32
  647.         end
  648.       when 3
  649.         if @sprite4 != nil
  650.         @sprite4.ox = 32
  651.           end
  652.         end
  653.       end
  654.     end
  655.   end
  656.   if @count == 10
  657.     for i in [email protected]
  658.       if @walk[i] == true
  659.         case i
  660.       when 0
  661.         if @sprite1 != nil
  662.         @sprite1.ox = 64
  663.         end
  664.       when 1
  665.         if @sprite2 != nil
  666.         @sprite2.ox = 64
  667.         end
  668.       when 2
  669.         if @sprite3 != nil
  670.         @sprite3.ox = 64
  671.         end
  672.       when 3
  673.         if @sprite4 != nil
  674.         @sprite4.ox = 64
  675.           end
  676.         end
  677.       end
  678.     end
  679.   end
  680.   if @count == 15
  681.     @count = 0
  682.   end
  683. end
  684. end
  685. #==============================================================================
  686. # | Window_Help
  687. #------------------------------------------------------------------------------
  688. #==============================================================================

  689. class Window_HelpShop < Window_Base
  690. #--------------------------------------------------------------------------
  691. def initialize
  692.   super(80, 70, 480, 64)
  693. self.contents = Bitmap.new(width - 32, height - 32)
  694.   self.contents.font.name = "宋体"
  695.   self.contents.font.size = 18
  696.   self.opacity = 130
  697. end

  698. #--------------------------------------------------------------------------
  699. def set_text(text, align = 1)
  700.   if text != @text or align != @align
  701.     self.contents.clear
  702.     self.contents.font.color = normal_color
  703.     self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  704.     @text = text
  705.     @align = align
  706.     @actor = nil
  707.   end
  708.   self.visible = true
  709. end

  710. #--------------------------------------------------------------------------
  711. def set_actor(actor)
  712.   if actor != @actor
  713.     self.contents.clear
  714.     draw_actor_name(actor, 4, 0)
  715.     draw_actor_state(actor, 140, 0)
  716.     draw_actor_hp(actor, 284, 0)
  717.     draw_actor_sp(actor, 460, 0)
  718.     @actor = actor
  719.     @text = nil
  720.     self.visible = true
  721.   end
  722. end

  723. #--------------------------------------------------------------------------
  724. def set_enemy(enemy)
  725.   text = enemy.name
  726.   state_text = make_battler_state_text(enemy, 112, false)
  727.   if state_text != ""
  728.     text += "  " + state_text
  729.   end
  730.   set_text(text, 1)
  731. end
  732. end


  733. #==============================================================================
  734. # | Scene_Shop
  735. #------------------------------------------------------------------------------
  736. # 对比下看看什么东西改变了~
  737. #==============================================================================

  738. class Scene_Shop

  739. #--------------------------------------------------------------------------
  740. def main
  741.   @spriteset = Spriteset_Map.new
  742.   @help_window = Window_HelpShop.new
  743.   @command_window = Window_ShopCommand.new
  744.   @command_window. x = 100
  745.   @command_window. y = 390
  746.   @gold_window = Window_Gold2.new
  747.   @gold_window.x = 240
  748.   @gold_window.y = 8
  749.   @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  750.   @buy_window.active = false
  751.   @buy_window.visible = false
  752.   @buy_window.help_window = @help_window
  753.   @sell_window = Window_ShopSell.new
  754.   @sell_window.active = false
  755.   @sell_window.visible = false
  756.   @sell_window.help_window = @help_window
  757.   @number_window = Window_ShopNumber.new
  758.   @number_window.active = false
  759.   @number_window.visible = false
  760.   @status_window = Window_ShopStatus.new
  761.   @status_window.visible = false
  762.   #command
  763.   Graphics.transition
  764.   loop do
  765.     Graphics.update
  766.     Input.update
  767.     update
  768.     if $scene != self
  769.       break
  770.     end
  771.   end
  772.   Graphics.freeze
  773.   @spriteset.dispose
  774.   @help_window.dispose
  775.   @command_window.dispose
  776.   @gold_window.dispose
  777.   @buy_window.dispose
  778.   @sell_window.dispose
  779.   @number_window.dispose
  780.   @status_window.dispose
  781. end

  782. #--------------------------------------------------------------------------
  783. def update
  784.   @help_window.update
  785.   @command_window.update
  786.   @gold_window.update
  787.   @buy_window.update
  788.   @sell_window.update
  789.   @number_window.update
  790.   @status_window.update
  791.   
  792.   if @command_window.active
  793.     update_command
  794.     return
  795.   end
  796.   if @buy_window.active
  797.     update_buy
  798.     return
  799.   end
  800.   if @sell_window.active
  801.     update_sell
  802.     return
  803.   end
  804.   if @number_window.active
  805.     update_number
  806.     return
  807.   end
  808. end
复制代码


KRKR + NS 学习中..........
回复 支持 反对

使用道具 举报

Lv1.梦旅人

查无此人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2006-5-8
帖子
1399
18
 楼主| 发表于 2006-7-18 22:35:08 | 只看该作者
接上7月18日更新的商店整合脚本

用的时候3个部分连接在一起放一个脚本里,嗯。

PART3
  1. #--------------------------------------------------------------------------
  2. def update_command
  3.   if Input.trigger?(Input::B)
  4.     $game_system.se_play($data_system.cancel_se)
  5.     $scene = Scene_Map.new
  6.     return
  7.   end
  8.   if Input.trigger?(Input::C)
  9.     case @command_window.index
  10.     when 0
  11.       $game_system.se_play($data_system.decision_se)
  12.       @command_window.active = false
  13.       @buy_window.active = true
  14.       @buy_window.visible = true
  15.       @buy_window.refresh
  16.       @status_window.visible = true
  17.     when 1
  18.       $game_system.se_play($data_system.decision_se)
  19.       @command_window.active = false
  20.       @sell_window.active = true
  21.       @sell_window.visible = true
  22.       @sell_window.refresh
  23.     when 2
  24.       $game_system.se_play($data_system.decision_se)
  25.       # 这个加进去的装备界面
  26.       $scene = Scene_Equip2.new
  27.     when 3  
  28.       $game_system.se_play($data_system.decision_se)
  29.       $scene = Scene_Map.new
  30.     end
  31.     return
  32.   end
  33. end

  34. #--------------------------------------------------------------------------
  35. def update_buy

  36.   @status_window.item = @buy_window.item

  37.   if Input.trigger?(Input::B)

  38.     $game_system.se_play($data_system.cancel_se)
  39.     @command_window.active = true
  40.     @buy_window.active = false
  41.     @buy_window.visible = false
  42.     @status_window.visible = false
  43.     @status_window.item = nil
  44.     @help_window.set_text("")
  45.     return
  46.   end

  47.   if Input.trigger?(Input::C)
  48.     @item = @buy_window.item
  49.      if @item == nil or @item.price > $game_party.gold
  50.       $game_system.se_play($data_system.buzzer_se)
  51.       return
  52.     end
  53.     case @item
  54.     when RPG::Item
  55.       number = $game_party.item_number(@item.id)
  56.     when RPG::Weapon
  57.       number = $game_party.weapon_number(@item.id)
  58.     when RPG::Armor
  59.       number = $game_party.armor_number(@item.id)
  60.     end
  61.     if number == 99
  62.       $game_system.se_play($data_system.buzzer_se)
  63.       return
  64.     end
  65.     $game_system.se_play($data_system.decision_se)
  66.     max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  67.     max = [max, 99 - number].min
  68.     @buy_window.active = false
  69.     @buy_window.visible = false
  70.     @number_window.set(@item, max, @item.price)
  71.     @number_window.active = true
  72.     @number_window.visible = true
  73.   end
  74. end

  75. #--------------------------------------------------------------------------
  76. def update_sell
  77.   
  78.   if Input.trigger?(Input::B)
  79.    $game_system.se_play($data_system.cancel_se)
  80.    @command_window.active = true
  81.    @sell_window.active = false
  82.    @sell_window.visible = false
  83.    @status_window.item = nil
  84.    ##########下面这个没了##########
  85.    #@status_window.visible = false
  86.    @help_window.set_text("")
  87.    return
  88. end

  89. if Input.trigger?(Input::C)
  90.    @item = @sell_window.item
  91.    @status_window.item = @item
  92.    if @item == nil or @item.price == 0
  93.      $game_system.se_play($data_system.buzzer_se)
  94.      @status_window.item = nil
  95.      @status_window.item =  @item
  96.      return
  97.    end
  98.    $game_system.se_play($data_system.decision_se)
  99.    case @item
  100.    when RPG::Item
  101.      number = $game_party.item_number(@item.id)
  102.    when RPG::Weapon
  103.      number = $game_party.weapon_number(@item.id)
  104.    when RPG::Armor
  105.      number = $game_party.armor_number(@item.id)
  106.    end
  107.    max = number
  108.    @sell_window.active = false
  109.    @sell_window.visible = false
  110.    @number_window.set(@item, max, @item.price / 2)
  111.    @number_window.active = true
  112.    @number_window.visible = true
  113.    @status_window.visible = true
  114. end
  115. end
  116. #--------------------------------------------------------------------------
  117. def update_number
  118. if Input.trigger?(Input::B)
  119.    $game_system.se_play($data_system.cancel_se)
  120.    @number_window.active = false
  121.    @number_window.visible = false
  122.    case @command_window.index
  123.    when 0
  124.      @buy_window.active = true
  125.      @buy_window.visible = true
  126.    when 1  
  127.      @sell_window.active = true
  128.      @sell_window.visible = true
  129.      @status_window.visible = false
  130.      @status_window.item = nil
  131.    end
  132.    return
  133. end

  134. if Input.trigger?(Input::C)
  135.    $game_system.se_play($data_system.shop_se)
  136.    @number_window.active = false
  137.    @number_window.visible = false
  138.    case @command_window.index
  139.    when 0
  140.      $game_party.lose_gold(@number_window.number * @item.price)
  141.      case @item
  142.      when RPG::Item
  143.        $game_party.gain_item(@item.id, @number_window.number)
  144.      when RPG::Weapon
  145.        $game_party.gain_weapon(@item.id, @number_window.number)
  146.      when RPG::Armor
  147.        $game_party.gain_armor(@item.id, @number_window.number)
  148.      end
  149.      @gold_window.refresh
  150.      @buy_window.refresh
  151.      @status_window.refresh
  152.      @buy_window.active = true
  153.      @buy_window.visible = true
  154.    when 1
  155.      $game_party.gain_gold(@number_window.number * (@item.price / 2))
  156.      case @item
  157.      when RPG::Item
  158.        $game_party.lose_item(@item.id, @number_window.number)
  159.      when RPG::Weapon
  160.        $game_party.lose_weapon(@item.id, @number_window.number)
  161.      when RPG::Armor
  162.        $game_party.lose_armor(@item.id, @number_window.number)
  163.      end
  164.      @gold_window.refresh
  165.      @sell_window.refresh
  166.      @status_window.refresh
  167.      @sell_window.active = true
  168.      @sell_window.visible = true
  169.      @status_window.visible = false
  170.      @status_window.item = nil
  171.    end
  172.    return
  173. end
  174. end
  175. end


  176. #==============================================================================
  177. # ■ Scene_Equip2
  178. #------------------------------------------------------------------------------
  179. #  新的装备画面处理~对照原先的装备画面看看哪里变了
  180. #==============================================================================

  181. class Scene_Equip2

  182. #--------------------------------------------------------------------------
  183. def initialize(actor_index = 0, equip_index = 0)
  184.   @actor_index = actor_index
  185.   @equip_index = equip_index
  186. end

  187. #--------------------------------------------------------------------------
  188. def main
  189.   @spriteset = Spriteset_Map.new
  190.   @actor = $game_party.actors[@actor_index]
  191.   @equipment_window = Window_Equipment.new
  192.   @help_window = Window_Help2.new
  193.   @left_window = Window_EquipLeft2.new(@actor)
  194.   @right_window = Window_EquipRight2.new(@actor)
  195.   @item_window1 = Window_EquipItem2.new(@actor, 0)
  196.   @item_window2 = Window_EquipItem2.new(@actor, 1)
  197.   @item_window3 = Window_EquipItem2.new(@actor, 2)
  198.   @item_window4 = Window_EquipItem2.new(@actor, 3)
  199.   @item_window5 = Window_EquipItem2.new(@actor, 4)
  200.   @right_window.help_window = @help_window
  201.   @item_window1.help_window = @help_window
  202.   @item_window2.help_window = @help_window
  203.   @item_window3.help_window = @help_window
  204.   @item_window4.help_window = @help_window
  205.   @item_window5.help_window = @help_window
  206.   @right_window.index = @equip_index
  207.   refresh
  208.   Graphics.transition
  209.   loop do
  210.     Graphics.update
  211.     Input.update
  212.     update
  213.     if $scene != self
  214.       break
  215.     end
  216.   end
  217.   Graphics.freeze
  218.   @spriteset.dispose
  219.   @equipment_window.dispose
  220.   @help_window.dispose
  221.   @left_window.dispose
  222.   @right_window.dispose
  223.   @item_window1.dispose
  224.   @item_window2.dispose
  225.   @item_window3.dispose
  226.   @item_window4.dispose
  227.   @item_window5.dispose
  228. end
  229. #--------------------------------------------------------------------------
  230. def refresh
  231.   @item_window1.visible = (@right_window.index == 0)
  232.   @item_window2.visible = (@right_window.index == 1)
  233.   @item_window3.visible = (@right_window.index == 2)
  234.   @item_window4.visible = (@right_window.index == 3)
  235.   @item_window5.visible = (@right_window.index == 4)
  236.   item1 = @right_window.item
  237.   case @right_window.index
  238.   when 0
  239.     @item_window = @item_window1
  240.     newmode = 0
  241.   when 1
  242.     @item_window = @item_window2
  243.     newmode = 1
  244.   when 2
  245.     @item_window = @item_window3
  246.     newmode = 1
  247.   when 3
  248.     @item_window = @item_window4
  249.     newmode = 1
  250.   when 4
  251.     @item_window = @item_window5
  252.     newmode = 1
  253.   end
  254.   if newmode != @left_window.mode
  255.     @left_window.mode = newmode
  256.     @left_window.refresh
  257.   end
  258.   if @right_window.active
  259. ##############我要全部都显示####################   
  260.     @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,
  261.     "", "")
  262.   end
  263.   if @item_window.active
  264.     item2 = @item_window.item
  265.     last_hp = @actor.hp
  266.     last_sp = @actor.sp
  267.     old_atk = @actor.atk
  268.     old_pdef = @actor.pdef
  269.     old_mdef = @actor.mdef
  270.     old_str = @actor.str
  271.     old_dex = @actor.dex
  272.     old_agi = @actor.agi
  273.     old_int = @actor.int
  274.     old_eva = @actor.eva
  275.     @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  276.     new_atk = @actor.atk
  277.     new_pdef = @actor.pdef
  278.     new_mdef = @actor.mdef
  279.     new_str = @actor.str
  280.     new_dex = @actor.dex
  281.     new_agi = @actor.agi
  282.     new_int = @actor.int
  283.     new_eva = @actor.eva
  284.     @left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
  285.     if new_atk > old_atk
  286.       @left_window.changes[0] = 1
  287.     end
  288.     if new_atk < old_atk
  289.       @left_window.changes[0] = -1
  290.     end
  291.     if new_pdef > old_pdef
  292.       @left_window.changes[1] = 1
  293.     end
  294.     if new_pdef < old_pdef
  295.       @left_window.changes[1] = -1
  296.     end
  297.     if new_mdef > old_mdef
  298.       @left_window.changes[2] = 1
  299.     end
  300.     if new_mdef < old_mdef
  301.       @left_window.changes[2] = -1
  302.     end
  303.      if new_str > old_str
  304.       @left_window.changes[3] = 1
  305.     end
  306.     if new_str < old_str
  307.       @left_window.changes[3] = -1
  308.     end
  309.       if new_dex > old_dex
  310.       @left_window.changes[4] = 1
  311.     end
  312.     if new_dex < old_dex
  313.       @left_window.changes[4] = -1
  314.     end
  315.     if new_agi > old_agi
  316.       @left_window.changes[5] = 1
  317.     end
  318.     if new_agi < old_agi
  319.       @left_window.changes[5] = -1
  320.     end
  321.     if new_int > old_int
  322.       @left_window.changes[6] = 1
  323.     end
  324.     if new_int < old_int
  325.       @left_window.changes[6] = -1
  326.     end
  327.     if new_eva > old_eva
  328.       @left_window.changes[7] = 1
  329.     end
  330.     if new_eva < old_eva
  331.       @left_window.changes[7] = -1
  332.     end
  333.     elem_text = make_elem_text(item2)
  334.     stat_text = make_stat_text(item2)
  335.     @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  336.     @actor.hp = last_hp
  337.     @actor.sp = last_sp
  338.     @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
  339.     new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
  340.   end
  341. end
  342. # --------------------------------
  343. def make_elem_text(item)
  344.   text = ""
  345.   flag = false
  346.   if item.is_a?(RPG::Weapon)
  347.     for i in item.element_set
  348.       if flag
  349.         text += ", "
  350.       end
  351.       text += $data_system.elements[i]
  352.       flag = true
  353.     end
  354.   end
  355.   if item.is_a?(RPG::Armor)
  356.     for i in item.guard_element_set
  357.       if flag
  358.         text += ", "
  359.       end
  360.       text += $data_system.elements[i]
  361.       flag = true
  362.     end
  363.   end
  364.   return text
  365. end
  366. # --------------------------------
  367. def make_stat_text(item)
  368.   text = ""
  369.   flag = false
  370.   if item.is_a?(RPG::Weapon)
  371.     for i in item.plus_state_set
  372.       if flag
  373.         text += ", "
  374.       end
  375.       text += $data_states[i].name
  376.       flag = true
  377.     end
  378.   end
  379.   if item.is_a?(RPG::Armor)
  380.     for i in item.guard_state_set
  381.       if flag
  382.         text += ", "
  383.       end
  384.       text += $data_states[i].name
  385.       flag = true
  386.     end
  387.   end
  388.   return text
  389. end

  390. #--------------------------------------------------------------------------
  391. def update
  392.   @equipment_window.update
  393.   @left_window.update
  394.   @right_window.update
  395.   @item_window.update
  396.   refresh
  397.   if @right_window.active
  398.     update_right
  399.     return
  400.   end
  401.   if @item_window.active
  402.     update_item
  403.     return
  404.   end
  405. end

  406. def update_right
  407.   if Input.trigger?(Input::B)
  408.     $game_system.se_play($data_system.cancel_se)
  409. #########我要回到商店窗口#########
  410.     $scene = Scene_Shop.new
  411.     return
  412.   end
  413.   if Input.trigger?(Input::C)
  414.     if @actor.equip_fix?(@right_window.index)
  415.       $game_system.se_play($data_system.buzzer_se)
  416.       return
  417.     end
  418.     $game_system.se_play($data_system.decision_se)
  419.     @right_window.active = false
  420.     @item_window.active = true
  421.     @item_window.index = 0
  422.     return
  423.   end
  424.   
  425.   if Input.trigger?(Input::R)
  426.     $game_system.se_play($data_system.cursor_se)
  427.     @actor_index += 1
  428.     @actor_index %= $game_party.actors.size
  429.     $scene = Scene_Equip2.new(@actor_index, @right_window.index)
  430.     return
  431.   end
  432.   
  433.   if Input.trigger?(Input::L)
  434.     $game_system.se_play($data_system.cursor_se)
  435.     @actor_index += $game_party.actors.size - 1
  436.     @actor_index %= $game_party.actors.size
  437.     $scene = Scene_Equip2.new(@actor_index, @right_window.index)
  438.     return
  439.   end
  440. end
  441. #--------------------------------------------------------------------------
  442. def update_item
  443.   if Input.trigger?(Input::B)
  444.     $game_system.se_play($data_system.cancel_se)
  445.     @right_window.active = true
  446.     @item_window.active = false
  447.     @item_window.index = -1
  448.     return
  449.   end
  450.   if Input.trigger?(Input::C)
  451.     $game_system.se_play($data_system.equip_se)
  452.     item = @item_window.item
  453.     @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  454.     @right_window.active = true
  455.     @item_window.active = false
  456.     @item_window.index = -1
  457.     @right_window.refresh
  458.     @item_window.refresh
  459.     return
  460.   end
  461. end
  462. end
复制代码
KRKR + NS 学习中..........
回复 支持 反对

使用道具 举报

Lv1.梦旅人

查无此人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2006-5-8
帖子
1399
19
 楼主| 发表于 2006-7-18 22:36:31 | 只看该作者
7月19日更新

脚本名:Blackjack纸牌游戏
作者:lanlan  还有发明Blackjack的人=v=
来源:同上

使用方法:pictures里放入下面那张图(原来我已经放上去liao =。=),名字为cards
          使用时调用$scene = Scene_Blackjack.new

胜利条件(我自己看脚本得出的,不知道对不对,原版没有任何说明-  -):
1 我方持数为21,对方没有
2 对方大于22
3 我方小于20但大于对方
差不多这样了,会这种牌的人指点下。。







  1. =begin
  2. -----------------------------------------------------------------
  3. :A scr?pt brought to you by LanLanGames,
  4. :www.LanLanGames.tk, its horrendousgusting

  5. :made by lanlan
  6. :special thanks to those who helped at the
  7. :rmxp.net RGSS support thread
  8. :and to the guy who envented blackjack
  9. -----------------------------------------------------------------
  10. =end

  11. class Scene_Blackjack

  12. def main
  13. @help_window = Window_Help.new
  14. @table_window = Window_Table.new
  15. @bet_window = Window_Bet.new
  16. @bet_window.index = 0
  17. @money_window = Window_Money.new
  18. @hitstay_window = Window_HitStay.new
  19. @hitstay_window.active = false
  20. @cards = []
  21. @graphic = []
  22. @card_used = 0
  23. variable_init
  24. shuffle2
  25. val_graphic
  26. shuffle
  27. Graphics.transition
  28. loop do
  29. Graphics.update
  30. Input.update
  31. update
  32. if $scene != self
  33. break
  34. end
  35. end
  36. Graphics.freeze

  37. @help_window.dispose
  38. @table_window.dispose
  39. @bet_window.dispose
  40. @money_window.dispose
  41. @hitstay_window.dispose
  42. end

  43. def update
  44. @table_window.update
  45. @bet_window.update
  46. @help_window.update
  47. @money_window.update
  48. @hitstay_window.update
  49. if @bet_window.active
  50. update_bet
  51. return
  52. end
  53. if @hitstay_window.active
  54. update_hitstay
  55. return
  56. end
  57. end

  58. def update_bet
  59. if Input.trigger?(Input::B)
  60. $game_system.se_play($data_system.cancel_se)
  61. @bet_window.index = 5
  62. return
  63. end
  64. if Input.trigger?(Input::C)
  65. case @bet_window.index
  66. when 0
  67. @bet = 25
  68. if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
  69. $game_system.se_play($data_system.decision_se)
  70. bet
  71. else
  72. $game_system.se_play($data_system.buzzer_se)
  73. return
  74. end
  75. when 1
  76. @bet = 50
  77. if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
  78. $game_system.se_play($data_system.decision_se)
  79. bet
  80. else
  81. $game_system.se_play($data_system.buzzer_se)
  82. return
  83. end
  84. when 2
  85. @bet = 100
  86. if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
  87. $game_system.se_play($data_system.decision_se)
  88. bet
  89. else
  90. $game_system.se_play($data_system.buzzer_se)
  91. return
  92. end
  93. when 3
  94. @bet = 500
  95. if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
  96. $game_system.se_play($data_system.decision_se)
  97. bet
  98. else
  99. $game_system.se_play($data_system.buzzer_se)
  100. return
  101. end
  102. when 4
  103. $game_system.se_play($data_system.decision_se)
  104. start_blackjack
  105. when 5
  106. $game_system.se_play($data_system.cancel_se)
  107. $game_party.gain_gold(@currentbet)
  108. $scene = Scene_Map.new
  109. end
  110. end
  111. end

  112. def update_hitstay
  113. if Input.trigger?(Input::B)
  114. $game_system.se_play($data_system.cancel_se)
  115. @hitstay_window.index = 1
  116. return
  117. end
  118. if Input.trigger?(Input::C)
  119. case @hitstay_window.index
  120. when 0
  121. hit
  122. when 1
  123. stay
  124. end
  125. end

  126. end

  127. def bet
  128. $game_party.lose_gold(@bet)
  129. @currentbet += @bet
  130. @money_window.refresh(@currentbet)
  131. end

  132. def start_blackjack
  133. @bet_window.active = false
  134. @m_hand1 = @cards[@card_used]
  135. @graphic1 = @graphic[@card_used]
  136. check_cards
  137. @card_used +=1
  138. @m_hand2 = @cards[@card_used]
  139. @graphic2 = @graphic[@card_used]
  140. check_cards
  141. @card_used +=1
  142. @d_hand1 = @cards[@card_used]
  143. @d_graphic1 = @graphic[@card_used]
  144. check_cards
  145. @card_used +=1
  146. @d_hand2 = @cards[@card_used]
  147. @d_graphic2 = @graphic[@card_used]
  148. @m_total = @m_hand1+@m_hand2
  149. @d_total = @d_hand1+@d_hand2
  150. if @m_hand1 == 1
  151. @m_ace =1
  152. @m_hand1=@m_hand1+10
  153. @m_total=@m_hand1 + @m_hand2
  154. end
  155. if @m_hand2 == 1
  156. if @m_hand1 != 11
  157. @m_ace = 1
  158. @m_hand2 = @m_hand2+10
  159. @m_total = @m_hand1+@m_hand2
  160. else
  161. @m_hand2 = 1
  162. @m_total = @m_hand1+@m_hand2
  163. end
  164. end

  165. if @d_hand1 == 1
  166. @d_ace =1
  167. @d_hand1=@d_hand1+10
  168. @d_total=@d_hand1 + @d_hand2
  169. end
  170. if @d_hand2 == 1
  171. if @d_hand1 != 11
  172. @d_ace = 1
  173. @d_hand2 = @d_hand2+10
  174. @d_total = @d_hand1+@d_hand2
  175. else
  176. @d_card2 = 1
  177. @d_total = @d_hand1+@d_hand2
  178. end
  179. end
  180. draw_cards

  181. check_win

  182. end

  183. def shuffle
  184. j = 51
  185. k = 0
  186. temp = 0
  187. temp2 = 0

  188. while (j>=0)
  189. k = rand(j)

  190. temp = @cards[j]
  191. temp2 = @graphic[j]
  192. @cards[j] = @cards[k]
  193. @graphic[j] = @graphic[k]
  194. @cards[k] = temp
  195. @graphic[k] = temp2

  196. j-=1

  197. end

  198. end

  199. def shuffle2
  200. @cards = [1,2,3,4,5,6,7,8,9,10,10,10,10,
  201. 1,2,3,4,5,6,7,8,9,10,10,10,10,
  202. 1,2,3,4,5,6,7,8,9,10,10,10,10,
  203. 1,2,3,4,5,6,7,8,9,10,10,10,10,
  204. 0,0]
  205. end

  206. def val_graphic
  207. for i in 0...53
  208. @graphic[i] = i
  209. end
  210. end

  211. def check_cards
  212. if @card_used == 52
  213. shuffle
  214. @card_used = 0
  215. end
  216. end

  217. def draw_cards
  218. @table_window.refresh(@m_hand1,@graphic1,
  219. @m_hand2,@graphic2,
  220. @m_hand3,@graphic3,
  221. @m_hand4,@graphic4,
  222. @m_hand5,@graphic5,
  223. @d_hand1,52,
  224. @d_hand2,@d_graphic2,
  225. @d_hand3,@d_graphic3,
  226. @d_hand4,@d_graphic4,
  227. @d_hand5,@d_graphic5,
  228. @m_total)
  229. end

  230. def draw_real_cards
  231. @table_window.refresh(@m_hand1,@graphic1,
  232. @m_hand2,@graphic2,
  233. @m_hand3,@graphic3,
  234. @m_hand4,@graphic4,
  235. @m_hand5,@graphic5,
  236. @d_hand1,@d_graphic1,
  237. @d_hand2,@d_graphic2,
  238. @d_hand3,@d_graphic3,
  239. @d_hand4,@d_graphic4,
  240. @d_hand5,@d_graphic5,
  241. @m_total)
  242. end

  243. def variable_init
  244. @bet = 0
  245. @currentbet = 0
  246. @dummy_gold = 0
  247. @m_hand1 = 0
  248. @graphic1 = 53
  249. @m_hand2 = 0
  250. @graphic2 = 53
  251. @m_hand3 = 0
  252. @graphic3 = 53
  253. @m_hand4 = 0
  254. @graphic4 = 53
  255. @m_hand5 = 0
  256. @graphic5 = 53
  257. @d_hand1 = 0
  258. @d_graphic1 = 53
  259. @d_hand2 = 0
  260. @d_graphic2 = 53
  261. @d_hand3 = 0
  262. @d_graphic3 = 53
  263. @d_hand4 = 0
  264. @d_graphic4 = 53
  265. @d_hand5 = 0
  266. @d_graphic5 = 53
  267. @m_ace = 0
  268. @d_ace = 0
  269. @test = 0
  270. end

  271. def hit
  272. check_cards
  273. @card_used +=1
  274. if @m_hand3 == 0
  275. @m_hand3 = @cards[@card_used]
  276. @graphic3 = @graphic[@card_used]
  277. elsif @m_hand4 == 0 and @m_hand3 != 0
  278. @m_hand4 = @cards[@card_used]
  279. @graphic4 = @graphic[@card_used]
  280. elsif @m_hand5 == 0 and @m_hand4 != 0
  281. @m_hand5 = @cards[@card_used]
  282. @graphic5 = @graphic[@card_used]
  283. end

  284. if @cards[@card_used] == 1
  285. if @m_total <=10
  286. @m_ace = 1
  287. @m_total += 11
  288. else
  289. @m_total += 1
  290. end
  291. else
  292. @m_total += @cards[@card_used]
  293. end

  294. check_win2


  295. end

  296. def stay
  297. while (@d_total<=@m_total)
  298. check_cards
  299. @card_used +=1
  300. if @d_hand3 == 0
  301. @d_hand3 = @cards[@card_used]
  302. @d_graphic3 = @graphic[@card_used]
  303. elsif @d_hand4 == 0 and @m_hand3 != 0
  304. @d_hand4 = @cards[@card_used]
  305. @d_graphic4 = @graphic[@card_used]
  306. elsif @d_hand5 == 0 and @m_hand4 != 0
  307. @d_hand5 = @cards[@card_used]
  308. @d_graphic5 = @graphic[@card_used]
  309. end

  310. if @cards[@card_used] == 1
  311. if @d_total <=10
  312. @d_ace = 1
  313. @d_total += 11
  314. else
  315. @d_total += 1
  316. end
  317. else
  318. @d_total += @cards[@card_used]
  319. end
  320. end
  321. check_win3
  322. end

  323. def check_win
  324. if @test == 0
  325. if @m_total == 21 and @d_total != 21
  326. draw_real_cards
  327. win
  328. elsif @m_total != 21 and @d_total == 21
  329. draw_real_cards
  330. lose
  331. elsif @m_total == 21 and @d_total == 21
  332. draw_real_cards
  333. tie
  334. else
  335. @test = 1
  336. @hitstay_window.active = true
  337. end
  338. end
  339. end

  340. def check_win2
  341. if @m_total >= 22 and @m_ace == 1
  342. @m_total -= 10
  343. @m_ace = 0
  344. draw_cards
  345. elsif @m_total >= 22
  346. draw_real_cards
  347. lose
  348. elsif @m_total == 21
  349. draw_real_cards
  350. win
  351. elsif @m_total <=20
  352. draw_cards
  353. @hitstay_window.active = true
  354. end
  355. end

  356. def check_win3
  357. if @d_total >= 22 and @d_ace == 1
  358. @d_total -= 10
  359. @d_ace = 0
  360. draw_real_cards
  361. elsif @d_total >= 22
  362. draw_real_cards
  363. win
  364. elsif @d_total == 21
  365. draw_real_cards
  366. lose
  367. elsif @d_total > @m_total and @d_total <= 20
  368. draw_real_cards
  369. lose
  370. elsif @d_total == @m_total
  371. draw_real_cards
  372. tie
  373. elsif @d_total < @m_total
  374. draw_real_cards
  375. win
  376. end
  377. end

  378. def win
  379. $game_party.gain_gold(@currentbet*2)
  380. @help_window.set_text("Win!")
  381. delay(3)
  382. $scene = Scene_Map.new
  383. end

  384. def lose
  385. @help_window.set_text("Lose!")
  386. delay(3)
  387. $scene = Scene_Map.new
  388. end

  389. def tie
  390. $game_party.gain_gold(@currentbet)
  391. @help_window.set_text("Tie!")
  392. delay(3)
  393. $scene = Scene_Map.new
  394. end

  395. def delay(seconds)
  396. for i in 0...(seconds * 10)
  397. sleep 0.1
  398. Graphics.update
  399. end
  400. end

  401. end



  402. class Window_Table < Window_Base

  403. def initialize
  404. super(0, 64, 512, 416)
  405. self.contents = Bitmap.new(width - 32, height - 32)
  406. self.contents.font.name = $fontface
  407. self.contents.font.size = $fontsize
  408. refresh
  409. end
  410. #--------------------------------------------------------------------------
  411. def refresh(hand1 = 0, graphic1 = 53,
  412. hand2 = 0, graphic2 = 53,
  413. hand3 = 0, graphic3 = 53,
  414. hand4 = 0, graphic4 = 53,
  415. hand5 = 0, graphic5 = 53,
  416. d_hand1 = 0, d_graphic1 = 53,
  417. d_hand2 = 0, d_graphic2 = 53,
  418. d_hand3 = 0, d_graphic3 = 53,
  419. d_hand4 = 0, d_graphic4 = 53,
  420. d_hand5 = 0, d_graphic5 = 53,
  421. total = 0)

  422. @hand1 = hand1
  423. @hand2 = hand2
  424. @hand3 = hand3
  425. @hand4 = hand4
  426. @hand5 = hand5
  427. @d_hand1 = d_hand1
  428. @d_hand2 = d_hand2
  429. @d_hand3 = d_hand3
  430. @d_hand4 = d_hand4
  431. @d_hand5 = d_hand5
  432. @graphic1 = graphic1
  433. @graphic2 = graphic2
  434. @graphic3 = graphic3
  435. @graphic4 = graphic4
  436. @graphic5 = graphic5
  437. @d_graphic1 = d_graphic1
  438. @d_graphic2 = d_graphic2
  439. @d_graphic3 = d_graphic3
  440. @d_graphic4 = d_graphic4
  441. @d_graphic5 = d_graphic5
  442. @total = total

  443. self.contents.clear

  444. self.contents.draw_text(32, 320, 128, 32, "Your Hand: " + @total.to_s)

  445. graphic
  446. end

  447. def graphic
  448. x = 0
  449. y = 0
  450. @frame_width = 71
  451. @frame_height = 96
  452. if @graphic1 !=nil
  453. @xpos1 = @graphic1*@frame_width
  454. else
  455. @xpos1 = 52
  456. end
  457. if @graphic2 !=nil
  458. @xpos2 = @graphic2*@frame_width
  459. else
  460. @xpos2 = 52
  461. end
  462. if @graphic3 !=nil
  463. @xpos3 = @graphic3*@frame_width
  464. else
  465. @xpos3 = 52
  466. end
  467. if @graphic4 !=nil
  468. @xpos4 = @graphic4*@frame_width
  469. else
  470. @xpos4 = 52
  471. end
  472. if @graphic5 !=nil
  473. @xpos5 = @graphic5*@frame_width
  474. else
  475. @xpos5 = 52
  476. end
  477. if @d_graphic1 !=nil
  478. @xposd1 = @d_graphic1*@frame_width
  479. else
  480. @xposd1 = 52
  481. end
  482. if @graphic2 !=nil
  483. @xposd2 = @d_graphic2*@frame_width
  484. else
  485. @xposd2 = 52
  486. end
  487. if @d_graphic3 !=nil
  488. @xposd3 = @d_graphic3*@frame_width
  489. else
  490. @xposd3 = 52
  491. end
  492. if @graphic4 !=nil
  493. @xposd4 = @d_graphic4*@frame_width
  494. else
  495. @xposd4 = 52
  496. end
  497. if @d_graphic5 !=nil
  498. @xposd5 = @d_graphic5*@frame_width
  499. else
  500. @xposd5 = 52
  501. end
  502. bitmap = RPG::Cache.picture("cards")
  503. src_rect_hand1 = Rect.new(@xpos1, 0, @frame_width, @frame_height)
  504. src_rect_hand2 = Rect.new(@xpos2, 0, @frame_width, @frame_height)
  505. src_rect_hand3 = Rect.new(@xpos3, 0, @frame_width, @frame_height)
  506. src_rect_hand4 = Rect.new(@xpos4, 0, @frame_width, @frame_height)
  507. src_rect_hand5 = Rect.new(@xpos5, 0, @frame_width, @frame_height)
  508. src_rect_d_hand1 = Rect.new(@xposd1, 0, @frame_width, @frame_height)
  509. src_rect_d_hand2 = Rect.new(@xposd2, 0, @frame_width, @frame_height)
  510. src_rect_d_hand3 = Rect.new(@xposd3, 0, @frame_width, @frame_height)
  511. src_rect_d_hand4 = Rect.new(@xposd4, 0, @frame_width, @frame_height)
  512. src_rect_d_hand5 = Rect.new(@xposd5, 0, @frame_width, @frame_height)
  513. self.contents.blt(0,192,bitmap,src_rect_hand1)
  514. self.contents.blt(96,192,bitmap,src_rect_hand2)
  515. self.contents.blt(96*2,192,bitmap,src_rect_hand3)
  516. self.contents.blt(96*3,192,bitmap,src_rect_hand4)
  517. self.contents.blt(96*4,192,bitmap,src_rect_hand5)
  518. self.contents.blt(0,0,bitmap,src_rect_d_hand1)
  519. self.contents.blt(96,0,bitmap,src_rect_d_hand2)
  520. self.contents.blt(96*2,0,bitmap,src_rect_d_hand3)
  521. self.contents.blt(96*3,0,bitmap,src_rect_d_hand4)
  522. self.contents.blt(96*4,0,bitmap,src_rect_d_hand5)

  523. end


  524. end


  525. class Window_Bet < Window_Selectable
  526. # ------------------------------------
  527. def initialize
  528. super(512, 64, 128, 224)
  529. self.contents = Bitmap.new(width - 32, height - 32)
  530. self.contents.font.name = $fontface
  531. self.contents.font.size = $fontsize
  532. @column_max = 1
  533. refresh
  534. self.index = 0
  535. end
  536. # ------------------------------------

  537. def refresh
  538. if self.contents != nil
  539. self.contents.dispose
  540. self.contents = nil
  541. end
  542. @data = []
  543. @item_max = 6
  544. if @item_max > 0
  545. self.contents = Bitmap.new(width - 32, row_max * 32)
  546. for i in 0...@item_max
  547. draw_item(i)
  548. end
  549. end
  550. end
  551. # ------------------------------------
  552. def draw_item(index)
  553. x = 4
  554. y = index * 32
  555. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  556. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  557. case index
  558. when 0
  559. self.contents.draw_text(x , y, 128, 32, "25", 0)
  560. when 1
  561. self.contents.draw_text(x , y, 128, 32, "50", 0)
  562. when 2
  563. self.contents.draw_text(x , y, 128, 32, "100", 0)
  564. when 3
  565. self.contents.draw_text(x , y, 128, 32, "500", 0)
  566. when 4
  567. self.contents.draw_text(x , y, 128, 32, "Done", 0)
  568. when 5
  569. self.contents.draw_text(x , y, 128, 32, "Quit", 0)
  570. end
  571. end
  572. # ------------------------------------
  573. def update_help
  574. @help_window.set_text("" )
  575. end
  576. end


  577. class Window_Money < Window_Base
  578. # ------------------------------------
  579. def initialize
  580. super(512, 288, 128, 96)
  581. self.contents = Bitmap.new(width - 32, height - 32)
  582. self.contents.font.name = $fontface
  583. self.contents.font.size = $fontsize
  584. @bet = 0
  585. refresh(@bet)
  586. end
  587. # ------------------------------------
  588. def refresh(bet)
  589. @bet = bet
  590. self.contents.clear
  591. self.contents.font.color = normal_color
  592. self.contents.draw_text(0, 0, 96, 32, $game_party.gold.to_s,2)
  593. self.contents.draw_text(0, 32, 96, 32, @bet.to_s, 2)
  594. end
  595. end


  596. class Window_HitStay < Window_Selectable
  597. # ------------------------------------
  598. def initialize
  599. super(512, 384, 128, 96)
  600. self.contents = Bitmap.new(width - 32, height - 32)
  601. self.contents.font.name =$fontface
  602. self.contents.font.size = $fontsize
  603. @column_max = 1
  604. refresh
  605. self.index = 0
  606. end
  607. # ------------------------------------

  608. def refresh
  609. if self.contents != nil
  610. self.contents.dispose
  611. self.contents = nil
  612. end
  613. @data = []
  614. @item_max = 2
  615. if @item_max > 0
  616. self.contents = Bitmap.new(width - 32, row_max * 32)
  617. for i in 0...@item_max
  618. draw_item(i)
  619. end
  620. end
  621. end
  622. # ------------------------------------
  623. def draw_item(index)
  624. x = 4
  625. y = index * 32
  626. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  627. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  628. case index
  629. when 0
  630. self.contents.draw_text(x , y, 128, 32, "Hit", 0)
  631. when 1
  632. self.contents.draw_text(x , y, 128, 32, "Stay", 0)
  633. end
  634. end
  635. # ------------------------------------
  636. def update_help
  637. @help_window.set_text("" )
  638. end
  639. end

复制代码




图片:
http://ftp2.66rpg.com/3/临时� ... tle Arena/cards.png

KRKR + NS 学习中..........
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2005-10-22
帖子
519
20
发表于 2006-7-18 23:57:34 | 只看该作者
天气那个咚咚实在是太好了~~赞一个嘎~
3rd chapter ==> 55% 完工日期===>202X年?

跳不跳呢跳不跳呢跳不跳呢……下个项目死磕HQ……
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-12-5 03:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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