Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

quick question bout Rpgmaker's weapon lvl up script

Geowil

Member

I'm not sure if i am missing a commented line somewhere or something that may have to be done in the database, but i was wondering if leveling up the weapons was intended to add atk power to the character that equips the weapon.

as it stands right now, it is not doing that for me. I found a code line commented that adds attack power to a weapon when it gets leveled up but that increase is not passed on to the player.

is there a reason for this?

according to the comments the script I have is version .07

# ▼▲▼ XRXS24. システム・ウェポンプロパティXC. ver..07 ▼▲▼
 
Geowil":cgcglvxx said:
I'm not sure if i am missing a commented line somewhere or something that may have to be done in the database, but i was wondering if leveling up the weapons was intended to add atk power to the character that equips the weapon.

as it stands right now, it is not doing that for me. I found a code line commented that adds attack power to a weapon when it gets leveled up but that increase is not passed on to the player.

is there a reason for this?

according to the comments the script I have is version .07

# ▼▲▼ XRXS24. システム・ウェポンプロパティXC. ver..07 ▼▲▼
Who made the script? Try asking them for help.
 

Geowil

Member

well, in the interest of getting this fixed soon then later (rpgmaker has yet to respond to one of my pm's that i included the script with to see if he knew anything about the issue or if he even made the script) ill put the weapon level up section on here and see if anyone can figure out where the problem is at:

script block 1:

#The code goes from the first script, then second, then third

# it should be like this

#code one
#code two
#code three

#Code one begin





# ▼▲▼ XRXS.RGSS修正カスタマイズ ver..07 ▼▲▼
# by 桜雅 在土

#==============================================================================
# □ カスタマイズポイント
#==============================================================================
class Game_Battler
# 「乗算属性修正」
# ("特殊効果詰め合わせ"使用時は true にする必要があります。falseだと「最高倍率」)
ELEMENT_CORRECT_BY_MULTI = true
end
class Game_Actor < Game_Battler
# 「スキル使用可能条件をスキルを習得しているか否かに依存しない」(falseだと依存)
INDEPEND_SKILL_USABLE_ON_LEARNED = false
end
class Window_Skill < Window_Selectable
# 「消費SP0を隠す」(falseにすると、"スキル名 : 0"とゼロを表示します)
HIDE_ZERO_SP_COST = true
end
#==============================================================================
=begin
 前書き
    これはRGSSをXMS.RPGツクールXPスクリプトシェルフを
より開発しやすくする為に作られた修正の詰め合わせです。
 コピー場所
    「Scene_Debugより下でMainより上。
     スクリプトシェルフ等を利用している場合はそれら全てより上。」
※Scene_Debug以上を書き換えている場合、
それらの変更が無効になってしまう場合があります。
修正内容---------------------------------------------------------------------

修正/追加 部分
Game_Battler 属性修正の計算「乗算属性修正」への対応
Game_Actor 「スキル使用可能条件」への対応
オートステートの更新
   Window_Item @column_maxへの対応
   Window_SKill @column_maxへの対応
SP消費 0 を表示させない機能を搭載。
   Window_EquipItem @column_maxへの対応
   Window_ShopSell @column_maxへの対応
  Scene_Map 戦闘開始時のBGM停止を削除
同じBGMの場合は引き続きの演奏が出来る様に修正。
Scene_Battle バトルメッセージ処理軽減。
バトル終了時にMEをフェードアウト後に停止予約

リファクタリング 部分
Game_Battler 行動の効果適用の部分のリファクタリング
Game_Actor X位置のシフト値
Window_Item 武器などの@dataへのプッシュ
Window_MenuStatus draw_actor_menu_status
Window_EquipItem 武器などの@dataへのプッシュ
Window_ShopSell 武器などの@dataへのプッシュ
Window_BattleStatus draw_actor_battle_status
Scene_Equip 装備変更後のパラメータを取得 1~4
実際に装着
(追加)refresh軽量化
Scene_Battle make_basic_action_target_set
battle_exp
battle_gold

追加モジュール
XRXS_Check_ElementName_Set 属性名判定

-------------------------------------------------------------修正内容ここまで
=end
#------------------------------------------------------------------------------
#
#
# ▽ 修正/追加 部分
#
#
#==============================================================================
# â–  Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 属性修正の計算 + 倍率計算式
#--------------------------------------------------------------------------
alias xrxs_rgss_amendcustomize_elements_correct elements_correct
def elements_correct(element_set)
if ELEMENT_CORRECT_BY_MULTI
# 無属性の場合 100 を返す
return 100 if element_set == []
# 与えられた属性のレートを全て乗算
result = 100
for i in element_set
result *= self.element_rate(i) / 100.0
end
return result.to_i
else
return xrxs_rgss_amendcustomize_elements_correct
end
end
end
#==============================================================================
# â–  Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● スキルの使用可能判定 + 習得判定無効化設定可
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# INDEPEND_SKILL_USABLE_ON_LEARNED が true であればスキル習得判定を飛ばす
if not skill_learn?(skill_id) and not INDEPEND_SKILL_USABLE_ON_LEARNED
return false
end
return super
end
#--------------------------------------------------------------------------
# ● オートステートの更新
# old_armor : 外した防具
# new_armor : 装備した防具
#--------------------------------------------------------------------------
def update_auto_state(old_armor, new_armor)
# 外した防具のオートステートを強制解除
if old_armor != nil and old_armor.auto_state_id != 0
# 外す防具のオートステートが、
# 他の装備中の防具のオートステートと一致する場合、解除を行わない
bool = armors_auto_state_include?(old_armor)
unless bool
remove_state(old_armor.auto_state_id, true)
end
end
# 装備した防具のオートステートを強制付加
if new_armor != nil and new_armor.auto_state_id != 0
add_state(new_armor.auto_state_id, true)
end
end
#--------------------------------------------------------------------------
# ● 指定の防具のオートステートが現在装備中の防具のオートステートに含まれるか?
#--------------------------------------------------------------------------
def armors_auto_state_include?(old_armor)
return false if old_armor.nil?
bool = false
# 現在装備中の防具を取得
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
# 外された箇所を特定
case old_armor
when armor1
current_armor = armor1
when armor2
current_armor = armor2
when armor3
current_armor = armor3
when armor4
current_armor = armor4
end
# 判定
if current_armor != armor1 and !armor1.nil?
bool |= (old_armor.auto_state_id == armor1.auto_state_id)
end
if current_armor != armor2 and !armor2.nil?
bool |= (old_armor.auto_state_id == armor2.auto_state_id)
end
if current_armor != armor3 and !armor3.nil?
bool |= (old_armor.auto_state_id == armor3.auto_state_id)
end
if current_armor != armor4 and !armor4.nil?
bool |= (old_armor.auto_state_id == armor4.auto_state_id)
end
return bool
end
end





#------------------------------------------------------------------------------
#
#
# ▽ リファクタリング 部分
#
#
#==============================================================================
# â–  Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 通常攻撃のダメージを計算
#--------------------------------------------------------------------------
def attack_damage(attacker)
# 基本ダメージを計算
atk = [attacker.atk - self.pdef / 2, 0].max
damage = atk * (20 + attacker.str) / 20
return damage
end
#--------------------------------------------------------------------------
# ● スキルのダメージを計算
#--------------------------------------------------------------------------
def skill_damage(user, skill)
# 威力を計算
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# 倍率を計算
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# 基本ダメージを計算
damage = power * rate / 20
return damage
end
#--------------------------------------------------------------------------
# ● 第一命中力
#--------------------------------------------------------------------------
def first_hit_percent(user, skill = nil)
# skillがnilならば通常攻撃、でなければスキル、という判別。
if skill == nil
return user.hit
else
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
return hit
end
end
#--------------------------------------------------------------------------
# ● 第二命中力
#--------------------------------------------------------------------------
def second_hit_percent(user, skill = nil)
# skillがnilならば通常攻撃、でなければスキル、という判別。
eva = 8 * self.agi / user.dex + self.eva
if skill == nil
hit = self.damage < 0 ? 100 : 100 - eva
else
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
end
hit = self.cant_evade? ? 100 : hit
return hit
end
#--------------------------------------------------------------------------
# ● クリティカル発生確率の計算
#--------------------------------------------------------------------------
def critical_percent(user, skill = nil)
# skillがnilならば通常攻撃、でなければスキル、という判別。
if skill == nil
return 4 * user.dex / self.agi
else
return 0
end
end
#--------------------------------------------------------------------------
# ● 防御の効果適用
#--------------------------------------------------------------------------
def guarding_effect(damage)
return damage / 2
end
#--------------------------------------------------------------------------
# ● HP からダメージを減算
#--------------------------------------------------------------------------
def subtract_damage_from_hp(user, skill = nil)
last_hp = self.hp
self.hp -= self.damage
return self.hp != last_hp
end
#--------------------------------------------------------------------------
# ● 通常攻撃の効果適用
# attacker : 攻撃者 (バトラー)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# クリティカルフラグをクリア
self.critical = false
# 第一命中判定
hit_result = (rand(100) < first_hit_percent(attacker))
# 命中の場合
if hit_result == true
# 通常攻撃のダメージを計算
self.damage = attack_damage(attacker)
# 属性修正
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# ダメージの符号が正の場合
if self.damage > 0
# クリティカル修正
if rand(100) < critical_percent(attacker)
self.damage *= 2
self.critical = true
end
# 防御修正
if self.guarding?
self.damage = guarding_effect(self.damage)
end
end
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
hit_result = (rand(100) < second_hit_percent(attacker))
end
# 命中の場合
if hit_result == true
# ステート衝撃解除
remove_states_shock
# HP からダメージを減算
subtract_damage_from_hp(attacker)
# ステート変化
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# ミスの場合
else
# ダメージに "Miss" を設定
self.damage = "Miss"
# クリティカルフラグをクリア
self.critical = false
end
# メソッド終了
return true
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : スキルの使用者 (バトラー)
# skill : スキル
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# クリティカルフラグをクリア
self.critical = false
# スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
# またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# メソッド終了
return false
end
# 有効フラグをクリア
effective = false
# コモンイベント ID が有効の場合は有効フラグをセット
effective |= skill.common_event_id > 0
# 第一命中判定
hit_result = (rand(100) < first_hit_percent(user, skill))
# 不確実なスキルの場合は有効フラグをセット
effective |= hit < 100
# 命中の場合
if hit_result == true
# スキルのダメージを計算
self.damage = skill_damage(user, skill)
# 属性修正
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# ダメージの符号が正の場合
if self.damage > 0
# クリティカル修正
if rand(100) < critical_percent(user, skill)
self.damage *= 2
self.critical = true
end
# 防御修正
if self.guarding?
self.damage = guarding_effect(self.damage)
end
end
# 分散
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
hit_result = (rand(100) < second_hit_percent(user, skill))
# 不確実なスキルの場合は有効フラグをセット
effective |= hit < 100
end
# 命中の場合
if hit_result == true
# 威力 0 以外の物理攻撃の場合
if skill.power != 0 and skill.atk_f > 0
# ステート衝撃解除
remove_states_shock
# 有効フラグをセット
effective = true
end
# HP からダメージを減算
effective |= subtract_damage_from_hp(user, skill)
# ステート変化
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# 威力が 0 の場合
if skill.power == 0
# ダメージに空文字列を設定
self.damage = ""
# ステートに変化がない場合
unless @state_changed
# ダメージに "Miss" を設定
self.damage = "Miss"
end
end
# ミスの場合
else
# ダメージに "Miss" を設定
self.damage = "Miss"
end
# 戦闘中でない場合
unless $game_temp.in_battle
# ダメージに nil を設定
self.damage = nil
end
# メソッド終了
return effective
end
end


#==============================================================================
# â–  Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 描写するアイテムの取得
get_data_of_draw_items
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描写するアイテムの取得 @data
#--------------------------------------------------------------------------
def get_data_of_draw_items
# アイテムを追加
set_own_item_data
# 戦闘中以外なら武器と防具も追加
unless $game_temp.in_battle
set_own_weapon_data
set_own_armor_data
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上のアイテムを @data に返す
#--------------------------------------------------------------------------
def set_own_item_data
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items)
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の武器を @data に返す
#--------------------------------------------------------------------------
def set_own_weapon_data
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons)
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の防具を @data に返す
#--------------------------------------------------------------------------
def set_own_armor_data
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors)
end
end
end
end

#==============================================================================
# â–  Window_EquipRight
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# 初期化
self.contents.clear
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@data = []
@caption = []
# 描写するアイテムの取得
set_data_of_draw_items
@item_max = @data.size
# 描写
for i in 0...@data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * i, 92, 32, @caption)
draw_item_name(@data, 92, 32 * i)
end
end
#--------------------------------------------------------------------------
# ● 描写するアイテムの取得
#--------------------------------------------------------------------------
def set_data_of_draw_items
# アイテムデータ
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
# キャプションデータ
@caption.push($data_system.words.weapon)
@caption.push($data_system.words.armor1)
@caption.push($data_system.words.armor2)
@caption.push($data_system.words.armor3)
@caption.push($data_system.words.armor4)
end
end
#==============================================================================
# â–  Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 描写するアイテムの取得
get_data_of_draw_items
# 空白を追加
@data.push(nil)
# ビットマップを作成し、全項目を描画
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描写するアイテムの取得 @data
#--------------------------------------------------------------------------
def get_data_of_draw_items
case @equip_type
when 0 # 装備可能な武器を追加
set_equipable_weapon_data(@actor.class_id)
when 1..4 # 装備可能な防具を追加
set_equipable_armor_data(@actor.class_id)
end
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)
@data.push($data_weapons)
end
end
end
#--------------------------------------------------------------------------
# ● 指定クラスが装備可能、かつ所有している防具を @data に返す
#--------------------------------------------------------------------------
def set_equipable_armor_data(class_id)
armor_set = $data_classes[class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors.kind == @equip_type-1
@data.push($data_armors)
end
end
end
end
end
#==============================================================================
# â–  Window_ShopSell
#==============================================================================
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
set_own_item_data
set_own_weapon_data
set_own_armor_data
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上のアイテムを @data に返す
#--------------------------------------------------------------------------
def set_own_item_data
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items)
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の武器を @data に返す
#--------------------------------------------------------------------------
def set_own_weapon_data
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons)
end
end
end
#--------------------------------------------------------------------------
# ● 所有数が 1 以上の防具を @data に返す
#--------------------------------------------------------------------------
def set_own_armor_data
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors)
end
end
end
end

