Код:
########################### Внезапное нападение #########################
#isFem: женщина - true; мужчина - false
# Мизуна неожиданно атакова(на)/Василий неодиданно атакова(н)
# Группа Василия неожиданно атакова(на)
BattleManager_old = BattleManager.clone
module BattleManager
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
if Game_Party.battle_members.size > 1
$game_message.add(sprintf(isFem(true), $game_party.name))
else
#isFem Заменить на false, если персонаж мужчина.
$game_message.add(sprintf(isFem(true), $game_party.name))
end
end
wait_for_message
end
end
########################### Персонаж/Группа #########################
###########################(Мизуна/Группа Мизун(ы))#########################
class Game_Party < Game_Unit
alias name_pad name
def name
return "" if battle_members.size == 0
return leader.name if battle_members.size == 1
return sprintf(Vocab::PartyName, pad(leader.name,"R"))
end
end
class Window_BattleLog < Window_Selectable
alias display_substitute_new display_substitute
def display_substitute(substitute, target)
add_text(sprintf(Vocab::Substitute, substitute.name, pad(target.name, "V")))
wait
back_one
end
end
#Проверка падежа/пола.
def isFem(fem)
if fem == true
return "%s неожиданно атакована!"
else
return "%s неожиданно атакован!"
end
end
#Склонение имён по падежам.
#Хэш: 2 последние буквы окончания => замена последней буквы окончания.
def pad(actor, p)
if p == "V"
local = {"ка" => "у", "ко" => "у", "га" => "у", "за" => "у",
"на" => "у", "ма" => "у", "та" => "у", "фа" => "у",
"да" => "у", "ра" => "у", "са" => "у", "ия" => "ю",
"уя" => "ю", "ля" => "ю", "ён" => "а", "ер" => "а",
"ий" => "я", "ай" => "я", "ся" => "ю"}
elsif p == "D"
local = {"ка" => "е", "ко" => "е", "га" => "е", "за" => "е",
"на" => "е", "ма" => "е", "та" => "е", "фа" => "е",
"да" => "е", "ра" => "е", "са" => "е", "ия" => "е",
"уя" => "е", "ля" => "е", "ён" => "у", "ер" => "у",
"ий" => "ю", "ай" => "ю", "ся" => "е"}
elsif p == "R"
local = {"ка" => "и", "ко" => "и", "га" => "и", "за" => "ы",
"на" => "ы", "ма" => "ы", "та" => "ы", "фа" => "ы",
"да" => "ы", "ра" => "ы", "са" => "ы", "ия" => "и",
"уя" => "и", "ля" => "и", "ён" => "а", "ер" => "а",
"ий" => "я", "ай" => "я", "ся" => "и"}
elsif p == "T"
local = {"ка" => "ой", "ко" => "ой", "га" => "ой", "за" => "ой",
"на" => "ой", "ма" => "ой", "та" => "ой", "фа" => "ой",
"да" => "ой", "ра" => "ой", "са" => "ой", "ия" => "ей",
"уя" => "ей", "ля" => "ей", "ён" => "ом", "ер" => "ом",
"ий" => "ем", "ай" => "ем", "ся" => "ей"}
elsif p == "P"
local = {"ка" => "е", "ко" => "е", "га" => "е", "за" => "е",
"на" => "е", "ма" => "е", "та" => "е", "фа" => "е",
"да" => "е", "ра" => "е", "са" => "е", "ия" => "е",
"уя" => "е", "ля" => "е", "ён" => "е", "ер" => "е",
"ий" => "и", "ай" => "е", "ся" => "е"}
else
return actor
end
if(actor.slice(actor.length-2,2) == "ён" || actor.slice(actor.length-2,2) == "ер")
return actor + local[actor.slice(actor.length-2,2)]
else
return actor.slice(0,actor.length-1) + local[actor.slice(actor.length-2,2)]
end
end
Социальные закладки