Mundo Maker
¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.

[RMXP] Lightning Burst 0.2.3.3 para Number Flood

Ver el tema anterior Ver el tema siguiente Ir abajo

RPG Maker XP [RMXP] Lightning Burst 0.2.3.3 para Number Flood

Mensaje por silvanash el 2017-04-17, 10:32

Adaptado Lightning Burst a Number Flood v0.4.1. Esta versión muestra el daño del burst con una animación aparte, en lugar de combinar el daño en un solo número. Se configura de forma idéntica al Lightning Burst default, con un parámetro opcional más:

:critical => "texto",

Ese "texto" (entre comillas, eso es importante) es un mensaje adicional que se muestra como animación cuando se activa Lightning Burst sobre algo. Por ejemplo, "Bounce!" para una skill que tire un rayo que rebota en enemigos cercanos.

Stormblade 0.2 default funciona correctamente con Lightning Burst para Number Flood sin necesidad de actualizaciones.

El script CRASHEARÁ si el proyecto no tiene el script de Number Flood.

Código:
# Lightning Burst v0.2.3.3; ported to Number Flood
# silvanash

# This script allows skills to deal damage to adjacent entities
# Damage is based on distance from the main target to other targets
# The burst can bounce a limited amount of times before fading

# Stormblade 0.2 works with Number Flood without any modifications

module SLV_Config
 
  # IDs of the skills that can use the Lightning Burst effect and config
  LIGHTNING_BURST_SETUP = {
    1 => {:decay => 0.2, :bounce => 8, :hit_main => true, :critical => "Burst!",},
  }
 
  # :decay measures the % of damage lost per 100 pixels between targets
  # actor sprites are at ~160 pixels from each other
  # :critical is used as a damage display for Number Flood
 
end

class Spriteset_Battle
 
  def slv_get_distances(main_target)
    # Returns an array with the battlers and the distance (in pixels) from all
    # the living entities in the targeted party
    distances = []
    if main_target.is_a?(Game_Actor)
      party = @actor_sprites
    else
      party = @enemy_sprites
    end
    for sprite in party
      if sprite.battler == main_target
        # Gets the main target to read its position on-screen
        main = sprite
        break
      end
    end
    for sprite in party
      # Skip if battler doesn't exist
      next if sprite.battler.nil?
      # The burst can't bounce to the main target
      next if sprite.battler == main_target
      # The burst can't bounce to dead/hidden targets
      next if sprite.battler.dead? or sprite.battler.hidden
      # Gets the distance bewteen the main and the the side sprites
      width = (sprite.bitmap.width / 2 + sprite.x) -
      (main.bitmap.width / 2 + main.x)
      height = (sprite.bitmap.height / 2 + sprite.y) -
      (main.bitmap.width / 2 + main.y)
      d = width.abs + height.abs
      # Pushes the battler and the distance into the distance array
      distances.push([sprite.battler, d])
    end
    # Sorts the array by distance to the main target
    distances.sort! { |a, b| a[1] <=> b[1] }
    # Returns the array so it can be operated with
    return distances
  end
 
end

class Scene_Battle
 
  alias slv_lightning_burst make_skill_action_result unless $@
 
  # Procs the Lighning Burst
 
  def make_skill_action_result
    slv_lightning_burst
    proc_lightning_burst
  end
 
  def proc_lightning_burst(skill = nil)
    # The Lightning Burst was called with a skill
    burst_skill = @skill.dup if !@skill.nil?
    burst_skill = skill if !skill.nil?
    # Procs Lightning Burst here
    # Lightning Burst won't proc if there are multiple targets
    if SLV_Config::LIGHTNING_BURST_SETUP.has_key?(burst_skill.id) and
      @target_battlers.size == 1 && @target_battlers[0].damage.to_i > 0
      d = @spriteset.slv_get_distances(@target_battlers[0])
      # Gets the Lightning Burst config for this skill
      data = SLV_Config::LIGHTNING_BURST_SETUP[burst_skill.id]
      # The Burst can target the main target
      hit_main = data[:hit_main]
      if hit_main == true
        d = [[@target_battlers[0], 0]].concat(d)
      end
      # Procs the burst as many times as allowed
      for i in 0...data[:bounce]
        # Break if no more targets are available
        break if i >= d.size
        # Breaks if the next target is out of range
        if hit_main == true and i > 0
          break if !data[:range].nil? and data[:range] < d[i - 1][1]
        else
          break if !data[:range].nil? and data[:range] < d[i][1]
        end
        # Reduces the skill damage using the distance between battlers
        f = (d[i][1] * data[:decay]).truncate
        # Breaks if the next target is so far that it wouldn't take damage
        break if f >= 100
        # Modifies the skill parameters
        burst_skill.power -= burst_skill.power * f / 100
        burst_skill.atk_f -= burst_skill.atk_f * f / 100
        burst_skill.str_f -= burst_skill.str_f * f / 100
        burst_skill.dex_f -= burst_skill.dex_f * f / 100
        burst_skill.agi_f -= burst_skill.agi_f * f / 100
        burst_skill.int_f -= burst_skill.int_f * f / 100
        # Pushes the closest next target into the targeted battlers array
        if hit_main
          if i > 0
            @target_battlers.push(d[i][0])
            ary = @target_battlers[-1].main_damage.dup
            @target_battlers[-1].skill_effect(@active_battler, burst_skill)
            @target_battlers[-1].damages.insert(0, @target_battlers[-1].main_damage.dup)
            @target_battlers[-1].damages.insert(0, [data[:critical]]) if !data[:critical].nil?
            @target_battlers[-1].main_damage = ary
          else
            ary = @target_battlers[0].main_damage.dup
            @target_battlers[0].skill_effect(@active_battler, burst_skill)
            @target_battlers[0].damages.insert(0, @target_battlers[0].main_damage.dup)
            @target_battlers[-1].damages.insert(0, [data[:critical]]) if !data[:critical].nil?
            @target_battlers[0].main_damage = ary
          end
        else
          @target_battlers.push(d[i][0])
          ary = @target_battlers[-1].main_damage.dup
          @target_battlers[-1].skill_effect(@active_battler, burst_skill)
          @target_battlers[-1].damages.insert(0, @target_battlers[-1].main_damage.dup)
          @target_battlers[-1].damages.insert(0, [data[:critical]]) if !data[:critical].nil?
          @target_battlers[-1].main_damage = ary
        end
      end
    end
  end
 
end
avatar
silvanash
Aventurero
Aventurero

0/3

Créditos 1630

Gracias : 231

Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


Permisos de este foro:
No puedes responder a temas en este foro.