赞 | 3 |
VIP | 0 |
好人卡 | 39 |
积分 | 1 |
经验 | 101436 |
最后登录 | 2017-9-1 |
在线时间 | 2276 小时 |
Lv1.梦旅人 路人党员
- 梦石
- 0
- 星屑
- 52
- 在线时间
- 2276 小时
- 注册时间
- 2010-12-30
- 帖子
- 3225
|
本帖最后由 英顺的马甲 于 2011-2-15 11:23 编辑
- $item_max = {1=>30,2=>10} # 物品id => 上限(可以超过99)
- class Game_Party
- def gain_item(item_id, n)
- if item_id > 0
- @max = 99
- @max = $item_max[item_id] if $item_max[item_id] != nil
- @items[item_id] = [[item_number(item_id) + n, 0].max, @max].min
- end
- end
- end
- class Scene_Shop
- def update_buy
- @status_window.item = @buy_window.item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @buy_window.item
- if @item == nil or @item.price > $game_party.gold
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- item_max = 99
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- item_max = $item_max[@item.id] if $item_max[@item.id] != nil
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- if number == 99
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- max = @item.price == 0 ? 99 : $game_party.gold / @item.price
- max = [max, item_max - number].min
- @buy_window.active = false
- @buy_window.visible = false
- @number_window.set(@item, max, @item.price)
- @number_window.active = true
- @number_window.visible = true
- end
- end
- end
复制代码 |
|