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

746 lines
31 KiB
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

#==============================================================================
# □ TelepoMap
#------------------------------------------------------------------------------
#  テレポート用のモジュール
#==============================================================================
module TelepoMap
#--------------------------------------------------------------------------
# ○ 定数
#--------------------------------------------------------------------------
#名前
NAME = Hash[
0 => "魔法王国サジタリーズ", #id 0
1 => "森の村ロベ",
2 => "商業の町ラグラス",
3 => "港町セネシオ", #id 3
4 => "九条の里",
5 => "ナワテの町",
6 => "南の渡し場", #id 6
7 => "港町サカイ", #id 7
8 => "国境の関所・サジタリーズ方面",
9 => "国境の関所・ダリア方面", #id 9
#↑10番目
10 => "無法街ネメシア",
11 => "ダリア王国・王都カクタス", #id 11
12 => "山間の村ビオーサ",#id 12
13 => "砂漠のオアシス",
14 => "リゾート地ガラディ", #id 14
15 => "湖畔牧場",
16 => "n",
17 => "o", #id 17
18 => "p",
19 => "q", #id 19
#↑20番目
20 => "r", #id 20
21 => "地下遺跡 入口",
39 => "地下遺跡 4層",
22 => "炎帝の遺跡 入口",
23 => "グレア洞窟 中腹",
24 => "ティモル山 麓",
25 => "ティモル山 岐路",
26 => "フリゼニア神殿 入口",
27 => "フリゼニア神殿 小部屋前",
28 => "トキワへの地下道 小島",
29 => "封印の洞窟 ヤマコの巣出口",
40 => "封印の洞窟 封印の地手前",
30 => "迷宮の孤島",
31 => "九条迷宮 第二層",
32 => "フォリア遺跡 入口",
33 => "フォリア遺跡 内部",
34 => "ハイドラ水路 中腹",
35 => "暗闇の廃坑 最下層手前",
36 => "レオンタイス砂漠 入口",
37 => "万魔の塔 4階",
38 => "万魔の塔 7階",
41 => "浮遊大陸",
42 => "淫堕の洗脳砦",
43 => "淫堕の洗脳砦 出口手前",
44 => "魔神城",
45 => "魔神城 3階",
46 => "魔神城 5階 小部屋前",
]
=begin
NAME = ["魔法王国サジタリーズ", #id 0
"森の村ロベ",
"商業の町ラグラス",
"港町セネシオ", #id 3
"九条の里",
"ナワテの町",
"南の渡し場", #id 6
"港町サカイ", #id 7
"無法街ネメシア",
"ダリア王国・王都カクタス", #id 9
#↑10番目
"山間の村ビオーサ",#id 10
"リゾート地ガラティ",
"j",
"k",
"l", #id 14
"m",
"n",
"o", #id 17
"p",
"q", #id 19
#↑20番目
"r", #id 20
"地下遺跡 入口",
"炎帝の遺跡 入口",
"グレア洞窟 中腹",
"ティモル山 麓",
"ティモル山 岐路",
"フリゼニア神殿 入口",
"フリゼニア神殿 小部屋前",
"トキワへ続く地下道 小島",
"29",]
=end
TELEPO = "<テレポート>"
NOT_TELEPO = "<テレポート禁止!>"
ANIME = 0 #テレポートアニメーションのID 0指定でアニメを行わない
SWITCH_ID = 13 #テレポート禁止判定スイッチ
#移動位置の配列をハッシュで設定 [マップID, x座標, y座標, エリア管理ID, 町かどうか]
MAP_TELEPORT = Hash[
NAME[0] => [1, 108, 20, 0, true],
NAME[1] => [1, 121, 80, 0, true],
NAME[2] => [1, 72, 91, 0, true],
NAME[3] => [1, 162, 117, 0, true],
NAME[4] => [2, 34, 58, 1, true],
NAME[5] => [2, 108, 65, 1, true],
NAME[6] => [2, 42, 81, 1, true],
NAME[7] => [2, 31, 133, 1, true],
NAME[8] => [1, 32, 20, 0, true],
NAME[9] => [3, 40, 147, 2, true],
#↑10番目
NAME[10] => [3, 67, 116, 2, true],
NAME[11] => [3, 49, 74, 2, true],
NAME[12] => [3, 26, 31, 2, true],
NAME[13] => [255, 23, 9, 2, true],
NAME[14] => [3, 144, 84, 2, true],
NAME[15] => [1, 15, 88, 0, true],
NAME[16] => [1, 4, 3, 1],
NAME[17] => [1, 4, 3, 1],
NAME[18] => [1, 4, 3, 2],
NAME[19] => [1, 4, 3, 2],
#↑20番目
NAME[20] => [1, 4, 3, 2],
NAME[21] => [103, 6, 10, 10],
NAME[22] => [28, 14, 33, 0],
NAME[23] => [142, 28, 42, 0],
NAME[24] => [57, 4, 21, 0],
NAME[25] => [59, 24, 8, 0],
NAME[26] => [161, 30, 25, 0],
NAME[27] => [179, 35, 48, 0],
NAME[28] => [187, 9, 14, 1],
NAME[29] => [222, 36, 60, 1],
NAME[30] => [230, 14, 23, 1],
NAME[31] => [232, 13, 25, 1],
NAME[32] => [53, 15, 33, 2],
NAME[33] => [382, 30, 34, 2],
NAME[34] => [394, 58, 19, 2],
NAME[35] => [81, 16, 25, 2],
NAME[36] => [102, 17, 26, 2],
NAME[37] => [288, 40, 37, 2],
NAME[38] => [294, 28, 45, 2],
NAME[39] => [349, 44, 54, 10],
NAME[40] => [380, 188, 7, 1],
NAME[41] => [4, 61, 77, 3],
NAME[42] => [415, 18, 12, 3],
NAME[43] => [416, 34, 75, 3],
NAME[44] => [20, 33, 48, 3],
NAME[45] => [347, 43, 109, 3],
NAME[46] => [435, 27, 91, 3],
]
SE = ["Audio/SE/Powerup", 80, 150] #テレポート時の SE設定
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
#  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
# スのインスタンスは $game_party で参照されます。
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
#attr_accessor :teleportable # テレポート可能判定
attr_accessor :permitted # テレポート許可エリア
attr_reader :telepo # テレポート場所の配列
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias telepo_initialize initialize
def initialize
telepo_initialize
telepo_init
@permitted = []
end
#--------------------------------------------------------------------------
# ○ テレポの初期化
#--------------------------------------------------------------------------
def telepo_init
@telepo = Array.new(TelepoMap::NAME.size){ nil }
end
#--------------------------------------------------------------------------
# ○ テレポの許可状態
# ※マップがテレポ使用禁止でなく、テレポが登録されており、時間が昼の場合で
# テレポ可能判定がtrueの場合のみ使用可能 + スリップ状態じゃない
#--------------------------------------------------------------------------
def telepo_ok?
!$game_map.note.include?(TelepoMap::NOT_TELEPO) && @telepo.any? && #$game_switches[TelepoMap::TELEPO_SWITCH] && game_day == :day
$game_system.game_day == :day && teleportable? && !$game_player.slip_straight
end
#--------------------------------------------------------------------------
# ○ テレポスイッチのオン
#--------------------------------------------------------------------------
def telepo_switch_on(id)
@telepo[id] = true
end
#--------------------------------------------------------------------------
# ○ テレポ可能判定
#--------------------------------------------------------------------------
def teleportable?
!$game_switches[TelepoMap::SWITCH_ID]
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ○ テレポートフラグ解放
#--------------------------------------------------------------------------
def telepo_on(id)
$game_party.telepo_switch_on(id)
end
#--------------------------------------------------------------------------
# ○ テレポートフラグ初期化
#--------------------------------------------------------------------------
def telepo_init
$game_party.telepo_init
end
#--------------------------------------------------------------------------
# ○ テレポートフラグチェック
#--------------------------------------------------------------------------
def telepo_check(id)
$game_party.telepo[id]
end
#--------------------------------------------------------------------------
# ○ テレポート可能フラグ解放
#--------------------------------------------------------------------------
=begin
def ok_telepo
$game_party.teleportable = true
end
#--------------------------------------------------------------------------
# ○ テレポート不可
#--------------------------------------------------------------------------
def not_telepo
$game_party.teleportable = false
end
=end
#--------------------------------------------------------------------------
# ○ テレポート許可エリアの追加
#--------------------------------------------------------------------------
def telepo_area(area_id)
$game_party.permitted.push(area_id)
end
#--------------------------------------------------------------------------
# ○ テレポート許可エリアのリセット
#--------------------------------------------------------------------------
def area_reset
$game_party.permitted.clear
end
end
#==============================================================================
# ■ Window_Selectable
#------------------------------------------------------------------------------
#  カーソルの移動やスクロールの機能を持つウィンドウクラスです。
#==============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# ○ メモチェック
#--------------------------------------------------------------------------
def note_check(item, word)
return false if !item
item.note.include?(word)
end
end
#==============================================================================
# ■ Window_ItemList
#------------------------------------------------------------------------------
#  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● アイテムを許可状態で表示するかどうか ※エイリアス
#--------------------------------------------------------------------------
alias telepo_enable? enable?
def enable?(item)
#return false if !item
if note_check(item, TelepoMap::TELEPO)#item.note.include?(TelepoMap::TELEPO)
telepo_enable?(item) && $game_party.telepo_ok?
else
telepo_enable?(item)
end
end
end
#==============================================================================
# ■ Window_SkillList
#------------------------------------------------------------------------------
#  スキル画面で、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● スキルを許可状態で表示するかどうか ※エイリアス
#--------------------------------------------------------------------------
alias telepo_enable? enable?
def enable?(item)
#return false if !item
if note_check(item, TelepoMap::TELEPO)#item.note.include?(TelepoMap::TELEPO)
telepo_enable?(item) && $game_party.telepo_ok?
else
telepo_enable?(item)
end
end
end
#==============================================================================
# ■ Scene_ItemBase
#------------------------------------------------------------------------------
#  アイテム画面とスキル画面の共通処理を行うクラスです。
#==============================================================================
class Scene_ItemBase < Scene_MenuBase
#--------------------------------------------------------------------------
# ● アイテムの決定 ※エイリアス
#--------------------------------------------------------------------------
alias telepo_determine_item determine_item
def determine_item
if item.note.include?(TelepoMap::TELEPO)
SceneManager.telepo_call(Scene_Teleport, user, item)
else
telepo_determine_item
end
end
end
#==============================================================================
# □ Window_Teleport
#------------------------------------------------------------------------------
#  テレポート選択画面で、移動先の一覧を表示するウィンドウです。
#==============================================================================
class Window_Teleport < Window_Selectable
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, window_height)
@index = 0
activate
@data = []
refresh
#self.opacity = 0
end
#--------------------------------------------------------------------------
# ○ ウィンドウ横幅
#--------------------------------------------------------------------------
def window_width
Graphics.width / 2 * col_max
end
#--------------------------------------------------------------------------
# ○ ウィンドウ縦幅
#--------------------------------------------------------------------------
def window_height
Graphics.height
end
#--------------------------------------------------------------------------
# ○ 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ○ 項目数の取得
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 0
end
#--------------------------------------------------------------------------
# ○ テレポート場所の取得
#--------------------------------------------------------------------------
def teleport_name
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# ○ マップをリストに含めるかどうか
#--------------------------------------------------------------------------
def include?(id)
$game_party.telepo[id]
end
#--------------------------------------------------------------------------
# ○ 転移場所を許可状態で表示するかどうか
#--------------------------------------------------------------------------
def enable?(map_name)
$game_party.permitted.empty? ? true : $game_party.permitted.include?(TelepoMap::MAP_TELEPORT[map_name][3])
end
#--------------------------------------------------------------------------
# ○ 町かどうか
#--------------------------------------------------------------------------
def town?(map_name)
TelepoMap::MAP_TELEPORT[map_name][4]
end
#--------------------------------------------------------------------------
# ○ 選択項目の有効状態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# ○ マップリストの作成
#--------------------------------------------------------------------------
def make_map_list
#TelepoMap::NAME.each_with_index do |name, i|
#@data.push(name) if include?(i)
#end
TelepoMap::NAME.each_pair do |id, name|
@data.push(name) if include?(id)
end
end
#--------------------------------------------------------------------------
# ○ 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
map = @data[index]
if map
rect = item_rect(index)
rect.width -= 4
if town?(map)
change_color(normal_color, enable?(map))
else
change_color(crisis_color, enable?(map))
end
draw_text(rect.x + 4, rect.y, rect.width, line_height, map, 0)
end
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
make_map_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
#  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
# 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :telepo_on # テレポでの移動かどうかの判定
attr_accessor :telepo_map_id #
attr_accessor :telepo_map_x #
attr_accessor :telepo_map_y #
#--------------------------------------------------------------------------
# ● オブジェクト初期化 ※エイリアス
#--------------------------------------------------------------------------
alias telepo_initialize initialize
def initialize
telepo_initialize
teleport_flag_init
end
#--------------------------------------------------------------------------
# ○ テレポートフラグの初期化
#--------------------------------------------------------------------------
def teleport_flag_init
@telepo_on = false
@telepo_map_id = 1
@telepo_map_x = 0
@telepo_map_y = 0
end
#--------------------------------------------------------------------------
# ○ テレポートアニメの設定
#--------------------------------------------------------------------------
def teleport_anime
@animation_id = TelepoMap::ANIME
end
#--------------------------------------------------------------------------
# ● 場所移動情報のクリア ※エイリアス
#--------------------------------------------------------------------------
alias telepo_clear_transfer_info clear_transfer_info
def clear_transfer_info
telepo_clear_transfer_info
teleport_flag_init # テレポフラグ初期化
end
#--------------------------------------------------------------------------
# ● 移動可能判定 ※エイリアス
#--------------------------------------------------------------------------
alias telepo_movable? movable?
def movable?
return false if @telepo_on # テレポ予約状態だと移動不可
telepo_movable?
end
#--------------------------------------------------------------------------
# ○ 場所移動の予約
# d : 移動後の向き2,4,6,8
#--------------------------------------------------------------------------
def reserve_teleport(d = 2)
@transferring = true
@new_map_id = @telepo_map_id
@new_x = @telepo_map_x
@new_y = @telepo_map_y
@new_direction = d
end
#--------------------------------------------------------------------------
# ● 場所移動の実行 ※エイリアス
#--------------------------------------------------------------------------
alias telepo_perform_transfer perform_transfer
def perform_transfer
if @telepo_on # テレポ移動の場合
if transfer?
set_direction(@new_direction)
if @new_map_id != $game_map.map_id
$game_map.setup(@new_map_id)
$game_map.autoplay
end
@encount_reset = true # エンカウントリセットフラグをオン
moveto(@new_x, @new_y)
30.times { Graphics.update } # 移動後30フレームウェイト
clear_transfer_info
end
else
telepo_perform_transfer
end
end
end
#==============================================================================
# □ Scene_Teleport
#------------------------------------------------------------------------------
#  テレポート場所の選択・決定を行うクラスです。
#==============================================================================
class Scene_Teleport < Scene_MenuBase
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(user, item)
@item = item
@user = user
end
#--------------------------------------------------------------------------
# ○ 開始処理
#--------------------------------------------------------------------------
def start
super
create_telepo_window
end
#--------------------------------------------------------------------------
# ○ テレポウィンドウの作成
#--------------------------------------------------------------------------
def create_telepo_window
@telepo_window = Window_Teleport.new
@telepo_window.set_handler(:ok, method(:map_select_ok))
@telepo_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ○ 移動座標の設定
#--------------------------------------------------------------------------
def position_set(key)
map = FAKEREAL.deep_copy(TelepoMap::MAP_TELEPORT[key])#.dup
$game_player.telepo_map_id = map[0]
$game_player.telepo_map_x = map[1]
$game_player.telepo_map_y = map[2]
end
#--------------------------------------------------------------------------
# ○ 項目の決定
#--------------------------------------------------------------------------
def map_select_ok
@user.use_item(@item)
position_set(@telepo_window.teleport_name)
teleport_on
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ○ テレポを予約
#--------------------------------------------------------------------------
def teleport_on
$game_player.telepo_on = true
end
#--------------------------------------------------------------------------
# ★ 呼び出し元のシーンへ戻る ※オーバーライド
# もし戻るシーンがアイテム画面及びスキル画面なら専用のリターンプロセスを行う
# 処理は SceneManagerプラス に記述
#--------------------------------------------------------------------------
def return_scene
if SceneManager.laststack_is?(Scene_Item) || SceneManager.laststack_is?(Scene_Skill) || SceneManager.laststack_is?(Scene_SelectionItem)
SceneManager.telepo_return
else
super
end
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
#  マップ画面の処理を行うクラスです。
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias telepo_start start
def start
telepo_start
execute_teleport if $game_player.telepo_on
end
#--------------------------------------------------------------------------
# ○ テレポートの実行
#--------------------------------------------------------------------------
def execute_teleport
$game_temp.fade_type = 1 #フェードタイプ白
$game_player.teleport_anime
$game_player.reserve_teleport
play_se_teleport
end
#--------------------------------------------------------------------------
# ○ テレポ使用時の SE 演奏
#--------------------------------------------------------------------------
def play_se_teleport
Audio.se_play(*TelepoMap::SE)
end
end
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
#  アイテム画面の処理を行うクラスです。
#==============================================================================
class Scene_Item < Scene_ItemBase
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
attr_accessor :telepo_return # テレポシーンから戻ったかの判定
#--------------------------------------------------------------------------
# ○ オブジェクト初期化 ※テレポ判定初期化
#--------------------------------------------------------------------------
def initialize
@telepo_return = false
end
#--------------------------------------------------------------------------
# ● 開始処理 ※テレポから戻った後、念の為 判定初期化 ※エイリアス
#--------------------------------------------------------------------------
alias teleport_start start
def start
teleport_start
create_servant_window
if @telepo_return
last_symbol = return_symbol
@category_window.select_symbol(last_symbol)
category_process
@telepo_return = false
end
end
#--------------------------------------------------------------------------
# ○ テレポ判定のシンボル
#--------------------------------------------------------------------------
def return_symbol
$game_party.last_item.object.itype_id == 1 ? :item : :key_item
end
#--------------------------------------------------------------------------
# ○ テレポ判定のシンボル
#--------------------------------------------------------------------------
def category_process
@category_window.deactivate
on_category_ok
end
end
#==============================================================================
# ■ SceneManager
#------------------------------------------------------------------------------
#  シーン遷移を管理するモジュール ※追加分
#==============================================================================
module SceneManager
#--------------------------------------------------------------------------
# ○ テレポート専用呼び出し ※使用者とアイテムを引数に渡してシーン移動
#--------------------------------------------------------------------------
def self.telepo_call(scene_class, user, item)
@stack.push(@scene)
@scene = scene_class.new(user, item)
end
#--------------------------------------------------------------------------
# ○ 直前のシーンクラス判定 ※これでアイテムかどうか判定
#--------------------------------------------------------------------------
def self.laststack_is?(scene_class)
@stack[-1].instance_of?(scene_class)
end
#--------------------------------------------------------------------------
# ○ 呼び出し元へ戻る ※アイテムの場合
#--------------------------------------------------------------------------
def self.telepo_return
@scene = @stack.pop
@scene.telepo_return = true
end
end
#==============================================================================
# ■ Scene_Skill
#------------------------------------------------------------------------------
#  スキル画面の処理を行うクラスです。処理共通化の便宜上、スキルも「アイテム」
# として扱っています。
#==============================================================================
class Scene_Skill < Scene_ItemBase
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
attr_accessor :telepo_return # テレポシーンから戻ったかの判定
#--------------------------------------------------------------------------
# ○ オブジェクト初期化 ※テレポ判定初期化
#--------------------------------------------------------------------------
def initialize
@telepo_return = false
end
#--------------------------------------------------------------------------
# ● 開始処理 ※テレポから戻った後、念の為 判定初期化 ※エイリアス
#--------------------------------------------------------------------------
alias teleport_start start
def start
teleport_start
if @telepo_return
@command_window.select_last
@command_window.deactivate
command_skill
@telepo_return = false
end
end
end