#==============================================================================
# â–  Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● リフレッシュ + 軽量化処理
#--------------------------------------------------------------------------
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)
@item_window_cursor = -1
end
# アイテムウィンドウがアクティブの場合
if @item_window.active
# カーソル位置が変わっていなければリターン
return if @item_window_cursor == @item_window.index
@item_window_cursor = @item_window.index
# HP/SPを保持
last_hp = @actor.hp
last_sp = @actor.sp
after_equip_parameter # ▽ 装備変更後のパラメータを取得
@actor.hp = last_hp
@actor.sp = last_sp
end
end
#--------------------------------------------------------------------------
# ● 装備変更後のパラメータを取得 1~4
#--------------------------------------------------------------------------
def after_equip_parameter
# 現在選択中のアイテムを取得
item2 = @item_window.item
# 装備を変更
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(get_equip_type, item2 == nil ? 0 : item2.id)
# 装備変更後のパラメータを取得
after_equip_parameter_phase2
# 現在装備中のアイテムを取得
item1 = @right_window.item
# 装備を戻す
@actor.equip(get_equip_type, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# レフトウィンドウに描画
after_equip_parameter_phase4
end
def after_equip_parameter_phase2
# 装備変更後のパラメータを取得
@new_atk = @actor.atk
@new_pdef = @actor.pdef
@new_mdef = @actor.mdef
end
def after_equip_parameter_phase4
# レフトウィンドウに描画
@left_window.set_new_parameters(@new_atk, @new_pdef, @new_mdef)
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)
# 実際に装着
update_item_do_equip
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# ライトウィンドウ、アイテムウィンドウの内容を再作成
@right_window.refresh
@item_window.refresh
return
end
end
#--------------------------------------------------------------------------
# ● 実際に装着
#--------------------------------------------------------------------------
def update_item_do_equip
# アイテムウィンドウで現在選択されているデータを取得
item = @item_window.item
# 装備を変更
@actor.equip(get_equip_type, item == nil ? 0 : item.id)
end
#--------------------------------------------------------------------------
# ● equip_typeの取得
#--------------------------------------------------------------------------
def get_equip_type
return @right_window.index
end
end


#------------------------------------------------------------------------------
#
#
# ▽ 追加モジュール
#
#
#==============================================================================
# ◇ 付加属性名称判定モジュール
#==============================================================================
module XRXS_Check_ElementName_Set
#--------------------------------------------------------------------------
# ● マテリアルが指定名の属性を持つか判定
#--------------------------------------------------------------------------
def material_element_include?(material, element_name)
case material
when RPG::Item
return item_element_include?(material, element_name)
when RPG::Weapon
return weapon_element_include?(material, element_name)
when RPG::Armor
return armor_element_include?(material, element_name)
end
return [false, 0, 0]
end
#--------------------------------------------------------------------------
# ● スキルが指定名の属性を持つか判定
#--------------------------------------------------------------------------
def skill_element_include?(skill, element_name)
return [false, 0, 0] unless skill.is_a?(RPG::Skill)
returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
for i in skill.element_set
if $data_system.elements =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
returnar[0] = true
if $2 == nil
returnar[1] += $1.to_i
else
returnar[2] += $1.to_i
end
end
end
return returnar
end
#--------------------------------------------------------------------------
# ● アイテムが指定名の属性を持つか判定
#--------------------------------------------------------------------------
def item_element_include?(item, element_name)
return [false, 0, 0] unless item.is_a?(RPG::Item)
returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
for i in item.element_set
if $data_system.elements =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
returnar[0] = true
if $2 == nil
returnar[1] += $1.to_i
else
returnar[2] += $1.to_i
end
end
end
return returnar
end
#--------------------------------------------------------------------------
# ● 武器が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def weapon_element_include?(weapon, element_name)
return weapon_id_element_include?(weapon.id, element_name)
end
#--------------------------------------------------------------------------
# ● 指定IDの武器が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def weapon_id_element_include?(weapon_id, element_name)
return [false, 0, 0] if weapon_id == nil or weapon_id <= 0
returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
for i in $data_weapons[weapon_id].element_set
if $data_system.elements =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
returnar[0] = true
if $2 == nil
returnar[1] += $1.to_i
else
returnar[2] += $1.to_i
end
end
end
return returnar
end
#--------------------------------------------------------------------------
# ● 防具が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def armor_element_include?(armor, element_name)
returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
return returnar unless armor.is_a?(RPG::Armor)
for i in armor.guard_element_set
if $data_system.elements =~ /#{element_name}([+-]?[0-9]+)?(%)?/
returnar[0] = true
if $2 == nil
returnar[1] += $1.to_i
else
returnar[2] += $1.to_i
end
end
end
return returnar
end
#--------------------------------------------------------------------------
# ● 防具が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def armor_id_element_include?(armor_id, element_name)
return [false, 0, 0] if armor_id == nil
return armor_element_include?($data_armors[armor_id], element_name)
end
#--------------------------------------------------------------------------
# ● 防具が指定名の属性を持つ場合その後に付く接尾テキストを取得
#--------------------------------------------------------------------------
def armor_id_element_suftext(armor_id, element_name)
return nil if armor_id == nil or armor_id == 0
armor = $data_armors[armor_id]
for i in armor.guard_element_set
if $data_system.elements =~ /#{element_name}(.*)/
return $1
end
end
return nil
end
#--------------------------------------------------------------------------
# ● アクターが指定名の属性を持つ武器を装備しているかか判定
#--------------------------------------------------------------------------
def equip_weapon_element_include?(actor, element_name)
return [false, 0, 0] unless actor.is_a?(Game_Actor)
return [false, 0, 0] if actor.weapon_id == nil or actor.weapon_id <= 0
bool = false
one_total = two_total = 0
# 判定
for i in $data_weapons[actor.weapon_id].element_set
if $data_system.elements =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
if $2 == nil
one_total += $1.to_i
else
two_total += $1.to_i
end
bool = true
end
end # 存在したか、%無き数値の合計、%有る数値の合計 を返す
# 値を返す
return [bool, one_total, two_total]
end
#--------------------------------------------------------------------------
# ● アクターが指定名の属性を持つ武器/防具を装備中か判定 数値の合計も保持
#--------------------------------------------------------------------------
def actor_element_equip?(actor, element_name)
return [false, 0, 0] unless actor.is_a?(Game_Actor)
weapon = $data_weapons[actor.weapon_id]
armor1 = $data_armors[actor.armor1_id]
armor2 = $data_armors[actor.armor2_id]
armor3 = $data_armors[actor.armor3_id]
armor4 = $data_armors[actor.armor4_id]
bool = false
one_total = two_total = 0
# 武器
returnar = equip_weapon_element_include?(actor, element_name)
bool |= returnar[0]
one_total += returnar[1].to_i
two_total += returnar[2].to_i
# 盾
returnar = armor_element_include?(armor1, element_name)
bool |= returnar[0]
one_total += returnar[1].to_i
two_total += returnar[2].to_i
# 頭防具
returnar = armor_element_include?(armor2, element_name)
bool |= returnar[0]
one_total += returnar[1].to_i
two_total += returnar[2].to_i
# 身体防具
returnar = armor_element_include?(armor3, element_name)
bool |= returnar[0]
one_total += returnar[1].to_i
two_total += returnar[2].to_i
# 装飾品
returnar = armor_element_include?(armor4, element_name)
bool |= returnar[0]
one_total += returnar[1].to_i
two_total += returnar[2].to_i
# 存在したか、%無き数値の合計、%有る数値の合計 を返す
return [bool, one_total, two_total]
end
end
#code one end


script block 2:
#code two begin






# ▼▲▼ XRXS24. システム・ウェポンプロパティXC. ver..07 ▼▲▼
# by 桜雅 在土

#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module Xrxs24_Fixed_Valiables
LIST_ITEM_ONLY_FOR_GRANT = false # 「付与可能のみをリスト」
SHOW_WEAPON_LEVEL_SYSTEM = true # 「武器Lv.概念を表示」
GRANT_SLOT_NUMBER = 4 # ディフォルト付与属性数(0~4)
ELEMENTS_NUMBER = 16 # 「属性」数(ダメージ倍率用として用いられる属性の数)
WEAPONS_NO = 1 # 武器の数
end
#==============================================================================
$xrxs24_weapon_property_system_work = true
#==============================================================================
# ■ 定数の設定
#==============================================================================
module Fixed_PropertyNumber
include Xrxs24_Fixed_Valiables
# 現在のプロパティの総数
PROPERTY_NUMBER = 8
# 以下のナンバーは 同値は指定不可能かつ0から個数-1までの整数
PROPERTY_ROOM_FILLED = 0 # プロパティ:部屋が空いているかどうか
PROPERTY_LEVEL = 1 # プロパティ:武器レベル
PROPERTY_EXP = 2 # プロパティ:エクストラポイント
PROPERTY_EXP_SECOND = 3 # プロパティ:エクストラポイント2ケタ目(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
#==============================================================================
# â–  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
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
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] == 0
# 部屋を埋める
@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
# 空き部屋が無かった場合
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
include XRXS_Check_ElementName_Set
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :weapon_property # 装備中の武器のウェポンプロパティ
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias xrxs24_setup setup
def setup(actor_id)
xrxs24_setup(actor_id)
# 初期化
@weapon_property = []
for i in 0...WEAPONS_NO
@weapon_property = Table.new(PROPERTY_NUMBER)
@weapon_property[PROPERTY_LEVEL] = 1 # 初期武器のレベルは1
@weapon_property[PROPERTY_EXP] = 1
end
end
#--------------------------------------------------------------------------
# ● 通常攻撃の属性取得 + 武器に付与された属性も追加
#--------------------------------------------------------------------------
alias xrxs24_element_set element_set
def element_set
# 元々の武器の属性を取得
attack_element_set = xrxs24_element_set
# 付与されている属性を取得
for no in 0...WEAPONS_NO
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[no][j] == i and !attack_element_set.include?(i)
attack_element_set.push(i)
end
end
end
end
# 値を返す
return attack_element_set
end
#--------------------------------------------------------------------------
# ● 武器の変更
# equip_type : 武器のインデックス(通常は0のみ)
# id : 武器ID (0 なら装備解除)
# room_no : 武器部屋No.
#--------------------------------------------------------------------------
def equip_wp(equip_type, id, room_no)
if id == 0 or $game_party.weapon_number(id) > 0
# equip_typeの変換
# 0 → 0, 5+n → 1+n,
# 初期化
equip_used_room_no = 0
equip_type -= 4 if equip_type != 0
weapon_id = equip_type == 0 ? @weapon_id : @weapon_ids[equip_type+1]
# 現在装備武器
if weapon_id != 0
# 現在装備を増やす
equip_used_room_no = $game_party.gain_weapon(weapon_id, 1)
# アクター現在武器のプロパティ
for i in 0...PROPERTY_NUMBER
# プロパティを部屋へコピー
$game_party.weapons_table[weapon_id, equip_used_room_no, i] = @weapon_property[equip_type]
# コピー後に削除
@weapon_property[equip_type] = 0
end
# 部屋の空き状況は無条件で 1 にする
$game_party.weapons_table[weapon_id, equip_used_room_no, PROPERTY_ROOM_FILLED] = 1
end
# 新規装着
if id != 0
# 装備対象武器のプロパティ
for i in 0...PROPERTY_NUMBER
# プロパティをアクターへコピー
@weapon_property[equip_type] = $game_party.weapons_table[id, room_no, i]
# コピー後に削除
$game_party.weapons_table[id, room_no, i] = 0
end
# 装備対象のアイテムを消す
$game_party.lose_weapon(id, room_no)
# 外す場合
else
# アクタープロパティを初期化
for i in 0...PROPERTY_NUMBER
@weapon_property[equip_type] = 0
end
end
# 装備変更
if equip_type == 0
@weapon_id = id
else
@weapon_ids[equip_type+1] = id
end
end
return equip_used_room_no
end
#--------------------------------------------------------------------------
# ● 基本攻撃力の取得
#--------------------------------------------------------------------------
alias xrxs24_base_atk base_atk
def base_atk
# 基本攻撃力の取得
atk = xrxs24_base_atk
# 武器Lv.による強化
for no in 0...WEAPONS_NO
weapon = no == 0 ? $data_weapons[@weapon_id] : $data_weapons[@weapon_ids[no+1]]
next unless weapon.is_a?(RPG::Weapon)
atk += (weapon.atk * (weapon.atk%10 * @weapon_property[no][PROPERTY_LEVEL]) / 100.0).floor
end
# 特殊効果:武器ATK(±数字)[%]
returnar = equip_weapon_element_include?(self, "武器ATK")
if returnar[0]
atk = (atk * (100 + returnar[2]) / 100.0).floor
atk+= returnar[1]
end
# ----------------
return atk
end
#--------------------------------------------------------------------------
# ● 基本物理防御の取得
#--------------------------------------------------------------------------
alias xrxs24_base_pdef base_pdef
def base_pdef
# 基本物理防御の取得
pdef = xrxs24_base_pdef
# 武器の物理防御の取得
weapon = $data_weapons[@weapon_id]
weapon_pdef = weapon != nil ? weapon.pdef : 0
# 特殊効果:武器PDEF(±数字)[%]
returnar = equip_weapon_element_include?(self, "Arm PDEF")
if returnar[0]
pdef -= weapon_pdef
weapon_pdef =(weapon_pdef * (100 + returnar[2]) / 100.0).floor
weapon_pdef += returnar[1]
pdef += weapon_pdef
end
# ----------------
return pdef
end
#--------------------------------------------------------------------------
# ● 基本魔法防御の取得
#--------------------------------------------------------------------------
alias xrxs24_base_mdef base_mdef
def base_mdef
# 基本物理防御の取得
mdef = xrxs24_base_mdef
# 武器の物理防御の取得
weapon = $data_weapons[@weapon_id]
weapon_mdef = weapon != nil ? weapon.mdef : 0
# 特殊効果:武器MDEF(±数字)[%]
returnar = equip_weapon_element_include?(self, "Arm MDEF")
if returnar[0]
mdef -= weapon_mdef
weapon_mdef =(weapon_mdef * (100 + returnar[2]) / 100.0).floor
weapon_mdef += returnar[1]
mdef += weapon_mdef
end
# ----------------
return mdef
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)
# 名前
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# 武器レベル部分
if SHOW_WEAPON_LEVEL_SYSTEM
if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id)
self.contents.font.color = system_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
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.font.name = $fontface
self.contents.font.size = $fontsize
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.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(x + 232, y, 48, 32, level, 2)
end
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
# 武器Lv.
if SHOW_WEAPON_LEVEL_SYSTEM
for no in 0...WEAPONS_NO
next if @data[no].nil?
self.contents.font.color = system_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(276, 32 * no, 56, 32, "Lv. ")
self.contents.font.color = normal_color
level = @actor.weapon_property[no][PROPERTY_LEVEL].to_s
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(284, 32 * no, 48, 32, level, 2)
end
end
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.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# 武器Lv.
if SHOW_WEAPON_LEVEL_SYSTEM
self.contents.font.color = system_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
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.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(x + 232, y, 48, 32, level, 2)
end
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.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# 武器Lv.
if SHOW_WEAPON_LEVEL_SYSTEM
self.contents.font.color = system_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
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)
end
else
xrxs24_draw_item(index)
end
end
end
#==============================================================================
# â–  Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● 装備変更後のパラメータを取得 1~4
#--------------------------------------------------------------------------
alias xrxs24_after_equip_parameter after_equip_parameter
def after_equip_parameter
# 武器のみ分岐
if get_equip_type == 0 or (get_equip_type >= 5 and get_equip_type < 4 + WEAPONS_NO)
after_equip_weapon_parameter
else
xrxs24_after_equip_parameter
end
end
def after_equip_weapon_parameter
# 現在装備中のアイテムを取得
item1 = @right_window.item
# 現在選択中のアイテムと部屋No.を取得
item2 = @item_window.item
item2_room_no = (@item_window.item_room_no == nil ? 0 : @item_window.item_room_no)
# 装備を変更------
# ---実際に装備を変更
# ---使用した部屋No.を取得
item1_room_no = @actor.equip_wp(get_equip_type, item2 == nil ? 0 : item2.id, item2_room_no)

