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

Project1

 找回密码
 注册会员
搜索
查看: 1068|回复: 1
打印 上一主题 下一主题

[已经过期] 武器升級系統

[复制链接]

Lv4.逐梦者

梦石
0
星屑
6388
在线时间
989 小时
注册时间
2010-12-3
帖子
45
跳转到指定楼层
1
发表于 2012-7-28 20:08:26 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 ada01 于 2012-7-28 21:04 编辑

這個腳本是我在RM大师天干宝典乙卷找到的...不過不知為何它的所有道具欄中的顯示似乎是不正確的...可以請懂的人幫我看看嗎??
另外...他原本一個武器可以中裝備四個屬性,我想把它設定成原本只有一個,然後依照武器等級提升才陸續出現其他三個...謝謝...
以下是腳本的內容...

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

# ▼▲▼ XRXS24. システム?ウェポンプロパティXC. ver..01a ▼▲▼
# by 桜雅 在土
#
# ※ XRXS.RGSS改良カスタマイズ が必要です。

# --- 仕様 ---
#
# ◇装備武器のプロパティの変更
#  ├◇例:actor(==Game_Actor)の装備武器の付与属性#1を 21 に設定
# └◇スクリプト:actor.weapon_property[PROPERTY_ELEMENT_GRANT_1st] = 21
#
#==============================================================================
# □ 定数
#==============================================================================
module Fixed_PropertyNumber
# 現在のプロパティの総数
PROPERTY_NUMBER = 8
# 「属性」数(ダメージ倍率ようとして用いられる属性の数)
ELEMENTS_NUMBER = 16
# 以下のナンバーは 同値は指定不可能かつ0から個数-1までの整数
PROPERTY_ROOM_FILLED = 0 # プロパティ:部屋が空いているかどうか
PROPERTY_LEVEL = 1 # プロパティ:武器レベル
PROPERTY_EXP = 2 # プロパティ:エクストラポイント
PROPERTY_EXP_SECOND = 3 # プロ靴匹#亥ē攻去楗荪ぅ螗?ケタ目(32768進法)
PROPERTY_ELEMENT_GRANT_1st = 4 # プロパティ:付与属性#1
PROPERTY_ELEMENT_GRANT_2nd = 5 # プロパティ:付与属性#2
PROPERTY_ELEMENT_GRANT_3rd = 6 # プロパティ:付与属性#3
PROPERTY_ELEMENT_GRANT_4th = 7 # プロパティ:付与属性#4
end
#==============================================================================
$xrxs24_weapon_property_system_work = true
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :weapons_table # ウェポンテーブル
#--------------------------------------------------------------------------
# ウェポンテーブル解説
#--------------------------------------------------------------------------
=begin
@weapons_table[weapon_id, room_no, property]

weapon_id は、武器のIDです。
room_no は、部屋のNo.です。武器がここに格納されます。
property は、プロパティです。

property
0 部屋の空き情報。0が空き、1が埋まり。
1 EXP数値。数値が入ります。

例えば、@weapons_table[1, 0, 0] が1の場合、
ID.1の武器がNo.0の部屋に存在する。ということ。
=end
def weapons_table
@weapons_table
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias xrxs24_initialize initialize
def initialize
xrxs24_initialize
# ウェポンテーブルを作成
@weapons_table = Table.new(0,0,PROPERTY_NUMBER)
end
#--------------------------------------------------------------------------
# ● 武器の入手 # ←武器の増加
# weapon_id : 武器 ID
# set_level : 初期武器レベル # ←元個数n
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, set_level)
# weapon_id が 0 の場合
if weapon_id == 0
return 0
end
# ハッシュの個数データを更新
if weapon_id > 0
@weapons[weapon_id] = [[weapon_number(weapon_id) + 1, 0].max, 99].min
end
# ウェポンテーブルに新規アイテムを追加
# xsize(テーブルの武器IDの最大値)が足りない場合リサイズ
if @weapons_table.xsize <= weapon_id
@weapons_table.resize(weapon_id+1, @weapons_table.ysize, @weapons_table.zsize)
end
# ysize(テーブルの個数の最大値)が足りない場合リサイズ
num = weapon_number(weapon_id)
if @weapons_table.ysize <= num
@weapons_table.resize(@weapons_table.xsize, num+1, @weapons_table.zsize)
end
# ウェポンテーブルから空き部屋No.を検索
for i in 0...@weapons_table.ysize
# 空き部屋である 0 を返した場合
if @weapons_table[weapon_id, i, PROPERTY_ROOM_FILLED] != 1
# 部屋を埋める
@weapons_table[weapon_id, i, PROPERTY_ROOM_FILLED] = 1
# 初期武器レベルを設定
@weapons_table[weapon_id, i, PROPERTY_LEVEL] = set_level
# EXPをレベルの三乗に設定
expp = set_level ** 3
# EXPの数値を設定
@weapons_table[weapon_id, i, PROPERTY_EXP] = expp%32768
@weapons_table[weapon_id, i, PROPERTY_EXP_SECOND] = (expp/32768).floor
# 終了、部屋番号を返す
return i
end
end
# 空き部屋が無かった場合
p "[空的房间!!" # 本来起こりえないはず # 起きたらプログラムミス
end
#--------------------------------------------------------------------------
# ● 武器を捨てる # ←武器の減少
# weapon_id : 武器 ID
# room_no : ルームNo. # ※元?個数n
#--------------------------------------------------------------------------
def lose_weapon(weapon_id, room_no)
# weapon_id が 0 の場合
if weapon_id == 0
return 0
end
# ハッシュの個数データを更新
if weapon_id > 0
@weapons[weapon_id] = [[weapon_number(weapon_id) - 1, 0].max, 99].min
end
# ウェポンテーブルに設定
# 部屋を空き部屋にする
@weapons_table[weapon_id, room_no, PROPERTY_ROOM_FILLED] = 0
# 他全プロパティを 0 化
for i in 0...PROPERTY_NUMBER
@weapons_table[weapon_id, room_no, i] = 0
end
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :weapon_property # 装備中の武器のウェポンプロパティ
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias xrxs24_setup setup
def setup(actor_id)
xrxs24_setup(actor_id)
# 初期化
@weapon_property = Table.new(PROPERTY_NUMBER)
@weapon_property[PROPERTY_LEVEL] = 1 # 初期武器のレベルは1
@equip_room_no = 0
end
#--------------------------------------------------------------------------
# ● 通常攻撃の属性取得
#--------------------------------------------------------------------------
alias xrxs24_element_set element_set
def element_set
attack_element_set = xrxs24_element_set
for i in 1..ELEMENTS_NUMBER
for j in [PROPERTY_ELEMENT_GRANT_1st,
PROPERTY_ELEMENT_GRANT_2nd,
PROPERTY_ELEMENT_GRANT_3rd,
PROPERTY_ELEMENT_GRANT_4th]
if @weapon_property[j] == i and !attack_element_set.include?(i)
attack_element_set.push(i)
end
end
end
return attack_element_set
end
#--------------------------------------------------------------------------
# ● 装備変更予定の部屋番号
# room_no : 装備する元のアイテムの部屋No.
#--------------------------------------------------------------------------
def equip_room_no(rn)
@equip_room_no = rn
end
#--------------------------------------------------------------------------
# ● 装備の変更
# equip_type : 装備タイプ
# id : 武器 or 防具 ID (0 なら装備解除)
#--------------------------------------------------------------------------
alias xrxs24_equip equip
def equip(equip_type, id)
case equip_type
when 0 # 武器
if id == 0 or $game_party.weapon_number(id) > 0
# 現在装備武器
if @weapon_id != 0
# 現在装備を増やす
used_room_no = $game_party.gain_weapon(@weapon_id, 1)
# アクター現在武器のプロパティ
for i in 0...PROPERTY_NUMBER
# プロパティを部屋へコピー
$game_party.weapons_table[@weapon_id, used_room_no, i] = @weapon_property
# コピー後に削除
@weapon_property = 0
end
# 部屋の空き状況は無条件で 1 にする
$game_party.weapons_table[@weapon_id, used_room_no, PROPERTY_ROOM_FILLED] = 1
#p "武器ID. " + @weapon_id.to_s + ", 部屋No." + used_room_no.to_s
end
# 新規装着
if id != 0
# 装備対象武器のプロパティ
for i in 0...PROPERTY_NUMBER
# プロパティをアクターへコピー
@weapon_property = $game_party.weapons_table[id, @equip_room_no, i]
# コピー後に削除
$game_party.weapons_table[id, @equip_room_no, i] = 0
end
# 装備対象のアイテムを消す
$game_party.lose_weapon(id, @equip_room_no)
# 外す場合
else
# アクタープロパティを初期化
for i in 0...PROPERTY_NUMBER
@weapon_property = 0
end
end
# 装備変更
@weapon_id = id
end
return
end
xrxs24_equip(equip_type, id)
end
#--------------------------------------------------------------------------
# ● 基本攻撃力の取得
#--------------------------------------------------------------------------
def base_atk
weapon = $data_weapons[@weapon_id]
if weapon == nil
return 0
else
return weapon.atk * (100 + weapon.atk%10 * @weapon_property[PROPERTY_LEVEL]) /100
end
end
end
#==============================================================================
# ■ Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias xrxs24_refresh refresh
def refresh
@data_id = []
xrxs24_refresh
end
#--------------------------------------------------------------------------
# ● アイテムの部屋番号の取得
#--------------------------------------------------------------------------
def item_room_no
return @data_id[self.index]
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の武器を @data に返す
#--------------------------------------------------------------------------
def set_own_weapon_data
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
# 武器の個別描写を行う
for j in 0...$game_party.weapons_table.ysize
if $game_party.weapons_table[i, j, PROPERTY_ROOM_FILLED] == 1
# 武器をプッシュ
@data.push($data_weapons)
# 部屋No.を合わせる
@data_id[@data.size-1] = j
end
end
# ---
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
alias xrxs24_draw_item draw_item
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
room_no = @data_id[index].nil? ? 0 : @data_id[index]
number = $game_party.weapon_number(item.id)
x = 4 + index % @column_max * (288 + 32)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id)
opacity = 255
else
opacity = 128
end
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id)
self.contents.font.color = system_color
self.contents.draw_text(x + 224, y, 56, 32, "Lv. ")
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
self.contents.draw_text(x +224, y, 56, 32, "Lv. ")
end
level = $game_party.weapons_table[item.id, room_no, PROPERTY_LEVEL].to_s
self.contents.draw_text(x + 232, y, 48, 32, level, 2)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
else
xrxs24_draw_item(index)
end
end
end
#==============================================================================
# ■ Window_EquipRight
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias xrxs24_refresh refresh
def refresh
xrxs24_refresh
self.contents.font.color = system_color
self.contents.draw_text(276, 0, 56, 32, "Lv. ")
self.contents.font.color = normal_color
level = @actor.weapon_property[PROPERTY_LEVEL].to_s
self.contents.draw_text(284, 0, 48, 32, level, 2)
end
end
#==============================================================================
# ■ Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● アイテムの部屋番号の取得
#--------------------------------------------------------------------------
def item_room_no
return @data_id[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias xrxs24_refresh refresh
def refresh
@data_id = []
xrxs24_refresh
end
#--------------------------------------------------------------------------
# ● 指定クラスが装備可能、かつ所有している武器を @data に返す
#--------------------------------------------------------------------------
def set_equipable_weapon_data(class_id)
weapon_set = $data_classes[class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
# 武器の個別描写を行う
for j in 0...$game_party.weapons_table.ysize
if $game_party.weapons_table[i, j, PROPERTY_ROOM_FILLED] == 1
# 武器をプッシュ
@data.push($data_weapons)
# 部屋No.を合わせる
@data_id[@data.size-1] = j
end
end
# ---
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
alias xrxs24_draw_item draw_item
def draw_item(index)
item = @data[index]
x = 4 + index % @column_max * (288 + 32)
y = index / @column_max * 32
case item
when RPG::Weapon
room_no = @data_id[index].nil? ? 0 : @data_id[index]
number = $game_party.weapon_number(item.id)
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = system_color
self.contents.draw_text(x + 224, y, 56, 32, "Lv. ")
self.contents.font.color = normal_color
level = $game_party.weapons_table[item.id, room_no, PROPERTY_LEVEL].to_s
self.contents.draw_text(x + 232, y, 48, 32, level, 2)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
else
xrxs24_draw_item(index)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
if self.item.is_a?(RPG::Weapon)
element_name = $data_system.elements[$game_party.weapons_table[self.item.id, self.item_room_no, PROPERTY_ELEMENT_GRANT_1st]]
else
element_name = ""
end
@help_window.set_text(self.item == nil ? "" : self.item.description + element_name)
end
end
#==============================================================================
# ■ Window_ShopSell
#==============================================================================
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :column_max
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias xrxs24_refresh refresh
def refresh
@data_id = []
xrxs24_refresh
end
#--------------------------------------------------------------------------
# ● 部屋No.の取得
#--------------------------------------------------------------------------
def item_room_no
return @data_id[self.index]
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の武器を @data に返す
#--------------------------------------------------------------------------
def set_own_weapon_data
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
# 武器の個別描写を行う
for j in 0...$game_party.weapons_table.ysize
if $game_party.weapons_table[i, j, PROPERTY_ROOM_FILLED] == 1
# 武器をプッシュ
@data.push($data_weapons)
# 部屋No.を合わせる
@data_id[@data.size-1] = j
end
end
# ---
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
alias xrxs24_draw_item draw_item
def draw_item(index)
item = @data[index]
x = 4 + index % @column_max * (288 + 32)
y = index / @column_max * 32
case item
when RPG::Weapon
room_no = @data_id[index].nil? ? 0 : @data_id[index]
number = $game_party.weapon_number(item.id)
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = system_color
self.contents.draw_text(x + 224, y, 56, 32, "Lv. ")
self.contents.font.color = normal_color
level = $game_party.weapons_table[item.id, room_no, PROPERTY_LEVEL].to_s
self.contents.draw_text(x + 232, y, 48, 32, level, 2)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
else
xrxs24_draw_item(index)
end
end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# アイテムウィンドウの可視状態設定
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# 現在装備中のアイテムを取得
item1 = @right_window.item
# 現在のアイテムウィンドウを @item_window に設定
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# ライトウィンドウがアクティブの場合
if @right_window.active
# 装備変更後のパラメータを消去
@left_window.set_new_parameters(nil, nil, nil)
end
# アイテムウィンドウがアクティブの場合
if @item_window.active
# 現在選択中のアイテムを取得
item2 = @item_window.item
# 部屋No.の取得
room_no = @item_window.item_room_no
# 装備は変更しない
# 装備変更後のパラメータを取得
if item2.is_a?(RPG::Weapon)
# 現在の仕様では、アクター自体には物理攻撃力保持が有り得ないと考える。
# この仕様が変更された場合は、ここの改造のこと。
if item2 == nil
new_atk = 0
else
level = $game_party.weapons_table[item2.id, room_no, PROPERTY_LEVEL]
new_atk = item2.atk * (100 + item2.atk%10 * level) / 100
end
end
new_pdef = @actor.pdef - (item1 == nil ? 0 : item1.pdef) + (item2 == nil ? 0 : item2.pdef)
new_mdef = @actor.mdef - (item1 == nil ? 0 : item1.mdef) + (item2 == nil ? 0 : item2.mdef)
# レフトウィンドウに描画
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_item
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 装備 SE を演奏
$game_system.se_play($data_system.equip_se)
# アイテムウィンドウで現在選択されているデータを取得
item = @item_window.item
item_room_no = @item_window.item_room_no
# 装備を変更------
# ---部屋No.を先に教える
@actor.equip_room_no(item_room_no != nil ? item_room_no : 0)
# ---実際に装備を変更
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# ---------------
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# ライトウィンドウ、アイテムウィンドウの内容を再作成
@right_window.refresh
@item_window.refresh
return
end
end
end
#==============================================================================
# ■ Scene_Shop
#==============================================================================
class Scene_Shop
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias xrxs24_main main
def main
# 売却確認ウィンドウの作成
@sell_check_window = Window_ShopSellCheck.new
@sell_check_window.active = false
@sell_check_window.visible = false
# 呼び戻す
xrxs24_main
# ウィンドウを解放
@sell_check_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias xrxs24_update update
def update
# ウィンドウを更新
@sell_check_window.update
# 売却確認ウィンドウがアクティブの場合: update_sell_check を呼ぶ
if @sell_check_window.active
update_sell_check
return
end
# 呼び戻す
xrxs24_update
end
#--------------------------------------------------------------------------
# ● フレーム更新 (売却ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
alias xrxs24_update_sell update_sell
def update_sell
# C ボタンが押された場合
if Input.trigger?(Input::C) and @sell_window.item.is_a?(RPG::Weapon)
# アイテムを取得
@item = @sell_window.item
# 部屋No.の取得
sell_room_no = @sell_window.room_no
# ステータスウィンドウのアイテムを設定
@status_window.item = @item
# アイテムが無効の場合、または価格が 0 (売却不可) の場合
if @item == nil or @item.price == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ウィンドウの状態を売却確認モードへ
@sell_window.active = false
@sell_window.visible = false
@sell_check_window.set(@item.id, sell_room_no)#,@item, max, @item.price / 2)
@sell_check_window.active = true
@sell_check_window.visible = true
@status_window.visible = true
return
end
xrxs24_update_sell
end
#--------------------------------------------------------------------------
# ● フレーム更新 (売却確認ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_sell_check
# B ボタンが押された場合 / "やめる"で C ボタンが押された場合
if Input.trigger?(Input::B) or
(Input.trigger?(Input::C) and @sell_check_window.cursor_pos == 1)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# 売却確認ウィンドウを非アクティブ?不可視に設定
@sell_check_window.active = false
@sell_check_window.visible = false
# ウィンドウの状態を売却モードへ
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
return
end
# "売却"で C ボタンが押された場合
if Input.trigger?(Input::C) and @sell_check_window.cursor_pos == 0
# ショップ SE を演奏
$game_system.se_play($data_system.shop_se)
# 売却確認ウィンドウを非アクティブ?不可視に設定
@sell_check_window.active = false
@sell_check_window.visible = false
# 売却処理
$game_party.gain_gold(@sell_check_window.total_price)
# room_noのアイテムを消す
item_id = @sell_check_window.item_id
room_no = @sell_check_window.room_no
$game_party.lose_weapon(item_id, room_no)
# 各ウィンドウをリフレッシュ
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# ウィンドウの状態を売却モードへ
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
return
end
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● アフターバトルフェーズ開始
#--------------------------------------------------------------------------
alias xrxs24_start_phase5 start_phase5
def start_phase5
# EXPを初期化
exp = 0
# ループ
for enemy in $game_troop.enemies
# エネミーが隠れ状態でない場合
unless enemy.hidden
# 獲得 EXP、ゴールドを追加
exp += enemy.exp
end
end
# EXP 獲得
for i in 0...$game_party.actors.size
actor = $game_party.actors
#if actor.cant_get_exp? == false
# アクターの武器に経験値獲得
now_exp = actor.weapon_property[PROPERTY_EXP_SECOND] * 32768
now_exp += actor.weapon_property[PROPERTY_EXP]
now_exp += exp
actor.weapon_property[PROPERTY_EXP] += now_exp%32768
actor.weapon_property[PROPERTY_EXP_SECOND] +=(now_exp/32768).floor
#end
end
xrxs24_start_phase5
end
end
#==============================================================================
# ■ Window_ShopSellCheck
#------------------------------------------------------------------------------
#  ショップ画面で、売却するアイテムを表示し、売却を選択するウィンドウです。
#==============================================================================
class Window_ShopSellCheck < Window_Base
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :total_price
attr_reader :cursor_pos
attr_reader :item_id
attr_reader :room_no
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 128, 368, 352)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● アイテムID、部屋No.
#--------------------------------------------------------------------------
def set(item_id, room_no)
@item_id = item_id
@room_no = room_no
@cursor_pos = 0
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# アイテム名描写
draw_item_name($data_weapons[@item_id], 4, 32)
# 武器レベルの取得と描写
level = $game_party.weapons_table[@item_id, @room_no, PROPERTY_LEVEL]
self.contents.font.color = system_color
self.contents.draw_text(244, 32, 90, 32, "Lv. ")
self.contents.font.color = normal_color
self.contents.draw_text(244, 32, 90, 32, level.to_s, 2)
# カーソル位置の更新
self.cursor_rect.set(240, 224, 96, 32)
# 選択肢の描写
self.contents.draw_text(244, 224, 96, 32, "出售")
self.contents.draw_text(244, 256, 96, 32, "取消")
# 売却金額の計算
@total_price = $data_weapons[@item_id].price * (10 + 1*level) / 20
# 合計価格と通貨単位を描画
domination = $data_system.words.gold
cx = contents.text_size(domination).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 160, 328-cx-2, 32, @total_price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(332-cx, 160, cx, 32, domination, 2)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if self.active
# カーソル上下
if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
if @cursor_pos == 0
@cursor_pos = 1
else
@cursor_pos = 0
end
# カーソル位置の更新
self.cursor_rect.set(240, 224 + 32 * @cursor_pos, 96, 32)
end
end
end
end
#==============================================================================
# ■ Window_PartyWeapon
#------------------------------------------------------------------------------
#  鍛冶屋画面で、パーティ全員の現在装備している武器を表示するウィンドウです。
#==============================================================================

class Window_PartyWeapon < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 368, 224)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.index = -1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, "全部武器")
self.contents.draw_text(4, 160, 192, 32, "所有物品")
for i in 0...$game_party.actors.size
actor = $game_party.actors
next if actor == nil
@data.push($data_weapons[actor.weapon_id])
# キャラ顔
draw_actor_facesquare($game_party.actors, 4, 32 + 32 * i+4)
# 武器名
self.contents.font.color = normal_color
draw_item_name(@data, 36, 32 + 32 * i)
level = $game_party.actors.weapon_property[PROPERTY_LEVEL]
# レベル
self.contents.draw_text(296, 32 + 32 * i, 24, 32, level.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(260, 32 + 32 * i, 32, 32, "Lv.")
end
@item_max = @data.size
end
#--------------------------------------------------------------------------
# ● グラフィック→顔&枠の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_facesquare(actor, x, y, width = 24, height = 24)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
src_rect = Rect.new((bitmap.width/4 - width)/2, 0, width, height)
self.contents.blt(x, y, bitmap, src_rect)
self.contents.draw_polygon([[x,y],[x+width,y],[x+width,y+height],[x,y+height]], Color.new(255,255,255,128))
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, 0,0)
else
self.cursor_rect.set(0, 32 + @index * 32, self.width - 32, 32)
end
end
end
#==============================================================================
# ■ Window_WeaponInfo
#------------------------------------------------------------------------------
#  鍛冶屋画面で、武器のパラメータなどを表示するウィンドウです。
#==============================================================================

