Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # DSI Unit System
- # -- Last Updated: 2018.1.27
- # -- Author: dsiver144
- # -- Level: Hard
- # -- Requires: n/a
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["DSI-UnitSystem"] = true
- #==============================================================================
- # + Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2018.1.16 - Finish first version.
- # 2018.1.17 - Update more script call, notetags.
- # 2018.1.18 - Update more script call, notetags.
- # 2018.1.27 - Fix graphical bug.
- #==============================================================================
- # + 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.
- #==============================================================================
- # Enemy Notetag: <enemy unit> : For the game know that enemy is a unit
- #==============================================================================
- # Actor Notetags:
- # Example:
- # <unit actor>
- # battler: Skull Demon
- # battler offset: 0, 0
- # battler trans: Skull Demon 2
- # skill set: 17, 18, 19
- # passive: 29, 512 # State ID, Skill ID
- # transform state id: 29
- # attack skill id: 1
- # spawn common event id: 34
- # die common event id: 35
- # disable command: attack, skill, transform (* new)
- # transform animation: 4 ( * new )
- #
- # unit trans effect: learn_skill 10 ( * new )
- # unit trans effect: mhp 10 ( * new )
- # unit trans effect: new_passive 25 522 ( * new )
- # unit trans effect: enable attack skill ( * new )
- # unit trans effect: disable transform ( * new )
- # unit trans effect: new_attack_skill 1 ( * new )
- # unit trans effect: mmp 5 ( * new )
- #
- # transform call common event: true, 36 ( * new )
- #
- # <end unit actor>
- # ----------------------------------------------------------------------------
- # Script Call:
- # enable_unit_slot(slot_id) -> To Unlock Slot from being locked
- # disable_unit_slot(slot_id) -> To lock a slot.
- # * New Script calls:
- # - random_summon_unit(unit_id)
- # - summon_unit(unit_id, slot_id)
- # * Conditional Script Call:
- # - has_player_unit_on_slotX?(slot_id)
- # - unit_has_skill?(slot_id, skill_id)
- # - unit_has_state?(slot_id, state_id)
- # - force_transform(slot_id, tp_cost = 0, enable_transform_in_turn = false) ( * new )
- # - destroy_unit(slot_id, return_card = true)
- # eg: destroy_unit(4) # Destroy Unit on slot 4
- # - destroy_all_unit(return_card = true)
- # eg: destroy_all_unit(true) # Destroy all player units. If there was no unit
- # being destroyed then return the card to player hand.
- # - inflict_state_unit(slot_id, state_id, return_card = true)
- # - inflict_state_all_unit(state_id, return_card = true)
- # Conditional Branches Script call:
- # - lastest_unit_placement?(type) : type = :offense , :defense
- # eg: lastest_unit_placement?(:offense) # Check if lastest placement is offense slot
- # eg: lastest_unit_placement?(:defense) # Check if lastest placement is defense slot
- # -----------------------------------------------------------------------------
- # Skill Notetag: <summon unit: unit_id> -> Summon a certain unit to battle.
- # Force target to transform if target is player unit and unit is
- # not transform.
- # <force unit transform: tp_cost, enable_more_than_1_summon_rule, return_card>
- # eg: <force unit transform: 0, true, true>
- # -> This will force target unit transform. You can still transform another
- # units in this turn. If the target was transformed then return the card to
- # player hand.
- # - <refresh unit attack> : Refresh Unit Attack/Skill Command if disabled.
- #===============================================================================
- module DSIVER144
- module UNIT_SYSTEM
- SLOT_COORDINATES = {}
- SLOT_COORDINATES[:player] = {}
- SLOT_COORDINATES[:player][1] = [301 + 40,252]
- SLOT_COORDINATES[:player][2] = [301 + 40,251 + 25]
- SLOT_COORDINATES[:player][3] = [301 + 40,250 + 25*2]
- SLOT_COORDINATES[:player][4] = [300,252]
- SLOT_COORDINATES[:player][5] = [300,251 + 25]
- SLOT_COORDINATES[:player][6] = [300,250 + 25*2]
- SLOT_DISABLE_SWITCHES = {}
- SLOT_DISABLE_SWITCHES[1] = 81
- SLOT_DISABLE_SWITCHES[2] = 82
- SLOT_DISABLE_SWITCHES[3] = 83
- SLOT_DISABLE_SWITCHES[4] = 84
- SLOT_DISABLE_SWITCHES[5] = 85
- SLOT_DISABLE_SWITCHES[6] = 86
- UNIT_CONFIG = {}
- UNIT_CONFIG[5] = {}
- UNIT_CONFIG[5][:transform] = {} #Shade Man
- UNIT_CONFIG[5][:transform][:desc] = "Max HP +2, Max MP +2, Attack does 2 more DMG."
- UNIT_CONFIG[5][:transform][:desc_offset] = [0, -10]
- UNIT_CONFIG[6] = {}
- UNIT_CONFIG[6][:transform] = {} #Pulsar Bat
- UNIT_CONFIG[6][:transform][:desc] = "Max HP +2, Max MP +2, Attack does 1 more DMG."
- UNIT_CONFIG[6][:transform][:desc_offset] = [0, -10]
- UNIT_CONFIG[7] = {}
- UNIT_CONFIG[7][:transform] = {} #Skull Demon
- UNIT_CONFIG[7][:transform][:desc] = "Max HP +4, Max MP +2, Attack does 2 more DMG."
- UNIT_CONFIG[7][:transform][:desc_offset] = [0, -10]
- UNIT_CONFIG[8] = {}
- UNIT_CONFIG[8][:transform] = {} #Laser Man
- UNIT_CONFIG[8][:transform][:desc] = "Max HP +2, Max MP +2, Attack does 1 more DMG."
- UNIT_CONFIG[8][:transform][:desc_offset] = [0, -10]
- UNIT_CONFIG[9] = {}
- UNIT_CONFIG[9][:transform] = {} #Protecto
- UNIT_CONFIG[9][:transform][:desc] = "Max HP +3, Max MP +3."
- UNIT_CONFIG[9][:transform][:desc_offset] = [0, -10]
- UNIT_CONFIG[10] = {}
- UNIT_CONFIG[10][:transform] = {} #Coffin
- UNIT_CONFIG[10][:transform][:desc] = "???"
- UNIT_CONFIG[10][:transform][:desc_offset] = [0, -10]
- UNIT_CONFIG[11] = {}
- UNIT_CONFIG[11][:transform] = {} #The Count
- UNIT_CONFIG[11][:transform][:desc] = "Max HP +2, Max MP +2, Attack does 2 more DMG."
- UNIT_CONFIG[11][:transform][:desc_offset] = [0, -10]
- DEFAULT_UNIT_APPEAR_COMMON_EVENT_ID = 6
- DEFAULT_UNIT_DISAPPEAR_COMMON_EVENT_ID = 7
- end # UNIT_SYSTEM
- end # DSIVER144
- class Game_Party
- attr_accessor :can_perform_transform
- attr_accessor :battle_units
- attr_accessor :units_order
- attr_accessor :passives
- attr_accessor :lastest_unit
- #---------------------------------------------------------------------------
- # * alias method: initialize
- #---------------------------------------------------------------------------
- alias_method(:initialize_dsi_unit_system, :initialize)
- def initialize
- initialize_dsi_unit_system
- init_battle_units
- end
- #---------------------------------------------------------------------------
- # * alias method: battle_members
- #---------------------------------------------------------------------------
- alias_method(:dsi_unit_system_battle_members, :battle_members)
- def battle_members
- dsi_unit_system_battle_members + (@battle_units ? @battle_units.values : [])
- end
- #--------------------------------------------------------------------------
- # * Processing at Start of Battle
- #--------------------------------------------------------------------------
- alias_method(:dsi_unit_system_on_battle_start, :on_battle_start)
- def on_battle_start
- @battle_units ||= {}
- @units_order ||= []
- @can_perform_transform = true
- dsi_unit_system_on_battle_start
- end
- #---------------------------------------------------------------------------
- # * new method: not_unit_members
- #---------------------------------------------------------------------------
- def not_unit_members
- battle_members - (@battle_units ? @battle_units.values : [])
- end
- #--------------------------------------------------------------------------
- # * Get Members
- #--------------------------------------------------------------------------
- def members(include_unit = false)
- if !include_unit
- in_battle ? not_unit_members : all_members
- else
- in_battle ? battle_members : all_members
- end
- end
- #---------------------------------------------------------------------------
- # * new method: initialize
- #---------------------------------------------------------------------------
- def init_battle_units
- @battle_units = {}
- @units_order = []
- @can_perform_transform = true
- @lastest_unit = nil
- end
- #--------------------------------------------------------------------------
- # * Processing at End of Battle
- #--------------------------------------------------------------------------
- alias_method(:dsi_unit_system_on_battle_end, :on_battle_end)
- def on_battle_end
- dsi_unit_system_on_battle_end
- @battle_units.clear
- @units_order.clear
- @can_perform_transform = true
- @lastest_unit = nil
- end
- #---------------------------------------------------------------------------
- # * new method: reset_units
- #---------------------------------------------------------------------------
- def reset_units
- @can_perform_transform = true
- @battle_units.values.each do |unit|
- unit.can_attack = true
- unit.on_turn_end
- end
- end
- #---------------------------------------------------------------------------
- # * new method: summon_unit
- #---------------------------------------------------------------------------
- def summon_unit(actor_id, slot_id)
- if @battle_units.has_key?(slot_id)
- return false
- end
- new_unit = Game_ActorUnit.new(actor_id)
- new_unit.slot_id = slot_id
- new_unit.load_unit_passive
- new_unit.load_attack_skill
- new_unit.load_unit_disable_commands
- new_unit.add_state(new_unit.passives[0])
- new_unit.can_attack = true
- new_unit.can_transform = true
- @battle_units[slot_id] = new_unit
- @units_order << new_unit
- @lastest_unit = new_unit
- return true
- end
- #--------------------------------------------------------------------------
- # * Get Maximum Number of Battle Units
- #--------------------------------------------------------------------------
- def max_units
- return 6
- end
- #--------------------------------------------------------------------------
- # * Get Array of Living Members including alive unit
- #--------------------------------------------------------------------------
- def alive_members
- members.select {|member| member.alive? } + @battle_units.values.select {|unit| unit.alive? }
- end
- #--------------------------------------------------------------------------
- # * Determine Everyone is Dead
- #--------------------------------------------------------------------------
- def all_dead?
- (alive_members - @battle_units.values.select {|unit| unit.alive?}).empty?
- end
- end # Game_Troop
- class Game_ActorUnit < Game_Actor
- include DSIVER144::UNIT_SYSTEM
- attr_accessor :battle_unit_flag
- attr_accessor :can_attack
- attr_accessor :can_transform
- attr_accessor :transformed
- attr_accessor :unit_attack_skill_id
- attr_accessor :slot_id
- attr_accessor :passives
- attr_accessor :on_finish_collapse_method
- attr_accessor :disable_commands
- #---------------------------------------------------------------------------
- # * new method: reset_turn
- #---------------------------------------------------------------------------
- def reset_turn
- @can_attack = true
- end
- #---------------------------------------------------------------------------
- # * new method: load_attack_skill
- #---------------------------------------------------------------------------
- def load_attack_skill
- @unit_attack_skill_id = actor.unit_attack_skill_id
- end
- #---------------------------------------------------------------------------
- # * new method: load_unit_passive
- #---------------------------------------------------------------------------
- def load_unit_passive
- @passives = []
- return unless actor.unit_passive
- @passives = actor.unit_passive.clone
- end
- #---------------------------------------------------------------------------
- # * new method: load_unit_disable_commands
- #---------------------------------------------------------------------------
- def load_unit_disable_commands
- @disable_commands = {}
- return unless actor.unit_disable_commands
- @disable_commands = actor.unit_disable_commands.clone
- end
- #---------------------------------------------------------------------------
- # * new method: can_target?
- #---------------------------------------------------------------------------
- def can_target?
- return true
- end
- #---------------------------------------------------------------------------
- # * overwrite method: battler_name
- #---------------------------------------------------------------------------
- def battler_name
- return actor.unit_battler if !@transformed
- return actor.unit_trans_battler if @transformed
- end
- #---------------------------------------------------------------------------
- # * overwrite method: screen_x
- #---------------------------------------------------------------------------
- def screen_x
- return SLOT_COORDINATES[:player][slot_id][0] + actor.unit_battler_offset[0]
- end
- #---------------------------------------------------------------------------
- # * overwrite method: screen_y
- #---------------------------------------------------------------------------
- def screen_y
- return SLOT_COORDINATES[:player][slot_id][1] + actor.unit_battler_offset[1]
- end
- #--------------------------------------------------------------------------
- # * Execute Collapse Effect
- #--------------------------------------------------------------------------
- def perform_collapse_effect
- if $game_party.in_battle
- @on_finish_collapse_method = method(:remove_unit)
- @sprite_effect_type = :collapse
- Sound.play_actor_collapse
- end
- end
- #--------------------------------------------------------------------------
- # * new method: remove_unit
- #--------------------------------------------------------------------------
- def remove_unit
- $game_party.battle_units.delete(@slot_id)
- $game_party.units_order.delete(self)
- $game_temp.reserve_common_event(actor.unit_off_common_ev_id)
- SceneManager.scene.process_death_unit_common_event
- @on_finish_collapse_method = nil
- end
- #---------------------------------------------------------------------------
- # * new method: is_battle_unit?
- #---------------------------------------------------------------------------
- def is_battle_unit?
- return actor.note.include?("<battle_unit>")
- end
- #--------------------------------------------------------------------------
- # * Use Skill/Item
- # Called for the acting side and applies the effect to other than the user.
- #--------------------------------------------------------------------------
- def use_item(item)
- pay_skill_cost(item) if item.is_a?(RPG::Skill)
- item.effects.each {|effect| item_global_effect_apply(effect) }
- end
- #--------------------------------------------------------------------------
- # * Check Usability Conditions for Skill
- #--------------------------------------------------------------------------
- def skill_conditions_met?(skill)
- skill_cost_payable?(skill)
- end
- #--------------------------------------------------------------------------
- # * Force Action
- #--------------------------------------------------------------------------
- def force_skill(skill_id, target_index = -1, force = true)
- clear_actions
- action = Game_Action.new(self, force)
- action.set_skill(skill_id)
- @actions.push(action)
- action.target_index = target_index
- end
- #--------------------------------------------------------------------------
- # * Use Sprite
- #--------------------------------------------------------------------------
- def use_sprite?
- return true
- end
- end # Game_BattleUnit
- #===============================================================================
- # Window_ActorCommand
- #===============================================================================
- class Window_ActorCommand < Window_Command
- #--------------------------------------------------------------------------
- # Add units command
- #--------------------------------------------------------------------------
- def add_unit_command
- add_command("Units", :units, unit_command_enable?)
- end
- #--------------------------------------------------------------------------
- # Check if unit command is enable
- #--------------------------------------------------------------------------
- def unit_command_enable?
- return $game_party.battle_units.values.size > 0 && $game_party.battle_units.values.any? {|unit| unit.can_attack == true}
- end
- #--------------------------------------------------------------------------
- # Make new command List (overwrite)
- #--------------------------------------------------------------------------
- def make_command_list
- return unless @actor
- add_attack_command if PC27::CG::USE_ATTACK
- add_guard_command if PC27::CG::USE_GUARD
- add_skill_commands
- add_item_command if PC27::CG::USE_ITEMS
- add_unit_command
- add_look_at_grave_command
- add_turn_end_command
- end
- end
- #===============================================================================
- # Scene_Battle
- #===============================================================================
- class Scene_Battle < Scene_Base
- include DSIVER144::UNIT_SYSTEM
- #--------------------------------------------------------------------------
- # * Create Actor Window [Overwrite]
- #--------------------------------------------------------------------------
- def create_actor_window
- @actor_window = Window_DSIBattleActor.new(0,0)
- @actor_window.set_handler(:ok, method(:on_actor_ok))
- @actor_window.set_handler(:cancel, method(:on_actor_cancel))
- end
- alias_method(:dsi_unit_system_create_all_windows, :create_all_windows)
- #--------------------------------------------------------------------------
- # * Create All Windows
- #--------------------------------------------------------------------------
- def create_all_windows
- dsi_unit_system_create_all_windows()
- create_unit_command_window
- create_unit_list
- create_unit_skill_help_window
- create_unit_skill_list
- create_summon_window
- create_transform_window
- end
- #--------------------------------------------------------------------------
- # * Create Transform Window
- #--------------------------------------------------------------------------
- def create_transform_window
- @transform_window = Window_UnitTransform.new
- @transform_window.y -= 60
- @transform_prompt = Window_TransformPrompt.new(@transform_window.x, @transform_window.y + 150)
- @transform_prompt.set_handler(:ok, method(:on_trans_ok))
- @transform_prompt.set_handler(:cancel, method(:on_trans_cancel))
- @transform_prompt.hide.deactivate
- @transform_window.hide
- end
- #--------------------------------------------------------------------------
- # * new method: create_summon_window
- #--------------------------------------------------------------------------
- def create_summon_window
- @summon_window = Window_SummonCommand.new(0,0)
- @summon_window.x = (Graphics.width - @summon_window.width) * 0.5
- @summon_window.y = (Graphics.height - @summon_window.height) * 0.5
- @summon_window.set_handler(:ok, method(:on_summon_ok))
- @summon_window.set_handler(:cancel, method(:on_summon_cancel))
- @summon_window.refresh
- @summon_window.hide.deactivate
- end
- #--------------------------------------------------------------------------
- # * new method: create_unit_list
- #--------------------------------------------------------------------------
- def create_unit_list
- @unit_list = Window_ActiveUnits.new
- @unit_list.x = @party_command_window.x
- @unit_list.y = @info_viewport.rect.y - @unit_list.height
- @unit_list.set_handler(:unit_command, method(:on_unit_ok))
- @unit_list.set_handler(:cancel, method(:on_unit_list_cancel))
- @unit_list.deactivate
- @unit_list.status_window = @status_window
- end
- #--------------------------------------------------------------------------
- # * new method: create_unit_skill_help_window
- #--------------------------------------------------------------------------
- def create_unit_skill_help_window
- @help_window2 = Window_DSIHelp.new(2)
- @help_window2.x = 0
- @help_window2.y = 0
- @help_window2.visible = false
- end
- #--------------------------------------------------------------------------
- # * new method: create_unit_skill_list
- #--------------------------------------------------------------------------
- def create_unit_skill_list
- wx = 0
- wy = @unit_list.y
- ww = 320
- @unit_skill_list = Window_UnitSkillList.new(wx,wy,ww)
- @unit_skill_list.hide.deactivate
- @unit_skill_list.set_handler(:ok, method(:on_unit_skill_ok))
- @unit_skill_list.set_handler(:cancel, method(:on_unit_skill_list_cancel))
- @unit_skill_list.help_window = @help_window2
- end
- #--------------------------------------------------------------------------
- # * new method:
- #--------------------------------------------------------------------------
- def on_unit_skill_ok
- @unit_skill = @unit_skill_list.item
- @current_unit.last_skill.object = @unit_skill
- @return_flag = nil
- if @unit_skill
- if !@unit_skill.need_selection?
- @unit_skill_list.hide.deactivate
- unit_use_skill
- elsif @unit_skill.for_opponent?
- select_enemy_selection
- else
- select_actor_selection
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Actor [Cancel]
- #--------------------------------------------------------------------------
- alias_method(:on_actor_cancel_dsi_unit_system, :on_actor_cancel)
- def on_actor_cancel
- if @unit_skill
- @unit_skill_list.hide.deactivate
- @actor_window.hide
- @unit_commnad_window.activate
- @unit_skill = nil
- else
- on_actor_cancel_dsi_unit_system
- end
- end
- #--------------------------------------------------------------------------
- # * Actor [OK]
- #--------------------------------------------------------------------------
- alias_method(:on_actor_ok_dsi_unit_system, :on_actor_ok)
- def on_actor_ok
- if @unit_skill
- @unit_skill_list.hide.deactivate
- @actor_window.hide
- @unit_skill_list.hide.deactivate
- @current_unit.force_skill(@unit_skill.id, @actor_window.index)
- @unit_skill = nil
- use_item_unit
- @subject = nil
- @current_unit.can_attack = false
- command_unit_cancel
- else
- on_actor_ok_dsi_unit_system
- end
- @unit_skill = nil
- end
- #--------------------------------------------------------------------------
- # * new method: on_unit_skill_list_cancel
- #--------------------------------------------------------------------------
- def on_unit_skill_list_cancel
- @unit_skill_list.hide.deactivate
- @unit_commnad_window.show.activate
- end
- #--------------------------------------------------------------------------
- # * new method: unit_use_skill
- #--------------------------------------------------------------------------
- def unit_use_skill
- @current_unit.force_skill(@unit_skill.id, nil, false)
- use_item_unit
- @current_unit.can_attack = false
- command_unit_cancel
- end
- #--------------------------------------------------------------------------
- # * Create Message Window [Overwrite]
- #--------------------------------------------------------------------------
- alias_method(:dsi_unit_system_create_message_window, :create_message_window)
- def create_message_window
- dsi_unit_system_create_message_window
- @message_window.z = 300
- end
- #--------------------------------------------------------------------------
- # * new method: on_unit_ok
- #--------------------------------------------------------------------------
- def on_unit_ok
- @unit_list.hide.deactivate
- @current_unit = $game_party.battle_units[@unit_list.current_slot_id]
- @status_window.current_unit = @current_unit
- @unit_commnad_window.setup(@current_unit)
- @actor_command_window.hide
- @unit_commnad_window.show.activate
- end
- #--------------------------------------------------------------------------
- # * new method: create_unit_command_window
- #--------------------------------------------------------------------------
- def create_unit_command_window
- @unit_commnad_window = Window_UnitCommand.new
- @unit_commnad_window.viewport = @info_viewport
- @unit_commnad_window.set_handler(:attack, method(:command_unit_attack))
- @unit_commnad_window.set_handler(:skill, method(:command_unit_skill))
- @unit_commnad_window.set_handler(:transform, method(:command_unit_transform))
- @unit_commnad_window.set_handler(:cancel, method(:command_unit_cancel))
- @unit_commnad_window.deactivate
- @unit_commnad_window.hide
- @unit_commnad_window.x = Graphics.width
- end
- #--------------------------------------------------------------------------
- # * Enemy [OK]
- #--------------------------------------------------------------------------
- def on_enemy_ok
- if @current_unit
- @enemy_window.hide
- if @unit_skill
- @unit_skill_list.hide.deactivate
- @current_unit.force_skill(@unit_skill.id, @enemy_window.enemy.index)
- @unit_skill = nil
- end
- use_item_unit
- @subject = nil
- @current_unit.can_attack = false
- command_unit_cancel
- else
- BattleManager.actor.input.target_index = @enemy_window.enemy.index
- @enemy_window.hide
- @skill_window.hide
- @item_window.hide
- next_command
- end
- end
- #--------------------------------------------------------------------------
- # * Enemy [Cancel]
- #--------------------------------------------------------------------------
- def on_enemy_cancel
- @enemy_window.hide
- if @return_flag && @return_flag == :unit_command_window
- @unit_commnad_window.activate
- @return_flag = nil
- return
- end
- if @unit_skill
- @unit_skill_list.refresh
- @unit_skill_list.activate
- @unit_skill = nil
- else
- case @actor_command_window.current_symbol
- when :attack
- @actor_command_window.activate
- when :skill
- @skill_window.activate
- when :item
- @item_window.activate
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: command_unit_attack
- #--------------------------------------------------------------------------
- def command_unit_attack
- @subject = @current_unit
- @unit_skill = $data_skills[@subject.unit_attack_skill_id]
- @return_flag = :unit_command_window
- select_enemy_selection
- end
- #--------------------------------------------------------------------------
- # * new method: command_unit_skill
- #--------------------------------------------------------------------------
- def command_unit_skill
- @subject = @current_unit
- @unit_skill_list.unit = @current_unit
- @unit_skill_list.refresh
- @unit_skill_list.show.activate
- @unit_skill_list.select_last
- end
- #--------------------------------------------------------------------------
- # * new method: on_trans_ok
- #--------------------------------------------------------------------------
- def on_trans_ok
- @transform_window.hide
- @transform_prompt.hide.deactivate
- 10.times do
- update_for_wait
- end
- run_common_event_flag = false
- @subject = @current_unit
- @subject.animation_id = @subject.actor.unit_trans_animation_id
- @subject.transformed = true
- @log_window.display_unit_transform(@subject)
- @subject.add_state(@subject.actor.unit_transform_state_id)
- if @subject.actor.unit_transform_effects.size > 0
- @subject.actor.unit_transform_effects.each do |effect|
- if effect[0] == :mhp
- @subject.add_param(0, effect[1])
- @subject.hp += effect[1]
- end
- if effect[0] == :mmp
- @subject.add_param(1, effect[1])
- @subject.mp += effect[1]
- end
- if effect[0] == :learn_skill
- @subject.learn_skill(effect[1])
- end
- if effect[0] == :new_passive
- @subject.remove_state(@subject.passives[0])
- @subject.passives = [effect[1], effect[2]]
- @subject.add_state(@subject.passives[0])
- end
- if effect[0] == :enable
- for i in 1...effect.size
- @subject.disable_commands.delete(effect[i])
- end
- end
- if effect[0] == :disable
- for i in 1...effect.size
- @subject.disable_commands[effect[i]] = true
- end
- end
- if effect[0] == :new_attack_skill
- @subject.unit_attack_skill_id = effect[1]
- end
- if effect[0] == :common_event
- $game_temp.reserve_common_event(effect[1])
- run_common_event_flag = true
- end
- end
- else
- if UNIT_CONFIG[@subject.actor.id]
- effects = UNIT_CONFIG[@subject.actor.id][:transform][:effects]
- effects.each do |effect|
- if effect[0] == :mhp
- @subject.add_param(0, effect[1])
- @subject.hp += effect[1]
- end
- if effect[0] == :mmp
- @subject.add_param(1, effect[1])
- @subject.mp += effect[1]
- end
- if effect[0] == :learn_skill
- @subject.learn_skill(effect[1])
- end
- if effect[0] == :new_passive
- @subject.remove_state(@subject.passives[0])
- @subject.passives = [effect[1], effect[2]]
- @subject.add_state(@subject.passives[0])
- end
- if effect[0] == :new_attack_skill
- @subject.unit_attack_skill_id = effect[1]
- end
- if effect[0] == :common_event
- $game_temp.reserve_common_event(effect[1])
- run_common_event_flag = true
- end
- end
- end
- end
- refresh_status
- BattleManager.actor.tp -= 1
- @current_unit.can_transform = false
- $game_party.can_perform_transform = false
- @log_window.wait_and_clear
- process_event if run_common_event_flag
- @unit_commnad_window.refresh
- @unit_commnad_window.activate
- @subject = nil
- end
- #--------------------------------------------------------------------------
- # * new method: transform_unit
- #--------------------------------------------------------------------------
- def transform_unit(unit, tp_lose = 1, disable_cm = true, runCME = true)
- run_common_event_flag = false
- @transform_unit = unit
- @transform_unit.animation_id = @transform_unit.actor.unit_trans_animation_id
- @transform_unit.transformed = true
- @log_window.display_unit_transform(@transform_unit)
- wait_for_effect
- @transform_unit.add_state(@transform_unit.actor.unit_transform_state_id)
- if @transform_unit.actor.unit_transform_effects.size > 0
- @transform_unit.actor.unit_transform_effects.each do |effect|
- if effect[0] == :mhp
- @transform_unit.add_param(0, effect[1])
- @transform_unit.hp += effect[1]
- end
- if effect[0] == :mmp
- @transform_unit.add_param(1, effect[1])
- @transform_unit.mp += effect[1]
- end
- if effect[0] == :learn_skill
- @transform_unit.learn_skill(effect[1])
- end
- if effect[0] == :new_passive
- @transform_unit.remove_state(@transform_unit.passives[0])
- @transform_unit.passives = [effect[1], effect[2]]
- @transform_unit.add_state(@transform_unit.passives[0])
- end
- if effect[0] == :enable
- for i in 1...effect.size
- @transform_unit.disable_commands.delete(effect[i])
- end
- end
- if effect[0] == :disable
- for i in 1...effect.size
- @transform_unit.disable_commands[effect[i]] = true
- end
- end
- if effect[0] == :new_attack_skill
- @transform_unit.unit_attack_skill_id = effect[1]
- end
- if effect[0] == :common_event
- $game_temp.reserve_common_event(effect[1])
- run_common_event_flag = true
- end
- end
- else
- if UNIT_CONFIG[@transform_unit.actor.id]
- effects = UNIT_CONFIG[@transform_unit.actor.id][:transform][:effects]
- effects.each do |effect|
- if effect[0] == :mhp
- @transform_unit.add_param(0, effect[1])
- @transform_unit.hp += effect[1]
- end
- if effect[0] == :mmp
- @transform_unit.add_param(1, effect[1])
- @transform_unit.mp += effect[1]
- end
- if effect[0] == :learn_skill
- @transform_unit.learn_skill(effect[1])
- end
- if effect[0] == :new_passive
- @transform_unit.remove_state(@transform_unit.passives[0])
- @transform_unit.passives = [effect[1], effect[2]]
- @transform_unit.add_state(@transform_unit.passives[0])
- end
- if effect[0] == :new_attack_skill
- @transform_unit.unit_attack_skill_id = effect[1]
- end
- if effect[0] == :common_event
- $game_temp.reserve_common_event(effect[1])
- run_common_event_flag = true
- end
- end
- end
- end
- refresh_status
- $game_party.members[0].tp -= tp_lose
- @transform_unit.can_transform = false
- $game_party.can_perform_transform = disable_cm
- @transform_unit = nil
- process_event if run_common_event_flag && runCME
- end
- #--------------------------------------------------------------------------
- # * new method: on_trans_cancel
- #--------------------------------------------------------------------------
- def on_trans_cancel
- @transform_window.unit = nil
- @transform_window.hide
- @transform_prompt.hide.deactivate
- @unit_commnad_window.refresh
- @unit_commnad_window.activate
- @subject = nil
- end
- #--------------------------------------------------------------------------
- # * new method: command_unit_transform
- #--------------------------------------------------------------------------
- def command_unit_transform
- @transform_window.unit = @current_unit
- @transform_window.show
- @transform_prompt.show.activate
- end
- #--------------------------------------------------------------------------
- # * new method: command_unit_cancel
- #--------------------------------------------------------------------------
- def command_unit_cancel
- return if $game_troop.all_dead?
- @unit_list.refresh
- @unit_commnad_window.hide.deactivate
- @unit_list.show.activate
- @actor_command_window.show
- @current_unit = nil
- @unit_skill = nil
- end
- #--------------------------------------------------------------------------
- # * new method: on_unit_list_cancel
- #--------------------------------------------------------------------------
- def on_unit_list_cancel
- @unit_list.hide.deactivate
- @actor_command_window.refresh
- @status_window.current_unit = nil
- @actor_command_window.activate
- end
- #--------------------------------------------------------------------------
- # Add end turn command and remove prior command (overwrite)
- #--------------------------------------------------------------------------
- def create_actor_command_window
- @actor_command_window = Window_ActorCommand.new
- @actor_command_window.viewport = @info_viewport
- @actor_command_window.set_handler(:skill, method(:command_skill))
- @actor_command_window.set_handler(:guard, method(:command_guard))
- @actor_command_window.set_handler(:item, method(:command_item))
- @actor_command_window.set_handler(:look_grave, method(:command_look_grave))
- @actor_command_window.set_handler(:end_turn, method(:command_end_turn))
- @actor_command_window.set_handler(:units, method(:command_units))
- @actor_command_window.x = Graphics.width
- end
- alias_method(:dsi_unit_system_command_end_turn, :command_end_turn)
- #--------------------------------------------------------------------------
- # Clears actions and ends the actors turn
- #--------------------------------------------------------------------------
- def command_end_turn
- dsi_unit_system_command_end_turn
- $game_party.reset_units
- end
- #--------------------------------------------------------------------------
- # * new method: command_units
- #--------------------------------------------------------------------------
- def command_units
- @unit_list.refresh
- @unit_list.show.activate
- @unit_list.select(0)
- @unit_list.refresh_status_window
- @actor_command_window.deactivate
- @unit_commnad_window.deactivate
- end
- #--------------------------------------------------------------------------
- # * Use Skill for Unit
- #--------------------------------------------------------------------------
- def use_item_unit
- item = @subject.current_action.item
- @log_window.display_use_item(@subject, item)
- @subject.use_item(item)
- refresh_status
- targets = @subject.current_action.make_targets.compact
- show_animation(targets, item.animation_id)
- targets.each {|target| item.repeats.times { invoke_item(target, item) } }
- @subject.remove_current_action
- process_action_end
- process_event
- end
- #--------------------------------------------------------------------------
- # * Wait Until Animation Display has Finished
- #--------------------------------------------------------------------------
- def wait_for_summoning
- update_for_wait
- update_for_wait while @summon_window.active
- end
- #--------------------------------------------------------------------------
- # * On Summon OK
- #--------------------------------------------------------------------------
- def on_summon_ok
- @summon_window.hide.deactivate
- slot_id = @summon_window.current_data[:slot_id]
- $game_party.summon_unit(@summon_unit_id, slot_id)
- unit = $game_party.battle_units[slot_id]
- $game_temp.reserve_common_event(unit.actor.unit_on_common_ev_id)
- @summon_unit_id = nil
- end
- #--------------------------------------------------------------------------
- # * On Summon Cancel
- #--------------------------------------------------------------------------
- def on_summon_cancel
- @summon_window.hide.deactivate
- @summon_unit_id = nil
- if @actor_stack
- BattleManager.actor.hand += @actor_stack
- @actor_stack.each do |card|
- BattleManager.actor.grave.delete_at(BattleManager.actor.grave.index(card))
- end
- @actor_stack = nil
- end
- end
- #--------------------------------------------------------------------------
- # * new method: process_death_unit_common_event
- #--------------------------------------------------------------------------
- def process_death_unit_common_event
- process_common_event
- end
- #--------------------------------------------------------------------------
- # * Return Card To Player Hand
- #--------------------------------------------------------------------------
- def return_card_to_player_hand
- if @actor_stack
- BattleManager.actor.hand += @actor_stack
- @actor_stack.each do |card|
- BattleManager.actor.grave.delete_at(BattleManager.actor.grave.index(card))
- end
- @actor_stack = nil
- end
- end
- #--------------------------------------------------------------------------
- # * Use Skill/Item
- #--------------------------------------------------------------------------
- alias_method(:dsi_unit_system_use_item, :use_item)
- def use_item
- @actor_stack = BattleManager.actor.stack.clone if BattleManager.actor
- skill = @subject.current_action.item
- my_targets = @subject.current_action.make_targets.compact.clone
- dsi_unit_system_use_item
- if skill && skill.is_a?(RPG::Skill)
- if skill.summon_unit_id
- @summon_unit_id = skill.summon_unit_id
- @summon_window.refresh
- @summon_window.show.activate
- wait_for_summoning
- @log_window.wait_and_clear
- process_common_event
- end
- if skill.unit_refresh_attack
- attack_flag = false
- my_targets.each do |target|
- if target.is_a?(Game_ActorUnit) && !target.can_attack
- attack_flag = true
- target.can_attack = true
- end
- end
- return_card_to_player_hand if attack_flag == false
- end # skill.unit_refresh_attack
- if skill.unit_force_transform
- setting = skill.unit_force_transform
- trans_flag = false
- my_targets.each do |target|
- if target.is_a?(Game_ActorUnit) && !target.transformed
- target.result.success = true
- transform_unit(target, setting[:tp], setting[:disable_trans])
- trans_flag = true
- end
- end
- if trans_flag == false
- if setting[:return_card]
- return_card_to_player_hand
- end
- end
- end # end skill.unit_force_transform
- end
- end
- end
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # * Get Enemy and Actor Sprites
- #--------------------------------------------------------------------------
- def battler_sprites
- @enemy_sprites + @actor_sprites + @unit_sprites
- end
- alias_method(:dsi_create_actors_unit_system, :create_actors)
- #--------------------------------------------------------------------------
- # * Create Actor Sprites
- #--------------------------------------------------------------------------
- def create_actors
- dsi_create_actors_unit_system
- @unit_sprites = Array.new(6) { Sprite_Unit.new(@viewport1) }
- end
- #--------------------------------------------------------------------------
- # * Update Unit Sprite
- #--------------------------------------------------------------------------
- def update_units
- @unit_sprites.each_with_index do |sprite, i|
- sprite.battler = $game_party.battle_units[i + 1]
- sprite.update
- end
- end
- alias_method(:dsi_update_actors_unit_system, :update_actors)
- #--------------------------------------------------------------------------
- # * Update Actor Sprite
- #--------------------------------------------------------------------------
- def update_actors
- dsi_update_actors_unit_system
- update_units
- end
- end # Spriteset_Battle
- class RPG::Actor
- include DSIVER144::UNIT_SYSTEM
- attr_accessor :unit_battler
- attr_accessor :unit_skill_ids
- attr_accessor :unit_battler_offset
- attr_accessor :unit_passive
- attr_accessor :unit_trans_battler
- attr_accessor :unit_attack_skill_id
- attr_accessor :unit_transform_state_id
- attr_accessor :unit_on_common_ev_id
- attr_accessor :unit_off_common_ev_id
- attr_accessor :unit_disable_commands
- attr_accessor :unit_transform_effects
- attr_accessor :unit_trans_animation_id
- def load_unit_notetag
- @read_unit = false
- @unit_attack_skill_id = nil
- @unit_transform_state_id = nil
- @unit_battler = ""
- @unit_skill_ids = []
- @unit_trans_battler = ""
- @unit_battler_offset = [0,0]
- @unit_passive = nil
- @unit_disable_commands = nil
- @unit_transform_effects = []
- @unit_trans_animation_id = 4
- @unit_on_common_ev_id = DEFAULT_UNIT_APPEAR_COMMON_EVENT_ID
- @unit_off_common_ev_id = DEFAULT_UNIT_DISAPPEAR_COMMON_EVENT_ID
- self.note.split(/[\r\n]+/).each do |line|
- if line =~ /<unit actor>/i
- @read_unit = true
- end
- if line =~ /<end unit actor>/i
- @read_unit = false
- end
- if @read_unit
- if line =~ /battler:\s*(.+)/i
- @unit_battler = $1
- end
- if line =~ /battler trans:\s*(.+)/i
- @unit_trans_battler = $1
- end
- if line =~ /skill set:\s*(.+)/i
- @unit_skill_ids = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /battler offset:\s*(.+)/i
- @unit_battler_offset = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /passive:\s*(.+)/i
- @unit_passive = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /transform state id:\s*(\d+)/i
- @unit_transform_state_id = $1.to_i
- end
- if line =~ /attack skill id:\s*(\d+)/i
- @unit_attack_skill_id = $1.to_i
- end
- if line =~ /spawn common event id:\s*(\d+)/i
- @unit_on_common_ev_id = $1.to_i
- end
- if line =~ /die common event id:\s*(\d+)/i
- @unit_off_common_ev_id = $1.to_i
- end
- if line =~ /transform animation:\s*(\d+)/i
- @unit_trans_animation_id = $1.to_i
- end
- if line =~ /transform call common event:\s*(.+)/i
- array = $1.split(",").map {|id| id.delete(" ")}
- if array[0] == "true"
- @unit_transform_effects += [[:common_event, array[1].to_i]]
- @unit_transform_effects.uniq!
- end
- end
- if line =~ /disable command:\s*(.+)/i
- @unit_disable_commands ||= {}
- $1.split(",").map {|id| id.delete(" ").to_sym}.each do |key|
- @unit_disable_commands[key] = true
- end
- end
- if line =~ /unit trans effect:\s*(.+)/i
- array = $1.split(" ")
- array[0] = array[0].to_sym
- if [:enable, :disable].include?(array[0])
- for i in 1...array.size
- array[i] = array[i].to_sym
- end
- else
- for i in 1...array.size
- array[i] = array[i].to_i
- end
- end
- @unit_transform_effects += [array]
- @unit_transform_effects.uniq!
- end
- end
- end
- end
- end # RPG::Actor
- class RPG::Skill
- attr_accessor :summon_unit_id
- attr_accessor :unit_passive
- attr_accessor :unit_slot_lock
- attr_accessor :unit_force_transform
- attr_accessor :unit_refresh_attack
- def load_unit_notetag
- @summon_unit_id = nil
- @unit_passive = false
- @unit_force_transform = nil
- @unit_refresh_attack = nil
- self.note.split(/[\r\n]+/).each do |line|
- if line =~ /<summon unit:\s*(\d+)>/i
- @summon_unit_id = $1.to_i
- end
- if line =~ /<unit passive>/i
- @unit_passive = true
- end
- if line =~ /<lock a slot>/i
- @unit_slot_lock = true
- end
- if line =~ /<refresh unit attack>/i
- @unit_refresh_attack = true
- end
- if line =~ /<force unit transform:\s*(.+)>/i
- array = $1.split(",").map {|param| param.delete(" ")}
- @unit_force_transform ||= {}
- @unit_force_transform[:tp] = array[0].to_i
- @unit_force_transform[:disable_trans] = array[1] == "true"
- @unit_force_transform[:return_card] = array[2] == "true"
- end
- end
- end
- end # RPG::Actor
- class RPG::Enemy
- attr_accessor :unit_flag
- attr_accessor :stats_offset
- attr_accessor :custom_offset
- def load_unit_notetag
- @unit_flag = false
- @stats_offset = nil
- @custom_offset = {}
- self.note.split(/[\r\n]+/i).each do |line|
- if line =~ /<enemy unit>/i
- @unit_flag = true
- end
- if line =~ /<stat offset:\s*(.+)>/i
- @stats_offset = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /<hp offset:\s*(.+)>/i
- @custom_offset[:hp] = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /<mp offset:\s*(.+)>/i
- @custom_offset[:mp] = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /<tp offset:\s*(.+)>/i
- @custom_offset[:tp] = $1.split(",").map {|id| id.to_i}
- end
- if line =~ /<shield offset:\s*(.+)>/i
- @custom_offset[:shp] = $1.split(",").map {|id| id.to_i}
- end
- end
- end
- end
- class Game_Troop
- #--------------------------------------------------------------------------
- # * Get Enemy Units
- #--------------------------------------------------------------------------
- def enemy_units
- alive_members.select {|e| e.enemy.unit_flag}
- end
- #--------------------------------------------------------------------------
- # * Determine Everyone is Dead
- #--------------------------------------------------------------------------
- def all_dead?
- (alive_members - enemy_units).empty?
- end
- end
- #==============================================================================
- # ** DataManager
- #==============================================================================
- module DataManager
- class << self
- alias unit_system_load_database load_database
- alias unit_system_init init
- end
- #----------------------------------------------------------------------------
- # * alias method: init
- #----------------------------------------------------------------------------
- def self.init
- unit_system_init
- load_notetags_unit_system
- end
- #----------------------------------------------------------------------------
- # * alias method: load_database
- #----------------------------------------------------------------------------
- def self.load_database
- unit_system_load_database
- end
- #----------------------------------------------------------------------------
- # * new method: load_notetags_unit_system
- #----------------------------------------------------------------------------
- def self.load_notetags_unit_system
- groups = [$data_actors, $data_skills, $data_enemies]
- for group in groups
- for obj in group
- next if obj.nil?
- next if obj.name == ""
- obj.load_unit_notetag
- end
- end
- end
- end # DataManager
- class Game_Party
- #-----------------------------------------------------------------------------
- # New. Return an array of battlers that can be targeted
- #-----------------------------------------------------------------------------
- def targetable_members
- battle_members.select {|member| member.can_target? }
- end
- #--------------------------------------------------------------------------
- # * Smooth Selection of Target
- #--------------------------------------------------------------------------
- def smooth_target(index)
- member = battle_members[index]
- (member && member.alive?) ? member : alive_members[0]
- end
- end
- class String
- #----------------------------------------------------------------------------
- # * Delete All Part of sub string in string
- #----------------------------------------------------------------------------
- def delete!(sub)
- while self.include?(sub)
- self.sub!(sub, "")
- end
- return self
- end
- end # String
- class Game_Interpreter
- include DSIVER144::UNIT_SYSTEM
- #--------------------------------------------------------------------------
- # * Actor Iterator (ID)
- # param : If 1 or more, ID. If 0, all
- #--------------------------------------------------------------------------
- def iterate_actor_id(param)
- if param == 0
- $game_party.members(true).each {|actor| yield actor }
- else
- actor = $game_actors[param]
- yield actor if actor
- end
- end
- #----------------------------------------------------------------------------
- # * Disable Unit Slot
- #----------------------------------------------------------------------------
- def disable_unit_slot(slot_id)
- $game_switches[SLOT_DISABLE_SWITCHES[slot_id]] = true
- end
- #----------------------------------------------------------------------------
- # * Enable Unit Slot
- #----------------------------------------------------------------------------
- def enable_unit_slot(slot_id)
- $game_switches[SLOT_DISABLE_SWITCHES[slot_id]] = false
- end
- #----------------------------------------------------------------------------
- # * Summon Certain Unit to certain slot in battle.
- #----------------------------------------------------------------------------
- def summon_unit(unit_id, slot_id)
- if $game_party.summon_unit(unit_id, slot_id)
- unit = $game_party.battle_units[slot_id]
- $game_temp.reserve_common_event(unit.actor.unit_on_common_ev_id)
- end
- end
- #----------------------------------------------------------------------------
- # * Random Summon a Unit to certain slot in battle.
- #----------------------------------------------------------------------------
- def random_summon_unit(unit_id)
- slot_id = ([1,2,3,4,5,6] - $game_party.battle_units.keys).shuffle[0]
- if slot_id
- summon_unit(unit_id, slot_id)
- return true
- end
- SceneManager.scene.return_card_to_player_hand
- return false
- end
- #----------------------------------------------------------------------------
- # * Check if there is a player unit on certain slot.
- #----------------------------------------------------------------------------
- def has_player_unit_on_slotX?(slot_id)
- return false unless SceneManager.scene_is?(Scene_Battle)
- return $game_party.battle_units.has_key?(slot_id)
- end
- #----------------------------------------------------------------------------
- # * Check if a unit in slot id has certain skill.
- #----------------------------------------------------------------------------
- def unit_has_skill?(slot_id, skill_id)
- return false unless SceneManager.scene_is?(Scene_Battle)
- skill = $data_skills[skill_id]
- return $game_party.battle_units[slot_id].skills.include?(skill)
- end
- #----------------------------------------------------------------------------
- # * Check if a unit in slot id has certain state.
- #----------------------------------------------------------------------------
- def unit_has_state?(slot_id, state_id)
- return false unless SceneManager.scene_is?(Scene_Battle)
- return $game_party.battle_units[slot_id].state?(state_id)
- end
- #----------------------------------------------------------------------------
- # * Check if a unit in slot can transform.
- #----------------------------------------------------------------------------
- def force_transform(slot_id, tp = 0, disable_cm = false)
- return false unless SceneManager.scene_is?(Scene_Battle)
- return false if !$game_party.battle_units.has_key?(slot_id)
- return false if $game_party.battle_units[slot_id].transformed
- unit = $game_party.battle_units[slot_id]
- SceneManager.scene.transform_unit(unit, tp, disable_cm, false)
- end
- #----------------------------------------------------------------------------
- # * Destroy Player Unit in specific Slot
- #----------------------------------------------------------------------------
- def destroy_unit(slot_id, return_card = true)
- unit = $game_party.battle_units[slot_id]
- if SceneManager.scene_is?(Scene_Battle) && unit
- unit.die
- unit.refresh
- unit.perform_collapse_effect
- return true
- end
- SceneManager.scene.return_card_to_player_hand if return_card
- return false
- end
- #----------------------------------------------------------------------------
- # * Destroy All Unit
- #----------------------------------------------------------------------------
- def destroy_all_unit(return_card = true)
- check = false
- for slot_id in 1..6
- if destroy_unit(slot_id, false)
- check = true
- end
- end
- if !check
- SceneManager.scene.return_card_to_player_hand if return_card
- end
- end
- #----------------------------------------------------------------------------
- # * Inflict State to Unit on Specific Slot
- #----------------------------------------------------------------------------
- def inflict_state_unit(slot_id, state_id, return_card = true)
- unit = $game_party.battle_units[slot_id]
- if SceneManager.scene_is?(Scene_Battle) && unit
- unit.add_state(state_id)
- unit.perform_collapse_effect if unit.dead?
- return true
- end
- SceneManager.scene.return_card_to_player_hand if return_card
- return false
- end
- #----------------------------------------------------------------------------
- # * Destroy All Unit
- #----------------------------------------------------------------------------
- def inflict_state_all_unit(state_id, return_card = true)
- check = false
- for slot_id in 1..6
- if inflict_state_unit(slot_id, state_id, false)
- check = true
- end
- end
- if !check
- SceneManager.scene.return_card_to_player_hand if return_card
- end
- end
- #----------------------------------------------------------------------------
- # * Check Lastest Unit Placement
- #----------------------------------------------------------------------------
- def lastest_unit_placement?(type)
- if $game_party.lastest_unit
- check = :defense if [1,2,3].include?($game_party.lastest_unit.slot_id)
- check = :offense if [4,5,6].include?($game_party.lastest_unit.slot_id)
- return type == check
- end
- return -1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement