# ============================================================================= # TheoAllen - In Map Slip Damage # Version : 1.0 # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com # (This script documentation is written in informal indonesian language) # ============================================================================= ($imported ||= {})[:Theo_SlipDamage] = true # ============================================================================= # CHANGE LOGS: # ----------------------------------------------------------------------------- # 2013.05.18 - Started and Finished script # ============================================================================= =begin PERKENALAN : Script ini ngebalikin fungsi yang ada di RMVX dimana state punya slip damage atau heal waktu berjalan dalam tiap langkah dalam map. CARA PENGGUNAAN : Pasang diatas main namun di bawah material. Tulis notetag seperti ini jika diperlukan dalam note state UNTUK DAMAGE : UNTUK HEAL : Dimana n adalah angka konstan. Apabila kamu menggunakan %, maka nilainya akan relatif terhadap nilai maksimal HP / MP. Misalnya kamu menuliskan Maka setiap satu langkah dalam map, HP actor akan berkurang 10% TERMS OF USE : Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau dipake buat komersil, jangan lupa, gw dibagi gratisannya. =end # ============================================================================= # Konfigurasi : # ============================================================================= module THEO module STATE # ======================================================================= # FLASH COLOR SETTING # ----------------------------------------------------------------------- # Berikut ini adalah settingan untuk flash color tiap tipe2 slip effect. # Yang perlu kamu tulis adalah : # => Color.new(red,green,blue,alpha) # # Masing2 nilai maksimalnya adalah 255. Alpha sama halnya seperti opacity. # yaitu kekuatan warna. Semisal kamu tulis 255, maka warnanya akan jadi # solid. Jika kamu tulis 30, maka warnanya lemah. # ======================================================================= # HP SLIP COLOR SETTINGS # ======================================================================= HP_DAMAGE_COLOR = Color.new(255,255,255,255) HP_HEAL_COLOR = Color.new(255,255,255,255) # ======================================================================= # MP SLIP COLOR SETTINGS # ======================================================================= MP_DAMAGE_COLOR = Color.new(255,255,255,255) MP_HEAL_COLOR = Color.new(255,255,255,255) # ======================================================================= # ======================================================================= FLASH_DURATION = 15 # ----------------------------------------------------------------------- # Durasi lamanya flash. Makin gede, makin lama. Satuannya adalah frame # yang dimana 1 detik = 60 frame # ======================================================================= end end # ============================================================================= # Akhir dari konfigurasi. Jangan diedit kecuali ente ngerti # ============================================================================= module THEO module STATE module REGEXP # Damages HP_SLIP_CON = /<(?:SLIP_HP|slip hp):[ ]*(\d+)>/i MP_SLIP_CON = /<(?:SLIP_MP|slip mp):[ ]*(\d+)>/i HP_SLIP_PER = /<(?:SLIP_HP|slip_hp):[ ]*(\d+)([%%])>/i MP_SLIP_PER = /<(?:SLIP_MP|slip mp):[ ]*(\d+)([%%])>/i # Heals HP_HEAL_CON = /<(?:HEAL_HP|heal hp):[ ]*(\d+)>/i MP_HEAL_CON = /<(?:HEAL_MP|heal mp):[ ]*(\d+)>/i HP_HEAL_PER = /<(?:HEAL_HP|heal hp):[ ]*(\d+)([%%])>/i MP_HEAL_PER = /<(?:HEAL_MP|heal mp):[ ]*(\d+)([%%])>/i end end end module DataManager class << self alias pre_in_map_states_db load_database end def self.load_database pre_in_map_states_db load_in_map_states_db end def self.load_in_map_states_db $data_states.compact.each do |state| state.load_slip_notetags end end end class RPG::State < RPG::BaseItem attr_accessor :hp_slip_con attr_accessor :hp_slip_per attr_accessor :hp_heal_con attr_accessor :hp_heal_per attr_accessor :mp_slip_con attr_accessor :mp_slip_per attr_accessor :mp_heal_con attr_accessor :mp_heal_per include THEO::STATE def load_slip_notetags init_hp_slips init_mp_slips self.note.split(/[\r\n]+/).each do |line| case line when REGEXP::HP_SLIP_CON @hp_slip_con = $1.to_i when REGEXP::HP_SLIP_PER @hp_slip_per = $1.to_i * 0.01 when REGEXP::HP_HEAL_CON @hp_heal_con = $1.to_i when REGEXP::HP_HEAL_PER @hp_heal_per = $1.to_i * 0.01 when REGEXP::MP_SLIP_CON @mp_slip_con = $1.to_i when REGEXP::MP_SLIP_PER @mp_slip_per = $1.to_i * 0.01 when REGEXP::MP_HEAL_CON @mp_heal_con = $1.to_i when REGEXP::MP_HEAL_PER @mp_heal_per = $1.to_i * 0.01 end end end def init_hp_slips @hp_slip_con = 0 @hp_slip_per = 0 @hp_heal_con = 0 @hp_heal_per = 0 end def init_mp_slips @mp_slip_con = 0 @mp_slip_per = 0 @mp_heal_con = 0 @mp_heal_per = 0 end end class Game_Actor < Game_Battler include THEO::STATE alias pre_slip_states_update_steps update_state_steps def update_state_steps(state) pre_slip_states_update_steps(state) perform_slip_effects(state) end def perform_slip_effects(state) perform_mp_damage(state) perform_mp_heal(state) perform_hp_damage(state) perform_hp_heal(state) end def slip_mp?(state) state.mp_slip_con > 0 || state.mp_slip_per > 0 end def heal_mp?(state) state.mp_heal_con > 0 || state.mp_heal_per > 0 end def slip_hp?(state) state.hp_slip_con > 0 || state.hp_slip_per > 0 end def heal_hp?(state) state.hp_heal_con > 0 || state.hp_heal_per > 0 end def perform_mp_damage(state) return unless slip_mp?(state) self.mp -= state.mp_slip_con self.mp -= mmp * state.mp_slip_per perform_flash_mp_damage end def perform_mp_heal(state) return unless heal_mp?(state) self.mp += state.mp_heal_con self.mp += mmp * state.mp_heal_per perform_flash_mp_heal end def perform_hp_damage(state) return unless slip_hp?(state) self.hp -= state.hp_slip_con self.hp -= mhp * state.hp_slip_per perform_flash_hp_damage end def perform_hp_heal(state) return unless heal_hp?(state) self.hp += state.hp_heal_con self.hp += mhp * state.hp_heal_per perform_flash_hp_heal end def perform_flash_mp_damage $game_map.screen.start_flash(MP_DAMAGE_COLOR,FLASH_DURATION) end def peform_flash_mp_heal $game_map.screen.start_flash(MP_HEAL_COLOR,FLASH_DURATION) end def perform_flash_hp_damage $game_map.screen.start_flash(HP_DAMAGE_COLOR,FLASH_DURATION) end def perform_flash_hp_heal $game_map.screen.start_flash(HP_HEAL_COLOR,FLASH_DURATION) end end