class Window_WeaponInfo < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :level # 表示中の武器のレベル
attr_reader :property_elements # 属性
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize
super(368, 64, 272, 416)
self.contents = Bitmap.new(width - 32, height - 32)
# 消去する
set(nil)
@item_max = 5
end
#--------------------------------------------------------------------------
# ● レベルを上げられる状況にあるか
#--------------------------------------------------------------------------
def levelupable?
return @levelupable
end
#--------------------------------------------------------------------------
# ● 値をセットする
#--------------------------------------------------------------------------
def set(item, room_no = 0)
# 初期化
@levelupable = false
case item
when nil
# nilの場合全てを消去
self.contents.clear
return
when Game_Actor
# アクターを指定した場合は装備中の武器の情報 使用例:set(actor)
@actor = item
@item = $data_weapons[@actor.weapon_id]
else
# アイテムを指定した場合
@actor = nil
@item = item
@room_no = room_no
end
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# 初期化
@levelupable = false
self.contents.clear
# 武器名
draw_item_name(@item, 4, 32)
# 武器の場合、Lv: の描写
if @item.is_a?(RPG::Weapon)
# 武器のレベルと経験値の取得
if @actor != nil
@level = @actor.weapon_property[PROPERTY_LEVEL]
exp_p = @actor.weapon_property[PROPERTY_EXP_SECOND]
exp_p *= 32768
exp_p += @actor.weapon_property[PROPERTY_EXP]
else
@level = $game_party.weapons_table[@item.id, @room_no, PROPERTY_LEVEL]
exp_p = $game_party.weapons_table[@item.id, @room_no, PROPERTY_EXP_SECOND]
exp_p *= 32768
exp_p += $game_party.weapons_table[@item.id, @room_no, PROPERTY_EXP]
end
# 武器レベル
self.contents.font.color = system_color
self.contents.draw_text(140, 64, 32, 32, "Lv.")
self.contents.font.color = normal_color
self.contents.draw_text(216, 64, 24, 32, @level.to_s, 2)
# 武器経験値
self.contents.font.size = 8
self.contents.font.color = system_color
self.contents.draw_text(156, 88, 32, 16, "EXP.")
# EXPメーター
self.contents.draw_line(171, 96, 273, 96, Color.new(0,0,0,255), 3)
now_level_exp = next_exp = ((@level) ** 3)
next_level_exp = ((@level + 1) ** 3) # 次のレベルの所要EXPへの割合
percentile = [[100 * (exp_p - now_level_exp) / (next_level_exp - now_level_exp), 0].max, 100].min
if percentile < 100
line_color = Color.new(255, 255, 0, 255)
else
line_color = Color.new( 0, 255, 0, 255)
@levelupable = true
end
self.contents.draw_line(172, 96, 172 + percentile, 96, line_color, 1)
self.contents.font.size = 22
# 攻撃力
self.contents.font.color = system_color
self.contents.draw_text( 96, 128, 96, 32, $data_system.words.atk)
atk_p = @item.atk * (100 + @item.atk%10 * level)/100
self.contents.font.color = normal_color
self.contents.draw_text(192, 128, 48, 32, atk_p.to_s, 2)
# 武器属性
i_no = 0
for i in [PROPERTY_ELEMENT_GRANT_1st,
PROPERTY_ELEMENT_GRANT_2nd,
PROPERTY_ELEMENT_GRANT_3rd,
PROPERTY_ELEMENT_GRANT_4th]
if @actor != nil
element_id = @actor.weapon_property
else
element_id = $game_party.weapons_table[@item.id, @room_no, i]
end
if element_id != 0 and element_id != nil
self.contents.font.color = normal_color
self.contents.draw_text(112, 160 + 32*i_no, 128, 32, $data_system.elements[element_id])
else
self.contents.font.color = disabled_color
self.contents.draw_text(112, 160 + 32*i_no, 128, 32, "---")
end
i_no += 1
end
end
# 可視状態にする
self.visible = true
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, 0,0)
elsif @index == 0
self.cursor_rect.set(0, 64, self.width - 32, 32)
else
self.cursor_rect.set(0, 128 + @index * 32, self.width - 32, 32)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@help_window.set_text("进行武器强化。")
else
@help_window.set_text("为武器附加属性。")
end
end
end
#==============================================================================
# ■ Window_CenterAsk
#------------------------------------------------------------------------------
#  画面中央で二択の質問を問い掛けるウィンドウです。
#==============================================================================

class Window_CenterAsk < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(320, 192, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
@first_choice = ""
@second_choice = ""
@helptext = ["", ""]
@disabled = []
self.z = 9999
@item_max = 2
self.index = 0
end
#--------------------------------------------------------------------------
# ● 選択肢の設定 first_choice,second_choice == String
#--------------------------------------------------------------------------
def set(first_choice, second_choice, help1 = "", help2 = "")
@disabled[0] = false
@disabled[1] = false
@first_choice = first_choice
@second_choice = second_choice
@helptext[0] = help1
@helptext[1] = help2
width1 = self.contents.text_size(@first_choice).width
width2 = self.contents.text_size(@second_choice).width
self.width = (width1 > width2 ? width1 : width2) + 40
self.x = 320 - self.width / 2
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● 選択肢無効化
#--------------------------------------------------------------------------
def disable(n)
@disabled[n] = true
refresh
end
#--------------------------------------------------------------------------
# ● 選択肢が無効化されているか?
#--------------------------------------------------------------------------
def disabled?(n)
return @disabled[n]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @disabled[0]
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(4, 0, self.width-8, 32, @first_choice)
if @disabled[1]
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(4, 32, self.width-8, 32, @second_choice)
# カーソル位置も戻す
self.index = 0
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(@helptext[self.index])
end
end
#==============================================================================
# ■ Window_SmithyItems
#------------------------------------------------------------------------------
#  鍛冶屋画面で、付与のための所持アイテムの一覧を表示するウィンドウです。
#==============================================================================

class Window_SmithyItems < Window_ShopSell
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :item_max
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
self.x = 32
self.y = 256
self.width = 336
self.height = 224
self.opacity = 0
self.back_opacity = 0
@column_max = 1
self.index = -1
refresh
end
#--------------------------------------------------------------------------
# ● 現在 @item の第一属性の取得
#--------------------------------------------------------------------------
def item_first_element
item = self.item
room_no = self.item_room_no
return 0 if item.nil? or item.id == 0
if item.is_a?(RPG::Armor)
element_set = item.guard_element_set
else
element_set = item.element_set
end
if element_set.size == 0 and item.is_a?(RPG::Weapon)
for i in [PROPERTY_ELEMENT_GRANT_1st,
PROPERTY_ELEMENT_GRANT_2nd,
PROPERTY_ELEMENT_GRANT_3rd,
PROPERTY_ELEMENT_GRANT_4th]
element_id = $game_party.weapons_table[item.id, room_no, i]
if element_id > 0
element_set = [element_id]
break
end
end
end
if element_set.size == 0
return 0
else
return element_set[0]
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上のアイテムを @data に返す &属性所有のみ
#--------------------------------------------------------------------------
def set_own_item_data
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
if $data_items.element_set.size > 0
@data.push($data_items)
end
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の武器を @data に返す &属性所有のみ
#--------------------------------------------------------------------------
def set_own_weapon_data
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
# 武器の個別描写を行う
for j in 0...$game_party.weapons_table.ysize
if $game_party.weapons_table[i, j, PROPERTY_ROOM_FILLED] == 1
for k in [PROPERTY_ELEMENT_GRANT_1st,
PROPERTY_ELEMENT_GRANT_2nd,
PROPERTY_ELEMENT_GRANT_3rd,
PROPERTY_ELEMENT_GRANT_4th]
if ($data_weapons.element_set.size > 0) or
($game_party.weapons_table[i, j, k] > 0)
# 武器をプッシュ
@data.push($data_weapons)
# 部屋No.を合わせる
@data_id[@data.size-1] = j
break
end
end
end
end
# ---
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の防具を @data に返す &属性所有のみ
#--------------------------------------------------------------------------
def set_own_armor_data
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
if $data_armors.guard_element_set.size > 0
@data.push($data_armors)
end
end
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
element_id = self.item_first_element
case element_id
when 0
@help_window.set_text("没有可以附加的属性")
else
@help_window.set_text("附加属性: " + $data_system.elements[element_id])
end
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias xrxs24_update update
def update
xrxs24_update
# プレイヤーの移動中ではない場合
unless $game_player.moving?
# 鍛冶屋画面の呼び出しを実行
if $game_temp.smithy_calling
call_smithy
end
end
end
#--------------------------------------------------------------------------
# ● 鍛冶屋の呼び出し
#--------------------------------------------------------------------------
def call_smithy
# 鍛冶屋呼び出しフラグをクリア
$game_temp.smithy_calling = false
# プレイヤーの姿勢を矯正
$game_player.straighten
# 鍛冶屋画面に切り替え
$scene = Scene_Smithy.new
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :smithy_calling # 鍛冶屋 呼び出しフラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias xrxs24_initialize initialize
def initialize
xrxs24_initialize
@smithy_calling = false
end
end
#==============================================================================
# ■ Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ◆ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ◇ 鍛冶屋の処理
#--------------------------------------------------------------------------
def command_smithy
# バトル中断フラグをセット
$game_temp.battle_abort = true
# 鍛冶屋呼び出しフラグをセット
$game_temp.smithy_calling = true
# 商品リストに新しい項目を設定
$game_temp.shop_goods = [@parameters]
end
#--------------------------------------------------------------------------
# ◇ 武器経験値の取得
#--------------------------------------------------------------------------
def command_weapon_gain_exp(actor_id, exp)
now_exp = $game_party.actors[actor_id].weapon_property[PROPERTY_EXP_SECOND] * 32768
now_exp+= $game_party.actors[actor_id].weapon_property[PROPERTY_EXP]
now_exp+= exp
$game_party.actors[actor_id].weapon_property[PROPERTY_EXP] += now_exp%32768
$game_party.actors[actor_id].weapon_property[PROPERTY_EXP_SECOND] +=(now_exp/32768).floor
end
end
#==============================================================================
# ■ Scene_Smithy
#------------------------------------------------------------------------------
#  鍛冶屋画面の処理を行うクラスです。
#==============================================================================

class Scene_Smithy
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウを作成
@help_window = Window_Help.new
# パーティ武器ウィンドウを作成
@partyweapon_window = Window_PartyWeapon.new
@partyweapon_window.help_window = @help_window
@partyweapon_window.height += 192
@partyweapon_window.active = true
@partyweapon_window.index = 0
# アイテムウィンドウを作成
@sellect_window = Window_SmithyItems.new
@sellect_window.help_window = @help_window
@sellect_window.z = @partyweapon_window.z + 1
@sellect_window.active = false
# 武器インフォウィンドウを作成
@weaponinfo_window = Window_WeaponInfo.new
@weaponinfo_window.set(nil)
@weaponinfo_window.active = false
@weaponinfo_window.index = -1
@weaponinfo_window.help_window = @help_window
# ゴールドウィンドウを作成
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 416
@gold_window.z = @weaponinfo_window.z + 1
# 訪ねウィンドウを作成
@ask_window = Window_CenterAsk.new
@ask_window.active = false
@ask_window.help_window = @help_window
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@help_window.dispose
@gold_window.dispose
@partyweapon_window.dispose
@sellect_window.dispose
@weaponinfo_window.dispose
@ask_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@gold_window.update
@partyweapon_window.update
@sellect_window.update
@weaponinfo_window.update
@ask_window.update
# パーティ武器ウィンドウがアクティブの場合: update_partyweapon を呼ぶ
if @partyweapon_window.active
update_partyweapon
return
end
# 武器インフォウィンドウがアクティブの場合: update_weaponinfo を呼ぶ
if @weaponinfo_window.active
update_weaponinfo
return
end
# アイテム選択ウィンドウがアクティブの場合: update_sellect を呼ぶ
if @sellect_window.active
update_sellect
return
end
# 中央選択ウィンドウがアクティブの場合: update_ask を呼ぶ
if @ask_window.active
update_ask
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティ武器ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_partyweapon
# ステータスウィンドウのアイテムを設定
@weaponinfo_window.set($game_party.actors[@partyweapon_window.index])
# B ボタンが押された場合
if Input.trigger?(Input::B)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
@weaponinfo_window.active = true
@weaponinfo_window.index = 0
@partyweapon_window.active = false
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (武器インフォウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_weaponinfo
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
@partyweapon_window.active = true
@weaponinfo_window.active = false
@weaponinfo_window.index = -1
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
case @weaponinfo_window.index
when 0
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# レベルによる強化金額の設定はこちら(もう一箇所も)
price = (@weaponinfo_window.level ** 1.5).floor * 50
first_choice = "进行强化!! " + price.to_s + " " + $data_system.words.gold
if @weaponinfo_window.levelupable?
help1 = "支付强化武器所需的金钱。"
else
help1 = "武器经验值不足。"
end
if $game_party.gold < price
help1 = "现金不足。"
end
help2 = "中止强化。"
@ask_window.set(first_choice,"取消", help1, help2)
unless @weaponinfo_window.levelupable?
@ask_window.disable(0)
end
if $game_party.gold < price
@ask_window.disable(0)
end
@ask_window.active = true
@ask_window.visible = true
@weaponinfo_window.active = false
return
else
# 属性付与へ。まずはアイテムウィンドウへ移行
if @sellect_window.item_max <= 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ウィンドウの状態を売却モードへ
@weaponinfo_window.active = false
@sellect_window.index = 0
@sellect_window.active = true
@sellect_window.refresh
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテム選択ウィンドウがアクティヴの場合)
#--------------------------------------------------------------------------
def update_sellect
# ステータスウィンドウのアイテムを設定
#@weaponinfo_window.set(@sellect_window.item, @sellect_window.item_room_no)
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ウィンドウの状態を初期モードへ
@weaponinfo_window.active = true
@sellect_window.active = false
@sellect_window.index = -1
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 属性が一つ以上あるか、
if @sellect_window.item_first_element == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 属性を付与確認
price = 500
first_choice = "附加属性!! " + price.to_s + " " + $data_system.words.gold
help1 = $data_system.elements[@sellect_window.item_first_element] + " 武器。"
help2 = "中止附加。"
if @sellect_window.item.price == 0
first_choice = "不能附加属性。"
help1 = "该人物不能使用。"
elsif $game_party.gold < price
help1 = "现金不足。"
end
@ask_window.set(first_choice,"取消", help1, help2)
if @sellect_window.item.price == 0
@ask_window.disable(0)
elsif $game_party.gold < price
@ask_window.disable(0)
end
@ask_window.active = true
@ask_window.visible = true
@sellect_window.active = false
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (中央二択ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_ask
# B ボタン or "やめる"で C ボタン が押された場合
if Input.trigger?(Input::B) or
(Input.trigger?(Input::C) and @ask_window.index == 1)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ウィンドウ
@ask_window.active = false
@ask_window.visible = false
if @sellect_window.index >= 0
@sellect_window.active = true
else
@weaponinfo_window.active = true
end
return
end
# "実行"で C ボタンが押された場合
if Input.trigger?(Input::C) and @ask_window.index == 0
if @ask_window.disabled?(0)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
if @sellect_window.index >= 0
# 属性付与
price = 500
# 属性付与 SE を演奏
Audio.se_stop
Audio.se_play("Audio/SE/027-Door04.ogg")
# 付与を実行
# IDNo.の取得
case @weaponinfo_window.index
when 1
set_id = PROPERTY_ELEMENT_GRANT_1st
when 2
set_id = PROPERTY_ELEMENT_GRANT_2nd
when 3
set_id = PROPERTY_ELEMENT_GRANT_3rd
when 4
set_id = PROPERTY_ELEMENT_GRANT_4th
end
# 代入
$game_party.actors[@partyweapon_window.index].weapon_property[set_id] =
@sellect_window.item_first_element
# 付与に使用したアイテムをなくす
if @sellect_window.item.is_a?(RPG::Weapon)
$game_party.lose_weapon(@sellect_window.item.id, @sellect_window.item_room_no)
else
$game_party.lose_item(@sellect_window.item.id, 1)
end
else
# 武器強化
# 武器レベルアップ ME を演奏
Audio.me_stop
Audio.me_play("Audio/ME/011-Item02.mid")
# 強化を実行
$game_party.actors[@partyweapon_window.index].weapon_property[PROPERTY_LEVEL] += 1
# レベルによる強化金額の設定はこちら(もう一箇所も)
price = (@weaponinfo_window.level ** 1.5).floor * 50
end
# 金額を支払う
$game_party.lose_gold(price)
# ウィンドウを戻す
@weaponinfo_window.active = true
@sellect_window.active = false
@sellect_window.index = -1
# ウィンドウを消す
@ask_window.active = false
@ask_window.visible = false
# 再描写する
@gold_window.refresh
@sellect_window.refresh
@partyweapon_window.refresh
@weaponinfo_window.refresh
end
end
end

#==============================================================================
# ◇ 外部ライブラリ
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# ● ライン描画 by 桜雅 在土
#--------------------------------------------------------------------------
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
# 描写距離の計算。大きめに直角時の長さ。
distance = (start_x - end_x).abs + (start_y - end_y).abs
# 描写開始
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x - (width-1)/2.floor, y - (width-1)/2.floor, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x - (width-1)/2.floor, y - (width-1)/2.floor, width, width, Color.new(r, g, b, a))
end
end
end
end
#--------------------------------------------------------------------------
# ● 多角形の描画(塗りつぶしなし) by 和希
# peaks : 頂点座標の配列 [[x1,y1],[x2,y2],[x3,y3], ... ]
# color : 線の色
# width : 線の幅
#--------------------------------------------------------------------------
def draw_polygon(peaks, color, width = 1)
# 辺(=頂点)の個数分だけ辺を描く
for i in 0 ... (peaks.size - 1)
# 頂点同士を線で結ぶ
draw_line( peaks[0], peaks[1], peaks[i+1][0], peaks[i+1][1], color, width )
end
# 最後の頂点と最初の頂点を結ぶ
draw_line( peaks[peaks.size - 1][0], peaks[peaks.size - 1][1], peaks[0][0], peaks[0][1], color, width )
end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

Lv4.逐梦者

梦石
0
星屑
6388
在线时间
989 小时
注册时间
2010-12-3
帖子
45
2
 楼主| 发表于 2012-8-7 00:11:04 | 只看该作者
我自行找到方法解決了...謝謝了(雖然也沒人理我就是了...哈哈)
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 20:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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