| 赞 | 12 |
| VIP | |
| 好人卡 | |
| 积分 | 13 |
| 经验 | |
| 最后登录 | 2023-9-26 |
| 在线时间 | 378 小时 |
- 梦石
- 0
- 星屑
- 1345
- 在线时间
- 378 小时
- 注册时间
- 2015-6-16
- 回帖
- 526
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 300英雄 于 2017-7-19 15:16 编辑
网址
[pre lang="ruby"]#==============================================================================
# ★ RGSS3_リンク付きクレジット Ver1.1
#==============================================================================
=begin
作者:tomoaky
webサイト:ひきも記は閉鎖しました。 (http://hikimoki.sakura.ne.jp/)
ブラウザでリンク先のサイトを開く機能をもったクレジットシーンです、
タイトルコマンドに追加されます。
以下のおまけ機能があります。
イベントコマンド『スクリプト』を使い、任意のサイトをブラウザで開く。
open_url("http://hikimoki.sakura.ne.jp/")
タイトルシーンからGame.exeと同じ場所にある readme.txt を開く。
2014.10.09 Ver1.1
・おまけ機能追加
2014.10.08 Ver1.0
・公開
=end
#==============================================================================
# □ 設定項目
#==============================================================================
module TMCREDIT
# クレジットの設定(["サイト名", "説明", "URL"])
DATA = [
["勇冒的通知", "通知", "http://guangmingmofaling.lofter.com/post/1e3937c2_da6506b"],
["勇冒1.9。", "1.9", "http://guangmingmofaling.lofter.com/post/1e3937c2_cfa6f62"],
["勇冒2.0。", "2.0", "http://guangmingmofaling.lofter.com/post/1e3937c2_ebbe968"],
["勇冒2.1。", "2.1", "http://guangmingmofaling.lofter.com/post/1e3937c2_ed79836"],
["勇冒2.2。", "2.2", "http://guangmingmofaling.lofter.com/post/1e3937c2_f281213"],
["勇冒2.3。", "2.3", "http://guangmingmofaling.lofter.com/post/1e3937c2_f30b3e3"],
]
TITLE_INDEX = 2 # タイトルコマンドの何番目に挿入するか(0 が先頭)
USE_MANUAL_CALL = false # readme.txt の呼び出し機能を使うか(false で無効)
end
#==============================================================================
# □ コマンド
#==============================================================================
module TMCREDIT
module Commands
#--------------------------------------------------------------------------
# ○ ブラウザでサイトを開く
#--------------------------------------------------------------------------
def open_url(url)
a = Win32API.new("shell32", "ShellExecuteA", %w(p p p p p i),"i")
a.call(0, "open", url, 0, 0, 1)
end
module_function :open_url
end
end # module TMCREDIT
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event
include TMCREDIT::Commands
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
include TMCREDIT::Commands
end
#==============================================================================
# ■ Window_TitleCommand
#==============================================================================
class Window_TitleCommand < Window_Command
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
alias tmcredit_window_titlecommand_make_command_list make_command_list
def make_command_list
tmcredit_window_titlecommand_make_command_list
@list.insert(TMCREDIT::TITLE_INDEX,
{:name=>"更新网站", :symbol=>:credit, :enabled=>true, :ext=>nil})
if TMCREDIT::USE_MANUAL_CALL
@list.insert(TMCREDIT::TITLE_INDEX + 1,
{:name=>"説明書", :symbol=>:manual, :enabled=>true, :ext=>nil})
end
end
end
#==============================================================================
# ■ Window_Credit
#==============================================================================
class Window_Credit < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
@data = TMCREDIT::DATA.clone
super
select(0)
activate
refresh
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
@data.size
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
@data[index]
end
#--------------------------------------------------------------------------
# ● URLの取得
#--------------------------------------------------------------------------
def url
@data[index][2]
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect_for_text(index)
draw_text(rect, sprintf("%s (%s)", item[0], item[2]))
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
text = sprintf("\\C[16]%s\\C[0] %s", item[1], item[0])
text += "\n\\C[2](确定键进去网址)"
@help_window.set_text(text)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias tmcredit_scene_title_create_command_window create_command_window
def create_command_window
tmcredit_scene_title_create_command_window
@command_window.set_handler(:credit, method(:command_credit))
if TMCREDIT::USE_MANUAL_CALL
@command_window.set_handler(:manual, method(:command_manual))
end
end
#--------------------------------------------------------------------------
# ○ コマンド[クレジット]
#--------------------------------------------------------------------------
def command_credit
close_command_window
SceneManager.call(Scene_Credit)
end
#--------------------------------------------------------------------------
# ○ コマンド[説明書]
#--------------------------------------------------------------------------
def command_manual
@command_window.activate
TMCREDIT::Commands.open_url("readme.txt")
end
end
#==============================================================================
# ■ Scene_Credit
#==============================================================================
class Scene_Credit < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_help_window
create_item_window
end
#--------------------------------------------------------------------------
# ● クレジットウィンドウの作成
#--------------------------------------------------------------------------
def create_item_window
ww = Graphics.width
wh = Graphics.height - @help_window.height
@credit_window = Window_Credit.new(0, @help_window.height, ww, wh)
@credit_window.help_window = @help_window
@credit_window.set_handler(:ok, method(:on_credit_ok))
@credit_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● クレジット[決定]
#--------------------------------------------------------------------------
def on_credit_ok
TMCREDIT::Commands.open_url(@credit_window.url)
@credit_window.activate
end
end[/pre]
复活机制
[pre lang="ruby"]#encoding:utf-8
=begin
*******************************************************************************************
* 時間自動復活機制 *
for RGSS3
Ver 1.00 2014.01.29
原作者:魂(Lctseng),巴哈姆特論壇ID:play123
替"ace922(容)"撰寫的特製版本
轉載請保留此標籤
個人小屋連結:http://home.gamer.com.tw/homeindex.php?owner=play123
主要功能:
一、指定回合數到後角色會自動復活
二、若角色身上擁有"無法他人復活"狀態,則他人的復活相關技能將對其沒有作用。
更新紀錄:
Ver 1.00 :
日期:2014.01.29
摘要:■、最初版本
■、功能:
一、指定回合數到後角色會自動復活
二、若角色身上擁有"無法他人復活"狀態,則他人的復活相關技能將對其沒有作用。
撰寫摘要:一、此腳本修改或重新定義以下類別:
■ Game_Actor
二、此腳本新定義以下類別和模組:
■ Lctseng::AutoRevive
*******************************************************************************************
=end
#encoding:utf-8
#==============================================================================
# ■ Lctseng::AutoRevive
#------------------------------------------------------------------------------
# 自動復活設定模組
#==============================================================================
module Lctseng
module AutoRevive
#--------------------------------------------------------------------------
# ● 設定是否顯示Console 紀錄
#--------------------------------------------------------------------------
SHOW_CONSOLE_INFO = true
#--------------------------------------------------------------------------
# ● 設定復活所需回合數
#--------------------------------------------------------------------------
REVIVE_TURN = 10
#--------------------------------------------------------------------------
# ● 設定復活時候,HP與MP的恢復計算公式
#--------------------------------------------------------------------------
HP_FORMULA = " rand(10000) "
MP_FORMULA = " mat + mdf "
#--------------------------------------------------------------------------
# ● 設定相關狀態編號
#--------------------------------------------------------------------------
DEAD_STATE = 1 # 死亡的狀態
NO_REVIVE_STATES = [197] # 禁止復活的狀態數列
end
end
#*******************************************************************************************
#
# 請勿修改從這裡以下的程式碼,除非你知道你在做什麼!
# DO NOT MODIFY UNLESS YOU KNOW WHAT TO DO !
#
#*******************************************************************************************
#--------------------------------------------------------------------------
# ★ 紀錄腳本資訊
#--------------------------------------------------------------------------
if !$lctseng_scripts
$lctseng_scripts = {}
end
$lctseng_scripts[:auto_revive] = "1.00"
puts "載入腳本:Lctseng - 時間自動復活機制,版本:#{$lctseng_scripts[:auto_revive]}"
#encoding:utf-8
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 管理角色的類。
# 本類在 Game_Actors 類 ($game_actors) 的內部使用。
# 具體使用請查看 Game_Party 類 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 回合結束處理
#--------------------------------------------------------------------------
def on_turn_end
super
#puts "#{self.name}執行回合結束。" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
if dead?
if !@dead_turn
@dead_turn = 0
end
puts " #{self.name}已經死了#{@dead_turn}個回合..." if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
if @dead_turn >= Lctseng::AutoRevive::REVIVE_TURN
puts " #{self.name}復活!清除死亡回合計數!" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
revive
remove_state(Lctseng::AutoRevive::DEAD_STATE,true)
self.hp += eval_formula(Lctseng::AutoRevive::HP_FORMULA)
self.mp += eval_formula(Lctseng::AutoRevive::MP_FORMULA)
@dead_turn = 0
else
@dead_turn += 1
end
else
@dead_turn = 0
end
if alive?
## 還活著,自行解除任何限制復活狀態
Lctseng::AutoRevive::NO_REVIVE_STATES.each do |state_id|
if state?(state_id)
puts " #{self.name}還活著,持有#{$data_states[state_id].name},將自動解除" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
remove_state(state_id)
end
end
end
end
#--------------------------------------------------------------------------
# ● 計算公式
#--------------------------------------------------------------------------
def eval_formula(formula)
eval(formula).round rescue 0
end
#--------------------------------------------------------------------------
# ● 計算傷害
#--------------------------------------------------------------------------
def make_damage_value(user, item)
new_item = item
if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id| state?(state_id) }
new_item = Marshal.load(Marshal.dump(item))
new_item.damage.formula = "0"
puts "#{self.name}已死亡且受到復活限制狀態,恢復HP計算強制歸零" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
end
super(user,new_item)
end
#--------------------------------------------------------------------------
# ● 更改 HP
#--------------------------------------------------------------------------
def hp=(hp)
if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id| state?(state_id) }
hp = 0
puts "#{self.name}已死亡且受到復活限制狀態,HP強制為0" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
end
super(hp)
end
#--------------------------------------------------------------------------
# ● 應用“恢復 HP”效果
#--------------------------------------------------------------------------
def item_effect_recover_hp(user, item, effect)
if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id| state?(state_id) }
puts " #{self.name}有禁止復活的狀態,恢復HP無效。" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
else
super
end
end
#--------------------------------------------------------------------------
# ● 應用“狀態解除”效果
#--------------------------------------------------------------------------
def item_effect_remove_state(user, item, effect)
if effect.data_id == Lctseng::AutoRevive::DEAD_STATE
if !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id| state?(state_id) }
super
if !state?(effect.data_id)
@dead_turn = 0
puts "#{self.name}已經復活!清除死亡回合數。"if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
end
end
else
super
end
end
#--------------------------------------------------------------------------
# ● 解除狀態
#--------------------------------------------------------------------------
def remove_state(state_id,force = false)
if state_id == Lctseng::AutoRevive::DEAD_STATE
if force || !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id| state?(state_id) }
super(state_id)
end
else
super(state_id)
end
end
#--------------------------------------------------------------------------
# ● 死亡
#--------------------------------------------------------------------------
def die
@dead_turn = 0
@hp = 0
clear_states_except_revive_limit
clear_buffs
end
#--------------------------------------------------------------------------
# ● 清除除了死亡限制以外的狀態
#--------------------------------------------------------------------------
def clear_states_except_revive_limit
## 先記錄死亡狀態資訊
states = {}
Lctseng::AutoRevive::NO_REVIVE_STATES.each do |state_id|
if @states.include?(state_id)
states[state_id] = [@state_steps[state_id],@state_turns[state_id]]
end
end
## 呼叫原始的清除方法
clear_states
## 把剛才紀錄的狀態放回去
states.each_pair do |state_id,data|
@states.push(state_id)
@state_steps[state_id] = data[0]
@state_turns[state_id] = data[1]
end
sort_states
end
#--------------------------------------------------------------------------
# ● 判定狀態是否可以附加
#--------------------------------------------------------------------------
def state_addable?(state_id)
if Lctseng::AutoRevive::NO_REVIVE_STATES.include?(state_id)
$data_states[state_id] && !state_resist?(state_id) &&
!state_removed?(state_id) && !state_restrict?(state_id)
else
super
end
end
#--------------------------------------------------------------------------
# ● 測試使用效果
#--------------------------------------------------------------------------
def item_effect_test(user, item, effect)
if effect.code == EFFECT_REMOVE_STATE && effect.data_id == Lctseng::AutoRevive::DEAD_STATE
state?(effect.data_id) && !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id| state?(state_id) }
else
super
end
end
end[/pre]
时间脚本
[pre lang="ruby"]#==============================================================================
# ■ BMSP 暦システム[KOYOMISYSTEM] Ver1.24 2014/08/09
#------------------------------------------------------------------------------
# 日付,時間の概念を導入します.
#==============================================================================
#------------------------------------------------------------------------------
# ■内容
# ゲームに日付,時間の概念を導入します.
# 自由に暦を設定して任意のタイミングで時間を進めることができます.
# 時間に合わせて画面の色調を自動で変更することも可能です.
#
# 位置:特に指定はありません
#
# ■使用方法
# スクリプトに丸ごと貼り付けていただければ使用できます.
#
# ●暦の設定
# まずは詳細設定にて暦の設定を行って下さい.
#
# ○RANKS:ランクの設定を行います.
# ランクとは秒,分,時,,などのような時間の単位を表します.
# ランクは上から順にランク0,ランク1と呼び,
# あるランクの値が上限を超えると一つ上のランクに繰り上げされます.
# 各ランクは
# ランク名 => 値の範囲
# のように設定します.
# 例
# RANKS = {
# :sec => 0...60,
# :min => 0...60,
# :hour => 0...24,
# :day => 1..30,
# :mon => 1..12,
# :year => 1..9999
# }
# 上記の例ではランクの低い順に秒,分,時,日,月,年を設定しています.
# また,それぞれ取り得る値の範囲も指定しています.
# (一月30日で年は便宜上9999年を上限としています)
# 例えばdayが25のときに7加算され32になると,
# 結果としてdayは2になり,monは1加算されます.
# このようにして基本となる暦を作成します.
# この部分を任意に変えることで自由な暦を設定できます.
#
# ○ SPECIAL_EXP:ランク以外の特別な暦情報を設定します
# 例えば曜日や季節,時間帯などを設定することができます.
# 設定の仕方は以下のフォーマットにしたがってください.
# SPECIAL_EXP[:%special%] = ->(cal){
# 任意の式
# }
# %special%に設定する名前を指定し,対応する任意の式を記述します.
# このときcalにより暦オブジェクトが参照できます.
# 例・時間帯の設定
# SPECIAL_EXP[:timezone] = ->(cal){
# case cal.hour
# when 4,5
# 0 # 早朝は0を返す
# when 6,7,8
# 1 # 朝は1を返す
# when 9...16
# 2 # 昼は2を返す
# when 16,17
# 3 # 夕方は3を返す
# when 18...22
# 4 # 夜は4を返す
# when 22...24,0...4
# 5 # 深夜は5を返す
# end
# }
#
# ○ TRANSFORM:表示変換の設定を行います.
# 暦を文字列として表現する際,整数以外の形式で表示したい場合に使用します.
# また,全く新しい独自の表示形式を指定することも可能
# 例・月の文字列表記
# TRANSFORM[:mon] = ->(cal){
# ["Jan", "Fab", "Mar", "Apr", "May", "Jun",
# "Jul", "Aug", "Seq", "Oct", "Nov", "Dec"][cal.mon]
# }
#
# ○ INITIAL_CAL:ゲーム開始時の暦を設定します.
# 設定したいランクと対応する値を指定します.
# 指定されなかったランクの初期値は値の範囲のうち最小のものになります.
# 例
# INITIAL_CAL = {
# :day => 15,
# :mon => 12,
# :year => 2011
# }
# この例では2011年12月15日0時0分0秒が初期値となります.
#
# ○ MAP_WINDOW:マップで暦ウインドウを表示するかを設定します.
# この設定はゲーム中以下のスクリプトにて切り替え可能です.
# $game_map.koyomi_display = true/false
#
# ○ MAP_WINDOW_FADE:マップでの暦ウインドウをフェードするか設定します.
# trueのとき一定時間表示したあとフェードアウトします.
# falseのとき暦ウインドウを常に表示します.
#
# ○ HIDE_MAP_WINDOW:マップで暦ウインドウを常に表示するとき,
# ウインドウを一時的に消去できるか設定します.
# この設定はゲーム中以下のスクリプトによって切り替え可能です.
# $game_koyomi.hide_map_window = true/false
# ○ HIDE_KEY:マップで暦ウインドウを一時的に消去するボタンです.
# もう一度押すと再び表示します.
# また,次のスクリプトをマップ上で実行するとイベント側から暦ウインドウの
# 一時消去および再表示を行うことができます.
# $game_map.hide_koyomi_window = true/false
#
# ○ MAP_WINDOW_FORMAT:マップでの暦ウインドウの表示内容を設定します.
# 配列でフォーマットを指定します.一つの要素につき一行となります.
# フォーマットについては後述のメソッドstrftimeを参照してください.
#
# ○ MENU_WINDOW:メニューで暦ウインドウを表示するかを設定します.
#
# ○ MENU_WINDOW_FORAMT:メニューでの暦ウインドウの表示内容を設定します.
# 設定の仕方はMAP_WINDOW_FORMATと同様です.
#
# ○ AUTO_TONE:暦による画面の色調の自動変更を設定します.
# trueの時時間によって画面の色調が自動で変更されます.
# また,イベントコマンドによる画面の色調変更は機能しなくなります.
# ただし,後述する色調固定マップでは機能します.
# この設定はゲーム中以下のスクリプトにて切り替え可能です.
# $game_koyomi.auto_tone = true/false
#
# ○ AUTO_TONE_DURATION:デフォルトの色調変更時間の設定です.
# 色調変更の条件で色調変更時間が指定されない場合はこの値が適用されます.
#
# ○ AUTO_TONE_COND:色調変更の条件を設定します.
# 色調を変更する条件となる時間とそれに対応する色調(Tone)を指定します.
# 上にある条件ほど優先的にマッチします.
# 条件の指定方法は条件に設定したいrankをキーにして対応する値を直接指定するか
# 値の範囲で指定します.22..4(22...24かつ0..4)のような指定も可能です.
# 範囲に関しては(0...3)の場合0から2まで,0...3の場合0から3までを表します.
# また,対応する色調は以下で指定します.
# Tone.new(赤(-255~255),緑(-255~255),青(-255~255),グレー(0~255))
# 例・時間帯によって色調を変える
# AUTO_TONE_COND = {
# {:hour => 16...18} => Tone.new(68,-34,-34,0),
# {:hour => 18...22} => Tone.new(-34,-34,0,34),
# {:hour => 22...4} => Tone.new(-68,-68,0,68),
# {:hour => 4...6} => Tone.new(-34,-34,-34,34),
# {:hour => 6...9} => Tone.new(34,34,34,34)
# }
#
# ○ FIX_TONE_ON_BATTLE:バトル画面では画面の色調を変更しない設定にできます.
# trueの場合マップで色調が自動変更されている場合でも画面の色調はデフォルト(0,0,0,0)になります.
# また,色調固定マップの場合でもデフォルトの色調になります.
#
# ○ AUTO_TIME_PASS:時間が自動経過するかを設定します.
# この設定はゲーム中以下のスクリプトによって切り替え可能です.
# $game_koyomi.auto_time_pass = true/false
#
# ○ AUTO_TIME_PASS_DURATION:時間の自動経過間隔を設定します.
# 指定したフレームが経過するごとにTIME_PASSINGで指定した分の時間が経過します.
#
# ○ TIME_PASSING:時間の自動経過量を設定します.
# 加算したいランクと対応する加算量を指定してください.
# 例・1分30秒ずつ加算する
# TIME_PASSING = {:min => 1, :sec => 30}
#
# ○ STOP_ON_EVENT:イベント中は時間の自動経過を停止するか設定します.
# この設定はゲーム中以下のスクリプトによって切り替え可能です.
# $game_koyomi.stop_auto_time_pass_on_event = true/false
#
# ○ STOP_ON_BATTLE:バトル中は時間の自動経過を停止するか設定します.
# この設定はゲーム中以下のスクリプトによって切り替え可能です.
# $game_koyomi.stop_auto_time_pass_on_battle = true/false
#
# ○ MOVE_TIME_PASS:場所移動による時間経過を設定します.
# 「場所移動」が行われる度に時間を経過させることができます.
# 加算したいランクと対応する加算量を指定してください.
# 場所移動により加算したくない場合は空のハッシュを指定してください.
#
# ○ BATTLE_START_TIME_PASS:戦闘開始による時間経過を設定します.
# 戦闘開始時に時間を経過させることができます.
# 加算したいランクと対応する加算量を指定してください.
# 加算したくない場合は空のハッシュを指定してください.
#
# ○ BATTLE_END_TIME_PASS:戦闘終了による時間経過を設定します.
# 戦闘終了時に時間を経過させることができます.
# 加算したいランクと対応する加算量を指定してください.
# 加算したくない場合は空のハッシュを指定してください.
#
# ●暦の操作
# ゲーム中は基本的にスクリプトコマンドから$game_koyomiにアクセスすることで暦を操作できます.
# 以下は$game_koyomiからできる主な操作一覧です.
# ○ $game_koyomi.auto_tone = true/false
# 時間による画面色調の自動変更をするかどうか設定できます.
#
# ○ $game_koyomi.tone_temp_duration = int
# これを設定した次の画面色調自動変更時のみ指定した時間で色調が変化します.
# イベント等で時間を進めた際早く色調を切り替えたいときなどに利用します.
#
# ○ $game_koyomi.move_temp_time_pass = {:rank => value, ...}
# これを指定した次の場所移動時のみ指定した分だけ時間が経過します.
#
# ○ $game_koyomi.battle_start_temp_time_pass = {:rank => value, ...}
# これを指定した次の戦闘開始時のみ指定した分だけ時間が経過します.
#
# ○ $game_koyomi.battle_end_temp_time_pass = {:rank => value, ...}
# これを指定した次の戦闘終了時時のみ指定した分だけ時間が経過します.
#
# ○ $game_koyomi.auto_time_pass = true/false
# 自動で時間を経過させるか設定できます.
#
# ○ $game_koyomi.stop_auto_time_pass_on_event = true/false
# 自動で時間が経過するとき,イベント中は時間経過を停止するか設定できます.
#
# ○ $game_koyomi.stop_auto_time_pass_on_battlet = true/false
# 自動で時間が経過するとき,バトル中は時間経過を停止するか設定できます.
#
# ○ $game_koyomi.rank
# 設定した各ランクの値を取得できます.
# 例・現在の月を取得
# $game_koyomi.mon
#
# ○ $game_koyomi.rank = value
# 設定した各ランクの値を変更できます.
# 例・現在の月を3に設定
# $game_koyomi.mon = 3
# 例・3時間進める
# $game_koyomi.hour += 3
#
# ○ $game_koyomi.special
# 設定した各特殊表現の値を取得できます.
# 例・現在の時間帯を取得
# $game_koyomi.timezone
#
# ○ $game_koyomi.set(init)
# 暦をセットします.
# initは各ランクと対応する値のハッシュか,後述する起算時からのランク0からみた経過時間
# を指定します.
# 例・ハッシュで暦をセット
# $game_koyomi.set(year: 2011, mon: 12. day: 15)
# 例・ある暦から得た起算時からの経過時間で暦をセット
# $game_koyomi.set(koyomi.to_i)
#
# ○ $game_koyomi.time_pass(amount)
# amountに各ランクと対応する値のハッシュを指定して,その分だけ時間を経過させます.
# 例・1月と3時間だけ時間をすすめる
# $game_koyomi.time_pass(mon: 1, hour: 3)
#
# ○ $game_koyomi.to_i
# 起算時からのランク0からみた経過時間を取得します.
# この結果を変数などに保存することで容易に暦を復元できます.
# 例・暦を整数にして保存・復元する
# koyomi = $game_koyomi.to_i
# $game_koyomi.set(koyomi)
#
# ○ $game_koyomi.strftime(format)
# formatに変換文字列を指定して現在の暦を文字列にします.
# format中には以下の二つの特別な文字列を記述することで暦の値を置き換えることができます.
# <<表示桁#rank>>
# 表示桁は先頭に - または 0 を付けた数字と置き換えます.
# rankは設定したランクのいずれかと置き換えます.
# ランクの値が指定した数字の桁分の幅の文字列と置換されます.
# 先頭に 0 をつけると余った桁0で埋められます.
# 先頭に - をつけると右寄せとなります.
# <<label>>
# labelはTRANSFORMで指定した変換ラベルと置き換えます.
# TRANSFORMで設定した内容に従って文字列に置換されます.
# 例・2011年12月15日4時00分00秒の暦のとき
# $game_koyomi.strftime("<<4#year>>-<<4#mon>>-<<04#day>>")
# #=> 2011- 12-0015
# $game_koyomi.strftime("<<mon>>-<<-4#day>>:<<timezone>>")
# #=> Dec-15 :早朝
#
# ●マップの個別設定
# マップのメモ欄に以下を記述することでマップごとに設定を行うことができます.
# ==暦非表示==
# マップで暦ウインドウを表示する場合でもこの記述があるマップは暦ウインドウを表示しません.
#
# ==暦停止==
# 自動で時間が経過する場合でもこの記述があるマップは自動で時間が経過しません.
#
# ==色調固定[r,g,b,gray]==
# 自動で画面色調が変更される場合でもこの記述があるマップは指定した色調になります.
# 屋内マップなどで利用します.薄暗い洞窟等も表現可能です.
# r,g,b,grayはそれぞれ色調(トーン)を指定する値です.
# 例・時間にかかわらず薄暗い洞窟
# ==色調固定[-34,-34,-34,34]==
#
# ■注意
# このスクリプトでは
# 「RPG::Map」「Game_Map」「Scene_Menu」「Scene_Map」
# 「Game_Screen」「Game_Troop」「Scene_Battle」
# のメソッドを改変しています.
# ■情報
# このスクリプトはgentlawkによって作られたものです.
# 利用規約はhttp://blueredzone.comをご覧ください.
#------------------------------------------------------------------------------
module BMSP
@@includes ||= {}
@@includes[:KoyomiSystem] = 1.24
module KoyomiSystem
#▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
#詳細設定
# ランクの設定
RANKS = {
:sec => 0...60,
:min => 0...60,
:hour => 0...24,
:day => 1..30,
:mon => 1..12,
:year => 1..9999
}
#------------------------------------------------------------
# ランク以外の暦情報の設定
SPECIAL_EXP = {}
SPECIAL_EXP[:timezone] = ->(cal){
case cal.hour
when 4,5
0 # 早朝は0を返す
when 6,7,8
1 # 朝は1を返す
when 9...16
2 # 昼は2を返す
when 16,17
3 # 夕方は3を返す
when 18...22
4 # 夜は4を返す
when 22...24,0...4
5 # 深夜は5を返す
end
}
#------------------------------------------------------------
# 表示変換の設定
TRANSFORM = {}
TRANSFORM[:mon] = ->(cal){
["一月", "二月", "三月", "四月", "五月", "六月",
"七月", "八月", "九月", "十月", "十一月", "十二月"][cal.mon]
}
TRANSFORM[:timezone] = ->(cal){
case cal.timezone # 上で設定した時間帯で条件分岐
when 0
"早朝"
when 1
"朝"
when 2
"昼"
when 3
"夕方"
when 4
"夜"
when 5
"深夜"
end
}
#------------------------------------------------------------
# ゲーム開始時の暦
INITIAL_CAL = {
:sec => 0,
:min => 0,
:hour => 0,
:day => 7,
:mon => 5,
:year => 2017
}
#------------------------------------------------------------
# マップで暦ウインドウを表示するか
MAP_WINDOW = true
# マップでの暦ウインドウをフェードするか(falseで常に表示)
MAP_WINDOW_FADE = false
# マップでの暦ウインドウの一時消去を許可するか(trueで許可)
HIDE_MAP_WINDOW = true
# マップでの暦ウインドウの一時消去ボタン
# (:DOWN,:UP,:LEFT,:RIGHT,:A,:B,:C,:X,:Y,:Z,:L,:R,:SHIFT,:CTRL,:ALT)
HIDE_KEY = :L
# マップでの暦ウインドウの表示内容
MAP_WINDOW_FORMAT = [
"<<4#year>>年<<2#mon>>月<<2#day>>日",
"<<02#hour>>:<<02#min>>:<<02#sec>> [<<timezone>>]"
]
# メニューで暦ウインドウを表示するか
MENU_WINDOW = true
# メニューでの暦ウインドウの表示内容
MENU_WINDOW_FORMAT = [
"<<4#year>>年<<2#mon>>月<<2#day>>日",
"<<02#hour>>:<<02#min>>:<<02#sec>>"
]
#------------------------------------------------------------
# 暦による画面の色調の自動変更
AUTO_TONE = true
# デフォルト色調変更時間
AUTO_TONE_DURATION = 120
# 色調変更の条件
AUTO_TONE_COND = {
{:hour => 16...18} => Tone.new(68,-34,-34,0),
{:hour => 18...22} => Tone.new(-34,-34,0,34),
{:hour => 22...4} => Tone.new(-68,-68,0,68),
{:hour => 4...6} => Tone.new(-34,-34,-34,34),
{:hour => 6...9} => Tone.new(34,34,34,34)
}
# バトル画面では色調を変更しない
FIX_TONE_ON_BATTLE = false
#------------------------------------------------------------
# 時間が自動経過するか
AUTO_TIME_PASS = true
# 時間の自動経過間隔
AUTO_TIME_PASS_DURATION = 15
# 時間の自動経過量
TIME_PASSING = {:min => 5}
# イベント中は自動経過を停止するか
STOP_ON_EVENT = true
# バトル中は自動経過を停止するか
STOP_ON_BATTLE = false
#------------------------------------------------------------
# 場所移動による時間経過
MOVE_TIME_PASS = {:min => 20}
# 戦闘開始による時間経過
BATTLE_START_TIME_PASS = {}
# 戦闘終了による時間経過
BATTLE_END_TIME_PASS = {}
#▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
end
#--------------------------------------------------------------------------
# ● 導入スクリプトのチェック
#--------------------------------------------------------------------------
class << self
if method_defined?(:check_script)
alias koyomisystem_check_script check_script
end
end
def self.check_script(script, version)
if methods.include?(:koyomisystem_check_script)
koyomisystem_check_script(script, version)
end
@@includes[script] && @@includes[script] >= version
end
end
#==============================================================================
# ■ RPG::Map
#==============================================================================
class RPG::Map
#--------------------------------------------------------------------------
# ● 暦ウインドウ表示のマップか
#--------------------------------------------------------------------------
def bmsp_koyomisystem_display_koyomi_on_map?
return @bmsp_koyomi_display if @bmsp_koyomi_display
@bmsp_koyomi_display = !self.note.include?('==暦非表示==')
end
#--------------------------------------------------------------------------
# ● 色調固定
#--------------------------------------------------------------------------
def bmsp_koyomisystem_fix_tone
return @bmsp_fix_tone unless @bmsp_fix_tone.nil?
if self.note =~ /==色調固定\[([+-]?\d+),([+-]?\d+),([+-]?\d+),([+-]?\d+)\]==/
r,g,b,gray = $1.to_i,$2.to_i,$3.to_i,$4.to_i
@bmsp_fix_tone = Tone.new(r,g,b,gray)
else
@bmsp_fix_tone = false
end
end
#--------------------------------------------------------------------------
# ● 暦停止のマップか
#--------------------------------------------------------------------------
def bmsp_koyomisystem_koyomi_stop?
return @bmsp_koyomi_stop if @bmsp_koyomi_stop
@bmsp_koyomi_stop = self.note.include?('==暦停止==')
end
end
#==============================================================================
# ■ Game_Koyomi
#==============================================================================
class Game_Koyomi
#============================================================================
# ■ Ranks
#============================================================================
module Ranks
#--------------------------------------------------------------------------
# ● モジュール変数
#--------------------------------------------------------------------------
@@ranks = BMSP::KoyomiSystem::RANKS
@@transform = BMSP::KoyomiSystem::TRANSFORM
#--------------------------------------------------------------------------
# ● ランクの取得
#--------------------------------------------------------------------------
def self.ranks
@@ranks
end
#--------------------------------------------------------------------------
# ● 表示変換
#--------------------------------------------------------------------------
def self.transform(label)
@@transform[label]
end
#--------------------------------------------------------------------------
# ● ランクの取得(順位指定)
#--------------------------------------------------------------------------
def self.rank(i)
r = @@ranks.to_a
return nil if r.nil?
r.first
end
#--------------------------------------------------------------------------
# ● ノーマライズ
#--------------------------------------------------------------------------
def self.normalize(i, rank)
i - @@ranks[rank].min
end
#--------------------------------------------------------------------------
# ● 指定した範囲の値か
#--------------------------------------------------------------------------
def self.include_range?(rank, range, value)
rank_min = @@ranks[rank].min
rank_max = @@ranks[rank].max
range_min = range.min
range_max = range.max
unless range_min.nil? || range_max.nil? # 有効なRange
min = [[range_min, rank_min].max, rank_max].min
max = [[range_max, rank_min].max, rank_max].min
(min..max).include?(value)
else # 無効なRange
first = range.first
last = range.last
nf = [[first, rank_min].max, rank_max].min
nl = [[last, rank_min].max, rank_max].min
range1 = (nf..rank_max)
range2 = nl <= last && range.exclude_end? ? (rank_min...nl) : (rank_min..nl)
range1.include?(value) || range2.include?(value)
end
end
#--------------------------------------------------------------------------
# ● ランクを一つ進める
#--------------------------------------------------------------------------
def self.succ(rank)
find = false
@@ranks.each do |r,|
return r if find
find = true if r == rank
end
return nil
end
end
#============================================================================
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :auto_tone # 画面の色調自動変更フラグ
attr_accessor :tone_temp_duration # 画面の色調時間一時変更フラグ
attr_accessor :move_temp_time_pass # 場所移動による時間経過一時変更フラグ
attr_accessor :battle_start_temp_time_pass # 戦闘開始による時間経過一時変更フラグ
attr_accessor :battle_end_temp_time_pass # 戦闘終了による時間経過一時変更フラグ
attr_accessor :auto_time_pass # 時間自動経過フラグ
attr_accessor :stop_auto_time_pass_on_event # イベント中時間自動経過停止フラグ
attr_accessor :stop_auto_time_pass_on_battle # バトル中時間自動経過停止フラグ
attr_reader :fix_tone_on_battle # バトル画面色調固定フラグ
attr_accessor :hide_map_window # 暦ウインドウ一時消去許可フラグ
#--------------------------------------------------------------------------
# ● ランクアクセサの定義
#--------------------------------------------------------------------------
Ranks.ranks.each_key do |rank|
reader = rank
writer = :"#{rank}="
define_method(reader){ @calendar[rank] }
define_method(writer){ |value| @calendar[rank] = value; fit; value }
end
#--------------------------------------------------------------------------
# ● 特別表現リーダーの定義
#--------------------------------------------------------------------------
BMSP::KoyomiSystem::SPECIAL_EXP.each do |special, exp|
define_method(special){ exp.call(self) }
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(init= {})
# 各種設定の初期化
@auto_tone = BMSP::KoyomiSystem::AUTO_TONE
@tone_temp_duration = 0
@default_tone = Tone.new(0,0,0,0)
@auto_time_pass = BMSP::KoyomiSystem::AUTO_TIME_PASS
@auto_time_pass_amount = {
:duration => BMSP::KoyomiSystem::AUTO_TIME_PASS_DURATION,
:amount => BMSP::KoyomiSystem::TIME_PASSING
}
@move_time_pass = BMSP::KoyomiSystem::MOVE_TIME_PASS
@battle_start_time_pass = BMSP::KoyomiSystem::BATTLE_START_TIME_PASS
@battle_end_time_pass = BMSP::KoyomiSystem::BATTLE_END_TIME_PASS
@stop_auto_time_pass_on_event = BMSP::KoyomiSystem::STOP_ON_EVENT
@stop_auto_time_pass_on_battle = BMSP::KoyomiSystem::STOP_ON_BATTLE
@fix_tone_on_battle = BMSP::KoyomiSystem::FIX_TONE_ON_BATTLE
@hide_map_window = BMSP::KoyomiSystem::HIDE_MAP_WINDOW
# 暦の初期化
set(init)
end
#--------------------------------------------------------------------------
# ● 範囲外の暦を修正
#--------------------------------------------------------------------------
def fit
carry = 0
@calendar.each_key do |rank|
@calendar[rank] += carry
value = @calendar[rank]
if Ranks.ranks[rank].include?(value)
carry = 0
else
n_value = Ranks.normalize(value, rank)
card = Ranks.ranks[rank].count
carry = n_value / card
@calendar[rank] = n_value % card + Ranks.ranks[rank].min
end
end
@int = calc_to_i
end
#--------------------------------------------------------------------------
# ● 暦のセット
#--------------------------------------------------------------------------
def set(init)
@calendar = {}
ini_h = init.is_a?(Hash) ? init : {}
Ranks.ranks.each_key do |rank|
@calendar[rank] =
ini_h[rank] ? ini_h[rank] : Ranks.ranks[rank].min
end
@calendar[Ranks.rank(0)] += init if init.is_a?(Integer)
fit
end
#--------------------------------------------------------------------------
# ● 時間自動経過の設定
#--------------------------------------------------------------------------
def set_auto_time_pass(passing)
@auto_time_pass_amount[:duration] = passing[:duration] if passing[:duration]
@auto_time_pass_amount[:amount] = passing[:amount] if passing[:amount]
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update(screen)
update_auto_time_pass
update_auto_tone(screen)
end
#--------------------------------------------------------------------------
# ● 時間経過
#--------------------------------------------------------------------------
def time_pass(amount)
amount.each do |rank, value|
next unless @calendar[rank]
@calendar[rank] += value
end
fit
end
#--------------------------------------------------------------------------
# ● イベント中判定
#--------------------------------------------------------------------------
def check_event_running?
if $game_party.in_battle
$game_troop.interpreter.running?
elsif !$BTEST
$game_map.interpreter.running?
end
end
#--------------------------------------------------------------------------
# ● 時間自動経過
#--------------------------------------------------------------------------
def update_auto_time_pass
return unless @auto_time_pass
return if @stop_auto_time_pass_on_event && check_event_running?
return if @stop_auto_time_pass_on_battle && $game_party.in_battle
return if !$BTEST && $game_map.map.bmsp_koyomisystem_koyomi_stop?
if @auto_time_pass_amount[:duration] > 0
return if Graphics.frame_count % @auto_time_pass_amount[:duration] != 0
time_pass(@auto_time_pass_amount[:amount])
end
end
#--------------------------------------------------------------------------
# ● 場所移動による時間経過
#--------------------------------------------------------------------------
def move_time_pass
unless @move_temp_time_pass
time_pass(@move_time_pass)
else
time_pass(@move_temp_time_pass)
@move_temp_time_pass = nil
end
end
#--------------------------------------------------------------------------
# ● 戦闘開始による時間経過
#--------------------------------------------------------------------------
def battle_start_time_pass
unless @battle_start_temp_time_pass
time_pass(@battle_start_time_pass)
else
time_pass(@battler_start_temp_time_pass)
@battle_start_temp_time_pass = nil
end
end
#--------------------------------------------------------------------------
# ● 戦闘終了による時間経過
#--------------------------------------------------------------------------
def battle_end_time_pass
unless @battle_end_temp_time_pass
time_pass(@battle_end_time_pass)
else
time_pass(@battler_end_temp_time_pass)
@battle_end_temp_time_pass = nil
end
end
#--------------------------------------------------------------------------
# ● 画面の色調自動変更
#--------------------------------------------------------------------------
def update_auto_tone(screen)
return if !@auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
return if $game_party.in_battle && @fix_tone_on_battle
target_tone,duration = get_match_tone
return if target_tone.nil? || screen.tone_target == target_tone
# 変更時間の設定
duration = BMSP::KoyomiSystem::AUTO_TONE_DURATION if duration.nil?
duration = @tone_temp_duration ? @tone_temp_duration : duration
@tone_temp_duration = nil
# 色調変更
screen.start_tone_change(target_tone, duration)
end
#--------------------------------------------------------------------------
# ● 条件にマッチする色調の取得
#--------------------------------------------------------------------------
def get_match_tone
BMSP::KoyomiSystem::AUTO_TONE_COND.each do |cond, (tone,duration)|
next unless cond.each { |rank, range|
case range
when Range
break unless Ranks.include_range?(rank, range, @calendar[rank])
else # それ以外(整数指定)
break if @calendar[rank] != range
end
}
return tone,duration
end
@default_tone
end
#--------------------------------------------------------------------------
# ● 暦を一つ進める
#--------------------------------------------------------------------------
def succ
rank0 = Ranks.rank(0)
@calendar[rank0] += 1
fit
end
#--------------------------------------------------------------------------
# ● 文字列フォーマット
#--------------------------------------------------------------------------
def strftime(format)
format = format.dup
Ranks.ranks.each_key do |rank|
pattern = /<<(-?)(0?)(\d)#(#{rank.to_s})>>/
format.gsub!(pattern){
left,zero,digit,r = $1,$2,$3,$4
sprintf("%#{left + zero + digit}d", @calendar[rank])
}
end
format.gsub!(/<<(.+?)>>/){
trans = Ranks.transform($1.to_sym)
trans.nil? ? "###" : trans.call(self)
}
format
end
#--------------------------------------------------------------------------
# ● オブジェクト複製
#--------------------------------------------------------------------------
def dup
Marshal.load(Marshal.dump self)
end
#--------------------------------------------------------------------------
# ● 起算時からのランク0からみた経過時間の計算
#--------------------------------------------------------------------------
def calc_to_i
@int = @calendar.each.reverse_each.inject(0) { |sum, (rank, value)|
sum * Ranks.ranks[rank].count + Ranks.normalize(value, rank)
}
end
#--------------------------------------------------------------------------
# ● 起算時からのランク0からみた経過時間の取得
#--------------------------------------------------------------------------
def to_i
@int
end
#--------------------------------------------------------------------------
# ● 比較演算子
#--------------------------------------------------------------------------
def ==(koyomi)
self.to_i == koyomi.to_i
end
def !=(koyomi)
self.to_i != koyomi.to_i
end
def <(koyomi)
self.to_i < koyomi.to_i
end
def <=(koyomi)
self.to_i <= koyomi.to_i
end
def >(koyomi)
self.to_i > koyomi.to_i
end
def >=(koyomi)
self.to_i >= koyomi.to_i
end
def <=>(koyomi)
self.to_i <=> koyomi.to_i
end
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# ● 各種ゲームオブジェクトの作成
#--------------------------------------------------------------------------
instance_eval{ alias bmsp_koyomisystem_create_game_objects create_game_objects }
def self.create_game_objects
bmsp_koyomisystem_create_game_objects
$game_koyomi = Game_Koyomi.new(BMSP::KoyomiSystem::INITIAL_CAL)
end
#--------------------------------------------------------------------------
# ● セーブ内容の作成
#--------------------------------------------------------------------------
instance_eval{ alias bmsp_koyomisystem_make_save_contents make_save_contents }
def self.make_save_contents
contents = bmsp_koyomisystem_make_save_contents
contents[:koyomi] = $game_koyomi
contents
end
#--------------------------------------------------------------------------
# ● セーブ内容の展開
#--------------------------------------------------------------------------
instance_eval{ alias bmsp_koyomisystem_extract_save_contents extract_save_contents }
def self.extract_save_contents(contents)
bmsp_koyomisystem_extract_save_contents(contents)
$game_koyomi = contents[:koyomi]
end
end
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :map # 現在のマップデータ
attr_accessor :koyomi_display # 暦表示フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias bmsp_koyomisytem_initialize initialize
def initialize
bmsp_koyomisytem_initialize
@koyomi_display = BMSP::KoyomiSystem::MAP_WINDOW
end
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_setup setup
def setup(map_id)
bmsp_koyomisystem_setup(map_id)
# 色調固定処理
bmsp_koyomisystem_change_fix_tone
end
#--------------------------------------------------------------------------
# ● 色調固定マップの処理
#--------------------------------------------------------------------------
def bmsp_koyomisystem_change_fix_tone
tone = self.map.bmsp_koyomisystem_fix_tone
if tone # 色調固定
self.screen.start_tone_change(tone, 0)
else # それ以外
if $game_koyomi.auto_tone
tone,duration = $game_koyomi.get_match_tone
self.screen.start_tone_change(tone, 0)
else
self.screen.start_tone_change(Tone.new(0,0,0,0), 0)
end
end
end
#--------------------------------------------------------------------------
# ● 暦ウィンドウの一時消去
#--------------------------------------------------------------------------
def hide_koyomi_window=(hidden)
return unless SceneManager.scene_is?(Scene_Map)
koyomi_window = SceneManager.scene.instance_eval{@bmsp_koyomi_window}
if $game_map.koyomi_display && !BMSP::KoyomiSystem::MAP_WINDOW_FADE
if $game_koyomi.hide_map_window
koyomi_window.hide_window if koyomi_window.hidden != hidden
end
end
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_start start
def start
bmsp_koyomisystem_start
bmsp_koyomisystem_create_koyomi_window if BMSP::KoyomiSystem::MENU_WINDOW
end
#--------------------------------------------------------------------------
# ● 暦ウィンドウの作成
#--------------------------------------------------------------------------
def bmsp_koyomisystem_create_koyomi_window
@bmsp_koyomi_window = BMSP::KoyomiSystem::Window_MenuKoyomi.new
@bmsp_koyomi_window.x = 0
@bmsp_koyomi_window.y = Graphics.height - @gold_window.height - @bmsp_koyomi_window.height
if BMSP.check_script(:EXPDistribution, 1.00) && BMSP::EXPDistribution::EXP_WINDOW
@bmsp_koyomi_window.y -= @bmsp_koyomi_window.fitting_height(1)
end
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_create_all_windows create_all_windows
def create_all_windows
bmsp_koyomisystem_create_all_windows
bmsp_koyomisystem_create_koyomi_window
end
#--------------------------------------------------------------------------
# ● 暦ウィンドウの作成
#--------------------------------------------------------------------------
def bmsp_koyomisystem_create_koyomi_window
@bmsp_koyomi_window = BMSP::KoyomiSystem::Window_MapKoyomi.new
end
#--------------------------------------------------------------------------
# ● 場所移動前の処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_pre_transfer pre_transfer
def pre_transfer
@bmsp_koyomi_window.close
bmsp_koyomisystem_pre_transfer
bmsp_koyomisystem_move_time_pass
end
#--------------------------------------------------------------------------
# ● 場所移動後の処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_post_transfer post_transfer
def post_transfer
@bmsp_koyomi_window.open unless BMSP::KoyomiSystem::MAP_WINDOW_FADE
bmsp_koyomisystem_post_transfer
@bmsp_koyomi_window.open if BMSP::KoyomiSystem::MAP_WINDOW_FADE
end
#--------------------------------------------------------------------------
# ● 場所移動による時間経過
#--------------------------------------------------------------------------
def bmsp_koyomisystem_move_time_pass
$game_koyomi.move_time_pass
end
end
#==============================================================================
# ■ BMSP::KoyomiSystem::Window_MenuKoyomi
#==============================================================================
class BMSP::KoyomiSystem::Window_MenuKoyomi < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
line_number = BMSP::KoyomiSystem::MENU_WINDOW_FORMAT.size
super(0, 0, window_width, fitting_height(line_number))
@time = $game_koyomi.to_i
@formats = BMSP::KoyomiSystem::MENU_WINDOW_FORMAT
refresh
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
refresh if redraw?
end
#--------------------------------------------------------------------------
# ● 再描画するか
#--------------------------------------------------------------------------
def redraw?
if $game_koyomi.to_i != @time
@time = $game_koyomi.to_i
return true
end
false
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_background(contents.rect)
rect = contents.rect
rect.height = line_height
rect.y = 0
@formats.each do |format|
draw_text(rect, $game_koyomi.strftime(format), 1)
rect.y += line_height
end
end
#--------------------------------------------------------------------------
# ● 背景の描画
#--------------------------------------------------------------------------
def draw_background(rect)
end
end
#==============================================================================
# ■ BMSP::KoyomiSystem::Window_MapKoyomi
#==============================================================================
class BMSP::KoyomiSystem::Window_MapKoyomi < BMSP::KoyomiSystem::Window_MenuKoyomi
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :hidden
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
line_number = BMSP::KoyomiSystem::MAP_WINDOW_FORMAT.size
x= Graphics.width - window_width
move(x, 0, window_width, fitting_height(line_number))
self.opacity = 0
if BMSP::KoyomiSystem::MAP_WINDOW_FADE || !$game_map.koyomi_display
self.contents_opacity = 0
end
@show_count = BMSP::KoyomiSystem::MAP_WINDOW_FADE ? 0 : 1
@time = $game_koyomi.to_i
@formats = BMSP::KoyomiSystem::MAP_WINDOW_FORMAT
@hidden = false
open
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 320
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @show_count > 0 && BMSP::KoyomiSystem::MAP_WINDOW_FADE
if $game_map.koyomi_display || self.contents_opacity != 0
update_fadein
@show_count -= 1
end
elsif @show_count == 0
update_fadeout
elsif $game_map.koyomi_display && !BMSP::KoyomiSystem::MAP_WINDOW_FADE
if $game_koyomi.hide_map_window
hide_window if Input.trigger?(BMSP::KoyomiSystem::HIDE_KEY)
else # 一時消去中にウインドウの消去が禁止になった場合は表示する
hide_window if @hidden
end
if @show_count > 1
@hidden ? update_fadeout : update_fadein
@show_count -= 1
end
end
end
#--------------------------------------------------------------------------
# ● フェードインの更新
#--------------------------------------------------------------------------
def update_fadein
self.contents_opacity += 16
end
#--------------------------------------------------------------------------
# ● フェードアウトの更新
#--------------------------------------------------------------------------
def update_fadeout
self.contents_opacity -= 16
end
#--------------------------------------------------------------------------
# ● ウインドウの一時消去切り替え
#--------------------------------------------------------------------------
def hide_window
@hidden = !@hidden
@show_count = 17
end
#--------------------------------------------------------------------------
# ● ウィンドウを開く
#--------------------------------------------------------------------------
def open
refresh
if $game_map.map.bmsp_koyomisystem_display_koyomi_on_map?
if !$game_map.koyomi_display
@show_count = 0
self.contents_opacity = 0
elsif BMSP::KoyomiSystem::MAP_WINDOW_FADE
@show_count = 150
self.contents_opacity = 0
else
if @hidden # 一時消去中
@show_count = 1
self.contents_opacity = 0
else
@show_count = 1
self.contents_opacity = 255
end
end
else
@show_count = 0
self.contents_opacity = 0
end
self
end
#--------------------------------------------------------------------------
# ● ウィンドウを閉じる
#--------------------------------------------------------------------------
def close
@show_count = 0 if BMSP::KoyomiSystem::MAP_WINDOW_FADE
self
end
#--------------------------------------------------------------------------
# ● 背景の描画
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# ● 背景色 1 の取得
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 192)
end
#--------------------------------------------------------------------------
# ● 背景色 2 の取得
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 0)
end
end
#==============================================================================
# ■ Game_Screen
#==============================================================================
class Game_Screen
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :tone_target
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_update update
def update
bmsp_koyomisystem_update
bmsp_koyomisystem_update_koyomi
end
#--------------------------------------------------------------------------
# ● 暦の更新
#--------------------------------------------------------------------------
def bmsp_koyomisystem_update_koyomi
$game_koyomi.update(self)
end
end
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
def setup(troop_id)
clear
@troop_id = troop_id
@enemies = []
troop.members.each do |member|
next unless $data_enemies[member.enemy_id]
enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
enemy.hide if member.hidden
enemy.screen_x = member.x
enemy.screen_y = member.y
@enemies.push(enemy)
end
init_screen_tone
make_unique_names
end
#--------------------------------------------------------------------------
# ● 画面の色調を初期化
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_init_screen_tone init_screen_tone
def init_screen_tone
bmsp_koyomisystem_init_screen_tone
bmsp_koyomisystem_battle_start_time_pass
bmsp_koyomisystem_fix_tone_on_battle
end
#--------------------------------------------------------------------------
# ● 戦闘開始による時間経過
#--------------------------------------------------------------------------
def bmsp_koyomisystem_battle_start_time_pass
$game_koyomi.battle_start_time_pass
return if !@auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
tone,duration = $game_koyomi.get_match_tone
$game_troop.screen.start_tone_change(tone, 0)
end
#--------------------------------------------------------------------------
# ● バトル中の色調固定
#--------------------------------------------------------------------------
def bmsp_koyomisystem_fix_tone_on_battle
return unless $game_koyomi.fix_tone_on_battle
$game_troop.screen.start_tone_change(Tone.new(0,0,0,0), 0)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
alias bmsp_koyomisystem_terminate terminate
def terminate
bmsp_koyomisystem_terminate
bmsp_koyomisystem_battle_end_time_pass
end
#--------------------------------------------------------------------------
# ● 戦闘終了による時間経過
#--------------------------------------------------------------------------
def bmsp_koyomisystem_battle_end_time_pass
$game_koyomi.battle_end_time_pass
return if !$game_koyomi.auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
tone,duration = $game_koyomi.get_match_tone
$game_map.screen.start_tone_change(tone, 0)
end
end
[/pre]
状态感染
[pre lang="ruby"]#==============================================================================
#
# ¥ Yami Engine Symphony - Infective State
# -- Last Updated: 2012.12.14
# -- Level: Easy
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YES-InfectiveState"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.12.14 - Finished Script.
# 2012.12.12 - Started Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides infect feature for specific states.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the state notebox in the database.
# -----------------------------------------------------------------------------
# <infect allies x: y, z%>
# Infects all allies with state x after y turns with a chance of z%.
#
# <infect enemies x: y, z%>
# Infects all enemies with state x after y turns with a chance of z%.
#
# <infect n allies x: y, z%>
# Infects n allies with state x after y turns with a chance of z%.
#
# <infect n enemies x: y, z%>
# Infects n enemies with state x after y turns with a chance of z%.
#
#==============================================================================
# ¥ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjustments.
#
#==============================================================================
#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ¡ Regular Expression
#==============================================================================
module REGEXP
module INFECTIVE_STATE
INFECT_ALLY = /<(?:INFECT ALLIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
INFECT_ENEMY = /<(?:INFECT ENEMIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
INFECT_X_ALLY = /<(?:INFECT[ ](\d+)[ ]ALLIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
INFECT_X_ENEMY = /<(?:INFECT[ ](\d+)[ ]ENEMIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
end # INFECTIVE_STATE
end # REGEXP
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_infective_state load_database; end
def self.load_database
load_database_infective_state
initialize_infective_state
end
#--------------------------------------------------------------------------
# new method: initialize_infective_state
#--------------------------------------------------------------------------
def self.initialize_infective_state
groups = [$data_states]
groups.each { |group|
group.each { |obj|
next if obj.nil?
obj.initialize_infective_state
}
}
end
end # DataManager
#==============================================================================
# ¡ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :infect_allies
attr_accessor :infect_enemies
#--------------------------------------------------------------------------
# new method: initialize_infective_state
#--------------------------------------------------------------------------
def initialize_infective_state
@infect_allies = {}
@infect_enemies = {}
self.note.split(/[\r\n]+/).each { |line|
case line
when REGEXP::INFECTIVE_STATE::INFECT_ALLY
array = [0, $2.to_i, $3.to_i]
array[2] = 100 if array[2] <= 0
@infect_allies[$1.to_i] = array if array[1] > 0
when REGEXP::INFECTIVE_STATE::INFECT_ENEMY
array = [0, $2.to_i, $3.to_i]
array[2] = 100 if array[2] <= 0
@infect_enemies[$1.to_i] = array if array[1] > 0
when REGEXP::INFECTIVE_STATE::INFECT_X_ALLY
array = [$1.to_i, $3.to_i, $4.to_i]
array[2] = 100 if array[2] <= 0
@infect_allies[$2.to_i] = array if array[1] > 0
when REGEXP::INFECTIVE_STATE::INFECT_X_ENEMY
array = [$1.to_i, $3.to_i, $4.to_i]
array[2] = 100 if array[2] <= 0
@infect_enemies[$2.to_i] = array if array[1] > 0
end
}
end
end # RPG::BaseItem
#==============================================================================
# ¡ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# new method: infective_states
#--------------------------------------------------------------------------
def infective_states
states.select { |state|
state.infect_allies.size + state.infect_enemies.size > 0
}
end
#--------------------------------------------------------------------------
# new method: infective_allies
#--------------------------------------------------------------------------
def infective_allies
states.select { |state|
state.infect_allies.size > 0
}
end
#--------------------------------------------------------------------------
# new method: infective_enemies
#--------------------------------------------------------------------------
def infective_enemies
states.select { |state|
state.infect_enemies.size > 0
}
end
#--------------------------------------------------------------------------
# new method: infect_allies_include?
#--------------------------------------------------------------------------
def infect_allies_include?(id)
infective_allies.any? { |state| state.infect_allies.keys.include?(id) }
end
#--------------------------------------------------------------------------
# new method: infect_enemies_include?
#--------------------------------------------------------------------------
def infect_enemies_include?(id)
infective_enemies.any? { |state| state.infect_enemies.keys.include?(id) }
end
#--------------------------------------------------------------------------
# new method: infective_calc
#--------------------------------------------------------------------------
def update_infective
@infect_allies ||= {}
@infect_enemies ||= {}
#---
infective_allies.each { |state|
state.infect_allies.each { |id, hash|
@infect_allies[id] = hash[1] if @infect_allies[id].nil? || @infect_allies[id] <= 0
@infect_allies[id] -= 1
}
}
#---
infective_enemies.each { |state|
state.infect_enemies.each { |id, hash|
@infect_enemies[id] = hash[1] if @infect_enemies[id].nil? || @infect_enemies[id] <= 0
@infect_enemies[id] -= 1
}
}
#---
infective_allies.each { |state|
state.infect_allies.each { |id, hash|
next if @infect_allies[id] > 0
if self.actor?
battlers = $game_party.battle_members
else
battlers = $game_troop.members
end
if hash[0] <= 0
if rand(100) < hash[2]
battlers.each { |battler| battler.add_state(id) }
end
else
count = hash[0]
battlers = battlers.shuffle
battlers.each { |battler|
if battler && battler.alive? && !battler.state?(id)
if rand(100) > hash[2]
battler.add_state(id)
count -= 1
end
end
break if count <= 0
}
end
}
}
#---
infective_enemies.each { |state|
state.infect_enemies.each { |id, hash|
next if @infect_enemies[id] > 0
next if rand(100) > hash[2]
if self.actor?
battlers = $game_troop.members
else
battlers = $game_party.battle_members
end
if hash[0] <= 0
if rand(100) < hash[2]
battlers.each { |battler| battler.add_state(id) }
end
else
count = hash[0]
battlers = battlers.shuffle
battlers.each { |battler|
if battler && battler.alive? && !battler.state?(id)
if rand(100) > hash[2]
battler.add_state(id)
count -= 1
end
end
break if count <= 0
}
end
}
}
end
#--------------------------------------------------------------------------
# new method: infective_clear
#--------------------------------------------------------------------------
def infective_clear
@infect_allies.each_key { |id|
@infect_allies[id] = nil unless infect_allies_include?(id)
}
#---
@infect_enemies.each_key { |id|
@infect_enemies[id] = nil unless infect_enemies_include?(id)
}
end
#--------------------------------------------------------------------------
# alias method: on_turn_end
#--------------------------------------------------------------------------
alias yes_infect_state_on_turn_end on_turn_end
def on_turn_end
yes_infect_state_on_turn_end
update_infective
infective_clear
end
end # Game_Battler
#==============================================================================
#
# ¥ End of File
#
#==============================================================================[/pre]
临死技(仅敌人有效)
[pre lang="ruby"]=begin
RGSS3
★ 断末魔 ★
戦闘不能になる直前に指定のスキルを発動するエネミーを作れます。
● 仕様 ●==========================================================
断末魔を発動したエネミーは、
自身を断末魔スキルの効果対象にすることはできません。
====================================================================
● 使い方 ●========================================================
エネミーのメモ欄に「临死技:n」と記述してください。
nには断末魔として発動させるスキルIDを指定してください。
====================================================================
ver1.00
Last Update : 2015/05/13
5/13 : RGSS2にあったものを移植
ろかん http://kaisou-ryouiki.sakura.ne.jp/
=end
$rsi ||= {}
$rsi["临死技"] = true
class RPG::Enemy < RPG::BaseItem
def death_throes_id
unless @death_throes_id
@death_throes_id = 0
self.note.each_line{|line|
if line =~ /临死技:(\d+)/i
@death_throes_id = $1.to_i
break
end
}
end
@death_throes_id
end
end
class << BattleManager
#--------------------------------------------------------------------------
# ● ターン終了
#--------------------------------------------------------------------------
alias death_throes_turn_end turn_end
def turn_end
death_throes_turn_end if @phase
end
end
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● 断末魔をあげるバトラーであるか
#--------------------------------------------------------------------------
def death_throes?
false
end
end
class Game_Action
#--------------------------------------------------------------------------
# ● 断末魔のターゲットの配列作成
#--------------------------------------------------------------------------
def make_targets_with_death_throes
if item.for_opponent?
targets_for_opponents
elsif item.for_friend?
targets_for_friends_with_death_throes
else
[]
end
end
#--------------------------------------------------------------------------
# ● 味方に対するターゲット
#--------------------------------------------------------------------------
def targets_for_friends_with_death_throes
if item.for_user?
[]
elsif item.for_dead_friend?
if item.for_one?
[friends_unit.smooth_dead_target(@target_index)]
else
friends_unit.dead_members
end
elsif item.for_friend?
result = friends_unit.alive_members
result.delete(@subject)
if item.for_one?
result.empty? ? [] : [result.sample]
else
result
end
end
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :gave_death_throes
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias death_throes_initialize initialize
def initialize(index, enemy_id)
death_throes_initialize(index, enemy_id)
@gave_death_throes = false # 既に断末魔をあげたかの判断に利用
end
#--------------------------------------------------------------------------
# ● 断末魔をあげるバトラーであるか
#--------------------------------------------------------------------------
def death_throes?
@result.added_states.include?(death_state_id) && !death_throes_id.zero? && !@gave_death_throes
end
#--------------------------------------------------------------------------
# ● 断末魔で発動するスキルID
#--------------------------------------------------------------------------
def death_throes_id
enemy.death_throes_id
end
#--------------------------------------------------------------------------
# ● 戦闘不能から復活
#--------------------------------------------------------------------------
def revive
super
@gave_death_throes = false
end
#--------------------------------------------------------------------------
# ● 戦闘不能判定
#--------------------------------------------------------------------------
def dead?
(!death_throes_id.zero? && !@gave_death_throes) ? false : super
end
#--------------------------------------------------------------------------
# ● 生存判定
#--------------------------------------------------------------------------
def alive?
(!death_throes_id.zero? && !@gave_death_throes) ? true : super
end
#--------------------------------------------------------------------------
# ● 断末魔行動の作成
#--------------------------------------------------------------------------
def make_death_throes_actions
clear_actions
action = Game_Action.new(self, true)
action.set_skill(death_throes_id)
@actions.push(action)
end
end
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# ● 断末魔用メソッドの設定
#--------------------------------------------------------------------------
def method_death_throes=(method)
@method_death_throes = method
end
#--------------------------------------------------------------------------
# ● 影響を受けたステータスの表示
#--------------------------------------------------------------------------
alias death_throes_display_affected_status display_affected_status
def display_affected_status(target, item)
if target.death_throes?
wait_and_clear
last_added_states = target.result.added_states.dup
@method_death_throes.call(target)
target.result.added_states = last_added_states
death_throes_display_affected_status(target, item)
wait_and_clear
BattleManager.judge_win_loss
else
death_throes_display_affected_status(target, item)
end
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● ログウィンドウの作成
#--------------------------------------------------------------------------
alias death_throes_create_log_window create_log_window
def create_log_window
death_throes_create_log_window
@log_window.method_death_throes = method(:process_death_throes)
end
#--------------------------------------------------------------------------
# ● 断末魔の処理
#--------------------------------------------------------------------------
def process_death_throes(user)
last_subject = @subject
@subject = user
@subject.make_death_throes_actions
targets = @subject.current_action.make_targets_with_death_throes.compact
unless targets.empty?
if @subject.current_action
@status_window.open
use_death_throes(targets)
@subject.remove_current_action
process_action_end
end
end
@subject.gave_death_throes = true
@subject = last_subject
update_for_wait
end
#--------------------------------------------------------------------------
# ● 断末魔の使用
#--------------------------------------------------------------------------
def use_death_throes(targets)
@subject.sprite_effect_type = :whiten
item = @subject.current_action.item
@log_window.display_use_item(@subject, item)
@subject.use_item(item)
refresh_status
show_animation(targets, item.animation_id)
targets.each {|target| item.repeats.times { invoke_item(target, item) } }
@log_window.wait_and_clear
end
end[/pre]
随即出售商品
[pre lang="ruby"]=begin
說明:
事件中執行腳本呼叫隨機物品商店
random_shop(group, number)
例:隨機出售組:A中的三件商品: random_shop(:A, 3)
打折出售
random_shop(group, number, disount)
例:8折出售商品: random_shop(:B, 4, 0.8)
不讓玩家出售物品
random_shop(group, number, discount, purchase_only)
例(須設定折扣):random_shop(:C, 20, 1, 1)
=end
class Game_Interpreter
Random_Goods = { #在這裡定義你的商品列表
:A => [:i1],
:时空商人 => [:i1_29, :i154],
:时空商人2 => [:i1_29, :i154],
:时空商人3 => [:i1_29, :i97, :i154],
:时空商人4 => [:i1_29, :i64_i68, :i154],
:时空商人5 => [:i1_29, :i154],
:时空商人6 => [:i1_29, :i109, :i154],
:时空商人7 => [:i1_29],
:时空商人8 => [:i1_29, :i86, :i154],
:时空商人9 => [:i1_29, :i154],
:时空商人10 => [:i1_29, :i104, :i154],
:时空商人11 => [:i1_29, :i71, :i154],
:时空商人12 => [:i1_29, :i72, :i154],
:时空商人13 => [:i1_29, :i130_i132, :i154],
:时空商人14 => [:i1_29, :i154],
:时空商人15 => [:i1_29, :i82, :i154],
:神器商人 => [:w71_75],
:C => [:w1_60]#i物品,w武器,每個組用逗號隔開
}
# 設置變數號碼,當變數改變后商人才會更新商品
# 設置為 nil 的話,每次跟商人對話商品都會更新
Goods_Change_Var = 86
#
def random_shop(group, num, discount = 1, purchase_only = false)
return if $game_party.in_battle
goods = []
Random_Goods[group].each {|g|
g = g.to_s
type = g[0]=="i" ? 0 : g[0]=="w" ? 1 : 2
if g.include?("_")
a, b = g.scan(/\d+/)
for i in a.to_i..b.to_i
begin
goods.push(random_goods_info(discount, type, i))
rescue
report_random_goods_crash(group, g)
return
end
end
else
g =~ /(\d+)/
begin
goods.push(random_goods_info(discount, type, $1.to_i))
rescue
report_random_goods_crash(group, g)
return
end
end
}
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(new_random_goods(goods, num), purchase_only)
Fiber.yield
end
#
def new_random_goods(goods, num)
return unless event = get_character(0)
if Goods_Change_Var
key = [@map_id, @event_id, :random_goods]
var = $game_variables[Goods_Change_Var]
unless $game_self_switches.get_value(key) &&
$game_self_switches.get_value(key)[0] == var
goods = goods.sample(num).sort
$game_self_switches.set_without_refresh(key, [var, goods])
return goods
else
return $game_self_switches.get_value(key)[1]
end
else
return goods.sample(num).sort
end
end
#
def random_goods_info(discount, type, i)
discount == 1 ?
[type, i, 0, which_random_goods(type).price] :
[type, i, 1, (which_random_goods(type).price * discount).round]
end
def which_random_goods(type)
case type
when 0; $data_items
when 1; $data_weapons
when 2; $data_armors
end
end
#
def report_random_goods_crash(group, g)
msgbox("隨機商店發生錯誤:Group :#{group} Element :#{g}") if $TEST
end
end
class Game_SelfSwitches
def set_without_refresh(key, value)
@data[key] = value
end
def get_value(key)
@data[key]
end
end
[/pre]
随机礼物(两个随机在图书馆有)
[pre lang="ruby"]=begin
說明:
事件中執行腳本呼叫來獲取隨機物品
random_gift(group, number)
例:隨機獲得組:A中的三件物品: random_gift(:A, 3)
=end
class Game_Interpreter
Random_Gifts = { #隨機獎品列表
:恢复 => [:i1_8], #i物品,w武器,每個組用逗號隔開
:符文 => [:i9_16],
:升阶 => [:i17_19],
:宝珠 => [:i22_29],
:终焉宝珠 => [:i140_144],
:攻击神器 => [:w71_75],
:防御神器 => [:a82_89],
:时空之光 => [:a108_116],
:点数 => [:i137_139],
:低级素材 => [:i1_8, :i20, :i21, :i35_37, :i17_19],
:中级素材 => [:i9_16, :i38, :i39, :i119, :i132],
:高级素材 => [:i114, :i103, :i70_72, :i56, :i45,:i22_29],
:奖池普 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29],
:王者 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29,:i172_180,:i140_144],
:礼装 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29,:a118_131],
:谱尼 => [:i130_132, :i119,:i144,:i70_72,:i53,:i46],
:票 => [:i1_8, :i17_19],
:券 => [:i1_8, :i17_19, :i9_16, :i22_29, :i137_139],
:药水 => [:i47, :i48, :i53_i56, :i84, :i85, :i78, :i133_i135, :i1_i8],
:各种礼包 => [:i145_152, :i154, :i155, :i157],
:末日 => [:i3, :i5, :i6, :i30, :i31, :i36, :i37, :i17_19, :i119, :i152],
:C => [:w1_60]
}
# 設置開關號碼,當開關開啟時一定會獲取到不同的幾件物品
# 設置為 nil 的話則總是有可能獲取到相同的物品
Diff_Gift_Swth = nil
def display_gift_text(name)
$game_message.add("获得:" + name)
end
#
def random_gift(group, num)
gifts = []
Random_Gifts[group].each {|g|
g = g.to_s
type = g[0]=="i" ? 0 : g[0]=="w" ? 1 : 2
if g.include?("_")
a, b = g.scan(/\d+/)
for i in a.to_i..b.to_i
gift = which_random_gift(type)
gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
end
else
g =~ /(\d+)/
gift = which_random_gift(type)[$1.to_i]
gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
end
}
wait_for_message
if Diff_Gift_Swth && $game_switches[Diff_Gift_Swth]
gifts.sample(num).each {|g|
$game_party.gain_item(g, 1)
display_gift_text(g.name)
}
else
num.times {
g = gifts[rand(gifts.size)]
$game_party.gain_item(g, 1)
display_gift_text(g.name)
}
end
$game_message.face_name = ''
$game_message.face_index = 0
$game_message.background = 0
$game_message.position = 2
wait_for_message
end
#
def which_random_gift(type)
case type
when 0; $data_items
when 1; $data_weapons
when 2; $data_armors
end
end
#
def report_random_gifts_crash(group, g)
msgbox("隨機禮物發生錯誤:Group :#{group} Element :#{g}") if $TEST
end
end
[/pre]
新套装系统(6RVA帖应该功能最全了)
[pre lang="ruby"]#============================================================================
# Equipment Sets v2.1e
# By Emerald
#----------------------------------------------------------------------------
# You're free to use the script for any game, as long as you give credits
#----------------------------------------------------------------------------
# Version History
# 1.0 -> Script fully ready for public use. Addes sets, unlimited set items,
# set bonuses for the 8 basic stats, set bonuses requirement (how many
# items of the set is the actor wearing?)
# 1.1 -> a. changed the set bonuses work. Instead of [parameter, bonus] you now
# use [sort, parameter, bonus]. Also added sorts 0 and 2. Check SPECIAL
# VALUES for their corresponding parameters.
# b. Added sort 1: Standard Parameters (Percentage). The corresponding
# parameters are the same as for sort 0. See SPECIAL VALUES for extra
# notes.
# 1.2 -> Added Sort 3: Special Parameters. The values for the parameters can be
# found in SPECIAL VALUES, just as usual. Addes Sort 4: Skills!! These
# use a different syntax than the other bonuses, so be sure to check
# SPECIAL VALUES if you are unfamiliar with them.
# 1.3 -> a. rewritten most of the code to remove so major bugs. Also cleaned
# code (about 140 lines less this time, WITH 4 added Sorts). Added
# Module Emerald (EME). Sets and Set_Bonuses move to Module EME. Added
# MAX_ELEMENTS to Module EME. Added Sort 5 (Elemental Efficiency), Sort
# 6 (Debuff Rate), Sort 7 (State Rate), Sort 8 (State Resist) and Sort 9
# (Attack Elements). See SPECIAL VALUES for instructions.
# WARNING these are still in Beta Stage, so report all bugs found.
# b. removed many, MANY major bugs! Removed a bug where unequipping
# resulted in an undefined array, removed some typos, fixed the bonuses
# for almost EVERY Sort, removed some more typos, shortened code a little
# bit, removed some more minor bugs regarding change_equip.
# 1.4 -> More bug fixes. Also added Sort 10 (Attack States), Sort 11 (Equipment
# Types) and Sort 12 (Attack Specials). Refer to SPECIAL VALUES for
# all needed information.
# 1.5 -> Bug fix to discard_equip(...). Added the foruth value of Sort 11
# (Dual Wielding), added Sort 13, Sort 14, Sort 15, Sort 16 and Sort 17
# which are Additional Skill Types, Sealed Skill Types, Sealed Skills,
# Fixed Equip Types and Sealed Equip Types respectively. As usual, go to
# SPECIAL VALUES for the needed instructions.
# 1.6 -> Added a compatibility patch for Fomar's Dual Wield -> Free Hands script.
# 1.7 -> Added Sorts 18 (special flags), 19 (party abilities) and 20 (other
# traits). See SPECIAL VALUES for the instructions.
# 1.8a-> Added sounds to be played when a certain amount of set pieces has been
# equipped. Also removed a bug regarding skipping amounts of pieces.
# 1.8b-> Small bugfix regarding set sounds.
# 1.8c-> Small bugfix regarding attack states.
#
# 2.0 -> MAJOR REWRITE. Aliased a few more methods than before, to further
# increases compatability. Added a method which initializes sets which
# are worn by actors at the start of the game. Halved the code used to
# determine if items belong to sets. Scraped a few uneccessairy methods.
# Practically removed 2/3 of my version of release_unequipable_equips,
# and made the EES + Fomar123's Dual Wield -> Free Hands script patch
# 1 line instead of 10. Almost entirely changed the way Set Skills and
# Set Equipment Options work. Also fixed a few bugs in the progress
# (for example additions of variable 2 which I accidentally left in the
# script.)
# 2.1a-> Start of the debugging patch. Added a function to remove bonuses when
# unequipping stuff, like usual. Forgot to re-add in 2.0 >.<
# 2.1b-> Fixed a small typo.
# 2.1c-> Fixed initalizition of set equips.
# 2.1d-> Fixed a bug regarding bonuses not being applied upon optimizing equips
# and a bug regarding the removing of bonuses when unequipping stuff.
# 2.1e-> Removed something which I should have added (regarding the BaseItem
# class) in release_unequippable_items. This also fixed the compatibility
# issues with Tsukihime's Effect Manager.
#----------------------------------------------------------------------------
# Started with a Iron Sword? Pretty good. Found a Gold Sword? Awesome! Found
# the complete Bronze Set? Bad stuff...
# Unless, they give you bonuses! In other words, this script allows you to create
# bonuses for wearing multiple items of a set... Just wanted to make it sound
# more fun...
#
# Instructions:
#
# Just as always, put this script between Бе Materials and Бе Main. Put this script
# below any script which rewrites change_equip and above any script which aliases
# 'param' in Game_Actor (usually in Game_BattlerBase, but it only matters if it
# is rewritten/aliased in Game_Actor).
#
# Set MAX_ELEMENTS below module EME and above Sets to the maximum number of
# elements in the database. Else, the script won't recognize any above the value.
#
#
# SETS
#
# To create sets (sorry, no names yet) go to Sets in the configuration part.
# Add the set id, followed by an array containing arrays. The latter arrays
# must be at least two elements long, one for the type of equipment, one for the
# id.
# Examples:
#
# 1 => [[0, 1], [1, 2]], <- The []'s define an array. The arrays like the [0,1]
# and [1, 2] should be at least two elements long (each element is separated by
# a comma.
#
# 2 => [[0, 5], [0, 6], [1, 5], [1,7]], <- If the array is not the last in the
# list, add a comma or you'll get an error. This goes for every array.
#
# set id => [[equipment type, equipment id], [equipment type, equipment id]]
#
# NOTE:
# The set id MUST be 0 or higher. The variable in which the sets are stored (which
# is called a hash) usually begins with 1 =>, so that's why that's also in the
# standard config.
# The Equipment Types are 0 (weapons) and 1 (armors.)
# DO NOT COPY the ID of items in the database. If you put all the useless 0's
# in front of the real ID, you'll get an error/the script won't work.
# Furthermore, you can have an infinite amount of equipment belonging (is that a
# word?) to a set, so don't worry about compatibility issues with Extra Equipment
# Slots scripts. Unless they rewrite change_equip, than there's a slight chance
# on problems. This can be fixed, however, by putting this script below any
# script which rewrites change_equip.
# Also, you can have multiple weapons in array and the same equipment in different
# sets.
#
#
# SET BONUSES
#
# For set bonuses, go to Set_Bonuses. Use the follwing syntax to add bonuses:
#
# set id => {
# amount of pieces required => [[sort, parameter, bonus]]
# },
#
# Specifications:
# set id = the same set id as in Sets.
#
# amount of pieces required = the amount of pieces the player must be wearing in
# order to receive the bonuses. If you want to skip one, just skip it. Like:
# 1 => blablabla
# 3 => blablabla
#
# sort = type of bonus. For all sorts, see SPECIAL VALUES.
#
# parameter = the parameter which receives the bonus. For all parameters, see
# SPECIAL VALUES.
#
# bonus = the bonus to be added to parameter. Note that this is a direct bonus,
# not a percentage. If the vale is negative, the bonus will become negative. If
# the value is 0, there will be no bonus to that stat.
#
#
# SPECIAL VALUES
# Sets
# ----
# Equipment types: 0 and 1. 0 is the Weapons tab in the database, 1 is the
# Armors tab in the database.
#
# Set_Bonuses
# ---
# Sorts:
# 0 - Standard Parameter
# 1 - Standard Parameter (Percentage)
# 2 - Extra Parameter
# 3 - Special Paramater
# 4 - Skills (WARNING, DIFFERENT SYNTAX!! See Skills on how to use them)
# 5 - Elemental Efficiency
# 6 - Debuff Rate
# 7 - State Rate
# 8 - State Resistance (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 9 - Attack Elements (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 10 - Attack States
# 11 - Equipment Types (WARNING, DIFFERENT SYNTAX!! See Equipment Types on how
# to use them)
# 12 - Attack Specials
# 13 - Additional Skill Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 14 - Sealed Skill Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 15 - Sealed Skills (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 16 - Fixed Equip Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 17 - Sealed Equip Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 18 - Special Flags (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 19 - Party Abilities (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
# 20 - Other Traits
#
# Standard Parameters: (Sort 0)
# 0 - MaxHp
# 1 - MaxMp
# 2 - Attack
# 3 - Defense
# 4 - Magic Attack (Spirit)
# 5 - Magic Defence (Resistance)
# 6 - Agility
# 7 - Luck
#
# Standard Parameters (Percentage): (Sort 1)
# 0 - MaxHp
# 1 - MaxMp
# 2 - Attack
# 3 - Defense
# 4 - Magic Attack (Spirit)
# 5 - Magic Defence (Resistance)
# 6 - Agility
# 7 - Luck
# Note that stats are calculated this way:
# Basic + Equipment Bonuses + Set Bonuses (normal) + Set Bonuses (percentages,
# equal to bonus% (in [1, parameter, bonus]) * basic + equipment bonuses)
#
# Extra Parameters: (Sort 2)
# 0 - Hit Rate
# 1 - Evasion
# 2 - Critical Rate
# 3 - Critical Evasion
# 4 - Magical Evasion
# 5 - Magical Reflection
# 6 - Counter Rate
# 7 - HP Regen
# 8 - MP Regen
# 9 - TP Regen
#
# Special Parameters: (Sort 3)
# 0 - Target Rate/ Accuracy Rate(in Eng Translation Patch)/ Aggro Rate
# 1 - Guard Effect Rate
# 2 - Recovery Effect Rate
# 3 - Pharmacology/ Knowledge in Medicine(in Eng Translation Patch)
# 4 - MP Cost Rate
# 5 - TP Charge Rate
# 6 - Physical Damage Rate
# 7 - Magical Damage Rate
# 8 - Floor Damage Rate
# 9 - Experience Rate
#
# Skills: (Sort 4)
# These skills don't have parameter values. Instead, the last two elements in
# their array have a different effect than usual:
# [sort (4), -----, skill_id]
# Sort = still the same and of course 4
# ----- = before this was Active, but that is no longer required. In order to
# by-pass the need to change this to skill_id (for people who had this script
# before v2.0), this variable has become unused instead of deleted all-together.
# You can put anything you want here, it doesn't even have to be an integer.
# Skill_Id = the id of the skill which the actor learns.
#
# Elemental Efficiency: (Sort 5)
# Values are the same as Element IDs in the database. (SO NO 0!!)
# If the bonus is negative, the actor becomes more resistant to the element.
# If the bonus is positive, the actor becomes weaker to the element.
#
# Debuff Rate: (Sort 6)
# 0 - MaxHp
# 1 - MaxMp
# 2 - Attack
# 3 - Defense
# 4 - Magic Attack (Spirit)
# 5 - Magic Defence (Resistance)
# 6 - Agility
# 7 - Luck
# If the bonus is negative, the actor becomes more resistant to debuffs regarding
# the set parameter.
# If the bonus is positive, the actor becomes weaker to debuffs regarding the set
# parameter.
#
# State Rate: (Sort 7)
# Values are the same as the State IDs in the database (SO NO 0!!)
# If the bonus is negative, the actor becomes more resistant to the state.
# If the bonus is positive, the actor becomes weaker to the state.
#
# State Resist: (Sort 8)
# Values are the same as the State IDs in the database (SO NO 0!!)
# If the bonus is positive, the actor becomes fully resistant to the set state.
# However, if the bonus is negative, the actor LOSES full resistance to the set
# state!
#
# Attack Elements: (Sort 9)
# Values are the same as the Element IDs in the database (SO NO 0!!)
# If the bonus is positive, the element is added to the attack elements.
# However, if the bonus is negative, the element is REMOVED from the attack
# elements!
#
# Attack States: (Sort 10)
# Values are the same as the State IDs in the database (SO NO 0!!)
# Bonus is the chance of the state to occur.
#
# Equipment Types: (Sort 11)
# 0 as parameter means that the bonus type is a Weapon Type.
# 1 as parameter means that the bonus type is a Weapon Type, but instead it will
# be REMOVED from the list of weapon types.
# 2 as parameter means that the bonus type is an Armor Type.
# 3 as parameter means that the bonus type is an Armor Type, but instead it will
# be REMOVED from the list of armor types.
# 4 as parameter allows Dual Wielding.
# Bonus is the same as the ID of the Equipment Types in the database.
# Note that removed types override added types. So you can first remove an
# equip type and afterwards add it, but you can first add it and then remove it.
#
# Attack Specials: (Sort 12)
# 0 - Attack Speed
# 1 - Additional Attacks
# Both in percentages. So for additional attacks, not 1 but 100.
#
# Additional Skill Types: (Sort 13)
# Values are the same as the Skill Types IDs in the database (SO NO 0!!)
# If the bonus is positive, the skill types is added.
# However, if the bonus is negative, the skill type is REMOVED!
#
# Sealed Skill Types: (Sort 14)
# Exact the same as above, only if the bonus is positive the type gets sealed,
# if the bonus is negative the type gets removed from the sealed types.
#
# Sealed Skills: (Sort 15)
# Again, exact the same as above. Only this time, replace the skill type id by
# the skill id.
#
# Fixed Equip Types: (Sort 16)
# Exact the same as Sealed Skill Types, only the equip types get fixed. Of course,
# replace skill type id by equip type id.
#
# Sealed Equip Types: (Sort 17)
# And yet again, exact the same only the equip types get sealed. Of course,
# replace skill type id by equip type id.
#
# Special Flags: (Sort 18)
# 0 - Auto Combat
# 1 - Guard
# 2 - Substitute/Cover
# 3 - Same TP in next battle
# For bonus, put a positive number (or 0) for added trait, and negative number
# for removed trait.
#
# Party Abilities: (Sort 19)
# 0 - Encounter cut down by half
# 1 - No encounters
# 2 - No suprise attacks
# 3 - Preemptive strike rate up
# 4 - Double currency from battles
# 5 - Double items from battles
# For bonus, put a positive number (or 0) for added trait, and negative number
# for removed trait.
#
# Others Traits: (Sort 20)
# 0 - Max TP up by bonus
# 1 - Atk Skill becomes bonus (skill ID) / So, if you have [20, 1, 10] the actor's
# attack skill becomes 10.
# 2 - Guard Skill becomes bonus (skill ID) / So, if you have [20, 2, 10] the
# actor's guard skill becomes 10,
#----------------------------------------------------------------------------
# Credits to:
# Lettuce, if it wasn't for his RMVX Item Sets script, I would not have learned
# how Arrays and Hashes work.
# Many members at www.rpgmakervxace.net for pointing out various bugs and whatnot.
# You for reading through the wall of text ^^ (at least... I hope you did that..)
#----------------------------------------------------------------------------
# If you have any issues with this script, contact me at
# http://www.rpgmakervxace.net/ind ... lds-equipment-sets/
#============================================================================
#
# CONFIGURATION
#
#============================================================================
module EME
MAX_ELEMENTS = 999
#----------------------------------------------------------------------------
# Sets syntax
#----------------------------------------------------------------------------
# Sets = {
# set_id => [[equipment_type, equipment_id]]
# }
#
# set_id must be bigger than 0
# equipment_type can be either 0 (weapon) or 1 (armor)
# Add a comma after a ']' if it's not the last element in the array/hash.
#
# Don't forget to add a ungettable item at the end! Else, the last item will
# count for two!
#----------------------------------------------------------------------------
Sets = {
1 => [[0, 64], [1, 61]],
2 => [[0, 79], [1, 102], [1, 103], [1, 104]],
3 => [[0, 86], [1, 106], [1, 107], [1, 117]]
}
#----------------------------------------------------------------------------
# Sets syntax
#----------------------------------------------------------------------------
# Set_Bonuses = {
# set id => {
# amount of pieces required => [[sort, parameter, bonus]], [sort, random parameter, 0]]
# }
# }
#
# set_id must correspond to set_id of Sets
# amount of pieces required indicates how many pieces of the set the actor must
# be wearing before receiving the bonus. If you want to skip one, make the only
# element in it's array [0, 0, 0].
# sort indicates which kind of parameters the bonuses change. See SPECIAL VALUES
# for all sorts.
# parameter can be a value depending on sort. See SPECIAL VALUES in the
# instructions for their corresponding stats.
# Bonus is a direct value added to 'parameter'. If 0, no bonus is added. If
# negative, bonus becomes negative.
# Random paramter is just a random parameter to prevent the last bonus from
# being doubled. Always make the bonus of this element 0.
#
# Add a comma after a ']' or '}' if it's not the last element in the array/hash.
#
# Don't forget to add a bonus of [0, 0, 0] at the end! Or else, the last bonus
# will be doubled!
#----------------------------------------------------------------------------
Set_Bonuses =
{
1 => {
#~ 1 => [[2, 7, 5]],
1 => [4,269],
2 => [[0, 0, 200]]
},
3 => {
1 => [[0, 2, 120]],
2 => [[0, 4, 120]],
3 => [[1, 2, 15]],
4 => [[1, 4, 15]]
},
2 => {
1 => [[0, 2, 120]],
2 => [[2, 2, 10]],
3 => [[3, 5, 115]],
4 => [[1, 2, 25]],
}
}
#-----------------------------------------------------------------------------
# Sets syntax
#-----------------------------------------------------------------------------
# Set_Sounds = {
# set_id => {
# amount_of_pieces_required => [file_name, volume, pitch]
# }
# }
#
# Resembles the other two parts so I think not much of an explanation is needed.
# When the required amount of pieces has been equipped, the sound sound will be
# played. Doesn't apply for unequipping. Again, watch the comma's!!
#----------------------------------------------------------------------------
Set_Sounds =
{
1 => {
1 => ["Flash2", 100, 100], # <- comma here since it isn't the last one!
2 => ["Flash1", 100, 100], # <- no comma here since it IS the last one!
3 => ["Flash1", 100, 100] # <- no comma here since it IS the last one!
}
}
end
# Only edit things past here if you know what you're doing
$imported = {} if $imported.nil?
$imported["Emerald's Equipment Sets"] = true
#============================================================================
#
# Game_Actor
# Handles everything for this script.
#============================================================================
class Game_Actor < Game_Battler
attr_reader :active_sets
attr_reader :item_sets
alias eme_ees_setup setup
def setup(actor_id)
@non_set_skills = []
@skill_from_sets = false
reset_bonuses
@active_sets = []
@item_sets = [0] * (EME::Sets.size + 1)
eme_ees_setup(actor_id)
end
alias eme_init_equips init_equips
def init_equips(equips)
eme_init_equips(equips)
equips.each_with_index{|item_id, i|
etype_id = index_to_etype_id(i)
slot_id = empty_slot(etype_id)
for set_id in 1..EME::Sets.size
for ees_set_equip in EME::Sets[set_id]
if item_id != nil and slot_id != nil and ees_is_the_set_item?(etype_id == 0 ? $data_weapons[item_id] : $data_armors[item_id], ees_set_equip)
@item_sets[set_id] += 1
@active_sets.push(set_id) unless @active_sets.include?(set_id)
end
end
end
}
refresh
end
def ees_is_the_set_item?(item, ees_set_equip)
return (((ees_set_equip[0] == 0 and item.is_a?(RPG::Weapon)) or (ees_set_equip[0] == 1 and item.is_a?(RPG::Armor))) and ees_set_equip[1] == item.id)
end
alias eme_ees_learn_skill learn_skill
def learn_skill(skill_id)
eme_ees_learn_skill(skill_id)
@non_set_skills.push(skill_id) unless @skill_from_sets
@skill_from_sets = false
end
alias eme_ebs_change_equip change_equip
def change_equip(slot_id, item)
for set_id in 1..EME::Sets.size
for ees_set_equip in EME::Sets[set_id]
if slot_id != nil and @equips[slot_id] != nil and @equips[slot_id].object != nil
if ees_is_the_set_item?(@equips[slot_id].object, ees_set_equip)
@item_sets[set_id] -= 1
@active_sets.delete(set_id) if @item_sets[set_id] == 0
end
end
if item != nil and ees_is_the_set_item?(item, ees_set_equip)
@item_sets[set_id] += 1
@active_sets.push(set_id) unless @active_sets.include?(set_id)
if EME::Set_Sounds.has_key?(set_id) and EME::Set_Sounds[set_id].has_key?(set_amount_wearing(set_id))
sound = EME::Set_Sounds[set_id][set_amount_wearing(set_id)]
Audio.se_play("Audio/SE/" + sound[0], sound[1], sound[2])
end
end
end
end
set_check
eme_ebs_change_equip(slot_id, item)
end
def unlearn_set_skills(set_id)
EME::Set_Bonuses[set_id].each_value{|bonus_array|
bonus_array.each{|bonus|
if bonus[0] == 4
forget_skill(bonus[2]) unless @non_set_skills.include?(bonus[2])
@ees_skills.delete(bonus[2])
end
}
}
end
def item_set_reset_all
@active_sets.each{|set_id| item_set_reset(set_id)}
end
def item_set_reset(set_id)
return unless set_id > 0 and @item_sets[set_id] > 0
unlearn_set_skills(set_id)
end
def release_unequippable_items(item_gain = true)
@equips.each_with_index do |item, i|
if !equippable?(item.object) || item.object.etype_id != equip_slots
trade_item_with_party(nil, item.object) if item_gain
item.object = nil
end
end
end
def release_unequippable_items(item_gain = true)
loop do
change_equips = 0
@equips.each_with_index do |item, i|
if !equippable?(item.object) or item.object.etype_id != equip_slots
next if (RPG::Weapon.method_defined?(:two_handed?) and dual_wield? and (equip_slots == 1 and item.object.etype_id == 0))
trade_item_with_party(nil, item.object) if item_gain
change_equips += 1 unless item.object.nil?
unless item.object.nil?
for set_id in 1..EME::Sets.size
for ees_set_equip in EME::Sets[set_id]
if ees_is_the_set_item?(item.object, ees_set_equip)
@item_sets[set_id] -= 1
@active_sets.delete(set_id) if @item_sets[set_id] == 0
end
end
end
end
item.object = nil
end
end
set_check
break if change_equips == 0
end
end
alias eme_ebs_discard_equip discard_equip
def discard_equip(item)
slot_id = equips.index(item)
if slot_id != nil
for set_id in 1..EME::Sets.size
for ees_set_equip in EME::Sets[set_id]
if ees_is_the_set_item?(item, ees_set_equip)
@item_sets[set_id] -= 1
@active_sets.delete(set_id) if @item_sets[set_id] == 0
end
end
end
end
eme_ebs_discard_equip(item)
refresh
end
def set_amount_wearing(set_id)
return @item_sets[set_id]
end
def set_check
item_set_reset_all
reset_bonuses
@active_sets.each{|set| change_bonuses(set) unless set == nil}
end
def change_bonuses(set_id)
return if set_id == 0 or set_amount_wearing(set_id) == 0
EME::Set_Bonuses[set_id].each_key{|key|
if set_amount_wearing(set_id) >= key
for g in 0...EME::Set_Bonuses[set_id][key].size
sort = EME::Set_Bonuses[set_id][key][g][0]
stat = EME::Set_Bonuses[set_id][key][g][1]
stat_bonus = EME::Set_Bonuses[set_id][key][g][2]
case EME::Set_Bonuses[set_id][key][g][0]
when 0
sets_param_change(stat, stat_bonus)
when 1
sets_per_param_change(stat, stat_bonus)
when 2
sets_xparam_change(stat, stat_bonus)
when 3
sets_sparam_change(stat, stat_bonus)
when 4
next if skill_learn?(stat_bonus)
@skill_from_sets = true
learn_skill(stat_bonus)
@ees_skills.push(stat_bonus)
when 5
stat -= 1
sets_element_rate_change(stat, stat_bonus)
when 6
stat -= 1
sets_debuff_rate_change(stat, stat_bonus)
when 7
stat -= 1
sets_state_rate_change(stat, stat_bonus)
when 8
sets_state_resist_change(stat, stat_bonus)
when 9
sets_atk_elements_change(stat, stat_bonus)
when 10
sets_atk_states_change(stat) if stat_bonus > 0
sets_atk_states_rate_change(stat, stat_bonus)
when 11
if stat < 2
change_sets_additional_wtypes(stat_bonus, (stat == 0 ? true : false))
elsif stat < 4
change_sets_additional_atypes(stat_bonus, (stat == 2))
elsif stat == 4
@eme_ebs_two_swords_style = true
end
when 12
sets_atk_specials_change(stat, stat_bonus)
when 13
add_sets_skill_types(stat, stat_bonus)
when 14
add_sets_sealed_skill_types(stat, stat_bonus)
when 15
add_sets_sealed_skills(stat, stat_bonus)
when 16
add_sets_fixed_equip_types(stat, stat_bonus)
when 17
add_sets_sealed_equip_types(stat, stat_bonus)
when 18
stat_bonus < 0 ? change_special_flags(stat, true) : change_special_flags(stat)
when 19
stat_bonus < 0 ? change_party_abilities(stat, true) : change_party_abilities(stat)
when 20
case stat
when 0
set_bonus_max_tp(stat_bonus)
when 1
set_atk_skill(stat_bonus)
when 2
set_grd_skill(stat_bonus)
end
end
end
end
}
end
#-------------------------------------------#
# LABEL FOR AUTHOR #
# Don't mind this ;) #
#-------------------------------------------#
def reset_bonuses
@sets_param_plus = [0] * 8
@sets_per_param_plus = [0] * 8
@sets_xparam_plus = [0] * 10
@sets_sparam_plus = [0] * 10
@sets_element_rate = [0] * (EME::MAX_ELEMENTS)
@sets_debuff_rate = [0] * 8
@sets_state_rate = [0] * ($data_states.size + 1)
@sets_state_resist = []
@sets_state_resist_remove = []
@sets_atk_elements = []
@sets_atk_elements_remove = []
@sets_atk_states = []
@sets_atk_states_rate = [0] * $data_states.size
@sets_atk_speed_plus = 0
@sets_atk_times_plus = 0
@sets_skill_types = []
@sets_skill_types_remove = []
@sets_sealed_skill_types = []
@sets_sealed_skill_types_remove = []
@sets_sealed_skills = []
@sets_sealed_skills_remove = []
@sets_fixed_equip_types = []
@sets_fixed_equip_types_remove = []
@sets_sealed_equip_types = []
@sets_sealed_equip_types_remove = []
@ees_added_special_flags = []
@ees_removed_special_flags = []
@ees_added_party_abilities = []
@ees_removed_party_abilities = []
@ees_bonus_max_tp = 0
@new_atk_skill = nil
@new_grd_skill = nil
@ees_skills = []
@sets_wtypes = []
@sets_atypes = []
@sets_removed_wtypes = []
@sets_removed_atypes = []
@eme_ebs_two_swords_style = false
end
def sets_param_plus(param_id)
@sets_param_plus[param_id]
end
def sets_param_change(param_id, value)
@sets_param_plus[param_id] += value
end
def sets_per_param_plus(param_id)
value = param_base(param_id) + param_plus(param_id)
value *= @sets_per_param_plus[param_id] / 100
return value
end
def sets_per_param_change(param_id, value)
@sets_per_param_plus[param_id] += value
end
def sets_xparam_plus(param_id)
@sets_xparam_plus[param_id]
end
def sets_xparam_change(param_id, value)
@sets_xparam_plus[param_id] += value
end
def sets_sparam_plus(param_id)
@sets_sparam_plus[param_id]
end
def sets_sparam_change(param_id, value)
@sets_sparam_plus[param_id] += value
end
def sets_element_rate(element_id)
@sets_element_rate[element_id]
end
def sets_element_rate_change(element_id, value)
@sets_element_rate[element_id] += value
end
def sets_debuff_rate(param_id)
@sets_debuff_rate[param_id]
end
def sets_debuff_rate_change(param_id, value)
@sets_debuff_rate[param_id] += value
end
def sets_state_rate(state_id)
@sets_state_rate[state_id]
end
def sets_state_rate_change(state_id, value)
@sets_state_rate[state_id] += value
end
def sets_state_resist(state_id)
@sets_state_resist[state_id]
end
def sets_state_resist_remove(state_id)
@sets_state_resist_remove[state_id]
end
def sets_state_resist_change(state_id, value)
value >= 0 ? (@sets_state_resist.push(state_id) unless @sets_state_resist.include?(state_id)) : (@sets_state_resist_remove.delete(state_id) unless @sets_state_resist_remove.include?(state_id))
end
def sets_atk_elements(element_id)
@sets_atk_elements[element_id]
end
def sets_atk_elements_remove(element_id)
@sets_atk_elements_remove[element_id]
end
def sets_atk_elements_change(element_id, value)
value >= 0 ? (@sets_atk_elements.push(element_id) unless @sets_atk_elements.include?(element_id)) : (@sets_attack_elements_remove.delete(element_id) unless @sets_atk_elements_remove.include?(element_id))
end
def sets_atk_states(state_id)
@sets_atk_states[state_id]
end
def sets_atk_states_change(state_id)
@sets_atk_states.push(state_id) unless @sets_atk_states.include?(state_id)
end
def sets_atk_states_rate(state_id)
@sets_atk_states_rate[state_id]
end
def sets_atk_states_rate_change(state_id, value)
@sets_atk_states_rate[state_id] += value
end
def sets_atk_speed_plus
@sets_atk_speed_plus
end
def sets_atk_times_plus
@sets_atk_times_plus
end
def sets_atk_specials_change(parameter, value)
parameter == 0 ? @sets_atk_speed_plus += value : @sets_atk_times_plus += value
end
def sets_skill_types(skill_type_id)
@sets_skill_types[skill_type_id]
end
def sets_skill_types_remove(skill_type_id)
@sets_skill_types_remove[skill_type_id]
end
def add_sets_skill_types(skill_type_id, value)
value >= 0 ? (@sets_skill_types.push(skill_type_id) unless @sets_skill_types.include?(skill_type_id)) : (@sets_skill_types_remove.delete(skill_type_id) unless @sets_skill_types_remove.include?(skill_type_id))
end
def sets_sealed_skill_types(skill_type_id)
@sets_sealed_skill_types[skill_type_id]
end
def sets_sealed_skill_types_remove(skill_type_id)
@sets_sealed_skill_types_remove[skill_type_id]
end
def add_sealed_skill_types(skill_type_id, value)
value >= 0 ? (@sets_sealed_skill_types.push(skill_type_id) unless @sets_sealed_skill_types.include?(skill_type_id)) : (@sets_sealed_skill_types_remove.delete(skill_type_id) unless @sets_sealed_skill_types_remove.include?(skill_type_id))
end
def sets_sealed_skills(skill_id)
@sets_sealed_skills[skill_id]
end
def sets_sealed_skills_remove(skill_id)
@sets_sealed_skills_remove[skill_id]
end
def add_sets_sealed_skills(skill_id, value)
value > 0 ? (@sets_sealed_skills.push(skill_id) unless @sets_sealed_skills.include?(skill_id)) : (@sets_attack_elements_remove.delete(skill_id) unless @sets_sealed_skills_remove.include?(skill_id))
end
def sets_additional_wtypes
@sets_wtypes
end
def sets_additional_atypes
@sets_atypes
end
def sets_removed_wtypes
@sets_removed_wtypes
end
def sets_removed_atypes
@sets_removed_atypes
end
def change_sets_additional_wtypes(wtype_id, positive_change = true)
positive_change ? @sets_wtypes.push(wtype_id) : @sets_removed_wtypes.push(wtype_id)
end
def change_sets_additional_atypes(atype_id, positive_change = true)
positive_change ? @sets_atypes.push(atype_id) : @sets_removed_atypes.push(atype_id)
end
def sets_fixed_equip_types(equip_type_id)
@sets_fixed_equip_types[equip_type_id]
end
def sets_fixed_equip_types_remove(equip_type_id)
@sets_fixed_equip_types_remove[equip_type_id]
end
def add_fixed_equip_types(equip_type_id, value)
value >= 0 ? @sets_fixed_equip_types.push(equip_type_id) : @sets_fixed_equip_types_remove.delete(sequip_type_id)
end
def sets_sealed_equip_types(equip_type_id)
@sets_sealed_equip_types[equip_type_id]
end
def sets_sealed_equip_types_remove(equip_type_id)
@sets_sealed_equip_types_remove[equip_type_id]
end
def add_sealed_equip_types(equip_type_id, value)
value > 0 ? (@sets_sealed_equip_types.push(equip_type_id) unless @sets_sealed_equip_types.include?(equip_type_id)) : (@sets_sealed_equip_types_remove.delete(equip_type_id) unless @sets_sealed_equip_types_remove.include?(equip_type_id))
end
def change_special_flags(flag_id, negative = false)
!negative ? @ees_added_special_flags.push(flag_id) : @ees_removed_special_flags.push(flag_id)
end
def change_party_abilities(ability_id, negative = false)
!negative ? @ees_added_party_abilities.push(ability_id) : @ees_removed_party_abilities.push(ability_id)
end
def set_bonus_max_tp(value)
@ees_bonus_max_tp += value
end
def set_atk_skill(skill_id)
@new_atk_skill = skill_id
end
def set_grd_skill(skill_id)
@new_grd_skill = skill_id
end
#-------------------------------------------#
# 'NOTHER LABEL FOR AUTHOR #
# Don't mind this ;) #
#-------------------------------------------#
def param(param_id)
value = param_base(param_id) + param_plus(param_id) + sets_param_plus(param_id) #+ [sets_per_param_plus(param_id), 0].max
value *= param_rate(param_id) * param_buff_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
alias eme_ebs_xparam xparam
def xparam(xparam_id)
value = eme_ebs_xparam(xparam_id) + sets_xparam_plus(xparam_id) / 100
return value
end
alias eme_ebs_sparam sparam
def sparam(sparam_id)
value = eme_ebs_sparam(sparam_id) + sets_sparam_plus(sparam_id) / 100
return value
end
alias eme_ebs_element_rate element_rate
def element_rate(element_id)
value = eme_ebs_element_rate(element_id) + sets_element_rate(element_id) / 100
return value
end
alias eme_ebs_debuff_rate debuff_rate
def debuff_rate(param_id)
value = eme_ebs_debuff_rate(param_id) + sets_debuff_rate(param_id) / 100
return value
end
alias eme_ebs_state_rate state_rate
def state_rate(state_id)
value = eme_ebs_state_rate(state_id) + sets_state_rate(state_id) / 100
return value
end
alias eme_ebs_state_resist_set state_resist_set
def state_resist_set
value = eme_ebs_state_resist_set
@sets_state_resist.each{|state| value.push(state) unless value.include?(element)}
@sets_state_resist_remove.each{|state| value.delete(state)}
return value
end
alias eme_ebs_atk_elements atk_elements
def atk_elements
value = eme_ebs_atk_elements
@sets_atk_elements.each{|element| value.push(element) unless value.include?(element)}
@sets_atk_elements_remove.each{|element| value.delete(element)}
return value
end
alias eme_ebs_atk_states atk_states
def atk_states
value = eme_ebs_atk_states
@sets_atk_states.each{|state| value.push(@sets_atk_states) }
return value
end
alias eme_ebs_atk_states_rate atk_states_rate
def atk_states_rate(state_id)
value = eme_ebs_atk_states_rate(state_id) + sets_atk_states_rate(state_id) / 100
return value
end
alias eme_ebs_atk_speed atk_speed
def atk_speed
value = eme_ebs_atk_speed + sets_atk_speed_plus / 100
return value
end
alias eme_ebs_atk_times atk_times_add
def atk_times_add
value = [eme_ebs_atk_times + sets_atk_times_plus / 100, 0].max
return value
end
alias eme_ebs_dual_wield? dual_wield?
def dual_wield?
return true if @eme_ebs_two_swords_style
eme_ebs_dual_wield?
end
alias eme_ebs_added_skill_types added_skill_types
def added_skill_types
value = eme_ebs_added_skill_types
@sets_skill_types.each{|sk_type| value.push(sk_type)}
@sets_skill_types_remove.each{|sk_type| value.delete(sk_type)}
return value
end
def skill_type_sealed?(stype_id)
value = features_set(FEATURE_STYPE_SEAL)
@sets_sealed_skill_types.each{|sk_type| value.push(sk_type)}
@sets_sealed_skill_types_remove.each{|sk_type| value.delete(sk_type)}
return true if value.include?(stype_id)
end
def skill_sealed?(skill_id)
value = features_set(FEATURE_SKILL_SEAL)
@sets_sealed_skills.each{|skill| value.push(skill)}
@sets_sealed_skills_remove.each{|skill| value.delete(skill)}
return true if value.include?(skill_id)
end
def equip_wtype_ok?(wtype_id)
value = features_set(FEATURE_EQUIP_WTYPE)
@sets_wtypes.each{|w_type| value.push(w_type)}
@sets_removed_wtypes.each{|w_type| value.delete(w_type)}
return true if value.include?(wtype_id)
end
def equip_atype_ok?(atype_id)
value = features_set(FEATURE_EQUIP_ATYPE)
@sets_atypes.each{|a_type| value.push(a_type)}
@sets_removed_atypes.each{|a_type| value.delete(a_type)}
return true if value.include?(atype_id)
end
def equip_type_fixed?(etype_id)
value = features_set(FEATURE_EQUIP_FIX)
@sets_fixed_equip_types.each{|e_type| value.push(e_type)}
@sets_fixed_equip_types_remove.each{|e_type| value.delete(e_type)}
return true if value.include?(etype_id)
end
def equip_type_sealed?(etype_id)
value = features_set(FEATURE_EQUIP_SEAL)
@sets_sealed_equip_types.each{|e_type| value.push(e_type)}
@sets_sealed_equip_types_remove.each{|e_type| value.delete(e_type)}
return true if value.include?(etype_id)
end
alias eme_ees_special_flag special_flag
def special_flag(flag_id)
return false if @ees_removed_special_flags.include?(flag_id)
return @ees_added_special_flags.include?(flag_id) ? true : eme_ees_special_flag(flag_id)
end
alias eme_ees_party_ability party_ability
def party_ability(ability_id)
return false if @ees_removed_party_abilities.include?(ability_id)
return @ees_added_party_abilities.include?(ability_id) ? true : eme_ees_party_ability(ability_id)
end
alias eme_ees_max_tp max_tp
def max_tp
return eme_ees_max_tp + @ees_bonus_max_tp
end
alias eme_ees_attack_skill attack_skill_id
def attack_skill_id
return @new_atk_skill unless @new_atk_skill == nil
return eme_ees_attack_skill
end
alias eme_ees_guard_skill guard_skill_id
def guard_skill_id
return @new_grd_skill unless @new_grd_skill == nil
return eme_ees_guard_skill
end
end
[/pre]
战斗优势:之前那个展示进度的那个大大的帖子。说过这个很特别
[pre lang="ruby"]#------------------------------------------------------------------------------#
# Galv's Battle Favour
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.8
#------------------------------------------------------------------------------#
# 2013-04-25 - version 1.8 - fixed bug when battle ends there is a has full bar
# 2012-12-14 - version 1.7 - option added to change bar widths
# 2012-12-01 - version 1.6 - added a lot more options to tweak bar aesthetics
# 2012-11-18 - version 1.5 - added a switch to disable the favour meter
# fixed 'enemy text' positioning
# 2012-11-14 - version 1.4 - fixed a bug where using items would crash the game
# 2012-11-14 - version 1.3 - updated to work better with Yanfly's battle
# 2012-11-12 - version 1.2 - potential bug remedied
# 2012-11-12 - version 1.1 - bug fix
# 2012-11-12 - version 1.0 - release
#------------------------------------------------------------------------------#
# This scripts adds a 'favour meter' to battle. As the meter fills for each
# team (enemy or party) they gain a state that can be used to determine the
# benefits of having higher favour. Upon reaching max favour, a common event
# can be called to add any additional effects you might like.
#
# These favour bars increase by causing damage. When one side causes damage, it
# can also decrease the other side's bar by an amount based on the gain amount.
#
# Actors and equips can give bonuses to how much these bars increase. Enemies
# can also have different bonuses for this as well.
#
# Skills can also be set to modify either side's favour bar without causing
# damage.
#------------------------------------------------------------------------------#
# SCRIPT CALLS
#------------------------------------------------------------------------------#
# You can use script calls to change party or enemy favour during battles.
#
# $game_party.enemy_favour = x # set enemy favour to x
# $game_party.favour = x # set party favour to x
#
# $game_actors[y].favour = x # set actor y's favour bonus to x
#
# For those with limited scripting knowledge, instead of "=" you can use:
#
# -= # minus += # plus *= # multiply
#
# NOTE: The enemy favour and party favour bars are reset each battle.
# The Actor favour changes remain for the game (and is used for bonuses)
#------------------------------------------------------------------------------#
# You can use script to get favour amounts (eg. for use in variables 'script')
#
# $game_party.enemy_favour # returns the amount the enemy favour bar has
# $game_party.favour # returns the amount the party favour bar has
# $game_actors[x].favour # returns how much favour actor x has
# $game_party.members[x].favour # returns how much favour actor in position x has
# $game_troop.members[x].favour # returns how much favour troop x has
#
#------------------------------------------------------------------------------#
# NOTETAG - ACTORS
#------------------------------------------------------------------------------#
# <favour: x> # Where x is the actor's INITIAL favour bonus. This
# # bonus can change with above script calls.
#------------------------------------------------------------------------------#
# NOTETAG - WEAPONS and ARMORS
#------------------------------------------------------------------------------#
# <favour: x> # Equips with this notetag will give bonus favour when
# # the equipped actor causes damage.
#------------------------------------------------------------------------------#
# NOTETAG - ENEMIES
#------------------------------------------------------------------------------#
# <favour: x> # Enemies tagged with this will get a bonus when they
# # cause damage.
#------------------------------------------------------------------------------#
# NOTETAG - SKILLS
#------------------------------------------------------------------------------#
# <favour: x> # Skills with this notetag will give bonus favour when
# # the skill used causes damage.
#------------------------------------------------------------------------------#
#
# HOW DO THE ABOVE NOTETAG BONUSES WORK?
#
# 10% of the total bonuses an actor or enemy has is added to the amount of
# favour that is generated for their team each time they cause damage.
#
#------------------------------------------------------------------------------#
# NOTETAG - SKILLS and ITEMS
#------------------------------------------------------------------------------#
# <mod_pfavour: x> # How you want to modify party favour
# <mod_efavour: x> # How you want to modify enemy favour
# # x can be set to:
# # 1 for 'add', 2 for 'multiply' or 3 for 'set'.
# # If you leave this out, the below won't do anything.
#
# <do_pfavour: x> # How much to "add", "mul" or "set" party favour by.
# <do_efavour: x> # How much to "add", "mul" or "set" enemy favour by.
#------------------------------------------------------------------------------#
# EXAMPLE OF TAGS ON A SKILL/ITEM:
#
# <mod_pfavour: 3> # This example, the skill would 'set' party
# <do_pfavour: 50> # favour to 50 and subtract 30 from enemy.
# <mod_efavour: 1> # Only one of each tag will apply.
# <do_efavour: -30>
#
#------------------------------------------------------------------------------#
($imported ||= {})["Galvs_Battle_Favour"] = true
module Galv_Favour
#------------------------------------------------------------------------------#
# SCRIPT SETTINGS
#------------------------------------------------------------------------------#
DISABLE_SWITCH = 999 # Turn switch ON to disable meters. Do this outside
# of combat.
#----------------------------#
# FAVOUR BAR AESTHETICS: #
#----------------------------#
FONT = "Arial" # The font for all bar related text
TEXT_SIZE = 22 # The font size of the party/enemy text names.
TEXT_Y = 0 # Offset ALL bar text vertically different to bars
PARTY_TEXT = "我方优势" # Text displayed above party favour bar.
PARTY_TEXT_COLOR = 0 # The colour of the party text
ENEMY_TEXT = "敌方优势" # Text displayed above enemy favour bar.
ENEMY_TEXT_COLOR = 0 # The colour of the enemy text
TURNS_TEXT_SIZE = 22 # Size of the turns text
TURNS_TEXT = " CD" # Text displayed after remaining special turns
PARTY_TURNS_COLOR = 8 # Colour of the turns text for party
ENEMY_TURNS_COLOR = 8 # Colour of the turns text for enemy
SHOW_NUMBERS = true # Show amount of favour as numbers above the bars.
BAR_WIDTH = 250 # How wide the bars are.
BAR_HEIGHT = 10 # The height of the actual bars.
BAR_Y = 0 # Offset the bars vertically different to text
BAR_POSITION = "bottom" # Position of the favour bars. Can be "top" or
# "bottom" or put in a number without quotes to
# display the bar that many pixels from the top.
PARTY_BAR_COLORS = [4,11] # Gradient colors of party bar.
ENEMY_BAR_COLORS = [14,10] # Gradient colors of enemy bar.
PARTY_ACTIVATE_SE = ["Barrier", 100, 100] # SE when favours reach MAX
PARTY_ACTIVATE_COLORS = [4,9,12,16] # bar cycles these colors randomly
ENEMY_ACTIVATE_SE = ["Barrier", 100, 100] # ["SE Name", volume, pitch]
ENEMY_ACTIVATE_COLORS = [2,10,18,21] # bar cycles these colors randomly
#-----------------------#
# FAVOUR MECHANICS: #
#-----------------------#
FAVOUR_MAX = 100 # The number used to determine a full favour bar.
INITIAL_PARTY_FAVOUR = [5,20] # Set amount of favour when battles begin
INITIAL_ENEMY_FAVOUR = [5,20] # randomized between the first and second
# numbers.
REDUCE_OPPONENT = 0.5 # When an enemy or party gains favour, the opposing
# side loses favour equal to this amount gained
# multiplied by this number. ie. 0.5 is 50%
SPECIAL_ACTIVATE = 119 # Common event ID that is activated when
# the party reaches MAX favour.
ENEMY_SPECIAL_ACTIVATE = 89 # Common event ID that is activated when
# the enemy reaches MAX favour.
SPECIAL_TURNS = 5 # When MAX favour is reached, the party or enemy
# team enter a "Special mode". They retain their
# MAX favour for this many turns. Once the special is over, the favour returns
# to 0. While in special mode, the opposing team's favour gains are halved.
# FAVOUR STATES
# Below are lists to set up to determine states to apply for each favour level.
# They are listed in pairs - a favour amount and a state id.
# eg. 20 => 21
# means: when favour amount reaches 20, apply state with id 21 to party/enemy.
# Each time the next favour level is reached, it removes the previous favour
# state the party or enemy troop had active.
FAVOUR_STATES = { # don't touch this.
#------------------------------------------------------------------------------#
# PARTY FAVOUR STATES
0 => 0, # when less than 20, display no state. Leave as is.
20 => 0, # when 20 favour earned, state 21 applied.
40 => 0, # when 40 favour earned, state 22 applied.
60 => 0, # when 60 favour earned, state 23 applied.
80 => 0, # when 80 favour earned, state 24 applied.
100 => 0, # when 100 favour earned, state 25 applied.
#------------------------------------------------------------------------------#
} # don't touch this
#------------------------------------------------------------------------------#
ENEMY_FAVOUR_STATES = { # don't touch this.
#------------------------------------------------------------------------------#
# ENEMY TROOP FAVOUR STATES
0 => 0, # when less than 20, display no state. Leave as is.
20 => 0, # when 20 favour earned, state 21 applied.
40 => 0, # when 40 favour earned, state 22 applied.
60 => 0, # when 60 favour earned, state 23 applied.
80 => 0, # when 80 favour earned, state 24 applied.
100 => 0, # when 100 favour earned, state 25 applied.
#------------------------------------------------------------------------------#
} # don't touch this
#------------------------------------------------------------------------------#
# CHARGING FAVOUR
#------------------------------------------------------------------------------#
# Below are equations for enemy and party to charge favour on damage caused.
# You will need some scripting knowledge to modify this. I have set it up to
# be used with 100 favour as the max in mind.
#------------------------------------------------------------------------------#
end # don't touch
module Galv_Favour_Mechanics # don't touch
#------------------------------------------------------------------------------#
# CHARGING PARTY FAVOUR - Equation for gaining favour when causing damage:
#------------------------------------------------------------------------------#
def charge_favour(damage) # don't touch
#------------------------------------------------------------------------------#
# Generate random favour depending % of max life damage actor does to enemy.
# Add 10% of all actor's favour bonuses:
@charge = rand(6) + 5 + (10 * ([damage.to_f,mhp].min / mhp)).to_i
@charge += (get_actor_favour_bonus * 0.1).to_i
#------------------------------------------------------------------------------#
end # don't touch
#------------------------------------------------------------------------------#
# CHARGING ENEMY FAVOUR - Equation for gaining favour when causing damage:
#------------------------------------------------------------------------------#
def charge_enemy_favour(damage) # don't touch
#------------------------------------------------------------------------------#
# Generate random favour depending % of max life damage enemy does to actor.
# Add 10% of enemy favour bonus:
@charge = rand(6) + 5 + (10 * ([damage.to_f,mhp].min / mhp)).to_i
@charge += (get_enemy_favour_bonus * 0.1).to_i
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# END OF SCRIPT SETTINGS
#------------------------------------------------------------------------------#
end
def get_actor_favour_bonus
@bonus = $game_temp.user.favour
@no_equips = $game_temp.user.equips.count
@no_equips.times { |i|
if $game_temp.user.equips != nil
@bonus += $game_temp.user.equips.favour_bonus
end
}
@bonus += $game_temp.skill_used.favour_bonus
return @bonus
end
def get_enemy_favour_bonus
@bonus = $game_temp.user.favour
@bonus += $game_temp.skill_used.favour_bonus
return @bonus
end
end # Galv_Favour_Mechanics
class RPG::BaseItem
def favour_bonus
if @favour_bonus.nil?
if @note =~ /<favour: (.*)>/i
@favour_bonus = $1.to_i
else
@favour_bonus = 0
end
end
@favour_bonus
end
def mod_pfavour
if @mod_pfavour.nil?
if @note =~ /<mod_pfavour: (.*)>/i
@mod_pfavour = $1.to_i
else
@mod_pfavour = 0
end
end
@mod_pfavour
end
def mod_efavour
if @mod_efavour.nil?
if @note =~ /<mod_efavour: (.*)>/i
@mod_efavour = $1.to_i
else
@mod_efavour = 0
end
end
@mod_efavour
end
def do_pfavour
if @do_pfavour.nil?
if @note =~ /<do_pfavour: (.*)>/i
@do_pfavour = $1.to_i
else
@do_pfavour = 0
end
end
@do_pfavour
end
def do_efavour
if @do_efavour.nil?
if @note =~ /<do_efavour: (.*)>/i
@do_efavour = $1.to_i
else
@do_efavour = 0
end
end
@do_efavour
end
end # RPG::BaseItem
class Window_Favour < Window_Base
def initialize
super(0, 0, Graphics.width, Graphics.height)
@cycle = 0
contents.font.name = Galv_Favour::FONT
update_location
draw_favour_bars
self.opacity = 0
end
def bar_width
return Galv_Favour::BAR_WIDTH
end
def update
self.refresh if $game_party.favour == Galv_Favour::FAVOUR_MAX || $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX || $imported["YEA-BattleEngine"]
end
def refresh
contents.clear
draw_favour_bars
end
def open
refresh
super
end
def update_location
case Galv_Favour::BAR_POSITION
when "top"
self.y = 0
when "bottom"
self.y = Graphics.height - 170
else
self.y = Galv_Favour::BAR_POSITION
end
self.z = 0
end
def party_random_color
@cycle = rand(Galv_Favour::PARTY_ACTIVATE_COLORS.count)
return Galv_Favour::PARTY_ACTIVATE_COLORS[@cycle]
end
def enemy_random_color
@cycle = rand(Galv_Favour::ENEMY_ACTIVATE_COLORS.count)
return Galv_Favour::ENEMY_ACTIVATE_COLORS[@cycle]
end
def draw_favour_bars
draw_party_favour(Graphics.width / 2, 0, bar_width)
draw_enemy_favour(Graphics.width / 2 - bar_width - 20, 0, bar_width)
end
def draw_party_favour(x, y, width)
if $game_party.favour < Galv_Favour::FAVOUR_MAX
draw_favour_gauge(x, y, width, favour_rate, text_color(Galv_Favour::PARTY_BAR_COLORS[0]), text_color(Galv_Favour::PARTY_BAR_COLORS[1]))
else
draw_favour_gauge(x, y, width, favour_rate, text_color(party_random_color), text_color(party_random_color))
change_color(text_color(Galv_Favour::PARTY_TURNS_COLOR))
xr = x + width
contents.font.size = Galv_Favour::TURNS_TEXT_SIZE
draw_text(xr - 100, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.p_special.to_s + Galv_Favour::TURNS_TEXT, 2)
end
change_color(text_color(Galv_Favour::PARTY_TEXT_COLOR))
contents.font.size = Galv_Favour::TEXT_SIZE
draw_text(x, y + Galv_Favour::TEXT_Y, bar_width, contents.font.size, party_text)
if Galv_Favour::SHOW_NUMBERS && $game_party.p_special <= 0
xr = x + width
draw_text(xr - 100, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.favour.to_s, 2)
end
end
def draw_enemy_favour(x, y, width)
if $game_party.enemy_favour < Galv_Favour::FAVOUR_MAX
draw_reverse_gauge(x, y, width, enemy_favour_rate, text_color(Galv_Favour::ENEMY_BAR_COLORS[0]), text_color(Galv_Favour::ENEMY_BAR_COLORS[1]))
else
draw_reverse_gauge(x, y, width, enemy_favour_rate, text_color(enemy_random_color), text_color(enemy_random_color))
change_color(text_color(Galv_Favour::ENEMY_TURNS_COLOR))
contents.font.size = Galv_Favour::TURNS_TEXT_SIZE
draw_text(x + 2, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.e_special.to_s + Galv_Favour::TURNS_TEXT, 0)
end
change_color(text_color(Galv_Favour::ENEMY_TEXT_COLOR))
contents.font.size = Galv_Favour::TEXT_SIZE
draw_text(x + 2, y + Galv_Favour::TEXT_Y, bar_width, contents.font.size, enemy_text,2)
if Galv_Favour::SHOW_NUMBERS && $game_party.e_special <= 0
xr = x + width
draw_text(x + 2, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.enemy_favour.to_s, 0)
end
end
def enemy_text
Galv_Favour::ENEMY_TEXT
end
def enemy_favour_rate
[$game_party.enemy_favour.to_f, Galv_Favour::FAVOUR_MAX].min / Galv_Favour::FAVOUR_MAX
end
def party_text
Galv_Favour::PARTY_TEXT
end
def favour_rate
[$game_party.favour.to_f, Galv_Favour::FAVOUR_MAX].min / Galv_Favour::FAVOUR_MAX
end
def draw_favour_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8 + Galv_Favour::BAR_Y
contents.fill_rect(x, gauge_y, width, Galv_Favour::BAR_HEIGHT, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, Galv_Favour::BAR_HEIGHT, color1, color2)
end
def draw_reverse_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8 + Galv_Favour::BAR_Y
contents.fill_rect(x, gauge_y, width, Galv_Favour::BAR_HEIGHT, gauge_back_color)
contents.gradient_fill_rect(x + width - fill_w, gauge_y, fill_w, Galv_Favour::BAR_HEIGHT, color1, color2)
end
end # Window_Favour < Window_Base
class Scene_Battle < Scene_Base
alias galv_favour_sb_start start
def start
set_initial_favour
galv_favour_sb_start
end
alias galv_favour_sb_terminate terminate
def terminate
clear_favour
galv_favour_sb_terminate
end
alias galv_favour_create_all_windows create_all_windows
def create_all_windows
galv_favour_create_all_windows
@favour_window = Window_Favour.new if !$game_switches[Galv_Favour::DISABLE_SWITCH]
end
alias galv_favour_refresh_status refresh_status
def refresh_status
galv_favour_refresh_status
@favour_window.refresh if !$game_switches[Galv_Favour::DISABLE_SWITCH]
end
if $imported["YEA-BattleEngine"]
def apply_item_effects(target, item)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:prepare, item, @subject, target)
end
target.item_apply(@subject, item)
status_redraw_target(@subject)
status_redraw_target(target) unless target == @subject
@log_window.display_action_results(target, item)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:during, item, @subject, target)
end
@status_window.refresh if !$game_switches[Galv_Favour::DISABLE_SWITCH]
perform_collapse_check(target)
end
end
def set_initial_favour
$game_party.p_special = 0
$game_party.e_special = 0
min = Galv_Favour::INITIAL_PARTY_FAVOUR[0]
max = Galv_Favour::INITIAL_PARTY_FAVOUR[1]
$game_party.favour = rand(max - min) + min
min = Galv_Favour::INITIAL_ENEMY_FAVOUR[0]
max = Galv_Favour::INITIAL_ENEMY_FAVOUR[1]
$game_party.enemy_favour = rand(max - min) + min
if $game_switches[Galv_Favour::DISABLE_SWITCH]
$game_party.favour = 0
$game_party.enemy_favour = 0
end
end
def clear_favour
$game_party.favour = 0
$game_party.enemy_favour = 0
end
end # Scene_Battle < Scene_Base
class Game_Party < Game_Unit
attr_accessor :favour
attr_accessor :enemy_favour
attr_accessor :p_special
attr_accessor :e_special
alias galv_favour_initialize initialize
def initialize
galv_favour_initialize
@favour = 0
@enemy_favour = 0
@p_special = 0
@e_special = 0
end
end # Game_Party < Game_Unit
class Game_BattlerBase
def apply_state
# get hash with KEYS: favour required and VALUES: state ids
@list = Galv_Favour::FAVOUR_STATES
# get state_id required:
@get_state = (@list.select {|k,v| k <= $game_party.favour}).max[1]
# add state_id required. Remove all other state_id's in list
Galv_Favour::FAVOUR_STATES.each {|key, value|
$game_party.alive_members.each do |mem|
if value == @get_state
if !mem.state?(@get_state) && value != 0
mem.add_favour_state(@get_state)
end
else
mem.remove_state(value)
end
end
}
end
def apply_enemy_state
# get hash with KEYS: favour required and VALUES: state ids
@enemy_list = Galv_Favour::ENEMY_FAVOUR_STATES
# get state_id required:
@get_enemy_state = (@enemy_list.select {|k,v| k <= $game_party.enemy_favour}).max[1]
# add state_id required. Remove all other state_id's in list
Galv_Favour::ENEMY_FAVOUR_STATES.each {|key, value|
$game_troop.alive_members.each do |enemy|
if value == @get_enemy_state
if !enemy.state?(@get_enemy_state) && value != 0
enemy.add_favour_state(@get_enemy_state)
end
else
enemy.remove_state(value)
end
end
}
end
def check_favour
return if $game_switches[Galv_Favour::DISABLE_SWITCH]
if $game_party.favour >= Galv_Favour::FAVOUR_MAX
$game_party.favour = Galv_Favour::FAVOUR_MAX
if $game_party.p_special == 0 && $game_party.favour == Galv_Favour::FAVOUR_MAX
RPG::SE.new(Galv_Favour::PARTY_ACTIVATE_SE[0], Galv_Favour::PARTY_ACTIVATE_SE[1], Galv_Favour::PARTY_ACTIVATE_SE[2]).play
$game_party.p_special = Galv_Favour::SPECIAL_TURNS
$game_temp.reserve_common_event(Galv_Favour::SPECIAL_ACTIVATE)
end
elsif $game_party.favour <= 0
$game_party.favour = 0
$game_party.p_special = 0
end
if $game_party.enemy_favour >= Galv_Favour::FAVOUR_MAX
$game_party.enemy_favour = Galv_Favour::FAVOUR_MAX
if $game_party.e_special == 0 && $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX
RPG::SE.new(Galv_Favour::ENEMY_ACTIVATE_SE[0], Galv_Favour::ENEMY_ACTIVATE_SE[1], Galv_Favour::ENEMY_ACTIVATE_SE[2]).play
$game_party.e_special = Galv_Favour::SPECIAL_TURNS
$game_temp.reserve_common_event(Galv_Favour::ENEMY_SPECIAL_ACTIVATE)
end
elsif $game_party.enemy_favour <= 0
$game_party.enemy_favour = 0
$game_party.e_special = 0
end
end
end # Game_BattlerBase
class Game_Battler < Game_BattlerBase
include Galv_Favour_Mechanics
alias galv_favour_execute_damage execute_damage
def execute_damage(user)
$game_temp.user = user
galv_favour_execute_damage(user)
end
alias galv_favour_on_damage on_damage
def on_damage(value)
galv_favour_on_damage(value)
return if $game_switches[Galv_Favour::DISABLE_SWITCH]
if $game_temp.user.actor?
# When enemy is damaged
if $game_party.e_special > 0
charge = charge_favour(value)
$game_party.favour += charge / 2
else
charge = charge_favour(value)
$game_party.favour += charge
$game_party.enemy_favour -= (charge * Galv_Favour::REDUCE_OPPONENT).to_i
end
else
# When party is damaged
if $game_party.p_special > 0
charge = charge_enemy_favour(value)
$game_party.enemy_favour += charge / 2
else
charge = charge_enemy_favour(value)
$game_party.enemy_favour += charge
$game_party.favour -= (charge * Galv_Favour::REDUCE_OPPONENT).to_i
end
end
check_favour
apply_state
apply_enemy_state
end
def add_favour_state(state_id)
add_new_state(state_id) unless state?(state_id)
reset_state_counts(state_id)
@result.added_states.push(state_id).uniq!
end
alias galv_favour_use_item use_item
def use_item(item)
$game_temp.skill_used = item
galv_favour_use_item(item)
change_party_favour if $game_temp.skill_used.mod_pfavour != 0
change_enemy_favour if $game_temp.skill_used.mod_efavour != 0
apply_state
apply_enemy_state
check_favour
end
def change_party_favour
case $game_temp.skill_used.mod_pfavour
when 1
$game_party.favour += $game_temp.skill_used.do_pfavour
when 2
$game_party.favour *= $game_temp.skill_used.do_pfavour
when 3
$game_party.favour = $game_temp.skill_used.do_pfavour
end
end
def change_enemy_favour
case $game_temp.skill_used.mod_efavour
when 1
$game_party.enemy_favour += $game_temp.skill_used.do_efavour
when 2
$game_party.enemy_favour *= $game_temp.skill_used.do_efavour
when 3
$game_party.enemy_favour = $game_temp.skill_used.do_efavour
end
end
end # Game_Battler < Game_BattlerBase
class Game_Enemy < Game_Battler
attr_accessor :favour
alias galv_favour_enemy_initialize initialize
def initialize(index, enemy_id)
galv_favour_enemy_initialize(index, enemy_id)
@favour = $data_enemies[enemy_id].favour_bonus
end
end # Game_Enemy < Game_Battler
class Game_Actor < Game_Battler
attr_accessor :favour
alias galv_favour_actor_initialize initialize
def initialize(actor_id)
galv_favour_actor_initialize(actor_id)
@favour = $data_actors[actor_id].favour_bonus
end
end # Game_Actor < Game_Battler
class Game_Temp
attr_accessor :user
attr_accessor :skill_used
end # Game_Temp
module BattleManager
class << self
alias galv_favour_bm_turn_end turn_end
def turn_end
galv_favour_bm_turn_end
return if $game_switches[Galv_Favour::DISABLE_SWITCH]
if $game_party.p_special >= 0 && $game_party.favour == Galv_Favour::FAVOUR_MAX
$game_party.p_special -= 1
if $game_party.p_special == 0
$game_party.favour = 0
rem_party_state
end
end
if $game_party.e_special >= 0 && $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX
$game_party.e_special -= 1
if $game_party.e_special == 0
$game_party.enemy_favour = 0
rem_enemy_state
end
end
end
def rem_party_state
@list = Galv_Favour::FAVOUR_STATES
Galv_Favour::FAVOUR_STATES.each {|key, value|
$game_party.alive_members.each do |mem|
mem.remove_state(value)
end
}
end
def rem_enemy_state
@enemy_list = Galv_Favour::ENEMY_FAVOUR_STATES
Galv_Favour::ENEMY_FAVOUR_STATES.each {|key, value|
$game_troop.alive_members.each do |enemy|
enemy.remove_state(value)
end
}
end
end
end # BattleManager[/pre]
状态蓝盾
[pre lang="ruby"]# Manashield
# This will make a manashield state which allow actor takes damage to mana
# instead of health points.
# Usage: use this notetag inside a state <manashield: X, Y%>
# X is damage absorb per mana point.
# Y is damage percentage which can be absorbed.
# Free for all using purposes.
# Credit: Archeia Nessiah for the allowance.
module REGEXP
module MANASHIELD
MANASHIELD = /<manashield:[ ]*(\d+),[ ]*(\d+)[%“]?>/i
end # MANASHIELD
end # REGEXP
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_manashield load_database; end
def self.load_database
load_database_manashield
initialize_manashield
end
#--------------------------------------------------------------------------
# new method: initialize_manashield
#--------------------------------------------------------------------------
def self.initialize_manashield
groups = [$data_states]
groups.each { |group|
group.each { |obj|
next if obj.nil?
obj.initialize_manashield
}
}
end
end # DataManager
#==============================================================================
# ¡ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :manashield
#--------------------------------------------------------------------------
# new method: initialize_manashield
#--------------------------------------------------------------------------
def initialize_manashield
#---
self.note.split(/[\r\n]+/).each { |line|
case line
when REGEXP::MANASHIELD::MANASHIELD
@manashield = [$1.to_i, [$2.to_i, 100].min]
end
}
end
end # RPG::BaseItem
#==============================================================================
# ¡ Game_ActionResult
#==============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# alias method: make_damage
#--------------------------------------------------------------------------
alias manashield_make_damage make_damage
def make_damage(value, item)
manashield_make_damage(value, item)
#---
if @battler.manashield && @battler.mp > 0
dpm = @battler.manashield[0]
percent = @battler.manashield[1]
shield = (@hp_damage * percent.to_f) / 100.0
shield = shield / dpm.to_f
shield = [shield, @battler.mp.to_f].min
@hp_damage -= (shield * dpm.to_f).to_i
@mp_damage += shield.to_i
end
end
end # Game_ActionResult
#==============================================================================
# ¡ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# new method: manashield
#--------------------------------------------------------------------------
def manashield
mns = nil
states.each { |state|
next unless state.manashield
mns = state.manashield
break
}
return mns ? mns : false
end
end # Game_Battler[/pre]
充能的技能(比那位tarxod大大那个延迟好用,因为T大大每回合都能动,但是到了释放时刻,没达到要求就不放了)
[pre lang="ruby"]#==============================================================================
#
# ¥ Yami Engine Ace - Charge Skill
# -- Last Updated: 2012.05.13
# -- Level: Easy
# -- Requires: none
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YSE-ChargeSkill"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.05.13 - Fixed Enemy Charging.
# 2012.03.30 - Fixed Skill Targets.
# 2012.03.29 - Fixed Auto Battle bug.
# 2012.03.27 - Fixed Cancel Charge bug.
# 2012.03.26 - Fixed Battle End bug.
# 2012.03.18 - Started and Finished Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides charging skill feature. Charging Skill means that skill
# will be used after some turn it was choosen.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
# -----------------------------------------------------------------------------
# <charge turn: x>
# Make skill be a charge skill with x charging turns.
# -----------------------------------------------------------------------------
# <start charge message>
# example
# </start charge message>
#
# Set the Charging Start Message to example.
# -----------------------------------------------------------------------------
# <continue charge message>
# example
# </continue charge message>
#
# Set the Charging Continue Message to example.
#
#==============================================================================
# ¥ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YSE
module CHARGE_SKILL
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Visual Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
VISUAL_SETTING = { # Start.
# Message shows when choose a charge skill.
# Set this to nil to disable.
:default_msg_start => "%s 开始充能 %s!",
# Message shows when end a charging turn.
# Set this to nil to disable.
:default_msg_continue => "%s 还在充能 %s...",
} # End.
end # CHARGE_SKILL
end # YSE
#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ¡ Regular Expression
#==============================================================================
module YSE
module REGEXP
module USABLEITEM
CHARGE_TURN = /<(?:CHARGE_TURN|charge turn):[ ](\d+)?>/i
START_MSG_BEGIN = /<(?:START_CHARGE_MESSAGE|start charge message)>/i
START_MSG_END = /<\/(?:START_CHARGE_MESSAGE|start charge message)>/i
CONT_MSG_BEGIN = /<(?:CONTINUE_CHARGE_MESSAGE|continue charge message)>/i
CONT_MSG_END = /<\/(?:CONTINUE_CHARGE_MESSAGE|continue charge message)>/i
end # STATE
end # REGEXP
end # YSE
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_ysecs load_database; end
def self.load_database
load_database_ysecs
load_notetags_ysecs
end
#--------------------------------------------------------------------------
# new method: load_notetags_ysecs
#--------------------------------------------------------------------------
def self.load_notetags_ysecs
groups = [$data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_ysecs
end
end
end
end # DataManager
#==============================================================================
# ¡ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :charge_turn
attr_accessor :start_msg
attr_accessor :continue_msg
#--------------------------------------------------------------------------
# common cache: load_notetags_ysecs
#--------------------------------------------------------------------------
def load_notetags_ysecs
@start_begin = false
@continue_begin = false
@charge_turn = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YSE::REGEXP::USABLEITEM::CHARGE_TURN
@charge_turn = $1.to_i
when YSE::REGEXP::USABLEITEM::START_MSG_BEGIN
@start_begin = true
when YSE::REGEXP::USABLEITEM::START_MSG_END
@start_begin = false
when YSE::REGEXP::USABLEITEM::CONT_MSG_BEGIN
@continue_begin = true
when YSE::REGEXP::USABLEITEM::CONT_MSG_END
@continue_begin = false
else
@start_msg = line.to_s if @start_msg.nil? && @start_begin
@start_msg += line.to_s if @start_begin
@continue_msg = line.to_s if @continue_msg.nil? && @continue_begin
@continue_msg += line.to_s if @continue_begin
end
} # self.note.split
#---
@charge_turn = nil if @charge_turn <= 0
@start_msg = YSE::CHARGE_SKILL::VISUAL_SETTING[:default_msg_start]
@continue_msg = YSE::CHARGE_SKILL::VISUAL_SETTING[:default_msg_continue]
@start_msg = nil if @start_msg == ""
@continue_msg = nil if @continue_msg == ""
end
end # RPG::UsableItem
#==============================================================================
# ¡ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :charged
attr_accessor :first_charge
#--------------------------------------------------------------------------
# alias method: auto_battle?
#--------------------------------------------------------------------------
alias yse_auto_battle_cs auto_battle?
def auto_battle?
charging? ? false : yse_auto_battle_cs
end
#--------------------------------------------------------------------------
# new method: charging?
#--------------------------------------------------------------------------
def charging?
!@charging_cache.nil? || @charged
end
#--------------------------------------------------------------------------
# new method: start_charge
#--------------------------------------------------------------------------
def start_charge
return false if charging?
return false if current_action.item.charge_turn.nil?
@charging_cache = current_action.clone
@charge_turn = current_action.item.charge_turn
return true
end
#--------------------------------------------------------------------------
# new method: current_charging
#--------------------------------------------------------------------------
def current_charging
@charging_cache
end
#--------------------------------------------------------------------------
# new method: end_charge
#--------------------------------------------------------------------------
def end_charge
@actions.push(@charging_cache)
@charging_cache = nil
@charge_turn = nil
@charged = true
return true
end
#--------------------------------------------------------------------------
# new method: cancel_charge
#--------------------------------------------------------------------------
def cancel_charge
clear_actions
@charging_cache = nil
@charge_turn = nil
@charged = false
end
#--------------------------------------------------------------------------
# new method: update_charge_skill
#--------------------------------------------------------------------------
def update_charge_skill
@charge_turn -= 1
return end_charge if @charge_turn == 0
return false
end
#--------------------------------------------------------------------------
# alias method: on_battle_end
#--------------------------------------------------------------------------
alias yse_on_battle_end_cs on_battle_end
def on_battle_end
cancel_charge
yse_on_battle_end_cs
end
end # Game_Battler
#==============================================================================
# ¡ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# alias method: inputable?
#--------------------------------------------------------------------------
alias yse_inputable_cs inputable?
def inputable?
yse_inputable_cs && !charging?
end
end # Game_Actor
#==============================================================================
# ¡ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# alias method: make_actions
#--------------------------------------------------------------------------
alias yse_make_actions_cs make_actions
def make_actions
return super if charging?
yse_make_actions_cs
end
end # Game_Enemy
#==============================================================================
# ¡ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: execute_action
#--------------------------------------------------------------------------
alias yse_execute_action_bacs execute_action
def execute_action
return start_charge if @subject.start_charge
yse_execute_action_bacs
end
#--------------------------------------------------------------------------
# alias method: process_action_end
#--------------------------------------------------------------------------
alias yse_process_action_end_bacs process_action_end
def process_action_end
process_charge_skill
yse_process_action_end_bacs
end
#--------------------------------------------------------------------------
# new method: start_charge
#--------------------------------------------------------------------------
def start_charge
@subject.first_charge = true
return if @subject.current_action.item.start_msg.nil?
str = @subject.current_action.item.start_msg
skill = @subject.current_action.item
skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
text = sprintf(str, @subject.name, skill_text)
@log_window.add_text(text)
3.times do @log_window.wait end
@log_window.back_one
end
#--------------------------------------------------------------------------
# new method: process_charge_skill
#--------------------------------------------------------------------------
def process_charge_skill
return @subject.first_charge = false if @subject.first_charge
return unless @subject.charging?
return unless check_charge_turn
process_action_charge
end
#--------------------------------------------------------------------------
# new method: check_charge_turn
#--------------------------------------------------------------------------
def check_charge_turn
continue = @subject.update_charge_skill
if continue
return true
else
return false if @subject.current_charging.item.continue_msg.nil?
str = @subject.current_charging.item.continue_msg
skill = @subject.current_charging.item
skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
text = sprintf(str, @subject.name, skill_text)
@log_window.add_text(text)
3.times do @log_window.wait end
@log_window.back_one
end
return false
end
#--------------------------------------------------------------------------
# new method: process_action_charge
#--------------------------------------------------------------------------
def process_action_charge
loop do
break if $game_troop.all_dead?
break unless @subject.current_action
@subject.current_action.prepare
execute_action if @subject.current_action.valid?
@subject.remove_current_action
end
@subject.charged = false
end
end # Scene_Battle
#==============================================================================
#
# ¥ End of File
#
#==============================================================================[/pre]
环境脚本
[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Field State Effects v1.00
# -- Last Updated: 2012.01.11
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-FieldStateEffects"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.11 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Field States are states that are applied to all actors and enemies without
# discrimination. Field states cannot be removed through usual means and can
# only be applied through certain skills and items. Multiple field states can
# be added at once whether side by side or overwriting any previous field
# states. Skills and items can also alter the turns of existing field states.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
# <add field state: x>
# <add field state: x, x>
# Causes the action to add state x to the field, making it apply to everyone
# and cannot be removed through normal state removal means. Insert multiples of
# this tag to have the action cause multiple field states.
#
# <remove field state: x>
# <remove field state: x, x>
# Causes the action to remove state x from the field. This does not remove
# states that were inflicted normally. Insert multiples of this tag to remove
# multiple field states.
#
# <remove all field states>
# Causes the action to remove all field states. This does not remove states
# that were inflicted normally.
#
# <overwrite field state: x>
# <overwrite field state: x, x>
# Causes the action to remove all field states and then add field states x,
# making it apply to everyone and cannot be removed through normal state
# removal means. Insert multiples of this tag to have the action overwrite and
# add more field states.
#
# <field state x turns: +y>
# <field state x turns: -y>
# Changes the remaining turns on field state x by y amount. If a field state
# is to reach 0 or less turns through this process, the field state is removed.
# This effect does not add turns to field states that weren't inflicted. Insert
# multiples of this tag to adjust multiple field states at once.
#
# <all field state turns: +x>
# <all field state turns: -x>
# Changes the remaining turns on all field states by x amount. If a field state
# is to reach 0 or less turns through this process, the field state is removed.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <add field state: x>
# <add field state: x, x>
# Causes the action to add state x to the field, making it apply to everyone
# and cannot be removed through normal state removal means. Insert multiples of
# this tag to have the action cause multiple field states.
#
# <remove field state: x>
# <remove field state: x, x>
# Causes the action to remove state x from the field. This does not remove
# states that were inflicted normally. Insert multiples of this tag to remove
# multiple field states.
#
# <remove all field states>
# Causes the action to remove all field states. This does not remove states
# that were inflicted normally.
#
# <overwrite field state: x>
# <overwrite field state: x, x>
# Causes the action to remove all field states and then add field states x,
# making it apply to everyone and cannot be removed through normal state
# removal means. Insert multiples of this tag to have the action overwrite and
# add more field states.
#
# <field state x turns: +y>
# <field state x turns: -y>
# Changes the remaining turns on field state x by y amount. If a field state
# is to reach 0 or less turns through this process, the field state is removed.
# This effect does not add turns to field states that weren't inflicted. Insert
# multiples of this tag to adjust multiple field states at once.
#
# <all field state turns: +x>
# <all field state turns: -x>
# Changes the remaining turns on all field states by x amount. If a field state
# is to reach 0 or less turns through this process, the field state is removed.
#
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the states notebox in the database.
# -----------------------------------------------------------------------------
# <field back 1: string>
# <field back 2: string>
# If this state is being used as a field state and this state is the state with
# the highest priority, these notetags will determine the battlebacks used
# while the field state is in effect. If this notetag is not used, there will
# be no changes to the battleback.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module FIELD_STATES
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Visual Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This setting causes a wave effect to play whenever the battlebacks change
# due to field state effects.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
WAVE_EFFECT = true # Plays a wave effect when the battleback changes.
end # FIELD_STATES
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module USABLEITEM
ADD_FIELD_STATE =
/<(?:ADD_FIELD_STATE|add field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
REMOVE_FIELD_STATE =
/<(?:REMOVE_FIELD_STATE|remove field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
REMOVE_ALL_FIELD_STATES =
/<(?:REMOVE_ALL_FIELD_STATES|remove all field states)>/i
OVERWRITE_FIELD_STATE =
/<(?:OVERWRITE_FIELD_STATE|OVERWRITE field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
CHANGE_FIELD_STATE_TURN =
/<(?:FIELD state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
CHANGE_ALL_FIELD_STATE_TURN =
/<(?:ALL_FIELD_STATE_TURNS|all field state turns):[ ]([\+\-]\d+)>/i
end # USABLEITEM
module STATE
FIELD_BATTLEBACK1 = /<(?:FIELD_BACK1|field back1|field back 1):[ ](.*)>/i
FIELD_BATTLEBACK2 = /<(?:FIELD_BACK2|field back2|field back 2):[ ](.*)>/i
end # STATE
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_fse load_database; end
def self.load_database
load_database_fse
load_notetags_fse
end
#--------------------------------------------------------------------------
# new method: load_notetags_fse
#--------------------------------------------------------------------------
def self.load_notetags_fse
groups = [$data_skills, $data_items, $data_states]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_fse
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :add_field_state
attr_accessor :remove_field_state
attr_accessor :remove_all_field_states
attr_accessor :change_field_state_turns
#--------------------------------------------------------------------------
# common cache: load_notetags_fse
#--------------------------------------------------------------------------
def load_notetags_fse
@add_field_state = []
@remove_field_state = []
@remove_all_field_states = false
@change_field_state_turns = {}
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::ADD_FIELD_STATE
$1.scan(/\d+/).each { |num|
@add_field_state.push(num.to_i) if num.to_i > 0 }
when YEA::REGEXP::USABLEITEM::REMOVE_FIELD_STATE
$1.scan(/\d+/).each { |num|
@remove_field_state.push(num.to_i) if num.to_i > 0 }
when YEA::REGEXP::USABLEITEM::REMOVE_ALL_FIELD_STATES
@remove_all_field_states = true
when YEA::REGEXP::USABLEITEM::OVERWRITE_FIELD_STATE
@remove_all_field_states = true
$1.scan(/\d+/).each { |num|
@add_field_state.push(num.to_i) if num.to_i > 0 }
when YEA::REGEXP::USABLEITEM::CHANGE_FIELD_STATE_TURN
@change_field_state_turns[$1.to_i] = $2.to_i
when YEA::REGEXP::USABLEITEM::CHANGE_ALL_FIELD_STATE_TURN
for i in 1...$data_states.size
@change_field_state_turns = $1.to_i
end
end
} # self.note.split
#---
end
end # class RPG::UsableItem
#==============================================================================
# ■ RPG::State
#==============================================================================
class RPG::State < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :field_battlebacks
#--------------------------------------------------------------------------
# common cache: load_notetags_fse
#--------------------------------------------------------------------------
def load_notetags_fse
@field_battlebacks = ["", ""]
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::STATE::FIELD_BATTLEBACK1
@field_battlebacks[0] = $1.to_s
when YEA::REGEXP::STATE::FIELD_BATTLEBACK2
@field_battlebacks[1] = $1.to_s
end
} # self.note.split
#---
end
end # RPG::State
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# alias method: init_members
#--------------------------------------------------------------------------
class <<self; alias battlemanager_init_members_fse init_members; end
def self.init_members
battlemanager_init_members_fse
clear_field_states
end
#--------------------------------------------------------------------------
# new method: field_states
#--------------------------------------------------------------------------
def self.field_states
return @field_states.collect {|id| $data_states[id] }
end
#--------------------------------------------------------------------------
# new method: field_state_turns
#--------------------------------------------------------------------------
def self.field_state_turns(state_id)
return @field_state_turns[state_id]
end
#--------------------------------------------------------------------------
# new method: field_state?
#--------------------------------------------------------------------------
def self.field_state?(state_id)
return @field_states.include?(state_id)
end
#--------------------------------------------------------------------------
# new method: sort_field_states
#--------------------------------------------------------------------------
def self.sort_field_states
@field_states = @field_states.sort_by { |id|
[-$data_states[id].priority, id] }
set_field_battlebacks
set_field_state_icons
end
#--------------------------------------------------------------------------
# new method: clear_field_states
#--------------------------------------------------------------------------
def self.clear_field_states
@field_states = []
@field_state_turns = {}
@field_state_battleback = ["", ""]
@field_state_icons = []
end
#--------------------------------------------------------------------------
# new method: add_field_state
#--------------------------------------------------------------------------
def self.add_field_state(state_id)
return if $data_states[state_id].nil?
return if @field_states.include?(state_id)
@field_states.push(state_id)
state = $data_states[state_id]
variance = 1 + [state.max_turns - state.min_turns, 0].max
@field_state_turns[state_id] = state.min_turns + rand(variance)
sort_field_states
end
#--------------------------------------------------------------------------
# new method: remove_field_state
#--------------------------------------------------------------------------
def self.remove_field_state(state_id)
return if $data_states[state_id].nil?
return unless @field_states.include?(state_id)
@field_states.delete(state_id)
@field_state_turns.delete(state_id)
sort_field_states
end
#--------------------------------------------------------------------------
# new method: change_field_state_turns
#--------------------------------------------------------------------------
def self.change_field_state_turns(state_id, value)
return unless field_state?(state_id)
state_id = state_id.id if state_id.is_a?(RPG::State)
return if $data_states[state_id].auto_removal_timing <= 0
@field_state_turns[state_id] = 0 if @field_state_turns[state_id].nil?
@field_state_turns[state_id] = [value, 0].max
remove_field_state(state_id) if @field_state_turns[state_id] <= 0
end
#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
class <<self; alias battlemanager_turn_end_fse turn_end; end
def self.turn_end
battlemanager_turn_end_fse
update_field_states
remove_field_states_auto
end
#--------------------------------------------------------------------------
# new method: update_field_states
#--------------------------------------------------------------------------
def self.update_field_states
for state_id in @field_states
next unless @field_state_turns[state_id] > 0
@field_state_turns[state_id] -= 1
end
end
#--------------------------------------------------------------------------
# new method: remove_field_states_auto
#--------------------------------------------------------------------------
def self.remove_field_states_auto
for state_id in @field_states
next if $data_states[state_id].auto_removal_timing <= 0
remove_field_state(state_id) if @field_state_turns[state_id] <= 0
end
end
#--------------------------------------------------------------------------
# new method: field_battlebacks
#--------------------------------------------------------------------------
def self.field_battlebacks
return @field_state_battleback
end
#--------------------------------------------------------------------------
# new method: set_field_battlebacks
#--------------------------------------------------------------------------
def self.set_field_battlebacks
@field_state_battleback = ["", ""]
for state in field_states
next if state.field_battlebacks == ["", ""]
@field_state_battleback = state.field_battlebacks
return
end
end
#--------------------------------------------------------------------------
# new method: field_state_icons
#--------------------------------------------------------------------------
def self.field_state_icons
return @field_state_icons
end
#--------------------------------------------------------------------------
# new method: set_field_state_icons
#--------------------------------------------------------------------------
def self.set_field_state_icons
icons = field_states.collect {|state| state.icon_index }
icons.delete(0)
@field_state_icons = icons
end
end # BattleManager
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :anti_field_states
#--------------------------------------------------------------------------
# alias method: states
#--------------------------------------------------------------------------
alias game_battlerbase_states_fse states
def states
result = game_battlerbase_states_fse
result |= field_states unless @anti_field_states
return result
end
#--------------------------------------------------------------------------
# new method: field_states
#--------------------------------------------------------------------------
def field_states
return [] unless SceneManager.scene_is?(Scene_Battle)
return BattleManager.field_states
end
#--------------------------------------------------------------------------
# alias method: state?
#--------------------------------------------------------------------------
alias game_battlerbase_state_fse state?
def state?(state_id)
return true if field_states.include?($data_states[state_id])
return game_battlerbase_state_fse(state_id)
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
alias game_battler_item_apply_fse item_apply
def item_apply(user, item)
game_battler_item_apply_fse(user, item)
apply_field_state_effect(item)
end
#--------------------------------------------------------------------------
# new method: apply_field_state_effect
#--------------------------------------------------------------------------
def apply_field_state_effect(item)
return if item.nil?
return unless $game_party.in_battle
return unless SceneManager.scene_is?(Scene_Battle)
return @result.success = true if item.add_field_state != []
return @result.success = true if item.remove_field_state != []
return @result.success = true if item.remove_all_field_states
for key in item.change_field_state_turns
return @result.success = true if BattleManager.field_state?(key[0])
end
end
#--------------------------------------------------------------------------
# alias method: on_restrict
#--------------------------------------------------------------------------
alias game_battler_on_restrict_fse on_restrict
def on_restrict
@anti_field_states = true
game_battler_on_restrict_fse
@anti_field_states = nil
end
#--------------------------------------------------------------------------
# alias method: update_state_turns
#--------------------------------------------------------------------------
alias game_battler_update_state_turns_fse update_state_turns
def update_state_turns
@anti_field_states = true
game_battler_update_state_turns_fse
@anti_field_states = nil
end
#--------------------------------------------------------------------------
# alias method: remove_battle_states
#--------------------------------------------------------------------------
alias game_battler_remove_battle_states_fse remove_battle_states
def remove_battle_states
@anti_field_states = true
game_battler_remove_battle_states_fse
@anti_field_states = nil
end
#--------------------------------------------------------------------------
# alias method: remove_states_auto
#--------------------------------------------------------------------------
alias game_battler_remove_states_auto_fse remove_states_auto
def remove_states_auto(timing)
@anti_field_states = true
game_battler_remove_states_auto_fse(timing)
@anti_field_states = nil
end
#--------------------------------------------------------------------------
# alias method: remove_states_by_damage
#--------------------------------------------------------------------------
alias game_battler_remove_states_by_damage_fse remove_states_by_damage
def remove_states_by_damage
@anti_field_states = true
game_battler_remove_states_by_damage_fse
@anti_field_states = nil
end
end # Game_Battler
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# alias method: create_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_create_viewports_fse create_viewports
def create_viewports
spriteset_battle_create_viewports_fse
create_field_state_effect
end
#--------------------------------------------------------------------------
# new method: create_field_state_effect
#--------------------------------------------------------------------------
def create_field_state_effect
@field_state_battleback = ["", ""]
@field_state_effect_sprite1 = Sprite.new(@viewport1)
@field_state_effect_sprite1.bitmap = Bitmap.new(640, 480)
@field_state_effect_sprite1.opacity = 0
@field_state_effect_sprite1.z = 3
@field_state_effect_sprite2 = Sprite.new(@viewport1)
@field_state_effect_sprite2.bitmap = Bitmap.new(640, 480)
@field_state_effect_sprite2.opacity = 0
@field_state_effect_sprite2.z = 4
end
#--------------------------------------------------------------------------
# alias method: dispose
#--------------------------------------------------------------------------
alias spriteset_battle_dispose_fse dispose
def dispose
dispose_field_state_effect
spriteset_battle_dispose_fse
end
#--------------------------------------------------------------------------
# new method: dispose_field_state_effect
#--------------------------------------------------------------------------
def dispose_field_state_effect
@field_state_effect_sprite1.bitmap.dispose
@field_state_effect_sprite1.dispose
@field_state_effect_sprite2.bitmap.dispose
@field_state_effect_sprite2.dispose
end
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias spriteset_battle_update_fse update
def update
update_field_state_effect
spriteset_battle_update_fse
end
#--------------------------------------------------------------------------
# new method: update_field_state_effect
#--------------------------------------------------------------------------
def update_field_state_effect
update_field_battleback_images
update_field_battleback_opacity
#---
@field_state_effect_sprite1.update
@field_state_effect_sprite2.update
end
#--------------------------------------------------------------------------
# new method: update_field_battleback_images
#--------------------------------------------------------------------------
def update_field_battleback_images
return if @field_state_battleback == BattleManager.field_battlebacks
@field_state_battleback = BattleManager.field_battlebacks.clone
change_field_battleback_images
end
#--------------------------------------------------------------------------
# new method: change_field_battleback_images
#--------------------------------------------------------------------------
def change_field_battleback_images
#---
@field_state_effect_sprite1.bitmap.dispose
@field_state_effect_sprite1.bitmap = @back1_sprite.bitmap.clone
@field_state_effect_sprite1.opacity = 255
@field_state_effect_sprite1.wave_amp = 0
center_sprite(@field_state_effect_sprite1)
#---
@field_state_effect_sprite2.bitmap.dispose
@field_state_effect_sprite2.bitmap = @back2_sprite.bitmap.clone
@field_state_effect_sprite2.opacity = 255
@field_state_effect_sprite2.wave_amp = 0
center_sprite(@field_state_effect_sprite2)
#---
if YEA::FIELD_STATES::WAVE_EFFECT
@field_state_effect_sprite1.wave_amp = 16
@field_state_effect_sprite2.wave_amp = 16
end
#---
@back1_sprite.bitmap.dispose
@back2_sprite.bitmap.dispose
if BattleManager.field_battlebacks == ["", ""]
bb1 = battleback1_bitmap
bb2 = battleback2_bitmap
else
bb1 = Cache.battleback1(BattleManager.field_battlebacks[0])
bb2 = Cache.battleback2(BattleManager.field_battlebacks[1])
end
@back1_sprite.bitmap = bb1
@back2_sprite.bitmap = bb2
center_sprite(@back1_sprite)
center_sprite(@back2_sprite)
end
#--------------------------------------------------------------------------
# new method: update_field_battleback_opacity
#--------------------------------------------------------------------------
def update_field_battleback_opacity
return if @field_state_effect_sprite1.opacity <= 0
@field_state_effect_sprite1.opacity -= 1
@field_state_effect_sprite2.opacity -= 1
end
end # Spriteset_Battle
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: use_item
#--------------------------------------------------------------------------
alias scene_battle_use_item_fse use_item
def use_item
item = @subject.current_action.item
scene_battle_use_item_fse
apply_field_state_effects(item)
end
#--------------------------------------------------------------------------
# new method: apply_field_state_effects
#--------------------------------------------------------------------------
def apply_field_state_effects(item)
return if item.nil?
remove_all_field_state_effects(item)
remove_field_state_effects(item)
add_field_state_effects(item)
change_field_state_turns(item)
refresh_all_battlers
end
#--------------------------------------------------------------------------
# new method: remove_all_field_state_effects
#--------------------------------------------------------------------------
def remove_all_field_state_effects(item)
return unless item.remove_all_field_states
BattleManager.clear_field_states
end
#--------------------------------------------------------------------------
# new method: remove_field_state_effects
#--------------------------------------------------------------------------
def remove_field_state_effects(item)
return if BattleManager.field_states == []
return if item.remove_field_state == []
for state_id in item.remove_field_state
BattleManager.remove_field_state(state_id)
end
end
#--------------------------------------------------------------------------
# new method: add_field_state_effects
#--------------------------------------------------------------------------
def add_field_state_effects(item)
return if item.add_field_state == []
for state_id in item.add_field_state
BattleManager.add_field_state(state_id)
end
end
#--------------------------------------------------------------------------
# new method: change_field_state_turns
#--------------------------------------------------------------------------
def change_field_state_turns(item)
return if item.change_field_state_turns == {}
for key in item.change_field_state_turns
state_id = key[0]
next unless BattleManager.field_state?(state_id)
next unless $data_states[state_id].auto_removal_timing > 0
turns = BattleManager.field_state_turns(state_id)
BattleManager.change_field_state_turns(state_id, turns + key[1])
end
end
#--------------------------------------------------------------------------
# new method: change_field_state_turns
#--------------------------------------------------------------------------
def refresh_all_battlers
all_battle_members.each { |battler| battler.refresh }
@status_window.refresh
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
结尾脚本
[pre lang="ruby"]#==============================================================================
# ■ VX-RGSS2-24 エンディング [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# エンディング(スタッフロール)の雛型です
# あくまで雛形なので、自分で納得がいくように改造してください。
#
# 表示順:製作者等表示 → ~Fin~表示
# (→クリアデータをセーブ)→ タイトルor強制終了
#
# 画像パス:Graphics/Pictures
#------------------------------------------------------------------------------
#【呼び出し】
# SceneManager.goto(Scene_Ending)
#==============================================================================
#==============================================================================
# □ カスタマイズ ~START~
#==============================================================================
module Ending
# エンディング後はタイトルに戻す(false:強制終了)
BACKTO_TITLE = true
# クリアデータセーブを行う?
CLRED_SAVE = false
# クリアデータ上でONにするスイッチ
CLRED_SWITCH = 10
# ボタン押下時にエンディングスキップ
ON_SKIP = true
# 画像表示位置
# 0 : 画像いっぱい
# 1 : 特定位置へ表示
# 2 : 特定矩形へ表示
G_TYPE = 1
# 画像表示位置 [x, y] <G_TYPE=1>
G_POS = [0, 0]
# 画像表示矩形 <G_TYPE=2>
G_RECT = Rect.new(10, 100, 200, 200)
# シーン番号ごとの切り替え間隔(frame数)
SC_WAIT = 60 * 3
# シーン切り替え演出
# 0 : 演出なし
# 1 : トランジション(フェード)を挟む
SC_EFFECT = 1
# ~FIN~表示位置 [x, y]
FIN_POS = [Graphics.width - 600, Graphics.height - 420]
# ~FIN~時のウェイト(nil:ボタンが押されるまでウェイト)
FIN_WAIT = 60 * 5
end
#==============================================================================
# ■ シーン制御設定
#==============================================================================
class Scene_Ending < Scene_Base
include Ending
#--------------------------------------------------------------------------
# ● エンドミュージック
# n : シーン番号
#--------------------------------------------------------------------------
def end_music(n=0)
case n
when 0 # 最初のBGM
return RPG::BGM.new("Theme3")
when -1 # Fin時のBGM
return RPG::BGM.new("Scene5", 80, 80)
end
return nil
end
#--------------------------------------------------------------------------
# ● エンド背景
# n : シーン番号 (-1:Fin画像)
#--------------------------------------------------------------------------
def end_graphic(n=0)
case n
when 0 # 最初の画像
return Cache.picture("Mountains5")
when -1 # Fin画像
return Cache.picture("Fin")
when -2 # Fin画像2
return Cache.picture("StarlitSky")
#~ when 3 # (例) 途中で画像をチェンジ
#~ return Cache.picture("Ocean1")
end
return nil
end
#--------------------------------------------------------------------------
# ★ エンディングロール処理
# n : シーン番号
#--------------------------------------------------------------------------
TEXTS = [
# ["役割", "名前", "付属情報", …]
["作者", "光明魔法灵"],
["特别合伙人", "风"],
["开场音楽", "GILIGI EYE",],
["游戏中音乐", "默认的VA音乐"],
["出场人物", "\\n[11]", "\\n[12]", "\\n[13]", "\\n[14]", "\\n[15]", "\\n[16]", "\\n[17]", "\\n[18]", "\\n[19]", "\\n[20]", "\\n[21]"],
["特别穿插", "火影人物类", "火影忍术创作", "火影人物穿插", "火影奥义"]
]
def update_ending(n)
play_music(n) # BGM演奏
redraw_end_graphic(n) # 画像描画
draw_text(10, 10, TEXTS[n]) # テキスト描画
end
#--------------------------------------------------------------------------
# ● Fin表示
#--------------------------------------------------------------------------
def finish
play_music(-1)
clear_graphic
#~ draw_graphic(end_graphic_rect(-2, 0), -2) # 背景
draw_graphic(end_graphic_rect(-1, 1, FIN_POS[0], FIN_POS[1]), -1)
end
end
#==============================================================================
# □ カスタマイズ ~END~
#==============================================================================
#==============================================================================
# ■ 汎用メソッド ★部分で使用する
#==============================================================================
class Scene_Ending < Scene_Base
#--------------------------------------------------------------------------
# ● ミュージック演奏
# n : シーン番号
#--------------------------------------------------------------------------
def play_music(n=0)
music = end_music(n)
return if music.nil?
music.play
end
#--------------------------------------------------------------------------
# ● エンド背景の描画先矩形
# n : シーン番号
#--------------------------------------------------------------------------
def end_graphic_rect(n=0, type=G_TYPE, x=G_POS[0], y=G_POS[1])
case type
when 0 # 画面いっぱいに描画
return @viewport.rect
when 1 # アスペクト比を維持して特定位置に描画
return Rect.new(x, y, end_graphic(n).width, end_graphic(n).height)
when 2 # 特定矩形に収まるように描画
return G_RECT
end
end
#--------------------------------------------------------------------------
# ● 画像描画
# rect : 描画先矩形
# n : シーン番号
#--------------------------------------------------------------------------
def draw_graphic(rect, n=0)
graphic = end_graphic(n)
src_rect = Rect.new
src_rect.width = graphic.width
src_rect.height = graphic.height
@sprite.bitmap.stretch_blt(rect, graphic, src_rect)
end
#--------------------------------------------------------------------------
# ● 画像領域消去
# rect : 消去矩形
#--------------------------------------------------------------------------
def clear_graphic(rect=@viewport.rect)
@sprite.bitmap.clear_rect(rect)
end
#--------------------------------------------------------------------------
# ● シーン番号別 画像描画
#--------------------------------------------------------------------------
def draw_end_graphic(n=0, type=G_TYPE)
draw_graphic(end_graphic_rect(n, type), n)
end
#--------------------------------------------------------------------------
# ● シーン番号別 画像再描画
#--------------------------------------------------------------------------
def redraw_end_graphic(n=0, type=G_TYPE)
return if end_graphic(n).nil?
clear_graphic
draw_end_graphic(n, type)
end
#--------------------------------------------------------------------------
# ● テキスト描画
#--------------------------------------------------------------------------
def draw_text(x, y, texts)
texts.size.times do |i|
xx = (i == 0) ? x : (x+30)
@window.draw_text_ex(xx, y, texts)
y += @window.line_height
end
end
#--------------------------------------------------------------------------
# ● テキスト消去
#--------------------------------------------------------------------------
def clear_text
@window.contents.clear
end
end
#==============================================================================
# ■ シーンクラス
#==============================================================================
class Scene_Ending < Scene_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
@no = 0
@called_save = false
end
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_viewport
create_sprite
create_window
return goto_next_scene if @no >= TEXTS.size
update_ending(@no)
end
#--------------------------------------------------------------------------
# ● 画面Viewport生成
#--------------------------------------------------------------------------
def create_viewport
@viewport = Viewport.new
end
#--------------------------------------------------------------------------
# ● 画像表示用スプライト生成
#--------------------------------------------------------------------------
def create_sprite
@sprite = Sprite_Base.new(@viewport)
@sprite.bitmap = Bitmap.new(@viewport.rect.width, @viewport.rect.height)
end
#--------------------------------------------------------------------------
# ● 文字描画用ウィンドウ生成
#--------------------------------------------------------------------------
def create_window
r = @viewport.rect
@window = Window_Base.new(r.x, r.y, r.width, r.width)
@window.opacity = 0
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
def terminate
dispose_sprite
dispose_viewport
super
end
#--------------------------------------------------------------------------
# ● 画面Viewport解放
#--------------------------------------------------------------------------
def dispose_viewport
@viewport.dispose
end
#--------------------------------------------------------------------------
# ● 画像表示用スプライト解放
#--------------------------------------------------------------------------
def dispose_sprite
@sprite.dispose
end
#--------------------------------------------------------------------------
# ● 次のシーンへ
#--------------------------------------------------------------------------
def goto_next_scene
if CLRED_SAVE and !@called_save
call_save
elsif BACKTO_TITLE
SceneManager.goto(Scene_Title)
else
fadeout_all
SceneManager.exit
end
end
#--------------------------------------------------------------------------
# ● クリアデータをセーブ
#--------------------------------------------------------------------------
def call_save
$game_switches[CLRED_SWITCH] = true
@called_save = true
SceneManager.call(Scene_Save)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
update_ending_scene
end
#--------------------------------------------------------------------------
# ● フレーム更新 <シーン切り替え制御>
#--------------------------------------------------------------------------
def update_ending_scene
return goto_next_scene if @no >= TEXTS.size
update_ending(@no)
perform_transition if SC_EFFECT == 1
wait
Graphics.freeze if SC_EFFECT == 1
clear_text
@no += 1
if @no >= TEXTS.size
RPG::BGM.fade(transition_speed * 2) if
finish
Graphics.transition(transition_speed * 2) if SC_EFFECT == 1
finish_wait
end
end
#--------------------------------------------------------------------------
# ● トランジション速度の取得
#--------------------------------------------------------------------------
def transition_speed
return 30
end
#--------------------------------------------------------------------------
# ● トランジション速度の取得
#--------------------------------------------------------------------------
def skip_trigger?
Input.trigger?(:C) or Input.trigger?(:B)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update_skipwait(skip=true)
update_basic
skip and skip_trigger?
end
#--------------------------------------------------------------------------
# ● ウェイト
#--------------------------------------------------------------------------
def wait(duration=SC_WAIT)
duration.times { |i| break if update_skipwait(ON_SKIP) }
end
#--------------------------------------------------------------------------
# ● Finishウェイト
#--------------------------------------------------------------------------
def finish_wait
if FIN_WAIT.nil?
loop do update_skipwait end
else
wait(FIN_WAIT)
end
end
end
[/pre]
比较好的天气系统
[pre lang="ruby"]#screen.change_weather(13,7,0)
#-------------------------------------------------------------------------------
# MAWS - Modified Advanced Weather Script for RPG Maker VX
# Version: 1.1.
# Based on Advanced Weather Script VX by Ccoa
# Modifications created by Agckuu Coceg
#-------------------------------------------------------------------------------
# Thanks DerWulfman to his help with VX version of script.
#-------------------------------------------------------------------------------
# Weather Types:
# 1 - 雨 (Ccoa)
# 2 - 风暴 (Ccoa)
# 3 - 雪 (Ccoa)
# 4 - 冰雹 (Ccoa)
# 5 - 雷阵雨 (Ccoa)
# 6 - 下降棕色叶子 (Ccoa)
# 7 - 吹棕色叶子 (Ccoa)
# 8 - 袅袅棕色叶子 (Ccoa)
# 9 - 下降绿色叶子 (Ccoa)
# 10 - 樱花(樱)花瓣 (Ccoa)
# 11 - 玫瑰花瓣 (Ccoa)
# 12 - 羽毛 (Ccoa)
# 13 - 血雨 (Ccoa)
# 14 - 火花 (Ccoa)
# 15 - 用户自定义
# 16 - 吹雪 (Ccoa)
# 17 - 流星雨 (Ccoa)
# 18 - 落灰 (Ccoa)
# 19 - 气泡 (Ccoa)
# 20 - 气泡 2 (Ccoa)
# 21 - 火花上升 (Ccoa)
#-------------------------------------------------------------------------------
# Version 1.0 addons
#-------------------------------------------------------------------------------
# Leaves effects:
# 22 - 吹绿叶 (Agckuu Coceg)
# 23 - 袅袅的绿叶 (Agckuu Coceg)
# 24 - 下降的黄叶 (Agckuu Coceg)
# 25 - 吹黄叶 (Agckuu Coceg)
# 26 - 袅袅的黄叶 (Agckuu Coceg)
# Rain effects:
# 27 - 石油雨 (Agckuu Coceg)
# 28 - 金雨 (Agckuu Coceg)
# Special effects:
# 29 - 火焰流星雨 (Agckuu Coceg)
#-------------------------------------------------------------------------------
# Version 1.1 addons
#-------------------------------------------------------------------------------
# Starburst effects addons:
# 30 - 彩色星暴 v.2 (replaced Color Starburst)(Agckuu Coceg)
# 31 - 升级版彩色星暴 v.2 (replaced Uprising color Starburst)
# (Agckuu Coceg)
# 32 - 彩色星暴雨 v.2 (replaced Color Starburst rain)(Agckuu Coceg)
# 33 - 单色暴 (Agckuu Coceg)
# 34 - 升级版单色暴 (Agckuu Coceg)
# 35 - 单色暴雨 (Agckuu Coceg)
# Rain effects:
# 36 - 金雨雷电和闪光 (Agckuu Coceg)
# 37 - 金色风暴 (Agckuu Coceg)
# 38 - 石油风暴 (Agckuu Coceg)
# 39 - 酸雨 (Agckuu Coceg)
# 40 - 酸雨闪电和闪光 (Agckuu Coceg)
# 41 - 酸雨风暴 (Agckuu Coceg)
# 42 - 棕褐色雨 (Agckuu Coceg)
# 43 - 棕褐色雨闪电和闪光 (Agckuu Coceg)
# 44 - 棕褐色雨风暴 (Agckuu Coceg)
# 45 - 现实风暴 (Agckuu Coceg)
# 46 - 血雨赤红的闪电和雷声 (Agckuu Coceg)
# 47 - 血雨风暴 (Agckuu Coceg)
# 48 - 血暴雪 (Agckuu Coceg)
# New leaves effects:
# 49 - 下降红枫叶 (Agckuu Coceg)
# 50 - 吹红枫叶 (Agckuu Coceg)
# 51 - 袅袅的红枫叶 (Agckuu Coceg)
# Special effects:
# 52 - 水弹 (Agckuu Coceg)
# 53 - 冰弹 (Agckuu Coceg)
# 54 - 照明弹 (Agckuu Coceg)
#-------------------------------------------------------------------------------
# Weather Power:
# An integer from 0-40. 0 = no weather, 40 = 400 sprites
#-------------------------------------------------------------------------------
# Usage:
# Create a call script with the following: screen.weather(type, power, hue)
#-------------------------------------------------------------------------------
# Usage of user-defined weather. Look at the following globals:
$WEATHER_UPDATE = false # the $WEATHER_IMAGES array has changed, please update
$WEATHER_IMAGES = [] # the array of picture names to use
$WEATHER_X = 0 # the number of pixels the image should move horizontally (positive = right, negative = left)
$WEATHER_Y = 0 # the number of pizels the image should move vertically (positive = down, negative = up)
$WEATHER_FADE = 0 # how much the image should fade each update (0 = no fade, 255 = fade instantly)
$WEATHER_ANIMATED = true # whether or not the image should cycle through all the images
# Take these out if you are using screen resolution script of Ccoa.
HEIGHT = 416
WIDTH = 544
#==============================================================================
# ** Spriteset_Weather
#------------------------------------------------------------------------------
class Spriteset_Weather
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :type
attr_reader :power
attr_reader :ox
attr_reader :oy
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(viewport = nil)
@type = 0
@power = 0
@ox = 0
@oy = 0
@count = 0
@current_pose = []
@info = []
@countarray = []
make_bitmaps
@sprites = []
for i in 1..500
sprite = Sprite.new(viewport)
sprite.visible = false
sprite.opacity = 0
@sprites.push(sprite)
@current_pose.push(0)
@info.push(rand(50))
@countarray.push(rand(15))
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
for sprite in @sprites
sprite.dispose
end
@rain_bitmap.dispose
@storm_bitmap.dispose
@snow_bitmap.dispose
@hail_bitmap.dispose
@petal_bitmap.dispose
@blood_rain_bitmap.dispose
@oil_rain_bitmap.dispose
@golden_rain_bitmap.dispose
@golden_storm_bitmap.dispose
@acid_rain_bitmap.dispose
@acid_storm_bitmap.dispose
@sepia_rain_bitmap.dispose
@sepia_storm_bitmap.dispose
@blood_storm_bitmap.dispose
@bloodblizz_bitmap.dispose
@meteor_bitmap.dispose
@flame_meteor_bitmap.dispose
@waterbomb_bitmap.dispose
@icybomb_bitmap.dispose
@flarebomb_bitmap.dispose
for image in @autumn_leaf_bitmaps
image.dispose
end
for image in @green_leaf_bitmaps
image.dispose
end
for image in @yellow_leaf_bitmaps
image.dispose
end
for image in @redmaple_leaf_bitmaps
image.dispose
end
for image in @rose_bitmaps
image.dispose
end
for image in @feather_bitmaps
image.dispose
end
for image in @sparkle_bitmaps
image.dispose
end
for image in @starburst_bitmaps
image.dispose
end
for image in @monostarburst_bitmaps
image.dispose
end
for image in @user_bitmaps
image.dispose
end
$WEATHER_UPDATE = true
end
#--------------------------------------------------------------------------
# * Set weather type
# type : new weather type
#--------------------------------------------------------------------------
def type=(type)
return if @type == type
@type = type
case @type
when 1 # rain
bitmap = @rain_bitmap
when 2 # storm
bitmap = @storm_bitmap
when 3 # snow
bitmap = @snow_bitmap
when 4 # hail
bitmap = @hail_bitmap
when 5 # rain w/ thunder and lightning
bitmap = @rain_bitmap
@thunder = true
when 6 # falling autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 7 # blowing autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 8 # swirling autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 9 # falling green leaves
bitmap = @green_leaf_bitmaps[0]
when 10 # sakura petals
bitmap = @petal_bitmap
when 11 # rose petals
bitmap = @rose_bitmaps[0]
when 12 # feathers
bitmap = @feather_bitmaps[0]
when 13 # blood rain
bitmap = @blood_rain_bitmap
when 14 # sparkles
bitmap = @sparkle_bitmaps[0]
when 15 # user-defined
bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
when 16 # blowing snow
bitmap = @snow_bitmap
when 17 # meteors
bitmap = @meteor_bitmap
when 18 # falling ash
bitmap = @ash_bitmaps[rand(@ash_bitmaps.size)]
when 19 # bubbles
bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
when 21 # sparkles up
bitmap = @sparkle_bitmaps[0]
when 22 # blowing green leaves
bitmap = @green_leaf_bitmaps[0]
when 23 # swirling green leaves
bitmap = @green_leaf_bitmaps[0]
when 24 # falling yellow leaves
bitmap = @yellow_leaf_bitmaps[0]
when 25 # blowing yellow leaves
bitmap = @yellow_leaf_bitmaps[0]
when 26 # swirling yellow leaves
bitmap = @yellow_leaf_bitmaps[0]
when 27 # oil rain
bitmap = @oil_rain_bitmap
when 28 # golden rain
bitmap = @golden_rain_bitmap
when 29 # flame meteors
bitmap = @flame_meteor_bitmap
when 30 # starburst
bitmap = @starburst_bitmaps[0]
when 31 # uprising starburst
bitmap = @starburst_bitmaps[0]
when 32 # starburst rain
bitmap = @starburst_bitmaps[0]
when 33 # mono-starburst
bitmap = @monostarburst_bitmaps[0]
when 34 # uprising mono-starburst
bitmap = @monostarburst_bitmaps[0]
when 35 # mono-starburst rain
bitmap = @monostarburst_bitmaps[0]
when 36 # Golden rain w\ thunder and ligthning
bitmap = @golden_rain_bitmap
@golden_thunder = true
when 37 # Golden storm
bitmap = @golden_storm_bitmap
when 38 # Oil storm
bitmap = @oil_storm_bitmap
when 39 # # Acid rain
bitmap = @acid_rain_bitmap
when 40 # Acid rain w\thunder and lightning
bitmap = @acid_rain_bitmap
@acid_thunder = true
when 41 # Acid storm
bitmap = @acid_storm_bitmap
when 42 # Sepia rain
bitmap = @sepia_rain_bitmap
when 43 # Sepia rain w\ thunder and lightning
bitmap = @sepia_rain_bitmap
@sepia_thunder = true
when 44 # Sepia storm
bitmap = @sepia_storm_bitmap
when 45 # Realistic storm
bitmap = @storm_bitmap
@real_storm = true
when 46 # Blood rain w\ thunder and lightning
bitmap = @blood_rain_bitmap
@crimson_thunder = true
when 47 # Blood storm
bitmap = @blood_storm_bitmap
when 48 # Blood blizzard
bitmap = @bloodblizz_bitmap
when 49 # Falling red maple leaves
bitmap = @redmaple_leaf_bitmaps[0]
when 50 # Blowing red maple leaves
bitmap = @redmaple_leaf_bitmaps[0]
when 51 # Swirling red maple leaves
bitmap = @redmaple_leaf_bitmaps[0]
when 52
bitmap = @waterbomb_bitmaps
when 53
bitmap = @icybomb_bitmaps
when 54
bitmap = @flarebomb_bitmaps
else
bitmap = nil
end
if @type != 5
@thunder = false
end
if @type != 36
@golden_thunder = false
end
if @type != 40
@acid_thunder = false
end
if @type != 43
@sepia_thunder = false
end
if @type != 45
@real_storm = false
end
if @type != 46
@crimson_thunder = false
end
for i in 0...@sprites.size
sprite = @sprites
sprite.visible = (i <= @power)
if @type == 19
sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
elsif @type == 20
sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
elsif @type == 3
r = rand(@snow_bitmaps.size)
@info = r
sprite.bitmap = @snow_bitmaps[r]
else
sprite.bitmap = bitmap
end
end
end
#--------------------------------------------------------------------------
# * Set starting point X coordinate
# ox : starting point X coordinate
#--------------------------------------------------------------------------
def ox=(ox)
return if @ox == ox;
@ox = ox
for sprite in @sprites
sprite.ox = @ox
end
end
#--------------------------------------------------------------------------
# * Set starting point Y coordinate
# oy : starting point Y coordinate
#--------------------------------------------------------------------------
def oy=(oy)
return if @oy == oy;
@oy = oy
for sprite in @sprites
sprite.oy = @oy
end
end
#--------------------------------------------------------------------------
# * Set maximum number of sprites
# max : maximum number of sprites
#--------------------------------------------------------------------------
def power=(power)
@power = power
for i in 1..40
sprite = @sprites
sprite.visible = (i <= @power) if sprite != nil
if @type == 19
sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
elsif @type == 20
sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
elsif @type == 3
r = rand(@snow_bitmaps.size)
@info = r
sprite.bitmap = @snow_bitmaps[r]
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
return if @type == 0
for i in 1..@power
sprite = @sprites
if @type == 1 or @type == 5 or @type == 13 or @type == 27 or @type == 28 or @type == 36 or @type == 39 or @type == 40 or @type == 42 or @type == 43 or @type == 46 #rain
if sprite.opacity <= 150
if @current_pose == 0
sprite.y += @rain_bitmap.height
sprite.x -= @rain_bitmap.width
if @type == 1 or @type == 5
sprite.bitmap = @rain_splash
else
sprite.bitmap = @blood_rain_splash
end
if @type == 27
sprite.bitmap = @oil_rain_splash
end
if @type == 28
sprite.bitmap = @golden_rain_splash
end
if @type == 36
sprite.bitmap = @golden_rain_splash
end
if @type == 39
sprite.bitmap = @acid_rain_splash
end
if @type == 40
sprite.bitmap = @acid_rain_splash
end
if @type == 42
sprite.bitmap = @sepia_rain_splash
end
if @type == 43
sprite.bitmap = @sepia_rain_splash
end
if @type == 46
sprite.bitmap = @blood_rain_splash
end
@current_pose = 1
end
else
if @current_pose == 1
if @type == 1 or @type == 5
sprite.bitmap = @rain_bitmap
else
sprite.bitmap = @blood_rain_bitmap
end
if @type == 27
sprite.bitmap = @oil_rain_bitmap
end
if @type == 28
sprite.bitmap = @golden_rain_bitmap
end
if @type == 36
sprite.bitmap = @golden_rain_bitmap
end
if @type == 39
sprite.bitmap = @acid_rain_bitmap
end
if @type == 40
sprite.bitmap = @acid_rain_bitmap
end
if @type == 42
sprite.bitmap = @sepia_rain_bitmap
end
if @type == 43
sprite.bitmap = @sepia_rain_bitmap
end
if @type == 46
sprite.bitmap = @blood_rain_bitmap
end
@current_pose = 0
end
sprite.x -= 2
sprite.y += 16
if @thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @golden_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @acid_thunder and (rand(5000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @sepia_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @sepia_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @crimson_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(141, 9, 9, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
end
sprite.opacity -= 8
end
if @type == 2 or @type == 37 or @type == 38 or @type == 41 or @type == 44 or @type == 45 or @type == 47 # storm
sprite.x -= 8
sprite.y += 16
sprite.opacity -= 12
end
if @real_storm and (rand(5000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
$game_map.screen.start_shake(9, 4, 5)
Audio.se_play("Audio/SE/Thunder9")
end
if @type == 3 # snow
case @info
when 0 # smallest flake, fall the slowest
sprite.y += 1
when 1
sprite.y += 3
when 2
sprite.y += 5
when 3
sprite.y += 7
end
sprite.opacity -= 3
end
if @type == 4 # hail
sprite.x -= 1
sprite.y += 18
sprite.opacity -= 15
end
if @type == 6 # falling autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @autumn_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 7 # blowing autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @autumn_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 8 # swirling autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @autumn_leaf_bitmaps.size
end
if @info != 0
if @info >= 1 and @info <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info >= 11 and @info <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info >= 17 and @info <= 20
sprite.y -= 3
elsif @info >= 21 and @info <= 30
sprite.y -= 2
sprite.x += 1
elsif @info >= 31 and @info <= 36
sprite.y -= 1
sprite.x += 3
elsif @info >= 37 and @info <= 40
sprite.x += 5
elsif @info >= 41 and @info <= 46
sprite.y += 1
sprite.x += 3
elsif @info >= 47 and @info <= 58
sprite.y += 2
sprite.x += 1
elsif @info >= 59 and @info <= 64
sprite.y += 3
elsif @info >= 65 and @info <= 70
sprite.x -= 1
sprite.y += 2
elsif @info >= 71 and @info <= 81
sprite.x -= 3
sprite.y += 1
elsif @info >= 82 and @info <= 87
sprite.x -= 5
end
@info = (@info + 1) % 88
else
if rand(200) == 0
@info = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 49 # falling red maple leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @redmaple_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 50 # blowing red maple leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @redmaple_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 51 # swirling red maple leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @redmaple_leaf_bitmaps.size
end
if @info != 0
if @info >= 1 and @info <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info >= 11 and @info <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info >= 17 and @info <= 20
sprite.y -= 3
elsif @info >= 21 and @info <= 30
sprite.y -= 2
sprite.x += 1
elsif @info >= 31 and @info <= 36
sprite.y -= 1
sprite.x += 3
elsif @info >= 37 and @info <= 40
sprite.x += 5
elsif @info >= 41 and @info <= 46
sprite.y += 1
sprite.x += 3
elsif @info >= 47 and @info <= 58
sprite.y += 2
sprite.x += 1
elsif @info >= 59 and @info <= 64
sprite.y += 3
elsif @info >= 65 and @info <= 70
sprite.x -= 1
sprite.y += 2
elsif @info >= 71 and @info <= 81
sprite.x -= 3
sprite.y += 1
elsif @info >= 82 and @info <= 87
sprite.x -= 5
end
@info = (@info + 1) % 88
else
if rand(200) == 0
@info = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 9 # falling green leaves
if @countarray == 0
@current_pose = (@current_pose + 1) % @green_leaf_bitmaps.size
sprite.bitmap = @green_leaf_bitmaps[@current_pose]
@countarray = rand(15)
end
@countarray = (@countarray + 1) % 15
sprite.y += 1
end
if @type == 10 # sakura petals
if @info < 25
sprite.x -= 1
else
sprite.x += 1
end
@info = (@info + 1) % 50
sprite.y += 1
end
if @type == 11 # rose petals
@count = rand(20)
if @count == 0
sprite.bitmap = @rose_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @rose_bitmaps.size
end
if @info % 2 == 0
if @info < 10
sprite.x -= 1
elsif
sprite.x += 1
end
end
sprite.y += 1
end
if @type == 12 # feathers
if @countarray == 0
@current_pose = (@current_pose + 1) % @feather_bitmaps.size
sprite.bitmap = @feather_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
if rand(100) == 0
sprite.x -= 1
end
if rand(100) == 0
sprite.y -= 1
end
if @info < 50
if rand(2) == 0
sprite.x -= 1
else
sprite.y -= 1
end
else
if rand(2) == 0
sprite.x += 1
else
sprite.y += 1
end
end
@info = (@info + 1) % 100
end
if @type == 30 # starburst
if @countarray == 0
@current_pose = (@current_pose + 1) % @starburst_bitmaps.size
sprite.bitmap = @starburst_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 31 # starburst up
if @countarray == 0
@current_pose = (@current_pose + 1) % @starburst_bitmaps.size
sprite.bitmap = @starburst_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.y -= 1
sprite.opacity -= 1
end
if @type == 32 # starburst up
if @countarray == 0
@current_pose = (@current_pose + 1) % @starburst_bitmaps.size
sprite.bitmap = @starburst_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.x -= 2
sprite.y += 8
sprite.opacity -= 1
end
if @type == 33 # mono-starburst
if @countarray == 0
@current_pose = (@current_pose + 1) % @monostarburst_bitmaps.size
sprite.bitmap = @monostarburst_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 34 # mono-starburst up
if @countarray == 0
@current_pose = (@current_pose + 1) % @monostarburst_bitmaps.size
sprite.bitmap = @monostarburst_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.y -= 1
sprite.opacity -= 1
end
if @type == 35 # mono-starburst rain
if @countarray == 0
@current_pose = (@current_pose + 1) % @monostarburst_bitmaps.size
sprite.bitmap = @monostarburst_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.x -= 2
sprite.y += 8
sprite.opacity -= 1
end
if @type == 29 # meteors
if @countarray > 0
if rand(20) == 0
sprite.bitmap = @flame_impact_bitmap
@countarray = -5
else
sprite.x -= 6
sprite.y += 10
end
else
@countarray += 1
if @countarray == 0
sprite.bitmap = @flame_meteor_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 18 # ash
sprite.y += 2
case @countarray % 3
when 0
sprite.x -= 1
when 1
sprite.x += 1
end
end
if @type == 14 # sparkles
if @countarray == 0
@current_pose = (@current_pose + 1) % @sparkle_bitmaps.size
sprite.bitmap = @sparkle_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 15 # user-defined
if $WEATHER_UPDATE
update_user_defined
$WEATHER_UPDATE = false
end
if $WEATHER_ANIMATED and @countarray == 0
@current_pose = (@current_pose + 1) % @user_bitmaps.size
sprite.bitmap = @user_bitmaps[@current_pose]
end
sprite.x += $WEATHER_X
sprite.y += $WEATHER_Y
sprite.opacity -= $WEATHER_FADE
end
if @type == 16 # blowing snow
sprite.x -= 10
sprite.y += 6
sprite.opacity -= 4
end
if @type == 48 # blood blizzard
sprite.x -= 10
sprite.y += 6
sprite.opacity -= 4
end
if @type == 52 # water bombs
if @countarray > 0
if rand(20) == 0
sprite.bitmap = @waterbomb_impact_bitmap
@countarray = -5
else
sprite.x -= 3
sprite.y += 5
end
else
@countarray += 1
if @countarray == 0
sprite.bitmap = @waterbomb_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 53 # icy bombs
if @countarray > 0
if rand(20) == 0
sprite.bitmap = @icybomb_impact_bitmap
@countarray = -5
else
sprite.x -= 3
sprite.y += 5
end
else
@countarray += 1
if @countarray == 0
sprite.bitmap = @icybomb_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 54 # flare bombs
if @countarray > 0
if rand(20) == 0
sprite.bitmap = @flarebomb_impact_bitmap
@countarray = -5
else
sprite.x -= 3
sprite.y += 5
end
else
@countarray += 1
if @countarray == 0
sprite.bitmap = @flarebomb_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 17 # meteors
if @countarray > 0
if rand(20) == 0
sprite.bitmap = @impact_bitmap
@countarray = -5
else
sprite.x -= 6
sprite.y += 10
end
else
@countarray += 1
if @countarray == 0
sprite.bitmap = @meteor_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 18 # ash
sprite.y += 2
case @countarray % 3
when 0
sprite.x -= 1
when 1
sprite.x += 1
end
end
if @type == 19 or @type == 20 # bubbles
switch = rand(75) + rand(75) + 1
if @info < switch / 2
sprite.x -= 1
else
sprite.x += 1
end
@info = (@info + 1) % switch
sprite.y -= 1
if switch % 2 == 0
sprite.opacity -= 1
end
end
if @type == 21 # sparkles up
if @countarray == 0
@current_pose = (@current_pose + 1) % @sparkle_bitmaps.size
sprite.bitmap = @sparkle_bitmaps[@current_pose]
end
@countarray = (@countarray + 1) % 15
sprite.y -= 1
sprite.opacity -= 1
end
if @type == 24 # falling yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 22 # blowing green leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @green_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @green_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 23 # swirling green leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @green_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @green_leaf_bitmaps.size
end
if @info != 0
if @info >= 1 and @info <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info >= 11 and @info <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info >= 17 and @info <= 20
sprite.y -= 3
elsif @info >= 21 and @info <= 30
sprite.y -= 2
sprite.x += 1
elsif @info >= 31 and @info <= 36
sprite.y -= 1
sprite.x += 3
elsif @info >= 37 and @info <= 40
sprite.x += 5
elsif @info >= 41 and @info <= 46
sprite.y += 1
sprite.x += 3
elsif @info >= 47 and @info <= 58
sprite.y += 2
sprite.x += 1
elsif @info >= 59 and @info <= 64
sprite.y += 3
elsif @info >= 65 and @info <= 70
sprite.x -= 1
sprite.y += 2
elsif @info >= 71 and @info <= 81
sprite.x -= 3
sprite.y += 1
elsif @info >= 82 and @info <= 87
sprite.x -= 5
end
@info = (@info + 1) % 88
else
if rand(200) == 0
@info = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 24 # falling yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 25 # blowing yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose + 1) % @yellow_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 26 # swirling yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose]
@current_pose = (@current_pose | |