lunariafantasia/Scripts/_.118.rb
2024-01-12 03:12:38 -06:00

134 lines
5.1 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
#  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
# スのインスタンスは $game_party で参照されます。
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
#attr_reader :kill_list #
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias kill_initialize initialize
def initialize
kill_initialize
init_kill_list
end
#--------------------------------------------------------------------------
# ○ 討伐リストの初期化
#--------------------------------------------------------------------------
def init_kill_list
@kill_list = {}
end
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
def kill_list(id)
@kill_list[id] || "--"
end
#--------------------------------------------------------------------------
# ○ 討伐数のセット
#--------------------------------------------------------------------------
def kill_list_set(id, num)
@kill_list[id] = num
end
#--------------------------------------------------------------------------
# ○ 討伐数の全セット
#--------------------------------------------------------------------------
def kill_list_fullset(item)
item.each{|k, v| kill_list_set(k, v)}
end
#--------------------------------------------------------------------------
# ○ 終了した討伐数の消去
#--------------------------------------------------------------------------
def kill_end(id)
@kill_list.delete(id)
end
#--------------------------------------------------------------------------
# ○ 討伐処理
#--------------------------------------------------------------------------
def kill(id, num)
return if !@kill_list[id]
@kill_list[id] = [@kill_list[id] - num, 0].max
end
#--------------------------------------------------------------------------
# ○ 討伐処理(種別)
#--------------------------------------------------------------------------
def kill_kind(kind, num)
return if !@kill_list[kind]
@kill_list[kind] = [@kill_list[kind] - num, 0].max
end
#--------------------------------------------------------------------------
# ○ 所持数確認
#--------------------------------------------------------------------------
def quest_item_number(c, id)
item_number(quest_item(c, id))
#return item_number($data_items[id]) if c.include?("i")
#return item_number($data_weapons[id]) if c.include?("w")
#return item_number($data_armors[id]) if c.include?("a")
#return 0
end
#--------------------------------------------------------------------------
# ○ アイテムデータの取得
#--------------------------------------------------------------------------
def quest_item(c, id)
return $data_items[id] if c.include?("i")
return $data_weapons[id] if c.include?("w")
return $data_armors[id]
end
end
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
#  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop
# 内部で使用されます。
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● オブジェクト初期化 ※エイリアス
#--------------------------------------------------------------------------
alias kill_count_initialize initialize
def initialize(index, enemy_id)
kill_count_initialize(index, enemy_id)
@kill_count = false
end
#--------------------------------------------------------------------------
# ● 戦闘不能になる
#--------------------------------------------------------------------------
def die
super
#$game_party.kill(@enemy_id, 1) if !@kill_count
if !@kill_count
$game_party.kill(@enemy_id, 1)
$game_party.kill_kind(enemy_kind, 1)
end
@kill_count = true
end
#--------------------------------------------------------------------------
# 種族の取得
#--------------------------------------------------------------------------
def enemy_kind
enemy.enemy_kind
end
end
class RPG::Enemy < RPG::BaseItem
def enemy_kind
@enemy_kind ||= enemy_kind_set
end
def enemy_kind_set
self.note =~ /\<種族:([^>]*)\>/ ? $1 : "NONE"
end
end