UltimaForum

Skrypty [VX] - Regeneracja obronna

Asantos - Wto 04 Maj, 2010 21:38
Temat postu: Regeneracja obronna
~ Regeneracja obronna ~

Krótki opis
Skrypt wprowadza regeneracje życia i/lub many podczas obrony w trakcie trwania walki.

Autor skryptu
Synthesize


Tłumaczenie

Asantos

Kompatybilność

Tylko VX

Skrypt

Spoiler:

Kod:
#===============================================================================
# Regenerate HP/MP - RMVX Version
#===============================================================================
# Written by Synthesize
# Version 1.2.0
# January 19, 2008
#===============================================================================
#            *Nie kompatybilny z XP*
#===============================================================================
module SynRegen
  # Format = { Actor_ID => procent regeneracji, Actor_ID2 => procent regeneracji}
  HP_regen = {1 => 5, 2 =>7} # %
  # Możesz zdecydować ile HP będzie regenerował jaki bohater.
  # Bohaterów oddzielaj przecinkiem (,)
  #-----------------------------------------------------------------------------
  # Jeśli nie jest ustawione ID bohatera to jest domyślna wartość
  HP_regen.default = 5 # %
  #-----------------------------------------------------------------------------
  # Prawdziwość regeneracji HP
  Use_hp_regen = true
  #----------------------------------------------------------------------------
  # Format = {Actor_ID => MP regenerowane
  MP regenerowane = {1 => 5, 2 => 7} # %
  # Tak jak wyżej, tylko decydujemy o MP
  #
  #-----------------------------------------------------------------------------
  # Domyślny procent regeneracji
  SP_regen.default = 5 # %
  #-----------------------------------------------------------------------------
  # Prawdziwość regeneracji MP
  Use_mp_regen = true
  #-----------------------------------------------------------------------------
  # MA być wyświetlane ilość zregenerowanego życia i many
  Draw_text = true
  #-----------------------------------------------------------------------------
  # Ilość obron aby można było uzyskać SUPER OBRONĘ
  Super_guard_rate = 4
  #-----------------------------------------------------------------------------
  # Ilość obron dla normalnej obrony
  Normal_guard_rate = 2
end
#-------------------------------------------------------------------------------
# Scene_Battle
#   This aliases the execute_action_guard method in Scene_Battle
#-------------------------------------------------------------------------------
class Scene_Battle
  # Alias execute_action_guard
  alias syn_regen_execute_guard execute_action_guard
  #-----------------------------------------------------------------------------
  # Execute Action_Guard
  #-----------------------------------------------------------------------------
  def execute_action_guard
    # Calculate the amount of HP and MP gained
    hp_restore = ((@active_battler.maxhp * SynRegen::HP_regen[@active_battler.id]) / 100) if SynRegen::Use_hp_regen == true
    sp_restore = ((@active_battler.maxmp * SynRegen::SP_regen[@active_battler.id]) / 100) if SynRegen::Use_mp_regen == true
    # Calculate the different between MaxHP, HP, MaxMP and MP
    temp_value_hp = (@active_battler.maxhp - @active_battler.hp)
    temp_value_mp = (@active_battler.maxmp - @active_battler.mp)
    # Add HP and MP
    @active_battler.hp += hp_restore if SynRegen::Use_hp_regen == true
    @active_battler.mp += sp_restore if SynRegen::Use_mp_regen == true
    # Draw how much HP/MP the actor regenerated
    if temp_value_hp != 0 and temp_value_mp != 0
      @message_window.add_instant_text("#{@active_battler.name} HP zregenerowane o #{hp_restore}  MP zregenerowane o #{sp_restore}")
    elsif temp_value_hp != 0 and temp_value_mp == 0
      @message_window.add_instant_text("#{@active_battler.name} HP zregenerowane o #{hp_restore}")
    elsif temp_value_hp == 0 and temp_value_mp != 0
      @message_window.add_instant_text("#{@active_battler.name} MP zregenerowane o #{sp_restore}")
    end
    # Call the original code
    syn_regen_execute_guard
  end
end
#-------------------------------------------------------------------------------
# Game_Battler
#   This rewrites the defense method found in Game_Battler
#-------------------------------------------------------------------------------
class Game_Battler
  #-----------------------------------------------------------------------------
  # Apply_Guard_Damage
  #-----------------------------------------------------------------------------
  def apply_guard(damage)
    if damage > 0 and guarding?
      # Divide the total damage from the effectivness of the defense rate.
      damage /= super_guard ? SynRegen::Super_guard_rate : SynRegen::Normal_guard_rate   
    end
    return damage
  end
end
#===============================================================================
# Skrypt nie jest kompatybilny RMXP
#===============================================================================
#           * Skrypt powinien teoretycznie działać *
#===============================================================================
# Written by Synthesize
# January 19, 2008
#===============================================================================
# Regeneracja HP/MP - RMVX Version
#===============================================================================


Demo

niepotrzebne

Instrukcja

1. Wklej skrypt nad "Main" w Edytorze Skryptu.
2. Reszta instrukcji znajduje się w treści skryptu.

Asantos - Wto 04 Maj, 2010 22:17

Poprawione hehe :) Mój błąd...
cj2 - Sro 05 Maj, 2010 13:59

Czy działa przy walce na mapie?
Sabikku - Sro 05 Maj, 2010 19:50

Jakby ktoś chciał do xp, proszę:
Spoiler:



Przydatny skrypt.

MrQubo - Pią 16 Lis, 2012 16:54

MP regenerowane = {1 => 5, 2 => 7} # %

Tu jest błąd, trzeba zamienić na SP_regen :

SP_regen = {1 => 5, 2 => 7} # %


Powered by phpBB modified by Przemo © 2003 phpBB Group