# 装備変更後のパラメータを取得
after_equip_parameter_phase2

# 装備を戻す------
# ---実際に装備を変更
@actor.equip_wp(get_equip_type, item1 == nil ? 0 : item1.id, item1_room_no)

# レフトウィンドウに描画
after_equip_parameter_phase4
end
#--------------------------------------------------------------------------
# ● 実際に装着
#--------------------------------------------------------------------------
alias xrxs24_update_item_do_equip update_item_do_equip
def update_item_do_equip
# 武器のみ分岐
if get_equip_type == 0 or (get_equip_type >= 5 and get_equip_type < 4 + WEAPONS_NO)
# アイテムウィンドウで現在選択されているデータを取得
item = @item_window.item
# 装備を変更------
@actor.equip_wp(get_equip_type, item == nil ? 0 : item.id, @item_window.item_room_no)
else
xrxs24_update_item_do_equip
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.item_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
if SHOW_WEAPON_LEVEL_SYSTEM
# 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?
# アクターの武器に経験値獲得
for no in 0...WEAPONS_NO
now_exp = actor.weapon_property[no][PROPERTY_EXP_SECOND] * 32768
now_exp += actor.weapon_property[no][PROPERTY_EXP]
now_exp += exp
actor.weapon_property[no][PROPERTY_EXP] = now_exp%32768
actor.weapon_property[no][PROPERTY_EXP_SECOND] =(now_exp/32768).floor
end
end
end
end
xrxs24_start_phase5
end
end
#==============================================================================
# â–  Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ○ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ◇ 武器経験値の獲得
#--------------------------------------------------------------------------
def command_weapon_gain_exp(actor_id, exp)
for no in 0...WEAPONS_NO
now_exp = $game_party.actors[actor_id].weapon_property[no][PROPERTY_EXP_SECOND] * 32768
now_exp+= $game_party.actors[actor_id].weapon_property[no][PROPERTY_EXP]
now_exp+= exp
$game_party.actors[actor_id].weapon_property[no][PROPERTY_EXP] = now_exp%32768
$game_party.actors[actor_id].weapon_property[no][PROPERTY_EXP_SECOND] =(now_exp/32768).floor
end
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
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
# アイテム名描写
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, "Buy")
self.contents.draw_text(244, 256, 96, 32, "Quit")
# 売却金額の計算
@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

#------------------------------------------------------------------------------
#
#
# ▽ モジュール変更
#
#
#==============================================================================
# ◇ 付加属性名称判定モジュール
#==============================================================================
module XRXS_Check_ElementName_Set
#--------------------------------------------------------------------------
# ○ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
#--------------------------------------------------------------------------
# ● アクターが指定名の属性を持つ武器を装備しているかか判定
#--------------------------------------------------------------------------
alias xrxs24_equip_weapon_element_include? equip_weapon_element_include?
def equip_weapon_element_include?(actor, element_name)
return [false, 0, 0] unless actor.is_a?(Game_Actor)
return [false, 0, 0] if actor.weapon_id == nil or actor.weapon_id <= 0
returnar = xrxs24_equip_weapon_element_include?(actor, element_name)
bool = returnar[0]
one_total = returnar[1]
two_total = returnar[2]
# ウェポンプロパティXC.による拡張
for i in [PROPERTY_ELEMENT_GRANT_1st, PROPERTY_ELEMENT_GRANT_2nd,
PROPERTY_ELEMENT_GRANT_3rd, PROPERTY_ELEMENT_GRANT_4th]
for no in 0...WEAPONS_NO
if $data_system.elements[actor.weapon_property[no]] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
if $2 == nil
one_total += $1.to_i
else
two_total += $1.to_i
end
bool = true
end
end
end
# 値を返す
return [bool, one_total, two_total]
end
end

#second code ends



script block 3:

#third code begin


#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module XRXS24_AX_Fixed_Variables
# 武器鍛冶可能な武器のインデックス(通常は[0]で使用)
# 複数武器装備の場合、[0, 1]とやれば武器二つ、[1]とやれば二つ目の武器のみ。
WEAPON_INDEX = [0]
# パーティ武器リスト列数
WINDOW_PARTYWEAPON_ROW = 4
# 付与アイテムリスト列数(↑↓あわせて 10 にするとぴったり)
WINDOW_SMITHYITEM_ROW = 6
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
#--------------------------------------------------------------------------
# ◇ 鍛冶屋の処理
#--------------------------------------------------------------------------
def command_smithy
# バトル中断フラグをセット
$game_temp.battle_abort = true
# 鍛冶屋呼び出しフラグをセット
$game_temp.smithy_calling = true
end
end



#------------------------------------------------------------------------------
#
#
# ▽ 新規追加部分
#
#
#==============================================================================
# â–  Window_SmithyLeft
#------------------------------------------------------------------------------
#  鍛冶屋画面で、左側に表示されるウィンドウの土台です。
#==============================================================================
class Window_SmithyLeft < Window_Base
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include XRXS24_AX_Fixed_Variables
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 368, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 192, 32, "Party arms")
self.contents.draw_text(4, 32 * (WINDOW_PARTYWEAPON_ROW+1), 192, 32, "Giving" + $data_system.words.item)
end
end
#==============================================================================
# â–  Window_PartyWeapon
#------------------------------------------------------------------------------
#  鍛冶屋画面で、パーティ全員の現在装備している武器を表示するウィンドウです。
#==============================================================================

class Window_PartyWeapon < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
include XRXS24_AX_Fixed_Variables
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
#height = ([$game_party.actors.size, 4].max + 3) * 32
super(0, 96, 368, 32 * (WINDOW_PARTYWEAPON_ROW+1))
h = ($game_party.actors.size * WEAPON_INDEX.size) * 32
self.contents = Bitmap.new(width - 32, h)
self.opacity = 0
self.back_opacity = 0
@column_max = 1
refresh
self.index = -1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@data = []
y = 32 * ($game_party.actors.size * WEAPON_INDEX.size + 1)
offset = 0
for i in 0...$game_party.actors.size
actor = $game_party.actors
next if actor == nil
# キャラ顔
draw_actor_facesquare(actor, 4, 32 * (i+offset)+4)
# 武器名描写
for no in WEAPON_INDEX
weapon_id = (no == 0 ? actor.weapon_id : actor.weapon_ids[no+1])
@data.push($data_weapons[weapon_id])
offset += 1 if WEAPON_INDEX.index(no) > 0
if weapon_id == 0
self.contents.font.color = disabled_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(36, 32 * (i+offset), 106, 32, "---", 2)
else
# 武器名
self.contents.font.color = normal_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_item_name(@data[i+offset], 36, 32 * (i+offset))
level = $game_party.actors.weapon_property[no][PROPERTY_LEVEL]
# レベル
if SHOW_WEAPON_LEVEL_SYSTEM
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(296, 32 * (i+offset), 24, 32, level.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(260, 32 * (i+offset), 32, 32, "Lv.")
end
end
end
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
super
if @index == -1
self.cursor_rect.set(0, 0, 0,0)
else
self.cursor_rect.set(0, @index * 32 - self.oy, self.width - 32, 32)
end
end
end
#==============================================================================
# â–  Window_WeaponInfo
#------------------------------------------------------------------------------
#  鍛冶屋画面で、武器のパラメータなどを表示するウィンドウです。
#==============================================================================

class Window_WeaponInfo < Window_Selectable
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
include XRXS_Check_ElementName_Set
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :level # 表示中の武器のレベル
attr_reader :property_elements # 属性
attr_reader :now_free_exp # 現在自由に使えるEXP
attr_reader :item_max
attr_accessor :item # アイテム
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(368, 64, 272, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
# 消去する
set(nil)
@item_max = 1
@weapon_no = 0
end
#--------------------------------------------------------------------------
# ● レベルを上げられる状況にあるか
#--------------------------------------------------------------------------
def levelupable?
return @levelupable
end
#--------------------------------------------------------------------------
# ● 値をセットする
#--------------------------------------------------------------------------
def set(item, room_no = 0)
# 初期化
@levelupable = false
case item
when nil
# nilの場合全てを消去
self.contents.clear
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
return
when Game_Actor
# アクターを指定した場合は装備中の武器の情報 使用例:___.set(actor)
@actor = item
@weapon_no = room_no
@item = $data_weapons[(room_no == 0 ? @actor.weapon_id : @actor.weapon_ids[room_no+1])]
else
# アイテムを指定した場合
@actor = nil
@item = item
@room_no = room_no
end
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# 初期化
@levelupable = false
now_free_exp = 0
self.contents.clear
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
# 武器名
draw_item_name(@item, 4, 32)
# 武器の場合、Lv: の描写
if @item.is_a?(RPG::Weapon)
# 武器のレベルと経験値の取得
if @actor != nil
@level = @actor.weapon_property[@weapon_no][PROPERTY_LEVEL]
exp_p = @actor.weapon_property[@weapon_no][PROPERTY_EXP_SECOND] * 32768
exp_p += @actor.weapon_property[@weapon_no][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] * 32768
exp_p += $game_party.weapons_table[@item.id, @room_no, PROPERTY_EXP]
end
# 武器Lv./EXP, の表示
if SHOW_WEAPON_LEVEL_SYSTEM
# 武器レベル
self.contents.font.color = system_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(124, 64, 32, 32, "Lv.")
self.contents.font.color = normal_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(216, 64, 24, 32, @level.to_s, 2)
# EXPメーター
self.contents.draw_line(143, 104, 273, 104, Color.new(0,0,0,255), 3)
now_level_exp = ((@level) ** 3) # 現在レベルの所要EXP
next_level_exp = ((@level + 1) ** 3) # 次のレベルの所要EXP
now_free_exp = [exp_p - now_level_exp, 0].max # 現在自由に使えるEXP
next_need_exp = next_level_exp - now_level_exp # 次のレベルに必要なEXP
percentile = [[100 * (now_free_exp) / (next_need_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(144, 104, 144 + percentile * 1.28, 104, line_color, 1)
# 武器経験値
self.contents.font.size = 10
self.contents.font.name = $fontface
self.contents.font.color = system_color
self.contents.draw_text(124, 96, 32, 16, "EXP.")
# EXP数値
self.contents.font.size = 10
self.contents.font.name = $fontface
self.contents.draw_text(124, 116, 64, 18, "NOW")
self.contents.font.size = 16
self.contents.font.color = normal_color
self.contents.draw_text(132, 116, 64, 16, now_free_exp.to_s + " /", 2)
self.contents.draw_text(140, 116, 96, 16, next_need_exp.to_s, 2)
end
# 攻撃力
self.contents.font.size = 22
self.contents.font.name = $fontface
self.contents.font.color = system_color
self.contents.draw_text( 96, 160, 96, 32, $data_system.words.atk)
atk_p = @actor.base_atk #@item.atk * (100 + @item.atk%10 * level)/100
self.contents.font.color = normal_color
self.contents.draw_text(192, 160, 48, 32, atk_p.to_s, 2)
# 付与属性数を取得
available_slots = GRANT_SLOT_NUMBER
returnar = equip_weapon_element_include?(@actor, "付与属性数")
if returnar[0]
available_slots = [returnar[1], 4].min
end
@item_max = 1 + available_slots
# 各々付与されている武器属性の描写
i_no = 0
if available_slots > 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[@weapon_no]
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.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(112, 192 + 32*i_no, 128, 32, $data_system.elements[element_id])
else
self.contents.font.color = disabled_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.draw_text(112, 192 + 32*i_no, 128, 32, "---")
end
i_no += 1 # _no _| ̄|○(←似てる(笑
break if available_slots <= i_no
end
end
end
@now_free_exp = now_free_exp
# 可視状態にする
self.visible = true
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if @index == -1
self.cursor_rect.set(0, 0, 0,0)
elsif @index == 0
if SHOW_WEAPON_LEVEL_SYSTEM
self.cursor_rect.set(0, 64, self.width - 32, 32)
else
# 武器Lv.表示が無効化されている場合に@indexが0になったばあい、1に修正
@index = 1
update_cursor_rect
return
end
else
self.cursor_rect.set(0, 160 + @index * 32, self.width - 32, 32)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@help_window.set_text("Arms are strengthened. ")
else
@help_window.set_text("The attribute is given to arms. ")
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
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
if @disabled[0]
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
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.font.name = $fontface
self.contents.font.size = $fontsize
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
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include XRXS_Check_ElementName_Set
include XRXS24_AX_Fixed_Variables
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :item_max
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
self.x = 32
self.y = 128 + 32 * WINDOW_PARTYWEAPON_ROW #* $game_party.actors.size * WEAPON_INDEX.size
self.width = 336
self.height = 32 * (WINDOW_SMITHYITEM_ROW+1)
self.contents = nil
self.contents = Bitmap.new(width - 32, height - 32)
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.push(element_id) unless element_set.include?(element_id)
break
end
end
end
# 例外属性を排除
element_set.delete("possible to give it.")
element_set.delete("Giving prohibition")
# 値を返す
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
if LIST_ITEM_ONLY_FOR_GRANT
next unless item_element_include?($data_items, "possible to give it.")[0]
next if $data_items.element_set.size < 2
else
next if item_element_include?($data_items, "Giving prohibition")[0]
end
@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
if LIST_ITEM_ONLY_FOR_GRANT
next unless weapon_id_element_include?(i, "possible to give it.")[0]
next if $data_items.element_set.size < 2
else
next if weapon_id_element_include?(i, "Giving prohibition")[0]
end
# 武器の個別描写を行う
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
if LIST_ITEM_ONLY_FOR_GRANT
next unless armor_element_include?($data_armors, "possible to give it.")[0]
next if $data_items.element_set.size < 2
else
next if armor_element_include?($data_armors, "Giving prohibition")[0]
end
@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("No attribute that can be given. ")
else
@help_window.set_text("Giving attribute" + $data_system.elements[element_id])
end
end
end
#==============================================================================
# â–  Scene_Smithy
#------------------------------------------------------------------------------
#  鍛冶屋画面の処理を行うクラスです。
#==============================================================================

class Scene_Smithy
#--------------------------------------------------------------------------
# ◇ インクルード
#--------------------------------------------------------------------------
include Fixed_PropertyNumber
include XRXS_Check_ElementName_Set
include XRXS24_AX_Fixed_Variables
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウを作成
@help_window = Window_Help.new
# レフトウィンドウを作成
@leftwindow = Window_SmithyLeft.new
# パーティ武器ウィンドウを作成
@partyweapon_window = Window_PartyWeapon.new
@partyweapon_window.help_window = @help_window
#@partyweapon_window.height = 480 - @partyweapon_window.y
@partyweapon_window.active = true
@partyweapon_window.index = 0
@partyweapon_window.z = @leftwindow.z + 1
# アイテムウィンドウを作成
@sellect_window = Window_SmithyItems.new
@sellect_window.help_window = @help_window
@sellect_window.z = @partyweapon_window.z + 1
@sellect_window.active = false
@sellect_window.visible = false if GRANT_SLOT_NUMBER == 0
# 武器インフォウィンドウを作成
@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
@leftwindow.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
# カーソル位置が変わった場合
if @partyweapon_window_now_index == nil or
(@partyweapon_window_now_index != @partyweapon_window.index)
# ステータスウィンドウのアイテムを設定
@weaponinfo_window.set($game_party.actors[@partyweapon_window.index/WEAPON_INDEX.size], WEAPON_INDEX[@partyweapon_window.index%WEAPON_INDEX.size])
@partyweapon_window_now_index = @partyweapon_window.index
end
# 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)
# 素手の場合
if @weaponinfo_window.item.nil?
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
# 武器Lv.非表示かつ付与属性数0
elsif @weaponinfo_window.item_max == 1 and !SHOW_WEAPON_LEVEL_SYSTEM
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
@weaponinfo_window.active = true
@weaponinfo_window.index = SHOW_WEAPON_LEVEL_SYSTEM ? 0 : 1
@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 = get_price_for_levelup
first_choice = "Reinforced execution. " + price.to_s + " " + $data_system.words.gold
if @weaponinfo_window.levelupable?
help1 = "prescribed amount of money is executed and strengthening the payment arms"
else
help1 = "Exp value of arms doesn't suffice."
end
if $game_party.gold < price
help1 = "Money on hand is insufficient. "
end
help2 = "Strengthening is discontinued. "
@ask_window.set(first_choice,"Quit", 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
# 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 = get_price_for_grant
necessary_exp = get_necessary_exp_for_grant
if necessary_exp >= 0
exp_str = " " + necessary_exp.to_s + " EXP"
else
exp_str = " +" + necessary_exp.abs.to_s + " EXP"
end
unless SHOW_WEAPON_LEVEL_SYSTEM
exp_str = ""
end
first_choice = "The attribute is given. " + price.to_s + " " + $data_system.words.gold + exp_str
help1 = $data_system.elements[@sellect_window.item_first_element] + "gives it to arms. "
help2 = "Giving is discontinued. "
if @sellect_window.item.price == 0
first_choice = "It is not possible to give it. "
help1 = "This item cannot be given. "
elsif $game_party.gold < price
help1 = "Money on hand is insufficient. "
end
@ask_window.set(first_choice,"Quit", help1, help2)
if @sellect_window.item.price == 0
@ask_window.disable(0)
elsif $game_party.gold < price
@ask_window.disable(0)
elsif SHOW_WEAPON_LEVEL_SYSTEM and @weaponinfo_window.now_free_exp < necessary_exp
@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 を演奏
index = @partyweapon_window.index/WEAPON_INDEX.size
no = WEAPON_INDEX[@partyweapon_window.index%WEAPON_INDEX.size]
$game_system.se_play($data_system.decision_se)
if @sellect_window.index >= 0
# 属性付与
price = get_price_for_grant
# 属性付与 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[index].weapon_property[no][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)
elsif @sellect_window.item.is_a?(RPG::Armor)
$game_party.lose_armor(@sellect_window.item.id, 1)
else
$game_party.lose_item(@sellect_window.item.id, 1)
end
# 武器EXPを消費する
if SHOW_WEAPON_LEVEL_SYSTEM
# 必要武器経験値の取得
necessary_exp = get_necessary_exp_for_grant
# 経験値の更新
now_exp = $game_party.actors[index].weapon_property[no][PROPERTY_EXP_SECOND] * 32768
now_exp+= $game_party.actors[index].weapon_property[no][PROPERTY_EXP]
now_exp-= necessary_exp
$game_party.actors[index].weapon_property[no][PROPERTY_EXP] = now_exp%32768
$game_party.actors[index].weapon_property[no][PROPERTY_EXP_SECOND] =(now_exp/32768).floor
end
else
# 武器強化
# 武器レベルアップ ME を演奏
Audio.me_stop
Audio.me_play("Audio/ME/011-Item02.mid")
# 強化を実行
$game_party.actors[index].weapon_property[no][PROPERTY_LEVEL] += 1
# レベルによる強化金額の取得
price = get_price_for_levelup
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
#--------------------------------------------------------------------------
# ● レベルアップに必要な金額を取得 # レベルによる強化金額の設定はこちら
#--------------------------------------------------------------------------
def get_price_for_levelup
base_price = @weaponinfo_window.item.price/10
price = (@weaponinfo_window.level ** (3/2.0)).floor * base_price
# "強化必要GOLD(±数字)%"属性による変動
returnar = equip_weapon_element_include?($game_party.actors[@partyweapon_window.index], "強化必要GOLD")
if returnar[0]
price = price * (100 + returnar[2]) / 100
end
# 値を返す
return price
end
#--------------------------------------------------------------------------
# ● 付与に必要なGOLDの取得
#--------------------------------------------------------------------------
def get_price_for_grant
price = @weaponinfo_window.item.price
# "付与必要GOLD(±数字)%"属性による変動:付与アイテム側
case @sellect_window.item
when RPG::Weapon
returnar = weapon_id_element_include?(@sellect_window.item.id, "Giving necessity GOLD")
when RPG::Armor
returnar = armor_element_include?(@sellect_window.item, "Giving necessity GOLD")
else
returnar = item_element_include?(@sellect_window.item, "Giving necessity GOLD")
end
if returnar[0]
price = price * (100 + returnar[2]) / 100
end
# "付与必要GOLD(±数字)%"属性による変動
returnar = equip_weapon_element_include?($game_party.actors[@partyweapon_window.index], "Giving necessity GOLD")
if returnar[0]
price = price * (100 + returnar[2]) / 100
end
return price
end
#--------------------------------------------------------------------------
# ● 付与に必要なEXPの取得
#--------------------------------------------------------------------------
def get_necessary_exp_for_grant
necessary_exp = @sellect_window.item.price/10
# "付与消費EXP(±数字)%"属性による変動:付与アイテム側
case @sellect_window.item
when RPG::Weapon
returnar = weapon_id_element_include?(@sellect_window.item.id, "Giving consumption EXP")
when RPG::Armor
returnar = armor_element_include?(@sellect_window.item, "Giving consumption EXP")
else
returnar = item_element_include?(@sellect_window.item, "Giving consumption EXP")
end
if returnar[0]
necessary_exp = necessary_exp * (100 + returnar[2]) / 100
end
# "付与消費EXP(±数字)%"属性による変動:武器
returnar = equip_weapon_element_include?($game_party.actors[@partyweapon_window.index], "Giving consumption EXP")
if returnar[0]
necessary_exp = necessary_exp * (100 + returnar[2]) / 100
end
# 値を返す
return necessary_exp
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
#third code ends
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top