Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # SISTEMA YGO DE QUICK EFFECT V5: Con Kill Switch (Modo Debug)
- #==============================================================================
- $MISCELLA_SYSTEM_ON = true # <--- Mantenelo en 'false' para probar a UCT.
- # Trace Card Destruction / MP (same flag as CardGameScript): $YTGO_CARD_TRACE = true in F12 console
- $YTGO_CARD_TRACE = false unless defined?($YTGO_CARD_TRACE)
- #==============================================================================
- # 1. SISTEMA GENÉRICO DE AURAS
- #==============================================================================
- class Game_Party < Game_Unit
- attr_accessor :active_auras
- unless method_defined?(:ygo_auras_battle_start)
- alias_method :ygo_auras_battle_start, :on_battle_start
- end
- def on_battle_start
- ygo_auras_battle_start
- @active_auras = [] if $MISCELLA_SYSTEM_ON
- end
- def add_aura(aura_name)
- @active_auras ||= []
- @active_auras << aura_name unless @active_auras.include?(aura_name)
- end
- def has_aura?(aura_name)
- return false if @active_auras.nil?
- @active_auras.include?(aura_name)
- end
- end
- class Game_Actor < Game_Battler
- unless method_defined?(:pc27_cg_on_turn_end_aura)
- alias_method :pc27_cg_on_turn_end_aura, :on_turn_end
- end
- def on_turn_end
- $game_party.active_auras = [] if $MISCELLA_SYSTEM_ON
- pc27_cg_on_turn_end_aura
- end
- def can_pay_card_cost?(card)
- return false unless card
- # 1. Chequeo de MP base (si usás el sistema nativo de RPG Maker)
- return false if card.respond_to?(:mp_cost) && self.mp < card.mp_cost
- # 2. Chequeo de requerimientos personalizados (tu método actual)
- return false if self.respond_to?(:custom_req_met?) && !self.custom_req_met?(card)
- # 3. Extraer el texto del costo de las notas
- cost_name = nil
- if card.note =~ /<card cost:\s*(.+?)>/i || card.note =~ /<spell_cost:\s*(.+?)>/i
- cost_name = $1.to_s.strip.downcase
- end
- # 4. Evaluación matemática
- if cost_name
- if cost_name =~ /discard(\d+)/i
- amount = $1.to_i
- return false if self.hand.size < amount
- elsif cost_name =~ /pay_lp_(\d+)/i
- amount = $1.to_i
- # En Yu-Gi-Oh no podés suicidarte para pagar un costo
- return false if self.hp <= amount
- end
- # Podés seguir agregando "elsif" acá en el futuro para costos como "banish1", etc.
- end
- return true
- end
- end
- #==============================================================================
- # 2. UI: VENTANAS DE RESPUESTA RÁPIDA Y NIVELES
- #==============================================================================
- # (La UI no interfiere con la lógica base, la dejamos intacta para evitar errores de clase no encontrada)
- class Window_ActivationNotice < Window_Base
- def initialize
- super(0, 0, 340, 100)
- self.x = 4
- self.y = (Graphics.height - self.height) / 2 - 140
- self.z = 10000
- self.visible = false
- self.contents_opacity = 0
- end
- def display_activation(item, target = nil, attacker = nil)
- contents.clear
- self.visible = true
- change_color(normal_color)
- if item.id == 1
- attacker_name = attacker ? attacker.name : "Opponent"
- text_part = "#{attacker_name} attacks "
- tw = text_size(text_part).width
- target_w = target ? text_size(target.name).width : 0
- if target && (tw + target_w > contents.width)
- draw_text(0, 0, contents.width, line_height, text_part)
- change_color(text_color(14))
- draw_text(0, line_height, contents.width, line_height, target.name)
- change_color(normal_color)
- draw_text(0, line_height * 2, contents.width, line_height, "Activate a response?")
- else
- draw_text(0, 0, contents.width, line_height, text_part)
- if target
- change_color(text_color(14))
- draw_text(tw, 0, contents.width - tw, line_height, target.name)
- change_color(normal_color)
- end
- draw_text(0, line_height, contents.width, line_height, "Activate a response?")
- end
- else
- attacker_name = attacker ? attacker.name : "Your opponent"
- draw_text(0, 0, contents.width, line_height, "#{attacker_name} activates:")
- draw_icon(item.icon_index, 0, line_height + 4)
- draw_text(28, line_height + 4, contents.width - 28, line_height, item.name)
- end
- self.contents_opacity = 255
- end
- def display_damage_activation(target)
- contents.clear
- self.visible = true
- change_color(text_color(14))
- draw_text(0, 0, contents.width, line_height, "#{target.name} took damage!")
- change_color(normal_color)
- draw_text(0, line_height, contents.width, line_height, "Activate a response?")
- self.contents_opacity = 255
- end
- end
- class Sprite_CardPreview < Sprite
- def initialize(viewport = nil)
- super(viewport)
- self.z = 10001
- self.visible = false
- end
- def show_card(item_id)
- begin
- self.bitmap = Cache.picture("Card#{item_id}")
- self.x = 350
- self.y = (Graphics.height / 2) - 190
- self.visible = true
- rescue
- self.visible = false
- end
- end
- end
- class Window_QuickPrompt < Window_Command
- def initialize
- super(0, 0)
- self.x = 4
- self.y = (Graphics.height - self.height) / 2 - 50
- self.z = 10000
- self.openness = 0
- self.active = false
- self.visible = false
- @responses = []
- end
- def window_width; return 340; end
- def set_responses(responses)
- @responses = responses
- refresh
- self.height = window_height
- self.y = (Graphics.height - self.height) / 2 - 50
- end
- def make_command_list
- if @responses && [email protected]?
- @responses.each do |resp|
- card = resp[:card]
- owner = resp[:owner]
- suffix = $game_party.battle_members.size > 1 ? " (#{owner.name})" : ""
- if resp[:trigger_type] == :set_and_faceup
- command_text = "Activate #{card.name} & its effect#{suffix}"
- elsif resp[:was_face_down]
- command_text = "Activate #{card.name}#{suffix}"
- else
- command_text = "Use effect of #{card.name}#{suffix}"
- end
- add_command(command_text, :yes, true, resp)
- end
- end
- add_command("Cancel", :no)
- end
- # --- NUEVO: Sobrescribimos draw_item para inyectar el icono ---
- def draw_item(index)
- change_color(normal_color, command_enabled?(index))
- rect = item_rect_for_text(index)
- # Recuperamos la información guardada en :ext
- resp = @list[index][:ext]
- # Si existe una carta asignada a esta opción, dibujamos su icono
- if resp && resp.is_a?(Hash) && resp[:card]
- draw_icon(resp[:card].icon_index, rect.x, rect.y)
- rect.x += 28 # Empujamos el texto hacia la derecha
- rect.width -= 28 # Reducimos el ancho para que no se corte
- end
- draw_text(rect, command_name(index), alignment)
- end
- end
- class Window_MiscellaLevelChoice < Window_Command
- def initialize(actor, valid_levels)
- @actor = actor
- @valid_levels = valid_levels
- super(0, 0)
- self.x = (Graphics.width - self.width) / 2
- self.y = (Graphics.height - self.height) / 2
- self.z = 10000
- end
- def window_width; return 240; end
- def make_command_list
- @valid_levels.each { |lvl| add_command("Summon Level #{lvl}", :select_level, true, lvl) }
- add_command("Cancel", :cancel)
- end
- end
- #==============================================================================
- # 3. NÚCLEO DE BATALLA: ESCENA Y LÓGICA DE CARTAS (CON KILL SWITCH)
- #==============================================================================
- class Scene_Battle < Scene_Base
- unless method_defined?(:ygo_v3_create_windows)
- alias_method :ygo_v3_create_windows, :create_all_windows
- end
- def create_all_windows
- ygo_v3_create_windows
- @activation_notice = Window_ActivationNotice.new
- @card_preview = Sprite_CardPreview.new
- @quick_prompt = Window_QuickPrompt.new
- @quick_prompt.set_handler(:yes, method(:on_quick_yes))
- @quick_prompt.set_handler(:no, method(:on_quick_no))
- @quick_prompt.set_handler(:cancel, method(:on_quick_no))
- @miscella_level_window = Window_MiscellaLevelChoice.new(nil, [])
- @miscella_level_window.set_handler(:select_level, method(:on_miscella_level_ok))
- @miscella_level_window.set_handler(:cancel, method(:on_miscella_level_cancel))
- @miscella_level_window.hide.deactivate
- end
- unless method_defined?(:ygo_auras_turn_end)
- alias_method :ygo_auras_turn_end, :turn_end
- end
- def turn_end
- $game_party.active_auras = [] if $MISCELLA_SYSTEM_ON
- ygo_auras_turn_end
- end
- unless method_defined?(:pc27_cg_command_end_turn_aura)
- alias_method :pc27_cg_command_end_turn_aura, :command_end_turn
- end
- def command_end_turn
- $game_party.active_auras = [] if $MISCELLA_SYSTEM_ON
- pc27_cg_command_end_turn_aura
- end
- # --- Uso de Cartas ---
- alias ygo_v3_use_item_check use_item unless method_defined?(:ygo_v3_use_item_check)
- def use_item
- return ygo_v3_use_item_check if @is_interrupt_effect && @subject && [email protected]?
- original_subject = @subject
- if $MISCELLA_SYSTEM_ON && @subject && @subject.enemy?
- item = @subject.current_action.item rescue nil
- if item
- @current_quick_subject = @subject
- @attack_negated = false
- target = @subject.current_action.make_targets.compact[0] rescue nil
- check_generic_quick_responses(item, target)
- end
- end
- if @attack_negated
- wait(90)
- $game_message.clear
- $game_message.background = 1
- $game_message.position = 1
- $game_message.add("Attack Negated!")
- if @message_window
- @message_window.openness = 255
- @message_window.visible = true
- end
- wait_for_message
- return
- end
- @subject = original_subject if original_subject
- ygo_v3_use_item_check
- end
- unless method_defined?(:pc27_grave_bug_fix)
- alias_method :pc27_grave_bug_fix, :on_skill_ok
- end
- def on_skill_ok
- if $MISCELLA_SYSTEM_ON
- @subject = BattleManager.actor
- if @subject && @subject.current_zone == :graveyard
- @skill = @skill_window.item
- handle_graveyard_skill(@skill)
- return
- end
- end
- pc27_grave_bug_fix
- end
- # --- Activación Manual ---
- unless method_defined?(:pc27_safe_resolve_card)
- alias_method :pc27_safe_resolve_card, :resolve_card_effect
- end
- def resolve_card_effect(skill)
- if $MISCELLA_SYSTEM_ON && @current_card_action == :hand_effect
- if skill.hand_impact == "miscellahand" || skill.note =~ /<quick_response_hand:\s*(.+?)>/i
- aura_name = :miscella
- aura_name = $1.to_s.strip.downcase.to_sym if $1
- $game_party.add_aura(aura_name)
- RPG::SE.new("Magic1", 80, 100).play rescue nil
- BattleManager.actor.popup_destroyed_card(skill.icon_index, "Protected!") if BattleManager.actor.respond_to?(:popup_destroyed_card)
- end
- end
- # --- FIX MP: REVISIÓN INTELIGENTE DE COSTOS ---
- tiene_costo_extra = (skill.note =~ /<card cost:/i || skill.note =~ /<spell_cost:/i)
- tiene_impacto = (skill.note =~ /<card impact:/i || skill.note =~ /<spell_impact:/i || skill.note =~ /<hand_impact:/i)
- # Field flip / set activation already calls pay_skill_cost in CardGameScript when !card.cost — do not pay again here.
- if !tiene_costo_extra && tiene_impacto && @current_card_action != :field_effect
- if defined?($YTGO_CARD_TRACE) && $YTGO_CARD_TRACE
- puts("[YTGO-CARD] resolve_card_effect pay_skill_cost id=#{skill.id} mp=#{BattleManager.actor.mp rescue '?' } zone_act=#{@current_card_action.inspect}")
- end
- BattleManager.actor.pay_skill_cost(skill) if BattleManager.actor.respond_to?(:pay_skill_cost)
- elsif defined?($YTGO_CARD_TRACE) && $YTGO_CARD_TRACE && tiene_impacto
- puts("[YTGO-CARD] resolve_card_effect SKIP pay id=#{skill.id} act=#{@current_card_action.inspect} tiene_costo_extra=#{!!tiene_costo_extra}")
- end
- # ----------------------------------------------
- pc27_safe_resolve_card(skill)
- end
- unless method_defined?(:ygo_miscella_restore_taken)
- alias_method :ygo_miscella_restore_taken, :restore_taken_cards
- end
- def restore_taken_cards(target)
- if $MISCELLA_SYSTEM_ON
- begin
- if target == :proceed && @temp_effect_data && @temp_effect_data[1]
- effect_name = @temp_effect_data[1]
- effect_data = PC27::CG::CARD_EFFECT[effect_name] rescue nil
- if effect_data.is_a?(Array) && effect_data.size >= 6
- destination = effect_data[5]
- if destination == :miscella_chain_summon
- taken_cards = @temp_effect_data[3].dup
- @temp_effect_data[3] = []
- process_banish_triggers(taken_cards)
- @card_select_window.actor.banish += taken_cards
- next_effect = "miscella_sp_summon"
- @current_card_action = :field_effect
- BattleManager.actor.current_zone = :deck
- invoke_card_impact(next_effect)
- return true
- end
- end
- end
- rescue
- end
- end
- ygo_miscella_restore_taken(target)
- end
- def proceed_selection
- @added_card_name = nil
- if @temp_effect_data && @temp_effect_data[3] && !@temp_effect_data[3].empty?
- @added_card_name = @temp_effect_data[3][0].name
- end
- @card_select_window.hide.deactivate
- @card_select_window.sort_index = -1
- restore_selected_cards
- player = @active_effect_owner || BattleManager.actor || $game_party.members[0]
- unless @current_card_action == :field_effect
- player.current_zone = :hand
- end
- if @temp_effect_data[0] == :cost
- effect_data = PC27::CG::CARD_EFFECT[@temp_effect_data[1]]
- is_chain = effect_data && effect_data[5].to_s.include?("chain")
- restore_taken_cards(:proceed)
- if @is_interrupt_effect
- puts "[DEBUG] Costo pagado. Saltando a impacto."
- skill_to_use = @skill || @active_effect_card
- impact_to_use = nil
- if skill_to_use.note =~ /<card impact:\s*(.+?)>/i ||
- skill_to_use.note =~ /<spell_impact:\s*(.+?)>/i ||
- skill_to_use.note =~ /<field_impact:\s*(.+?)>/i
- impact_to_use = $1.to_s.strip.downcase
- end
- @temp_effect_data = []
- invoke_card_impact(impact_to_use) if impact_to_use
- else
- unless is_chain
- if player && player.respond_to?(:input) && player.input
- player.input.set_skill(@skill.id)
- player.last_skill.object = @skill
- end
- @temp_effect_data = []
- next_command
- end
- end
- elsif @temp_effect_data[0] == :impact
- unless restore_taken_cards(:proceed)
- finish_proceed_selection
- end
- end
- end
- def handle_graveyard_skill(skill)
- if BattleManager.actor.state?(18)
- is_misc = (skill.grave_impact == "miscella" || skill.note =~ /<grave[-_ ]impact:\s*miscella>/i)
- if is_misc || (skill.grave_impact && BattleManager.actor.leads_to_special_summon?(skill.grave_impact))
- Sound.play_buzzer
- @skill_window.activate
- return
- end
- end
- if skill.grave_impact == "miscella" || skill.note =~ /<grave[-_ ]impact:\s*miscella>/i
- process_miscella_grave_effect(skill)
- elsif skill.grave_impact && skill.grave_impact != "" && skill.grave_impact != false
- @current_card_action = :grave_effect
- invoke_card_impact(skill.grave_impact)
- else
- Sound.play_buzzer
- @skill_window.activate
- end
- end
- def process_miscella_grave_effect(skill)
- actor = BattleManager.actor
- grave_dinos = actor.grave.select { |c| c.subtype == 9 rescue false }
- return Sound.play_buzzer.tap { $game_message.add("No monster zones!"); @skill_window.activate } unless actor.free_monster_zone_available?
- valid_levels = []
- actor.deck.each do |c|
- next unless (c.subtype == 9 rescue false)
- next if (c.note =~ /<special_only:/i) && !c.properly_summoned
- valid_levels << c.level if c.level > 0 && c.level <= grave_dinos.size && !valid_levels.include?(c.level)
- end
- return Sound.play_buzzer.tap { @skill_window.activate } if valid_levels.empty?
- @miscella_level_window.dispose if @miscella_level_window
- @miscella_level_window = Window_MiscellaLevelChoice.new(actor, valid_levels.sort)
- @miscella_level_window.set_handler(:select_level, method(:on_miscella_level_ok))
- @miscella_level_window.set_handler(:cancel, method(:on_miscella_level_cancel))
- @skill_window.deactivate
- @miscella_level_window.show.activate
- end
- def on_miscella_level_ok
- chosen_level = @miscella_level_window.current_ext
- @miscella_level_window.hide.deactivate
- actor, miscella_card = BattleManager.actor, @skill_window.item
- idx = actor.grave.index(miscella_card)
- actor.grave.delete_at(idx) if idx
- actor.banish.push(miscella_card)
- amount_needed = chosen_level - 1
- PC27::CG::CARD_EFFECT["miscella_sp_summon"] = [:takem, 0, :deck, :deck, [0, 0, 0, 9, chosen_level, 0, 0, 0, 0, 0, 0], :special_summon, 1]
- if amount_needed > 0
- PC27::CG::CARD_EFFECT["miscella_banish_cost"] = [:takem, 0, :grave, :grave, [0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0], :miscella_chain_summon, amount_needed]
- invoke_card_impact("miscella_banish_cost")
- else
- invoke_card_impact("miscella_sp_summon")
- end
- end
- unless method_defined?(:ygo_miscella_restore_taken)
- alias_method :ygo_miscella_restore_taken, :restore_taken_cards
- end
- def on_miscella_level_cancel; @miscella_level_window.hide.deactivate; @skill_window.activate; end
- def check_generic_quick_responses(enemy_item, target = nil)
- return if @is_interrupt_effect
- puts "[DEBUG] check_generic_quick_responses: Evaluando item enemigo #{enemy_item ? enemy_item.name : 'N/A'}"
- responses = gather_quick_responses(enemy_item, target)
- return if responses.empty?
- @skill_window.hide.deactivate if @skill_window
- @card_select_window.hide.deactivate if @card_select_window
- @actor_command_window.hide.deactivate if @actor_command_window
- if enemy_item
- @activation_notice.display_activation(enemy_item, target, @current_quick_subject)
- @card_preview.show_card(enemy_item.id) unless enemy_item.id == 1
- end
- @quick_prompt.set_responses(responses)
- @quick_prompt.visible = true
- @quick_prompt.open
- @quick_prompt.activate
- @quick_prompt.select(0)
- update_basic while @quick_prompt.active
- @activation_notice.visible = @card_preview.visible = false
- end
- def on_quick_yes
- @last_state_card_id = nil
- resp = @quick_prompt.current_ext
- @quick_prompt.close; @quick_prompt.deactivate; @quick_prompt.visible = false
- @activation_notice.visible = false
- @card_preview.visible = false
- @is_interrupt_effect = true
- player = resp[:owner]
- card = resp[:card]
- if resp[:source] == :hand
- hand_idx = player.hand.index(card)
- player.hand.delete_at(hand_idx) if hand_idx
- player.grave.push(card)
- $game_party.add_aura(resp[:aura])
- player.popup_destroyed_card(card.icon_index, "Protected!")
- RPG::SE.new("Magic1", 80, 100).play rescue nil
- @is_interrupt_effect = false
- elsif resp[:source] == :field
- idx = resp[:index]
- state = player.st_zones_state[idx]
- if resp[:was_face_down]
- player.pay_skill_cost(card) if player.respond_to?(:pay_skill_cost)
- end
- state[:face_down] = false
- @field_map_window.refresh if @field_map_window
- RPG::SE.new("Magic1", 80, 100).play rescue nil
- player.popup_destroyed_card(card.icon_index, "Activated!") rescue nil
- cost_name = nil
- if card.note =~ /<card cost:\s*(.+?)>/i || card.note =~ /<spell_cost:\s*(.+?)>/i
- cost_name = $1.to_s.strip.downcase
- end
- impact_name = nil
- if resp[:trigger_type] == :faceup || resp[:trigger_type] == :set_and_faceup
- if card.note =~ /<faceup_impact:\s*(.+?)>/i
- impact_name = $1.to_s.strip.downcase
- end
- else
- if card.note =~ /<card impact:\s*(.+?)>/i || card.note =~ /<spell_impact:\s*(.+?)>/i || card.note =~ /<field_impact:\s*(.+?)>/i
- impact_name = $1.to_s.strip.downcase
- end
- end
- @skill = card
- @item = card
- @selected_card = card
- @active_effect_card = card
- @current_processing_card = card
- $temp_active_card = card
- $chain_memory_card = card
- @active_effect_zone_type = :spell
- @active_effect_zone_index = idx
- @current_quick_owner = player
- if cost_name
- @current_card_action = :card_cost
- $chain_memory_card.instance_variable_set(:@quick_queued_impact, impact_name) if impact_name
- invoke_card_cost(cost_name)
- elsif impact_name
- @current_card_action = :field_effect
- invoke_card_impact(impact_name)
- else
- @is_interrupt_effect = false
- end
- end
- end
- def on_quick_no
- puts "[DEBUG] on_quick_no: Jugador canceló la respuesta."
- @quick_prompt.close
- @quick_prompt.deactivate
- @quick_prompt.visible = false
- @is_interrupt_effect = false
- @activation_notice.visible = false
- @card_preview.visible = false
- end
- def gather_quick_responses(enemy_item, target = nil)
- valid_responses = []
- $game_party.battle_members.each do |player|
- next unless player.alive?
- if player.respond_to?(:hand)
- player.hand.each do |card|
- if card.note =~ /<quick_response_hand:\s*(.+?)>/i
- valid_responses << {:card => card, :source => :hand, :aura => $1.to_s.strip.downcase.to_sym, :owner => player}
- end
- end
- end
- if player.respond_to?(:st_zones)
- player.st_zones.each_with_index do |card, index|
- next unless card
- state = player.st_zones_state[index]
- next unless state
- next unless player.can_pay_card_cost?(card)
- set_cond = card.note =~ /<quick_response_set:\s*(.+?)>/i ? $1.to_s.strip.downcase : nil
- faceup_cond = card.note =~ /<quick_response_faceup:\s*(.+?)>/i ? $1.to_s.strip.downcase : nil
- set_met = false
- faceup_met = false
- if set_cond == "any" || (set_cond == "attack" && enemy_item && enemy_item.id == 1)
- set_met = true
- elsif set_cond =~ /attack_dmg_(\d+)/ && enemy_item && enemy_item.id == 1 && target
- threshold = $1.to_i
- expected_dmg = [eval(enemy_item.damage.formula), 0].max rescue 0
- set_met = true if expected_dmg >= threshold
- end
- if faceup_cond == "any" || (faceup_cond == "attack" && enemy_item && enemy_item.id == 1)
- faceup_met = true
- elsif faceup_cond =~ /attack_dmg_(\d+)/ && enemy_item && enemy_item.id == 1 && target
- threshold = $1.to_i
- expected_dmg = [eval(enemy_item.damage.formula), 0].max rescue 0
- faceup_met = true if expected_dmg >= threshold
- end
- if state[:face_down]
- if set_met
- valid_responses << {:card => card, :source => :field, :index => index, :owner => player, :was_face_down => true, :trigger_type => :set, :condition => set_cond}
- if faceup_met
- valid_responses << {:card => card, :source => :field, :index => index, :owner => player, :was_face_down => true, :trigger_type => :set_and_faceup, :condition => faceup_cond}
- end
- end
- else
- if faceup_met
- valid_responses << {:card => card, :source => :field, :index => index, :owner => player, :was_face_down => false, :trigger_type => :faceup, :condition => faceup_cond}
- end
- end
- end
- end
- end
- return valid_responses
- end
- alias pc27_post_dmg_invoke_item invoke_item
- def invoke_item(target, item)
- pc27_post_dmg_invoke_item(target, item)
- # Si el que recibió el ataque es un Actor y perdió HP
- if $game_party.in_battle && target.is_a?(Game_Actor) && target.result.hp_damage > 0
- check_damage_responses(target)
- end
- end
- # 2. Mostramos el menú SOLAMENTE al jugador herido
- def check_damage_responses(target)
- return if @is_interrupt_effect
- puts "[DEBUG] check_damage_responses: Evaluando daño en #{target.name}"
- responses = gather_damage_responses(target)
- return if responses.empty?
- @skill_window.hide.deactivate if @skill_window
- @card_select_window.hide.deactivate if @card_select_window
- @actor_command_window.hide.deactivate if @actor_command_window
- @activation_notice.display_damage_activation(target)
- @quick_prompt.set_responses(responses)
- @quick_prompt.visible = true
- @quick_prompt.open
- @quick_prompt.activate
- @quick_prompt.select(0)
- # Igual que arriba, solo esperamos al Sí o No.
- update_basic while @quick_prompt.active
- @activation_notice.visible = false
- end
- # 3. Recolectamos trampas con la etiqueta de Daño exclusivas del herido
- def gather_damage_responses(player)
- valid_responses = []
- return valid_responses unless player && player.alive?
- if player.respond_to?(:st_zones)
- player.st_zones.each_with_index do |card, index|
- next unless card
- state = player.st_zones_state[index]
- # Debe estar seteada boca abajo y tener la etiqueta de daño
- if state && state[:face_down]
- if card.note =~ /<quick_response_damage>/i
- next unless player.can_pay_card_cost?(card)
- valid_responses << {:card => card, :source => :field, :index => index, :owner => player}
- end
- end
- end
- end
- return valid_responses
- end
- alias archo_ygo_freeze_scene_update update unless method_defined?(:archo_ygo_freeze_scene_update)
- def update
- if @is_interrupt_effect
- # Si estamos en modo interrupción, SOLO actualizamos las ventanas.
- # El 'return' evita que Yanfly procese turnos o ataques enemigos.
- update_basic
- return
- end
- archo_ygo_freeze_scene_update
- end
- alias pc27_qe_force_cleanup execute_finish_proceed_cleanup unless method_defined?(:pc27_qe_force_cleanup)
- def execute_finish_proceed_cleanup
- if @is_interrupt_effect
- card = @active_effect_card || @skill || @selected_card
- player = @active_effect_owner || @current_quick_owner || $game_party.members[0]
- if card && [24, 25, 29, 31].include?(card.subtype)
- if player && player.st_zones
- idx_to_clear = nil
- if @active_effect_zone_type == :spell && @active_effect_zone_index
- if player.st_zones[@active_effect_zone_index] && player.st_zones[@active_effect_zone_index].equal?(card)
- idx_to_clear = @active_effect_zone_index
- end
- end
- if idx_to_clear && player.st_zones[idx_to_clear]
- actual_card = player.st_zones[idx_to_clear]
- player.st_zones[idx_to_clear] = nil
- idx_field = player.field.index { |c| c && c.equal?(actual_card) }
- player.field.delete_at(idx_field) if idx_field
- player.grave.push(actual_card) unless player.grave.any? { |c| c.equal?(actual_card) }
- @field_map_window.refresh if defined?(@field_map_window) && @field_map_window
- @minifield_window.refresh if defined?(@minifield_window) && @minifield_window
- end
- end
- end
- end
- pc27_qe_force_cleanup
- end
- end
Advertisement