Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #--------------------------------------------------------------------------
- # SISTEMA DIA E NOITE AddOn(BY RAVEN) - v1.2 -
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # AddOn - Fases da Lua
- #--------------------------------------------------------------------------
- # * COMO USAR O SISTEMA DE DIA E NOITE - Fases da Lua
- # - BASTA QUE ESTE SCRIPT ESTEJA ACIMA DO MAIN E ABAIXO DO SCRIPT DE DIA E NOITE
- #
- #********************************************************************
- # COMANDOS PUBLICOS PARA SEREM USADOS NO MAPA OU EVENTOS
- #********************************************************************
- # <daynight_troop> moonphase = [id_troop, %] </daynight_troop>
- # - Se colocado no espaço de notas do mapa fará com que a
- # Tropa com o id "id_troop", mude as chances de aparecer para
- # a porcentagem (0~100) em "frequencia", durante o periodo
- # especificado em "phase" (nota: so serão alterados
- # tropas que estiverem na lista de encontros do mapa
- #
- # <daynight_step> moonphase = nº_step </daynight_step>
- # - Se colocado no espaço de notas do mapa fará com que as
- # chances de acontecer um encontro "steps" (menor mais chances)
- # durante um periodo especifico "phase"
- # caso o periodo não seja especificado, o valor de steps (passos)
- # será mantido conforme original
- # $game_daynight.which_phase_moon?
- # - Retorna em forma te Texto a fase atual da lua
- # $game_daynight.which_phase_moon_id?(phase=atual)
- # - Retorna o id da fase atual da lua
- #--------------------------------------------------------------------------
- # COMANDOS PARA MENSAGENS
- #--------------------------------------------------------------------------
- # \Moon - Exibe na janela a fase da lua
- #--------------------------------------------------------------------------
- $registro = [] if $registro.nil?
- $registro << ["BFK DayNight MoonFase",1.2]
- #==============================================================================
- # ** MODULO BKF
- #------------------------------------------------------------------------------
- # Este é o modulo principal para scripts feitos por este core
- #==============================================================================
- module BFK
- self.modular("BFK Core",1.0)
- self.modular("BFK DayNight",3.3)
- #--------------------------------------------------------------------------
- # * Aqui se encontra todas as variaveis para configuração e instalação
- #--------------------------------------------------------------------------
- module DayNight
- PHASE_MOON_PHASE = 2 # variavel que indica em que fase a lua é visivel
- PHASE_MOON_PHASE_INVERT = false #inverter fase da lua por hemisferio
- PHASE_MOON_CICLO = CICLOS[2] ## O ciclo da lua se completa no ciclo do Mês.
- PHASE_MOON = ["luna nueva", "luna creciente", "luna llena", "luna menguante"]
- PHASE_MOON_SWITCH = [85,86,87,88] ## As outras Switchs de 1 a 4 são para as phases do sol
- #--------------------------------------------------------------------------
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # Esta é a superclasse para todas as janelas no jogo.
- #==============================================================================
- class Window_Base < Window
- alias dnmoon_convert_escape_characters convert_escape_characters
- def convert_escape_characters(text)
- result = dnmoon_convert_escape_characters(text)
- result.gsub!(/\eMoon/i) { $game_daynight.which_phase_moon? }
- result
- end
- end
- #==============================================================================
- # ** DayNight
- #------------------------------------------------------------------------------
- # Esta é a superclasse para todo o controle de tempo no jogo
- #==============================================================================
- class DayNight
- attr_accessor :phase_moon
- #--------------------------------------------------------------------------
- # * Inicializa o processo acrecentando as fases da lua
- #--------------------------------------------------------------------------
- alias initialize_moon initialize
- def initialize
- initialize_moon
- get_phase_moon(day_ingame)
- end
- #--------------------------------------------------------------------------
- # * Faz o calculo da fase lunar e ativa as switchs
- #--------------------------------------------------------------------------
- def get_phase_moon(day)
- fase = day /(BFK::DayNight::PHASE_MOON_CICLO/BFK::DayNight::PHASE_MOON.count)
- @phase_moon = BFK::DayNight::PHASE_MOON[fase-1]
- value = BFK::DayNight::PHASE_MOON.index(@phase_moon)
- switch_refresh(value,BFK::DayNight::PHASE_MOON_SWITCH)
- end
- #--------------------------------------------------------------------------
- # * Retonra o nome da fase lunar atual
- #--------------------------------------------------------------------------
- def which_phase_moon?
- @phase_moon.capitalize
- end
- #--------------------------------------------------------------------------
- # * retona o id da fase da lua
- # :ohase_moon = nil para fase atual, outro nome para pegar seu ID
- #--------------------------------------------------------------------------
- def which_phase_moon_id?(phase_moon=nil)
- moon = (phase_moon == nil) ? @phase_moon : phase_moon
- return BFK::DayNight::PHASE_MOON.index(moon)
- end
- #--------------------------------------------------------------------------
- # * atualiza as fases da lua
- #--------------------------------------------------------------------------
- alias refresh_moon refresh
- def refresh
- refresh_moon
- get_phase_moon(day_ingame)
- end
- #--------------------------------------------------------------------------
- # Ajuda na veificação do status dos steps
- #--------------------------------------------------------------------------
- alias index_stst_moon_steps index_stat_steps
- def index_stat_steps(conteudo)
- return conteudo.index{|value|
- if value[0] == "min" || value[0] == "minute"
- min_ingame == value[1].to_i
- elsif value[0] == "hour" || value[0] == "hora"
- hour_ingame == value[1].to_i
- elsif (value[0] == "day" || value[0] == "dia") && value[2]
- day_ingame == value[1].to_i
- elsif value[0] == "month" || value[0] == "mes"
- month_ingame == value[1].to_i
- elsif value[0] == "year" || value[0] == "ano"
- year_ingame == value[1].to_i
- elsif phase_ingame[1] == value[0]
- phase_ingame[1] == value[0]
- elsif which_phase_moon_id? == value[0]
- which_phase_moon_id? == value[0]
- end
- }
- end
- #--------------------------------------------------------------------------
- # * Aqui define o index dos comandos que serão executados
- # * Priorisa os comandos de cima para baixo.
- #--------------------------------------------------------------------------
- alias index_stat_moon_troops index_stat_troops
- def index_stat_troops(conteudo)
- i = 0
- ary =[]
- conteudo.each{|value|
- if min_ingame == value[3].to_i && (value[0] == "min" || value[0] == "minute")
- ary << i
- elsif hour_ingame == value[3].to_i && (value[0] == "hour" || value[0] == "hora")
- ary << i
- elsif day_ingame == value[1].to_i && (value[0] == "day" || value[0] == "dia")
- ary << i
- elsif month_ingame == value[1].to_i && (value[0] == "month" || value[0] == "mes")
- ary << i
- elsif year_ingame == value[1].to_i && (value[0] == "year" || value[0] == "ano")
- ary << i
- elsif phase_ingame[1] == value[0]
- ary << i
- elsif which_phase_moon_id? == value[0]
- ary << i
- end
- i += 1
- }
- return ary.reverse!
- end
- end
- #==============================================================================
- # ** Display_Phase
- #------------------------------------------------------------------------------
- # Esta é a classe que controla o grsfico de periodo no relogio.
- #==============================================================================
- class Display_Phase < Sprite_Base
- #--------------------------------------------------------------------------
- # * Atualiza o sprite no mapa
- #--------------------------------------------------------------------------
- alias update_phase_moon update_phase
- def update_phase
- update_phase_moon
- if BFK::DayNight::PHASE_MOON_PHASE == @phase
- @index_phase_picx = $game_daynight.which_phase_moon_id?
- end
- end
- #--------------------------------------------------------------------------
- # * Inicializa o sprite
- #--------------------------------------------------------------------------
- alias update_phase_pic_moon update_phase_pic
- def update_phase_pic
- update_phase_pic_moon
- self.mirror = true if BFK::DayNight::PHASE_MOON_PHASE_INVERT
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement