#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ Battle Difficulty - KGC_BattleDifficulty Ace
#_/ ◇ Last Update: 2008/05/09 ◇
#_/ ◇ Converted: 2012/09/06
#_/ ◆ Translation by Mr. Anonymous ◆
#_/ ◇ Converted by Tsukihime
#_/----------------------------------------------------------------------------
#_/ This script adds battle difficulty settings to your game.
#_/============================================================================
#_/ Installation: Insert below KGC_ExtraDropItem and KGC_CustomMenuCommand.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================#
# ★ Customization ★ #
#==============================================================================#
module KGC
module BattleDifficulty
# ◆ Difficulty Variable ◆
# Change the variable the difficulty setting is stored in.
DIFFICULTY_VARIABLE = 944
# ◆ Add Difficulty Command to Main Menu ◆
# This toggle enables/disables the difficulty command selection to be added
# to the main command menu.
USE_MENU_DIFFICULTY_COMMAND = true
# ◆ Difficulty Initialization ◆
# DIFFICULTY Index
# By default, 1 = Normal
INITIAL_DIFFICULTY = 1
# ◆ Difficulty ◆
# Difficulty Format:
# DIFFICULTY << {
# :name => "Difficulty Name",
# :maxhp => MaxHP,
# :maxmp => MaxMP,
# :atk => Attack,
# :def => Defense,
# :mat => Magic Attack,
# :mdf => Magic Defense,
# :agi => Agility,
# :luk => Luck
# :param => Attack ・ Defense ・ Mat, Mdf ・ Agility, Luck (Batch Specification),
# :exp => Experience,
# :gold => Gold,
# :drop => Item Drop Rate,
# }
# Create by the format
# (:atk, :def, :spi, :agi (The :param field takes highest priority)
# The unit is a percentile of a each item.
# :name is not optional
# An omitted item is treated as a default of 100
DIFFICULTY = [] # Do not remove or modify this line!
# 〜 Custom Difficulty Settings Inserted Below Here 〜
DIFFICULTY << { # Difficulty Level: 0
:name => "简单",
:maxhp => 80,
:maxmp => 80,
:param => 80,
:cri => 50,
:drop => 80,
} # ← Do not remove!
DIFFICULTY << { # Difficulty Level: 1
:name => "普通",
}
DIFFICULTY << { # Difficulty Level: 2
:name => "困难",
:maxhp => 150, #150
:maxmp => 130,
:atk => 120,
:mat => 120,
:mdf => 120,
:agi => 105,
:luk => 110,
:exp => 150,
:drop => 150,
}
end
end
#------------------------------------------------------------------------------#
$imported = {} if $imported == nil
$imported["BattleDifficulty"] = true
module KGC::BattleDifficulty
# Parameters
PARAMS = [
:maxhp, :maxmp, :atk, :def, :mat, :mdf, :agi, :luk,
:exp, :gold, :drop
]
module_function
#--------------------------------------------------------------------------
# ○ 難易度補正値作成
#--------------------------------------------------------------------------
def create_param_revs
@@param_revs = []
DIFFICULTY.each { |d|
rev = {}
rev[:name] = d[:name]
# 一括指定を適用
if d[:param] != nil
rev[:atk] = rev[:def] = rev[:mat] = rev[:mdf] = rev[:agi] = rev[:luk] = d[:param]
end
# パラメータ指定を適用
PARAMS.each { |par|
if d[par] != nil
rev[par] = d[par]
else
rev[par] = 100 if rev[par] == nil
end
}
# リストに追加
@@param_revs << rev
}
end
#--------------------------------------------------------------------------
# ○ 難易度補正値取得
#--------------------------------------------------------------------------
def param_revs
return @@param_revs
end
#--------------------------------------------------------------------------
# ○ 難易度インデックス取得
#--------------------------------------------------------------------------
def get_index
vid = DIFFICULTY_VARIABLE
if $game_variables[vid] < 0 || DIFFICULTY.size <= $game_variables[vid]
$game_variables[vid] = INITIAL_DIFFICULTY
end
return $game_variables[vid]
end
#--------------------------------------------------------------------------
# ○ 難易度取得
#--------------------------------------------------------------------------
def get
return @@param_revs[get_index]
end
#--------------------------------------------------------------------------
# ○ 難易度変更
# index : 難易度インデックス
#--------------------------------------------------------------------------
def set(index)
index = [[index, DIFFICULTY.size - 1].min, 0].max
$game_variables[DIFFICULTY_VARIABLE] = index
end
create_param_revs
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::Enemy::DropItem
#==============================================================================
unless $@
class RPG::Enemy::DropItem
#--------------------------------------------------------------------------
# ● 出現率 1/N の分母 N
#--------------------------------------------------------------------------
alias denominator_KGC_BattleDifficulty denominator
def denominator
n = @denominator
if n > 1
n = [n * 100 / KGC::BattleDifficulty.get[:drop], 1].max
end
return n
end
end # class
end # unless $@
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
# Ace defines one method for accessing all basic parameters
alias :th_kgc_difficulty_param_base :param_base
def param_base(i)
th_kgc_difficulty_param_base(i) * KGC::BattleDifficulty.get[:maxhp] / 100
end
#--------------------------------------------------------------------------
# ● 経験値の取得
#--------------------------------------------------------------------------
alias :th_KGC_BattleDifficulty_exp :exp
def exp
th_KGC_BattleDifficulty_exp * KGC::BattleDifficulty.get[:exp] / 100
end
#--------------------------------------------------------------------------
# ● お金の取得
#--------------------------------------------------------------------------
alias :th_KGC_BattleDifficulty_gold :gold
def gold
th_KGC_BattleDifficulty_gold * KGC::BattleDifficulty.get[:gold] / 100
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Title
#==============================================================================
module DataManager
class << self
alias :th_KGC_BattleDifficulty_create_game :create_game_objects
end
def self.create_game_objects
th_KGC_BattleDifficulty_create_game
variable_id = KGC::BattleDifficulty::DIFFICULTY_VARIABLE
p variable_id
$game_variables[variable_id] = KGC::BattleDifficulty::INITIAL_DIFFICULTY
end
end
=begin
#==============================================================================
# ■ Scene_Menu
#==============================================================================
# new window for Ace, moving it out of Scene_Menu
class Window_BattleDifficulty < Window_Command
def make_command_list
KGC::BattleDifficulty::param_revs.each { |d|
add_command(d[:name], d[:name].to_sym)
}
end
end
class Window_MenuCommand
alias :th_kgc_battle_difficulty_add_main_commands :add_main_commands
def add_main_commands
th_kgc_battle_difficulty_add_main_commands
if KGC::BattleDifficulty::USE_MENU_DIFFICULTY_COMMAND
add_command("Difficulty", :difficulty, main_commands_enabled)
end
end
end
class Scene_Menu
# add new menu to the scene
alias :th_kgc_battle_difficulty_start :start
def start
th_kgc_battle_difficulty_start
create_difficulty_window
end
alias :th_kgc_battle_difficulty_cmd_window :create_command_window
def create_command_window
th_kgc_battle_difficulty_cmd_window
@command_window.set_handler(:difficulty, method(:command_difficulty))
end
def create_difficulty_window
@difficulty_window = Window_BattleDifficulty.new(80, 100)
@difficulty_window.set_handler(:ok, method(:on_difficulty_ok))
@difficulty_window.set_handler(:cancel, method(:on_difficulty_cancel))
@difficulty_window.hide.deactivate
end
def command_difficulty
@difficulty_window.show.open.activate
end
def on_difficulty_ok
KGC::BattleDifficulty.set(@difficulty_window.index)
end_difficulty_selection
end
def on_difficulty_cancel
end_difficulty_selection
end
def end_difficulty_selection
@difficulty_window.close
@command_window.activate
end
end
=end