Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ▼ Skill Fusion (Смешивание навыков)
- # Автор: Kread-EX
- # Версия: 1.03
- # Дата выхода: 10/12/2011
- #
- # Перевод: mephis
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- #-------------------------------------------------------------------------------------------------
- # ▼ ОБНОВЛЕНИЯ
- #-------------------------------------------------------------------------------------------------
- # # 02/01/2012. Fixed compatibility with Lunatic Objects and Cast Animations.
- # # 13/12/2011. Added permanent detection to ensure compat. with Glimmer.
- # # 12/12/2011. Fixed a bug preventing to use a skill for multiple fusions
- # # (thanks to infamous bon bon)
- #-------------------------------------------------------------------------------------------------
- # ▼ УСЛОВИЯ ИСПОЛЬЗОВАНИЯ
- #-------------------------------------------------------------------------------------------------
- # Вы можете изменять код этого скрипта под ваши нужды.
- # Вы можете использовать этот скрипт в коммерческих целях.
- # Обязательно указывайте автора.
- #
- # # По поддержке можно со мной связаться здесь:
- # # grimoirecastle.wordpress.com
- # # или здесь
- # # rpgmakervxace.net
- # # или здесь
- # # rpgrevolution.com
- #-------------------------------------------------------------------------------------------------
- # ▼ ВВЕДЕНИЕ
- #-------------------------------------------------------------------------------------------------
- # Этот скрипт позволяет персонажам объединять их навыки в другой навык.
- #-------------------------------------------------------------------------------------------------
- # ▼ ИНСТРУКЦИЯ
- #-------------------------------------------------------------------------------------------------
- # Добавьте в окошко Заметки нужного вам навыка этот тег:
- # <skill_fusion: x, y>
- # x = ID навыка, который будет участвовать в смешивании
- # y = ID объединённого навыка
- #-------------------------------------------------------------------------------------------------
- # ▼ СОВМЕСТИМОСТЬ
- #-------------------------------------------------------------------------------------------------
- # Совместим с DBS и Ace Battle Engine. Обязательно размещайте этот скрипт ниже ABE!
- #
- # Список псевдонимов и перекрытий:
- #
- # DataManager
- # load_database (alias)
- # load_skillfusion_notetags (new method)
- #
- # RPG::Skill
- # loadskillfusion_notetags (new method)
- #
- # Scene_Battle
- # use_item (overwrite)
- # fusion_check (new method)
- #-------------------------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported['KRX-SkillFusion'] = true
- puts 'Load: Skill Fusion v1.03 by Kread-EX'
- module KRX
- FUSION_PARTY_CHECK = true
- module REGEXP
- SKILL_FUSION = /<skill_fusion:[ ]*(\d+(?:\s*,\s*\d+)*)>/i
- end
- module VOCAB
- FUSION_TEXT = "Совместный навык!"
- end
- end
- #===========================================================================
- # ■ DataManager
- #===========================================================================
- module DataManager
- #--------------------------------------------------------------------------
- # ● Loads the database
- #--------------------------------------------------------------------------
- class << self
- alias_method(:krx_skillfusion_dm_load_database, :load_database) unless $@
- end
- def self.load_database
- krx_skillfusion_dm_load_database
- load_skillfusion_notetags
- end
- #--------------------------------------------------------------------------
- # ● Loads the note tags
- #--------------------------------------------------------------------------
- def self.load_skillfusion_notetags
- groups = [$data_skills]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_skillfusion_notetags
- end
- end
- puts "Read: Skill Fusion Notetags"
- end
- end
- #===========================================================================
- # ■ RPG::Skill
- #===========================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ● Public instance variables
- #--------------------------------------------------------------------------
- attr_reader :fusions
- #--------------------------------------------------------------------------
- # ● Loads the note tags
- #--------------------------------------------------------------------------
- def load_skillfusion_notetags
- @fusions = []
- @note.split(/[\r\n]+/).each do |line|
- case line
- when KRX::REGEXP::SKILL_FUSION
- $1.scan(/\d+/).each {|i| @fusions.push(i.to_i)}
- end
- end
- end
- end
- #===========================================================================
- # ■ Scene_Battle
- #===========================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● Uses a skill or item
- #--------------------------------------------------------------------------
- def use_item
- item = fusion_check(@subject.current_action.item)
- @log_window.display_use_item(@subject, item)
- @subject.use_item(item)
- # YEA compatibility
- if $imported["YEA-BattleEngine"]
- status_redraw_target(@subject)
- if $imported["YEA-LunaticObjects"]
- lunatic_object_effect(:before, item, @subject, @subject)
- end
- process_casting_animation if $imported["YEA-CastAnimations"]
- else
- refresh_status
- end
- # End of YEA compatibility
- targets = @subject.current_action.make_targets.compact
- show_animation(targets, item.animation_id)
- targets.each {|target| item.repeats.times { invoke_item(target, item) } }
- if $imported["YEA-LunaticObjects"]
- lunatic_object_effect(:after, item, @subject, @subject)
- end
- end
- #--------------------------------------------------------------------------
- # ● Determine if the fusion prerequisites are met
- #--------------------------------------------------------------------------
- def fusion_check(item)
- @fs_class = NilClass if @fs_class.nil?
- if (item.is_a?(RPG::Skill) && !item.fusions.empty?) &&
- ((KRX::FUSION_PARTY_CHECK && @subject.is_a?(@fs_class)) ||
- !KRX::FUSION_PARTY_CHECK)
- item.fusions.each_index do |i|
- next if i % 2 !=0
- if @fs_last != nil && @fs_last.id == item.fusions[i]
- if @subject.usable?($data_skills[item.fusions[i+1]])
- comb = " (#{@fs_last.name} + #{item.name})"
- item = $data_skills[item.fusions[i+1]]
- @subject.current_action.set_skill(item.id)
- @log_window.add_text(KRX::VOCAB::FUSION_TEXT + comb)
- end
- end
- end
- end
- @fs_last = item
- @fs_class = @subject.is_a?(Game_Actor) ? Game_Actor : Game_Enemy
- return item
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement