Kakakadafi

MOG Ultima HUD (MOD)

Nov 10th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 153.98 KB | None | 0 0
  1. #==============================================================================
  2. # +++ MOG - Ultima HUD (v1.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com
  6. #==============================================================================
  7. # Sistema avançado de Hud, voltado para artistas gráficos.
  8. # Este script possui uma vasta gama de opções que permitirão o designer gráfico
  9. # criar huds complexas e animadas, visando o máximo desempenho com o mínimo
  10. # de perda no processamento de imagens.
  11. #==============================================================================
  12. # Coloque as imagens da hud na pasta.
  13. #
  14. # Graphics/Huds/Ultima/
  15. #
  16. #==============================================================================
  17. #==============================================================================
  18. # Version History
  19. #==============================================================================
  20. # v1.1 - Corrigido o erro de não ativar o efeito shake em faces não animadas.
  21. #==============================================================================
  22. module MOG_ULTIMA_HUD
  23.  
  24.   #============================================================================
  25.   #============================================================================
  26.   # * VISIBILITY
  27.   #============================================================================
  28.   # Para ativar ou desativar a hud no meio do jogo utilize o código abaixo.
  29.   #
  30.   # hud_visible(true)
  31.   #
  32.   # hud_visible(false)
  33.   #
  34.   #---------------------------------------------------------------------------
  35.   # Deixar a Hud visível ao começar o jogo.
  36.   #---------------------------------------------------------------------------
  37.   INITIAL_VISIBLE = true  
  38.   #---------------------------------------------------------------------------
  39.   # Ocultar a Hud automaticamente ao iniciar o interpretador.
  40.   #---------------------------------------------------------------------------
  41.   AUTO_HIDE_FOR_INTERPRETER = true  
  42.   #============================================================================
  43.   #============================================================================
  44.  
  45.  
  46.   #============================================================================
  47.   #============================================================================
  48.   # * SMART FADE
  49.   #============================================================================
  50.   # Ativar a Hud no modo translucido quando o personagem ficar abaixo da hud.
  51.   #---------------------------------------------------------------------------
  52.   SMART_FADE_EFFECT = true
  53.   #---------------------------------------------------------------------------
  54.   # Definição da área "extra" do alcance do Smart Fade.
  55.   # O alcance é baseado no tamanho da imagem do Layout.
  56.   #---------------------------------------------------------------------------
  57.   SMART_FADE_RANGE_X = [0,0]
  58.   SMART_FADE_RANGE_Y = [0,0]
  59.   #---------------------------------------------------------------------------
  60.   # Limite de transparência da hud
  61.   #---------------------------------------------------------------------------
  62.   SMART_FADE_LIMIT = 90
  63.   #============================================================================
  64.   #============================================================================
  65.  
  66.  
  67.   #============================================================================
  68.   #============================================================================
  69.   # * HUD SPRITE (GENERAL)
  70.   #============================================================================
  71.   # Definição da prioridade da hud.
  72.   #---------------------------------------------------------------------------
  73.   HUD_Z = 305
  74.   #---------------------------------------------------------------------------
  75.   # Para  mudar a posição da HUD no meio do jogo use o código abaixo.
  76.   #
  77.   # hud_position( X , Y)
  78.   #
  79.   #---------------------------------------------------------------------------
  80.   # Definição da posição geral da hud, influência em todos os sprites da hud.
  81.   #---------------------------------------------------------------------------
  82.   HUD_POSITION = [5,12]
  83.   #---------------------------------------------------------------------------
  84.   # Definição da porcentagem do parâmetro baixo, isso influencia na cor
  85.   # do número dos parâmetros de HP, MP e TP.
  86.   #---------------------------------------------------------------------------
  87.   LOW_PARAMETER_PERCENTAGE = 30
  88.   #============================================================================
  89.   #============================================================================
  90.  
  91.  
  92.   #============================================================================
  93.   #============================================================================
  94.   # * NAME SPRITE
  95.   #============================================================================
  96.   # Ativar o Sprite do nome do personagem.
  97.   #---------------------------------------------------------------------------
  98.   NAME_VISIBLE = true
  99.   #---------------------------------------------------------------------------
  100.   # Definição da prioridade do Sprite.
  101.   #---------------------------------------------------------------------------  
  102.   NAME_Z = 5
  103.   #---------------------------------------------------------------------------
  104.   # Definição da posição da Face. [X,Y]
  105.   #---------------------------------------------------------------------------
  106.   NAME_POSITION = [87,-10]
  107.   #---------------------------------------------------------------------------
  108.   # Definição do tipo alinhamento do nome.
  109.   #
  110.   # 0 - Esquerda
  111.   # 1 - Centro
  112.   # 2 - Direita
  113.   #---------------------------------------------------------------------------  
  114.   NAME_ALIGN_TYPE = 0
  115.   #---------------------------------------------------------------------------
  116.   # Definição do nome da fonte.
  117.   #---------------------------------------------------------------------------
  118.   NAME_FONT_NAME = "Georgia"
  119.   #---------------------------------------------------------------------------
  120.   # Definição do tamanho da fonte.
  121.   #---------------------------------------------------------------------------  
  122.   NAME_FONT_SIZE = 16
  123.   #---------------------------------------------------------------------------
  124.   # Ativar Bold.
  125.   #---------------------------------------------------------------------------  
  126.   NAME_FONT_BOLD = true
  127.   #---------------------------------------------------------------------------
  128.   # Ativar Italic.
  129.   #---------------------------------------------------------------------------  
  130.   NAME_FONT_ITALIC = true
  131.   #---------------------------------------------------------------------------
  132.   # Definição da cor da fonte
  133.   #---------------------------------------------------------------------------    
  134.   NAME_FONT_COLOR = Color.new(255,255,255,255)
  135.   #---------------------------------------------------------------------------
  136.   # Ativar Sombra
  137.   #---------------------------------------------------------------------------  
  138.   NAME_FONT_SHADOW = true
  139.   #---------------------------------------------------------------------------
  140.   # Definição da cor da sombra
  141.   #---------------------------------------------------------------------------    
  142.   NAME_FONT_SHADOW_COLOR = Color.new(0,0,0,255)
  143.   #---------------------------------------------------------------------------
  144.   # Definição da distância da sombra.
  145.   #---------------------------------------------------------------------------    
  146.   NAME_FONT_SHADOW_POSITION = [2,2]  
  147.   #============================================================================
  148.   #============================================================================
  149.    
  150.  
  151.   #============================================================================
  152.   #============================================================================
  153.   # * FACE SPRITE
  154.   #============================================================================
  155.   # Ativar a face.
  156.   # Será necessário o arquivo.
  157.   #
  158.   # ACTOR_NAME + _Face.png
  159.   #
  160.   # Eric_Face.png
  161.   #
  162.   #---------------------------------------------------------------------------
  163.   FACE_VISIBLE = true
  164.   #---------------------------------------------------------------------------
  165.   # Definição da prioridade do sprite.
  166.   #---------------------------------------------------------------------------  
  167.   FACE_Z = -1
  168.   #---------------------------------------------------------------------------
  169.   # Definição da posição da Face. [X,Y]
  170.   #---------------------------------------------------------------------------
  171.   FACE_POSITION = [-7,-25]
  172.   #---------------------------------------------------------------------------
  173.   # Ativar faces animadas.
  174.   # Será necessário ter uma imagem de 4 faces do personagem no mesmo arquivo.
  175.   #
  176.   # FACE1/FACE2/FACE3/FACE4
  177.   #
  178.   # A imagem será dividida por 4 frames, no caso de definir a função como FALSE
  179.   # a imagem será dividida por 1 frame
  180.   #---------------------------------------------------------------------------  
  181.   FACE_ANIMATION = false
  182.   #---------------------------------------------------------------------------
  183.   # Definição do tempo duração da animação da face.
  184.   #---------------------------------------------------------------------------  
  185.   FACE_ANIMATION_DURATION = 40
  186.   #---------------------------------------------------------------------------
  187.   # Ativar o efeito tremor da face quando o personagem sofrer dano.
  188.   #---------------------------------------------------------------------------  
  189.   FACE_SHAKE_EFFECT = false
  190.   #============================================================================
  191.   #============================================================================
  192.  
  193.  
  194.   #============================================================================
  195.   #============================================================================
  196.   # * HP SPRITE
  197.   #============================================================================
  198.   # Ativar o número de HP.
  199.   # Será necessário o arquivo.
  200.   #
  201.   # HP_Number.png
  202.   #
  203.   #---------------------------------------------------------------------------
  204.   HP_NUMBER_VISIBLE = false
  205.   #---------------------------------------------------------------------------
  206.   # Definição da prioridade do Sprite.
  207.   #---------------------------------------------------------------------------    
  208.   HP_NUMBER_Z = 2
  209.   #---------------------------------------------------------------------------
  210.   # Definição da posição do número de HP. [X,Y]
  211.   #---------------------------------------------------------------------------  
  212.   HP_NUMBER_POSITION = [163,14]
  213.   #---------------------------------------------------------------------------  
  214.   # Ativar o número de HP Total.
  215.   # Será necessário o arquivo.
  216.   #
  217.   # HP_Number_Max.png
  218.   #
  219.   #---------------------------------------------------------------------------
  220.   HP_NUMBER_MAX_VISIBLE = false
  221.   #---------------------------------------------------------------------------
  222.   # Definição da posição do número de HP Total. [X,Y]
  223.   #---------------------------------------------------------------------------  
  224.   HP_NUMBER_MAX_POSITION = [165,30]
  225.   #---------------------------------------------------------------------------
  226.   # Definição do tipo alinhamento do número.
  227.   #
  228.   # 0 - Esquerda
  229.   # 1 - Centro
  230.   # 2 - Direita
  231.   #---------------------------------------------------------------------------  
  232.   HP_NUMBER_ALIGN_TYPE = 2
  233.   #---------------------------------------------------------------------------
  234.   # Ativa o efeito de alinhar os números em posições de Y diferentes.
  235.   #---------------------------------------------------------------------------
  236.   HP_NUMBER_WAVE_ALIGN_EFFECT = false
  237.   #---------------------------------------------------------------------------
  238.   # Apresentar os números em porcentagem.
  239.   #---------------------------------------------------------------------------    
  240.   HP_NUMBER_PERCENTAGE = false
  241.   #---------------------------------------------------------------------------
  242.   # Ativar números animados ("Rolantes").
  243.   #---------------------------------------------------------------------------  
  244.   HP_NUMBER_ANIMATION = false
  245.   #---------------------------------------------------------------------------
  246.   # Ativar a cor do HP baixo.
  247.   # Será necessário ter a imagem com as duas cores do paramêtro no mesmo
  248.   # arquivo de imagem, a imagem será dividida por 2 frames de altura.
  249.   #
  250.   # NORMAL_COLOR
  251.   # LOW_PARAMETER_COLOR
  252.   #
  253.   # Caso definir a função como FALSE a imagem será dividida apenas como
  254.   # 1 frame de altura.
  255.   #---------------------------------------------------------------------------  
  256.   HP_NUMBER_LOW_COLOR = false
  257.   #---------------------------------------------------------------------------
  258.   # Ativar o medidor de HP.
  259.   # Será necessário o arquivo.
  260.   #
  261.   # HP_Meter.png
  262.   #  
  263.   #---------------------------------------------------------------------------  
  264.   HP_METER_VISIBLE = true
  265.   #---------------------------------------------------------------------------
  266.   # Definição da prioridade do sprite.
  267.   #---------------------------------------------------------------------------    
  268.   HP_METER_Z = 1
  269.   #---------------------------------------------------------------------------
  270.   # Definição da posição do medidor de HP. [X,Y]
  271.   #---------------------------------------------------------------------------  
  272.   HP_METER_POSITION = [35,24]
  273.   #---------------------------------------------------------------------------
  274.   # Definição do ângulo do medidor.
  275.   #---------------------------------------------------------------------------  
  276.   HP_METER_ANGLE = 0
  277.   #---------------------------------------------------------------------------
  278.   # Ativar o efeito mirror, essa opção faz com que o medidor tenha o movimento
  279.   # inverso.
  280.   #---------------------------------------------------------------------------  
  281.   HP_METER_MIRROR_EFFECT = false
  282.   #---------------------------------------------------------------------------
  283.   # Ativar o efeito animado de dano no medidor.
  284.   # Será necessário ter a imagem com as duas cores do paramêtro no mesmo
  285.   # arquivo de imagem, a imagem será dividida por 2 frames de altura.
  286.   #
  287.   # NORMAL_COLOR
  288.   # DAMAGE_COLOR
  289.   #
  290.   # Se definir como FALSE use apenas use uma imagem com o tamanho normal.
  291.   #---------------------------------------------------------------------------  
  292.   HP_METER_REDUCTION_ANIMATION = true
  293.   #---------------------------------------------------------------------------
  294.   # Ativar o efeito animado do "medidor fluindo".
  295.   # Será necessário ter a imagem com a largura 3 vezes maior que o tamanho normal.
  296.   # Essa imagem dever estar em gradiente para ter o efeito "fluindo".
  297.   # Se definir como FALSE use apenas uma imagem com o tamanho normal.
  298.   #---------------------------------------------------------------------------  
  299.   HP_METER_GRADIENT_ANIMATION = false
  300.   #---------------------------------------------------------------------------
  301.   # Ativar HP em ícones.
  302.   # Será necessário ter a imagem.
  303.   #
  304.   # HP_Icon.png
  305.   #
  306.   #---------------------------------------------------------------------------
  307.   HP_ICON_VISIBLE = false
  308.   #---------------------------------------------------------------------------
  309.   # Definição da prioridade do Sprite.
  310.   #---------------------------------------------------------------------------    
  311.   HP_ICON_Z = 1
  312.   #---------------------------------------------------------------------------
  313.   # Posição do ícone de HP.
  314.   #---------------------------------------------------------------------------  
  315.   HP_ICON_POSITION = [200,0]
  316.   #---------------------------------------------------------------------------
  317.   # Ativar o sprite EX do ultimo ícone
  318.   # Será necessário ter a imagem.
  319.   #
  320.   # HP_Icon_EX.png
  321.   #
  322.   #---------------------------------------------------------------------------
  323.   HP_ICON_EX_VISIBLE = false
  324.   #---------------------------------------------------------------------------
  325.   # Posição do ícone Animado.
  326.   #---------------------------------------------------------------------------  
  327.   HP_ICON_EX_POSITION = [0,0]
  328.   #---------------------------------------------------------------------------
  329.   # Ativar o efeito de Zoom do Sprite.
  330.   #---------------------------------------------------------------------------
  331.   HP_ICON_EX_ZOOM_EFFECT = true
  332.   #---------------------------------------------------------------------------
  333.   # Espaço entre os ícones.
  334.   #---------------------------------------------------------------------------    
  335.   HP_ICON_SPACE = [-10,-10]
  336.   #---------------------------------------------------------------------------
  337.   # Definição da quantidade maxima de ícones na horizontal.
  338.   #---------------------------------------------------------------------------  
  339.   HP_ICON_COL_MAX = 10
  340.   #---------------------------------------------------------------------------
  341.   # Definição da quantidade maxima de ícones na vertical.
  342.   #---------------------------------------------------------------------------    
  343.   HP_ICON_ROW_MAX = 2
  344.   #---------------------------------------------------------------------------
  345.   # Ativar o número de HP de ícones.
  346.   # Será necessário ter a imagem.
  347.   #
  348.   # HP_Icon_Number.png
  349.   #
  350.   #---------------------------------------------------------------------------
  351.   HP_ICON_NUMBER_VISIBLE = false
  352.   #---------------------------------------------------------------------------
  353.   # Definição da prioridade do sprite.
  354.   #---------------------------------------------------------------------------
  355.   HP_ICON_NUMBER_Z = 4
  356.   #---------------------------------------------------------------------------
  357.   # Posição do número do ícone
  358.   #---------------------------------------------------------------------------  
  359.   HP_ICON_NUMBER_POSITION = [0,0]
  360.   #---------------------------------------------------------------------------
  361.   # Definição do tipo alinhamento do número.
  362.   #
  363.   # 0 - Esquerda
  364.   # 1 - Centro
  365.   # 2 - Direita
  366.   #---------------------------------------------------------------------------  
  367.   HP_ICON_NUMBER_ALIGN_TYPE = 0  
  368.   #============================================================================
  369.   #============================================================================
  370.  
  371.  
  372.   #============================================================================
  373.   #============================================================================
  374.   # * MP SPRITE
  375.   #============================================================================
  376.   # Ativar o número de MP.
  377.   # Será necessário o arquivo.
  378.   #
  379.   # MP_Number.png
  380.   #  
  381.   #---------------------------------------------------------------------------  
  382.   MP_NUMBER_VISIBLE = false
  383.   #---------------------------------------------------------------------------
  384.   # Definição da prioridade do Sprite.
  385.   #---------------------------------------------------------------------------    
  386.   MP_NUMBER_Z = 2  
  387.   #---------------------------------------------------------------------------
  388.   # Definição da posição do número de MP. [X,Y]
  389.   #---------------------------------------------------------------------------  
  390.   MP_NUMBER_POSITION = [187,43]
  391.   #---------------------------------------------------------------------------  
  392.   # Ativar o número de MP Total.
  393.   # Será necessário o arquivo.
  394.   #
  395.   # MP_Number_Max.png
  396.   #
  397.   #---------------------------------------------------------------------------
  398.   MP_NUMBER_MAX_VISIBLE = false
  399.   #---------------------------------------------------------------------------
  400.   # Definição da posição do número de MP Total. [X,Y]
  401.   #---------------------------------------------------------------------------  
  402.   MP_NUMBER_MAX_POSITION = [128,53]
  403.   #---------------------------------------------------------------------------
  404.   # Definição do tipo alinhamento do número.
  405.   #
  406.   # 0 - Esquerda
  407.   # 1 - Centro
  408.   # 2 - Direita
  409.   #---------------------------------------------------------------------------  
  410.   MP_NUMBER_ALIGN_TYPE = 2
  411.   #---------------------------------------------------------------------------
  412.   # Ativa o efeito de alinhar os números em posições de Y diferentes.
  413.   #---------------------------------------------------------------------------
  414.   MP_NUMBER_WAVE_ALIGN_EFFECT = false    
  415.   #---------------------------------------------------------------------------
  416.   # Apresentar os números em porcentagem.
  417.   #---------------------------------------------------------------------------    
  418.   MP_NUMBER_PERCENTAGE = false
  419.   #---------------------------------------------------------------------------
  420.   # Ativar números animados ("Rolantes").
  421.   #---------------------------------------------------------------------------  
  422.   MP_NUMBER_ANIMATION = true
  423.   #---------------------------------------------------------------------------
  424.   # Ativar a cor do MP baixo.
  425.   # Será necessário ter a imagem com as duas cores do paramêtro no mesmo
  426.   # arquivo de imagem, a imagem será dividida por 2 frames de altura.
  427.   #
  428.   # NORMAL_COLOR
  429.   # LOW_PARAMETER_COLOR
  430.   #
  431.   # Se definir como FALSE use apenas use uma imagem com o tamanho normal.
  432.   #---------------------------------------------------------------------------  
  433.   MP_NUMBER_LOW_COLOR = false
  434.   #---------------------------------------------------------------------------
  435.   # Ativar o medidor de MP.
  436.   # Será necessário o arquivo.
  437.   #
  438.   # MP_Meter.png
  439.   #    
  440.   #---------------------------------------------------------------------------  
  441.   MP_METER_VISIBLE = true
  442.   #---------------------------------------------------------------------------
  443.   # Definição da prioridade do sprite.
  444.   #---------------------------------------------------------------------------    
  445.   MP_METER_Z = 1  
  446.   #---------------------------------------------------------------------------
  447.   # Definição da posição do medidor de MP. [X,Y]
  448.   #---------------------------------------------------------------------------  
  449.   MP_METER_POSITION = [19,42]
  450.   #---------------------------------------------------------------------------
  451.   # Definição do ângulo do medidor.
  452.   #---------------------------------------------------------------------------  
  453.   MP_METER_ANGLE = 0
  454.   #---------------------------------------------------------------------------
  455.   # Ativar o efeito mirror, essa opção faz com que o medidor tenha o movimento
  456.   # inverso.
  457.   #---------------------------------------------------------------------------  
  458.   MP_METER_MIRROR_EFFECT = false
  459.   #---------------------------------------------------------------------------
  460.   # Ativar o efeito animado de dano no medidor.
  461.   # Será necessário ter a imagem com as duas cores do paramêtro no mesmo
  462.   # arquivo de imagem, a imagem será dividida por 2 frames de altura.
  463.   #
  464.   # NORMAL_COLOR
  465.   # DAMAGE_COLOR
  466.   #
  467.   # Se definir como FALSE use apenas use uma imagem com o tamanho normal.
  468.   #---------------------------------------------------------------------------  
  469.   MP_METER_REDUCTION_ANIMATION = true
  470.   #---------------------------------------------------------------------------
  471.   # Ativar o efeito animado do "medidor fluindo".
  472.   # Será necessário ter a imagem com a largura 3 vezes maior que o tamanho normal.
  473.   # Essa imagem dever estar em gradiente para ter o efeito "fluindo".
  474.   # Se definir como FALSE use apenas uma imagem com o tamanho normal.
  475.   #---------------------------------------------------------------------------  
  476.   MP_METER_GRADIENT_ANIMATION = false
  477.   #---------------------------------------------------------------------------
  478.   # Ativar MP em ícones.
  479.   # Será necessário ter a imagem.
  480.   #
  481.   # MP_Icon.png
  482.   #
  483.   #---------------------------------------------------------------------------
  484.   MP_ICON_VISIBLE = false
  485.   #---------------------------------------------------------------------------
  486.   # Definição da prioridade do Sprite.
  487.   #---------------------------------------------------------------------------    
  488.   MP_ICON_Z = 1  
  489.   #---------------------------------------------------------------------------
  490.   # Posição do ícone de MP.
  491.   #---------------------------------------------------------------------------  
  492.   MP_ICON_POSITION = [200,64]
  493.   #---------------------------------------------------------------------------
  494.   # Ativar o sprite EX do ultimo ícone
  495.   # Será necessário ter a imagem.
  496.   #
  497.   # MP_Icon_EX.png
  498.   #
  499.   #---------------------------------------------------------------------------
  500.   MP_ICON_EX_VISIBLE = false
  501.   #---------------------------------------------------------------------------
  502.   # Posição do ícone Animado.
  503.   #---------------------------------------------------------------------------  
  504.   MP_ICON_EX_POSITION = [0,0]
  505.   #---------------------------------------------------------------------------
  506.   # Ativar o efeito de Zoom do Sprite.
  507.   #---------------------------------------------------------------------------
  508.   MP_ICON_EX_ZOOM_EFFECT = false
  509.   #---------------------------------------------------------------------------
  510.   # Espaço entre os ícones.
  511.   #---------------------------------------------------------------------------    
  512.   MP_ICON_SPACE = [-10,-10]
  513.   #---------------------------------------------------------------------------
  514.   # Definição da quantidade maxima de ícones na horizontal.
  515.   #---------------------------------------------------------------------------  
  516.   MP_ICON_COL_MAX = 10
  517.   #---------------------------------------------------------------------------
  518.   # Definição da quantidade maxima de ícones na vertical.
  519.   #---------------------------------------------------------------------------    
  520.   MP_ICON_ROW_MAX = 2
  521.   #---------------------------------------------------------------------------
  522.   # Ativar o número de MP de ícones.
  523.   # Será necessário ter a imagem.
  524.   #
  525.   # MP_Icon_Number.png
  526.   #
  527.   #---------------------------------------------------------------------------
  528.   MP_ICON_NUMBER_VISIBLE = false
  529.   #---------------------------------------------------------------------------
  530.   # Definição da prioridade do sprite.
  531.   #---------------------------------------------------------------------------
  532.   MP_ICON_NUMBER_Z = 4
  533.   #---------------------------------------------------------------------------
  534.   # Posição do número do ícone
  535.   #---------------------------------------------------------------------------  
  536.   MP_ICON_NUMBER_POSITION = [0,64]
  537.   #---------------------------------------------------------------------------
  538.   # Definição do tipo alinhamento do número.
  539.   #
  540.   # 0 - Esquerda
  541.   # 1 - Centro
  542.   # 2 - Direita
  543.   #---------------------------------------------------------------------------  
  544.   MP_ICON_NUMBER_ALIGN_TYPE = 0    
  545.   #============================================================================
  546.   #============================================================================
  547.  
  548.  
  549.   #============================================================================
  550.   #============================================================================
  551.   # * TP SPRITE
  552.   #============================================================================
  553.   # Ativar o número de TP.
  554.   # Será necessário o arquivo.
  555.   #
  556.   # TP_Number.png
  557.   #    
  558.   #---------------------------------------------------------------------------
  559.   TP_NUMBER_VISIBLE = false
  560.   #---------------------------------------------------------------------------
  561.   # Definição da prioridade do sprite.
  562.   #---------------------------------------------------------------------------
  563.   TP_NUMBER_Z = 2  
  564.   #---------------------------------------------------------------------------
  565.   # Definição da posição do número de TP. [X,Y]
  566.   #---------------------------------------------------------------------------  
  567.   TP_NUMBER_POSITION = [123,71]
  568.   #---------------------------------------------------------------------------  
  569.   # Ativar o número de TP Total.
  570.   # Será necessário o arquivo.
  571.   #
  572.   # TP_Number_Max.png
  573.   #
  574.   #---------------------------------------------------------------------------
  575.   TP_NUMBER_MAX_VISIBLE = false
  576.   #---------------------------------------------------------------------------
  577.   # Definição da posição do número de TP Total. [X,Y]
  578.   #---------------------------------------------------------------------------  
  579.   TP_NUMBER_MAX_POSITION = [165,73]
  580.   #---------------------------------------------------------------------------
  581.   # Definição do tipo alinhamento do número.
  582.   #
  583.   # 0 - Esquerda
  584.   # 1 - Centro
  585.   # 2 - Direita
  586.   #---------------------------------------------------------------------------  
  587.   TP_NUMBER_ALIGN_TYPE = 2
  588.   #---------------------------------------------------------------------------
  589.   # Ativa o efeito de alinhar os números em posições de Y diferentes.
  590.   #---------------------------------------------------------------------------
  591.   TP_NUMBER_WAVE_ALIGN_EFFECT = false  
  592.   #---------------------------------------------------------------------------
  593.   # Apresentar os números em porcentagem.
  594.   #---------------------------------------------------------------------------    
  595.   TP_NUMBER_PERCENTAGE = false
  596.   #---------------------------------------------------------------------------
  597.   # Ativar números animados ("Rolantes").
  598.   #---------------------------------------------------------------------------  
  599.   TP_NUMBER_ANIMATION = false
  600.   #---------------------------------------------------------------------------
  601.   # Ativar a cor do TP baixo.
  602.   # Será necessário ter a imagem com as duas cores do paramêtro no mesmo
  603.   # arquivo de imagem, a imagem será dividida por 2 frames de altura.
  604.   #
  605.   # NORMAL_COLOR
  606.   # LOW_PARAMETER_COLOR
  607.   #
  608.   # Se definir como FALSE use apenas use uma imagem com o tamanho normal.
  609.   #---------------------------------------------------------------------------  
  610.   TP_NUMBER_LOW_COLOR = false
  611.   #---------------------------------------------------------------------------
  612.   # Ativar o medidor de TP.
  613.   # Será necessário o arquivo.
  614.   #
  615.   # TP_Meter.png
  616.   #    
  617.   #---------------------------------------------------------------------------  
  618.   TP_METER_VISIBLE = false
  619.   #---------------------------------------------------------------------------
  620.   # Definição da prioridade do sprite.
  621.   #---------------------------------------------------------------------------
  622.   TP_METER_Z = 1  
  623.   #---------------------------------------------------------------------------
  624.   # Definição da posição do medidor de TP. [X,Y]
  625.   #---------------------------------------------------------------------------  
  626.   TP_METER_POSITION = [75,65]
  627.   #---------------------------------------------------------------------------
  628.   # Definição do ângulo do medidor.
  629.   #---------------------------------------------------------------------------  
  630.   TP_METER_ANGLE = 0
  631.   #---------------------------------------------------------------------------
  632.   # Ativar o efeito mirror, essa opção faz com que o medidor tenha o movimento
  633.   # inverso.
  634.   #---------------------------------------------------------------------------  
  635.   TP_METER_MIRROR_EFFECT = false
  636.   #---------------------------------------------------------------------------
  637.   # Ativar o efeito animado de dano no medidor.
  638.   # Será necessário ter a imagem com as duas cores do paramêtro no mesmo
  639.   # arquivo de imagem, a imagem será dividida por 2 frames de altura.
  640.   #
  641.   # NORMAL_COLOR
  642.   # DAMAGE_COLOR
  643.   #
  644.   # Se definir como FALSE use apenas use uma imagem com o tamanho normal.
  645.   #---------------------------------------------------------------------------  
  646.   TP_METER_REDUCTION_ANIMATION = false
  647.   #---------------------------------------------------------------------------
  648.   # Ativar o efeito animado do "medidor fluindo".
  649.   # Será necessário ter a imagem com a largura 3 vezes maior que o tamanho normal.
  650.   # Essa imagem dever estar em gradiente para ter o efeito "fluindo".
  651.   # Se definir como FALSE use apenas uma imagem com o tamanho normal.
  652.   #---------------------------------------------------------------------------  
  653.   TP_METER_GRADIENT_ANIMATION = false
  654.   #---------------------------------------------------------------------------
  655.   # Ativar TP em ícones.
  656.   # Será necessário ter a imagem.
  657.   #
  658.   # TP_Icon.png
  659.   #
  660.   #---------------------------------------------------------------------------
  661.   TP_ICON_VISIBLE = false
  662.   #---------------------------------------------------------------------------
  663.   # Definição da prioridade do sprite.
  664.   #---------------------------------------------------------------------------
  665.   TP_ICON_Z = 1  
  666.   #---------------------------------------------------------------------------
  667.   # Posição do ícone de TP.
  668.   #---------------------------------------------------------------------------  
  669.   TP_ICON_POSITION = [200,128]
  670.   #---------------------------------------------------------------------------
  671.   # Ativar o sprite EX do ultimo ícone
  672.   # Será necessário ter a imagem.
  673.   #
  674.   # TP_Icon_EX.png
  675.   #
  676.   #---------------------------------------------------------------------------
  677.   TP_ICON_EX_VISIBLE = false
  678.   #---------------------------------------------------------------------------
  679.   # Posição do ícone Animado.
  680.   #---------------------------------------------------------------------------  
  681.   TP_ICON_EX_POSITION = [0,0]
  682.   #---------------------------------------------------------------------------
  683.   # Ativar o efeito de Zoom do Sprite.
  684.   #---------------------------------------------------------------------------
  685.   TP_ICON_EX_ZOOM_EFFECT = false
  686.   #---------------------------------------------------------------------------
  687.   # Espaço entre os ícones.
  688.   #---------------------------------------------------------------------------    
  689.   TP_ICON_SPACE = [-10,-10]
  690.   #---------------------------------------------------------------------------
  691.   # Definição da quantidade maxima de ícones na horizontal.
  692.   #---------------------------------------------------------------------------  
  693.   TP_ICON_COL_MAX = 10
  694.   #---------------------------------------------------------------------------
  695.   # Definição da quantidade maxima de ícones na vertical.
  696.   #---------------------------------------------------------------------------    
  697.   TP_ICON_ROW_MAX = 2
  698.   #---------------------------------------------------------------------------
  699.   # Ativar o número de TP de ícones.
  700.   # Será necessário ter a imagem.
  701.   #
  702.   # TP_Icon_Number.png
  703.   #
  704.   #---------------------------------------------------------------------------
  705.   TP_ICON_NUMBER_VISIBLE = false
  706.   #---------------------------------------------------------------------------
  707.   # Definição da prioridade do sprite.
  708.   #---------------------------------------------------------------------------
  709.   TP_ICON_NUMBER_Z = 4
  710.   #---------------------------------------------------------------------------
  711.   # Posição do número do ícone
  712.   #---------------------------------------------------------------------------  
  713.   TP_ICON_NUMBER_POSITION = [0,128]
  714.   #---------------------------------------------------------------------------
  715.   # Definição do tipo alinhamento do número.
  716.   #
  717.   # 0 - Esquerda
  718.   # 1 - Centro
  719.   # 2 - Direita
  720.   #---------------------------------------------------------------------------  
  721.   TP_ICON_NUMBER_ALIGN_TYPE = 0    
  722.   #============================================================================
  723.   #============================================================================
  724.  
  725.  
  726.   #============================================================================
  727.   #============================================================================
  728.   # * LEVEL / EXP SPRITE
  729.   #============================================================================
  730.   # Ativar o número de Level.
  731.   # Será necessário o arquivo.
  732.   #
  733.   # LV_Number.png
  734.   #    
  735.   #---------------------------------------------------------------------------
  736.   LEVEL_NUMBER_VISIBLE = true
  737.   #---------------------------------------------------------------------------
  738.   # Definição da prioridade do Sprite.
  739.   #---------------------------------------------------------------------------    
  740.   LEVEL_NUMBER_Z = 2
  741.   #---------------------------------------------------------------------------
  742.   # Definição da posição do número do Level. [X,Y]
  743.   #---------------------------------------------------------------------------  
  744.   LEVEL_NUMBER_POSITION = [49,51]
  745.   #---------------------------------------------------------------------------
  746.   # Definição do tipo alinhamento do número.
  747.   #
  748.   # 0 - Esquerda
  749.   # 1 - Centro
  750.   # 2 - Direita
  751.   #---------------------------------------------------------------------------  
  752.   LEVEL_NUMBER_ALIGN_TYPE = 1    
  753.   #---------------------------------------------------------------------------
  754.   # Ativar o medidor de exp.
  755.   # Será necessário o arquivo.
  756.   #
  757.   # LV_Meter.png
  758.   #    
  759.   #---------------------------------------------------------------------------  
  760.   LEVEL_METER_VISIBLE = true
  761.   #---------------------------------------------------------------------------
  762.   # Definição da prioridade do Sprite.
  763.   #---------------------------------------------------------------------------    
  764.   LEVEL_METER_Z = 1  
  765.   #---------------------------------------------------------------------------
  766.   # Definição da posição do medidor de experiência. [X,Y]
  767.   #---------------------------------------------------------------------------  
  768.   LEVEL_METER_POSITION = [5,57]
  769.   #---------------------------------------------------------------------------
  770.   # Definição do ângulo do medidor.
  771.   #---------------------------------------------------------------------------  
  772.   LEVEL_METER_ANGLE = 0  
  773.   #---------------------------------------------------------------------------
  774.   # Ativar o efeito mirror, essa opção faz com que o medidor tenha o movimento
  775.   # inverso.
  776.   #---------------------------------------------------------------------------  
  777.   LEVEL_METER_MIRROR_EFFECT = false
  778.   #---------------------------------------------------------------------------
  779.   # Ativar o número de exp necessário para atingir o level.
  780.   # Será necessário o arquivo.
  781.   #
  782.   # LV_Number_Exp.png
  783.   #    
  784.   #---------------------------------------------------------------------------  
  785.   LEVEL_NUMBER_EXP_VISIBLE = false
  786.   #---------------------------------------------------------------------------
  787.   # Definição da posição do número de experiência. [X,Y]
  788.   #---------------------------------------------------------------------------  
  789.   LEVEL_NUMBER_EXP_POSITION = [180,96]
  790.   #---------------------------------------------------------------------------
  791.   # Definição do tipo alinhamento do número.
  792.   #
  793.   # 0 - Esquerda
  794.   # 1 - Centro
  795.   # 2 - Direita
  796.   #---------------------------------------------------------------------------  
  797.   LEVEL_NUMBER_EXP_ALIGN_TYPE = 2    
  798.   #---------------------------------------------------------------------------
  799.   # Definição do tipo de exp apresentado na HUD.
  800.   #
  801.   # 0 = Exp necessária para atingir o próximo nível. (Next EXP)
  802.   # 1 = Exp total do personagem. (Current EXP)
  803.   #---------------------------------------------------------------------------  
  804.   LEVEL_NUMBER_EXP_TYPE = 0
  805.   #============================================================================
  806.   #============================================================================
  807.  
  808.  
  809.   #============================================================================
  810.   #============================================================================
  811.   # * STATE SPRITE
  812.   #============================================================================
  813.   # Ativar as condições.
  814.   #---------------------------------------------------------------------------  
  815.   STATES_VISIBLE = true
  816.   #---------------------------------------------------------------------------
  817.   # Definição da prioridade do sprite.
  818.   #---------------------------------------------------------------------------    
  819.   STATES_Z = 1
  820.   #---------------------------------------------------------------------------
  821.   # Definição da posição das condições. [X,Y]
  822.   #---------------------------------------------------------------------------  
  823.   STATES_POSITION = [147,60]
  824.   #---------------------------------------------------------------------------
  825.   # Ativar o efeito animado das condições deslizando.
  826.   #---------------------------------------------------------------------------  
  827.   STATES_SCROLLING_ANIMATION = false
  828.   #---------------------------------------------------------------------------
  829.   # Definição do ângulo do sprite.
  830.   #---------------------------------------------------------------------------  
  831.   STATE_ANGLE = 0
  832.   #============================================================================
  833.   #============================================================================
  834.  
  835.   #============================================================================
  836.   #============================================================================
  837.   # * SECOND LAYOUT (Overlayer)
  838.   #============================================================================  
  839.   # Ativar a segunda camada de Layout
  840.   # Será necessário o arquivo.
  841.   #
  842.   # Layout_2.png
  843.   #
  844.   #============================================================================  
  845.   SECOND_LAYOUT = true
  846.   #---------------------------------------------------------------------------
  847.   # Definição da prioridade do sprite.
  848.   #---------------------------------------------------------------------------  
  849.   SECOND_LAYOUT_Z = 10
  850.   #---------------------------------------------------------------------------
  851.   # Definição da posição do sprite.
  852.   #---------------------------------------------------------------------------  
  853.   SECOND_LAYOUT_POSITION = [19,18]
  854.   #============================================================================
  855.   #============================================================================
  856.  
  857.   #============================================================================
  858.   #============================================================================
  859.   # * GOLD HUD
  860.   #============================================================================  
  861.   # Ativar a HUD de ouro. (Dinheiro)
  862.   # Serão necessários os arquivos.
  863.   #
  864.   # Gold_Layout.png
  865.   # Gold_Number.png
  866.   #
  867.   #============================================================================  
  868.   GOLD_VISIBLE = false
  869.   #---------------------------------------------------------------------------
  870.   # Ativar o Smart Fade separado da hud principal.
  871.   #---------------------------------------------------------------------------  
  872.   GOLD_DETACHED_SMART_FADE = true
  873.   #---------------------------------------------------------------------------
  874.   # Definição da área "extra" do alcance do Smart Fade.
  875.   # O alcance é baseado no tamanho da imagem do Layout.
  876.   #---------------------------------------------------------------------------  
  877.   GOLD_SMART_FADE_RANGE_X = [-32,0]
  878.   GOLD_SMART_FADE_RANGE_Y = [0,32]
  879.   #---------------------------------------------------------------------------
  880.   # Definição da prioridade da hud.
  881.   #---------------------------------------------------------------------------  
  882.   GOLD_HUD_Z = 0
  883.   #---------------------------------------------------------------------------
  884.   # Definição da posição geral da hud, influência em todos os sprites da hud.
  885.   #---------------------------------------------------------------------------
  886.   GOLD_POSITION = [5,366]
  887.   #---------------------------------------------------------------------------
  888.   # Definição da posição do número.
  889.   #---------------------------------------------------------------------------    
  890.   GOLD_NUMBER_POSITION = [80,20]
  891.   #---------------------------------------------------------------------------
  892.   # Definição do tipo alinhamento do número.
  893.   #
  894.   # 0 - Esquerda
  895.   # 1 - Centro
  896.   # 2 - Direita
  897.   #---------------------------------------------------------------------------    
  898.   GOLD_NUMBER_ALIGN_TYPE = 1
  899.   #============================================================================
  900.   #============================================================================  
  901.    
  902.  
  903.   #============================================================================
  904.   #============================================================================
  905.   # * EQUIPMENT HUD
  906.   #============================================================================  
  907.   # Ativar a HUD de equipamento.
  908.   # Será necessário o arquivo.
  909.   #
  910.   # Equip_Layout.png
  911.   #
  912.   #============================================================================  
  913.   EQUIPMENT_VISIBLE = true
  914.   #---------------------------------------------------------------------------
  915.   # Ativar o Smart Fade separado da hud principal.
  916.   #---------------------------------------------------------------------------    
  917.   EQUIPMENT_DETACHED_SMART_FADE = true
  918.   #---------------------------------------------------------------------------
  919.   # Definição da área "extra" do alcance do Smart Fade.
  920.   # O alcance é baseado no tamanho da imagem do Layout.
  921.   #---------------------------------------------------------------------------    
  922.   EQUIPMENT_SMART_FADE_RANGE_X = [0,0]
  923.   EQUIPMENT_SMART_FADE_RANGE_Y = [0,32]
  924.   #---------------------------------------------------------------------------
  925.   # Definição da prioridade da hud.
  926.   #---------------------------------------------------------------------------  
  927.   EQUIPMENT_Z = 0
  928.   #---------------------------------------------------------------------------
  929.   # Definição da posição geral da hud, influência em todos os sprites da hud.
  930.   #---------------------------------------------------------------------------
  931.   EQUIPMENT_POSITION = [5,90]
  932.   #---------------------------------------------------------------------------
  933.   # Apresentar o ícone da arma e a definição da posição do ícone.
  934.   #---------------------------------------------------------------------------  
  935.   EQUIPMENT_WEAPON_VISIBLE = true
  936.   EQUIPMENT_WEAPON_POSITION = [8,9]
  937.   #---------------------------------------------------------------------------
  938.   # Apresentar o ícone da escudo e a definição da posição do ícone.
  939.   #---------------------------------------------------------------------------  
  940.   EQUIPMENT_SHIELD_VISIBLE = false
  941.   EQUIPMENT_SHIELD_POSITION = [2,2]  
  942.   #---------------------------------------------------------------------------
  943.   # Apresentar o ícone da capacete e a definição da posição do ícone.
  944.   #---------------------------------------------------------------------------  
  945.   EQUIPMENT_HEAD_VISIBLE = false
  946.   EQUIPMENT_HEAD_POSITION = [2,36]
  947.   #---------------------------------------------------------------------------
  948.   # Apresentar o ícone da armadura e a definição da posição do ícone.
  949.   #---------------------------------------------------------------------------    
  950.   EQUIPMENT_BODY_VISIBLE = false
  951.   EQUIPMENT_BODY_POSITION = [67,2]  
  952.   #---------------------------------------------------------------------------
  953.   # Apresentar o ícone do acessório e a definição da posição do ícone.
  954.   #---------------------------------------------------------------------------    
  955.   EQUIPMENT_ACCESSORY_VISIBLE = true
  956.   EQUIPMENT_ACCESSORY_POSITION = [38,37]  
  957.   #============================================================================
  958.   #============================================================================  
  959.  
  960.  
  961. end
  962. #==============================================================================
  963. #==============================================================================
  964. # ** Ultima Hud
  965. #==============================================================================
  966. #==============================================================================
  967. #==============================================================================
  968. # ** Game System
  969. #==============================================================================
  970. class Game_System
  971.  
  972.   attr_accessor :hud_face
  973.   attr_accessor :hud_visible
  974.   attr_accessor :hud_position
  975.  
  976.   #--------------------------------------------------------------------------
  977.   # * Initialize
  978.   #--------------------------------------------------------------------------  
  979.   alias mog_master_hud_initialize initialize
  980.   def initialize
  981.       @hud_face = [0,0]
  982.       @hud_visible = MOG_ULTIMA_HUD::INITIAL_VISIBLE
  983.       @hud_position = [MOG_ULTIMA_HUD::HUD_POSITION[0],MOG_ULTIMA_HUD::HUD_POSITION[1]]
  984.       mog_master_hud_initialize
  985.   end
  986.  
  987. end
  988. #==============================================================================
  989. # ** Game Interpreter
  990. #==============================================================================
  991. class Game_Interpreter
  992.  
  993.   #--------------------------------------------------------------------------
  994.   # * Hud Visible
  995.   #--------------------------------------------------------------------------
  996.   def hud_visible(value = true)
  997.       $game_system.hud_visible = value
  998.   end  
  999.  
  1000.   #--------------------------------------------------------------------------
  1001.   # * Hud Visible
  1002.   #--------------------------------------------------------------------------
  1003.   def hud_position(x = 0, y = 0)
  1004.       $game_system.hud_position = [x,y]
  1005.       SceneManager.goto(Scene_Refresh_Map)
  1006.   end
  1007.  
  1008.   #--------------------------------------------------------------------------
  1009.   # * Refresh Screen
  1010.   #--------------------------------------------------------------------------  
  1011.   def refresh_screen
  1012.       SceneManager.goto(Scene_Refresh_Map)
  1013.   end
  1014.  
  1015.   #--------------------------------------------------------------------------
  1016.   # * Testing Hud
  1017.   #--------------------------------------------------------------------------    
  1018.   def testing_hud(perc = 15, death = false)
  1019.       return if $game_party.members[0] == nil
  1020.       return if $game_party.members[0].hp == 0
  1021.       actor = $game_party.members[0]
  1022.       hp_per = actor.mhp * perc / 100
  1023.       mp_per = actor.mmp * perc / 100
  1024.       tp_per = actor.max_tp * perc / 100
  1025.       hp_per = perc > 0 ? 1 : -1 if hp_per == 0
  1026.       mp_per = perc > 0 ? 1 : -1 if mp_per == 0
  1027.       tp_per = perc > 0 ? 1 : -1 if tp_per == 0
  1028.       actor.hp -= hp_per
  1029.       actor.hp = 1 if !death and actor.hp == 0
  1030.       actor.mp -= mp_per
  1031.       actor.tp -= tp_per
  1032.   end
  1033.  
  1034.   #--------------------------------------------------------------------------
  1035.   # * Testing Hud Level
  1036.   #--------------------------------------------------------------------------      
  1037.   def testing_hud_level
  1038.       return if $game_party.members[0] == nil
  1039.       actor = $game_party.members[0]
  1040.       actor.change_level(actor.level + 1, false)
  1041.       actor.gain_exp_test
  1042.   end
  1043.  
  1044. end
  1045. #==============================================================================
  1046. # ** Cache
  1047. #==============================================================================
  1048. module Cache
  1049.  
  1050.   #--------------------------------------------------------------------------
  1051.   # * Hud
  1052.   #--------------------------------------------------------------------------
  1053.   def self.ultima_hud(filename)
  1054.       load_bitmap("Graphics/Huds/Ultima/", filename)
  1055.   end
  1056.  
  1057. end
  1058. #==============================================================================
  1059. # ** Game Actor
  1060. #==============================================================================
  1061. class Game_Actor < Game_Battler
  1062.  
  1063.   #--------------------------------------------------------------------------
  1064.   # ● Real Next Level
  1065.   #--------------------------------------------------------------------------  
  1066.   def real_next_level
  1067.       next_level_exp - exp_for_level(level)
  1068.   end
  1069.  
  1070.   #--------------------------------------------------------------------------
  1071.   # ● Remain Exp
  1072.   #--------------------------------------------------------------------------  
  1073.   def remain_exp
  1074.       exp - exp_for_level(level)
  1075.   end
  1076.  
  1077.   #--------------------------------------------------------------------------
  1078.   # ● Gain Exp Test
  1079.   #--------------------------------------------------------------------------
  1080.   def gain_exp_test
  1081.       exp_r = rand(next_level_exp)
  1082.       change_exp(self.exp + (exp_r * final_exp_rate).to_i, false)
  1083.   end    
  1084.  
  1085.   #--------------------------------------------------------------------------
  1086.   # ● Low HP?
  1087.   #--------------------------------------------------------------------------    
  1088.   def low_hp?
  1089.       hp <= (mhp * MOG_ULTIMA_HUD::LOW_PARAMETER_PERCENTAGE) / 100
  1090.   end
  1091.  
  1092.   #--------------------------------------------------------------------------
  1093.   # ● Low MP?
  1094.   #--------------------------------------------------------------------------    
  1095.   def low_mp?
  1096.       mp <= (mmp * MOG_ULTIMA_HUD::LOW_PARAMETER_PERCENTAGE) / 100
  1097.   end  
  1098.  
  1099.   #--------------------------------------------------------------------------
  1100.   # ● Low TP?
  1101.   #--------------------------------------------------------------------------    
  1102.   def low_tp?
  1103.       tp <= (max_tp * MOG_ULTIMA_HUD::LOW_PARAMETER_PERCENTAGE) / 100
  1104.   end  
  1105.    
  1106. end
  1107. #==============================================================================
  1108. # ** Scene Refresh Map
  1109. #==============================================================================
  1110. class Scene_Refresh_Map
  1111.  
  1112.   #--------------------------------------------------------------------------
  1113.   # * Main
  1114.   #--------------------------------------------------------------------------  
  1115.   def main
  1116.       Graphics.transition(10)
  1117.       SceneManager.goto(Scene_Map)
  1118.       Graphics.freeze
  1119.   end
  1120.  
  1121. end
  1122. #==============================================================================
  1123. # ** Spriteset Map
  1124. #==============================================================================
  1125. class Spriteset_Map
  1126.   #--------------------------------------------------------------------------
  1127.   # * Initialize
  1128.   #--------------------------------------------------------------------------
  1129.   alias mog_ultima_hud_initialize initialize
  1130.   def initialize
  1131.       create_ultima_hud
  1132.       mog_ultima_hud_initialize
  1133.   end
  1134.  
  1135.   #--------------------------------------------------------------------------
  1136.   # * Dispose
  1137.   #--------------------------------------------------------------------------  
  1138.   alias mog_ultima_hud_dispose dispose
  1139.   def dispose
  1140.       mog_ultima_hud_dispose
  1141.       dispose_ultima_hud
  1142.   end
  1143.  
  1144.   #--------------------------------------------------------------------------
  1145.   # * Update
  1146.   #--------------------------------------------------------------------------  
  1147.   alias mog_ultima_hud_update update
  1148.   def update
  1149.       mog_ultima_hud_update
  1150.       update_ultima_hud
  1151.   end
  1152.  
  1153.   #--------------------------------------------------------------------------
  1154.   # * Create Ultima Hud
  1155.   #--------------------------------------------------------------------------    
  1156.   def create_ultima_hud
  1157.       return if @mhud != nil
  1158.       @ultima_hud = Ultima_Hud.new
  1159.   end
  1160.  
  1161.   #--------------------------------------------------------------------------
  1162.   # * Dispose Ultima Hud
  1163.   #--------------------------------------------------------------------------  
  1164.   def dispose_ultima_hud
  1165.       return if @ultima_hud == nil
  1166.       @ultima_hud.dispose
  1167.       @ultima_hud = nil
  1168.   end
  1169.  
  1170.   #--------------------------------------------------------------------------
  1171.   # * Update Ultima Hud
  1172.   #--------------------------------------------------------------------------    
  1173.   def update_ultima_hud
  1174.       return if @ultima_hud == nil
  1175.       @ultima_hud.update
  1176.   end
  1177.  
  1178. end
  1179. #==============================================================================
  1180. #==============================================================================
  1181. # ** Ultima Hud (INITIALIZE)
  1182. #==============================================================================
  1183. #==============================================================================
  1184. class Ultima_Hud
  1185.   include MOG_ULTIMA_HUD
  1186.  
  1187.   #--------------------------------------------------------------------------
  1188.   # * Initialize
  1189.   #--------------------------------------------------------------------------  
  1190.   def initialize
  1191.       pre_cache
  1192.       setup
  1193.       create_sprites
  1194.   end
  1195.  
  1196.   #--------------------------------------------------------------------------
  1197.   # * Setup
  1198.   #--------------------------------------------------------------------------    
  1199.   def setup
  1200.       @actor = $game_party.members[0]
  1201.       $game_system.hud_face = [1,0]
  1202.       @hp_icon_max = -1
  1203.       @hp_icon_old = -1
  1204.       @hp_icon_col_max = HP_ICON_COL_MAX
  1205.       @hp_icon_col_max = 1 if @hp_icon_col_max <= 0
  1206.       @hp_icon_row_max = HP_ICON_ROW_MAX
  1207.       @hp_icon_row_max = 1 if @hp_icon_row_max <= 0
  1208.       @hp_icon_real_max = @hp_icon_col_max * @hp_icon_row_max
  1209.       @mp_icon_max = -1
  1210.       @mp_icon_old = -1
  1211.       @mp_icon_col_max = MP_ICON_COL_MAX
  1212.       @mp_icon_col_max = 1 if @mp_icon_col_max <= 0
  1213.       @mp_icon_row_max = MP_ICON_ROW_MAX
  1214.       @mp_icon_row_max = 1 if @mp_icon_row_max <= 0
  1215.       @mp_icon_real_max = @mp_icon_col_max * @mp_icon_row_max
  1216.       @tp_icon_max = -1
  1217.       @tp_icon_old = -1
  1218.       @tp_icon_col_max = TP_ICON_COL_MAX
  1219.       @tp_icon_col_max = 1 if @tp_icon_col_max <= 0
  1220.       @tp_icon_row_max = TP_ICON_ROW_MAX
  1221.       @tp_icon_row_max = 1 if @tp_icon_row_max <= 0
  1222.       @tp_icon_real_max = @tp_icon_col_max * @tp_icon_row_max
  1223.       setup_actor
  1224.   end
  1225.      
  1226.   #--------------------------------------------------------------------------
  1227.   # * Setup Actor
  1228.   #--------------------------------------------------------------------------    
  1229.   def setup_actor
  1230.       return if @actor == nil
  1231.       @hp_number_refresh = true
  1232.       @hp_number2_refresh = true
  1233.       @hp_number_old = @actor.hp
  1234.       @hp_number2_old = @actor.mhp
  1235.       @hp_old_meter = 0      
  1236.       @mp_number_refresh = true
  1237.       @mp_number2_refresh = true
  1238.       @mp_number_old = @actor.mp
  1239.       @mp_number2_old = @actor.mmp
  1240.       @mp_old_meter = 0      
  1241.       @tp_number_refresh = true
  1242.       @tp_number2_refresh = true
  1243.       @tp_number_old = @actor.tp
  1244.       @tp_number2_old = @actor.max_tp  
  1245.       @tp_old_meter = 0      
  1246.   end  
  1247.  
  1248.   #--------------------------------------------------------------------------
  1249.   # * Create Sprites
  1250.   #--------------------------------------------------------------------------    
  1251.   def create_sprites
  1252.       dispose
  1253.       return if @actor == nil
  1254.       create_layout
  1255.       create_layout_2
  1256.       create_name
  1257.       create_face
  1258.       create_hp_number
  1259.       create_hp_number_max
  1260.       create_hp_meter
  1261.       create_hp_icon
  1262.       create_hp_icon_ex
  1263.       create_hp_icon_number
  1264.       create_mp_number
  1265.       create_mp_number_max
  1266.       create_mp_meter
  1267.       create_mp_icon
  1268.       create_mp_icon_ex
  1269.       create_mp_icon_number
  1270.       create_tp_number
  1271.       create_tp_number_max
  1272.       create_tp_meter
  1273.       create_tp_icon
  1274.       create_tp_icon_ex
  1275.       create_tp_icon_number
  1276.       create_level_number
  1277.       create_level_number_exp
  1278.       create_level_meter
  1279.       create_states
  1280.       create_equipment
  1281.       create_gold
  1282.       update
  1283.   end    
  1284.  
  1285. end
  1286. #==============================================================================
  1287. #==============================================================================
  1288. # ** Ultima Hud (PRE CACHE)
  1289. #==============================================================================
  1290. #==============================================================================
  1291. class Ultima_Hud
  1292.   #--------------------------------------------------------------------------
  1293.   # * Pre Cache
  1294.   #--------------------------------------------------------------------------
  1295.   def pre_cache
  1296.       @force_hide = false
  1297.       @force_hide_time = 0
  1298.       @fade_hud = false
  1299.       @fade_hud_gold = false    
  1300.       @fade_hud_equip = false
  1301.       #------------------------------------------------
  1302.       # HP
  1303.       #------------------------------------------------
  1304.       if HP_NUMBER_VISIBLE
  1305.          @hp_number_image = Cache.ultima_hud("HP_Number")
  1306.          @hp_number_cw = @hp_number_image.width / 10
  1307.          if HP_NUMBER_LOW_COLOR
  1308.             @hp_number_ch = @hp_number_image.height / 2
  1309.          else
  1310.             @hp_number_ch = @hp_number_image.height
  1311.          end  
  1312.          @hp_wave_number = HP_NUMBER_WAVE_ALIGN_EFFECT
  1313.          @hp_number_ch += (@hp_number_ch / 2) if @hp_wave_number      
  1314.       end
  1315.       if HP_NUMBER_MAX_VISIBLE
  1316.          @hp_number2_image = Cache.ultima_hud("HP_Number_Max")
  1317.          @hp_number2_cw = @hp_number2_image.width / 10
  1318.          @hp_number2_ch = @hp_number2_image.height
  1319.       end
  1320.       if HP_METER_VISIBLE
  1321.          @hp_meter_image = Cache.ultima_hud("HP_Meter")
  1322.          if HP_METER_GRADIENT_ANIMATION
  1323.             @hp_meter_cw = @hp_meter_image.width / 3
  1324.          else  
  1325.             @hp_meter_cw = @hp_meter_image.width
  1326.          end  
  1327.          if HP_METER_REDUCTION_ANIMATION
  1328.             @hp_meter_ch = @hp_meter_image.height / 2
  1329.          else
  1330.             @hp_meter_ch = @hp_meter_image.height
  1331.          end  
  1332.       end
  1333.       if HP_ICON_VISIBLE
  1334.          @hp_icon_image = Cache.ultima_hud("HP_Icon")
  1335.          @hp_icon_cw = @hp_icon_image.width / 2
  1336.          @hp_icon_ch = @hp_icon_image.height
  1337.       end
  1338.       if HP_ICON_EX_VISIBLE
  1339.          @hp_icon2_image = Cache.ultima_hud("HP_Icon_EX")
  1340.          @hp_icon2_cw = @hp_icon2_image.width
  1341.          @hp_icon2_ch = @hp_icon2_image.height        
  1342.       end      
  1343.       if HP_ICON_NUMBER_VISIBLE
  1344.          @hp_icon_number_image = Cache.ultima_hud("HP_Icon_Number")
  1345.          @hp_icon_number_cw = @hp_icon_number_image.width / 10
  1346.          @hp_icon_number_ch = @hp_icon_number_image.height        
  1347.       end
  1348.       #------------------------------------------------
  1349.       # MP
  1350.       #------------------------------------------------
  1351.       if MP_NUMBER_VISIBLE
  1352.          @mp_number_image = Cache.ultima_hud("MP_Number")
  1353.          @mp_number_cw = @mp_number_image.width / 10
  1354.          if MP_NUMBER_LOW_COLOR
  1355.             @mp_number_ch = @mp_number_image.height / 2
  1356.          else
  1357.             @mp_number_ch = @mp_number_image.height
  1358.         end
  1359.         @mp_wave_number = MP_NUMBER_WAVE_ALIGN_EFFECT
  1360.         @mp_number_ch += (@mp_number_ch / 2) if @mp_wave_number
  1361.       end
  1362.       if MP_NUMBER_MAX_VISIBLE
  1363.          @mp_number2_image = Cache.ultima_hud("MP_Number_Max")
  1364.          @mp_number2_cw = @mp_number2_image.width / 10
  1365.          @mp_number2_ch = @mp_number2_image.height
  1366.       end
  1367.       if MP_METER_VISIBLE
  1368.          @mp_meter_image = Cache.ultima_hud("MP_Meter")
  1369.          if MP_METER_GRADIENT_ANIMATION
  1370.             @mp_meter_cw = @mp_meter_image.width / 3
  1371.          else  
  1372.             @mp_meter_cw = @mp_meter_image.width
  1373.          end  
  1374.          if MP_METER_REDUCTION_ANIMATION
  1375.             @mp_meter_ch = @mp_meter_image.height / 2
  1376.          else
  1377.             @mp_meter_ch = @mp_meter_image.height
  1378.          end
  1379.       end
  1380.       if MP_ICON_VISIBLE
  1381.          @mp_icon_image = Cache.ultima_hud("MP_Icon")
  1382.          @mp_icon_cw = @mp_icon_image.width / 2
  1383.          @mp_icon_ch = @mp_icon_image.height
  1384.       end
  1385.       if MP_ICON_EX_VISIBLE
  1386.          @mp_icon2_image = Cache.ultima_hud("MP_Icon_EX")
  1387.          @mp_icon2_cw = @mp_icon2_image.width
  1388.          @mp_icon2_ch = @mp_icon2_image.height        
  1389.       end      
  1390.       if MP_ICON_NUMBER_VISIBLE
  1391.          @mp_icon_number_image = Cache.ultima_hud("MP_Icon_Number")
  1392.          @mp_icon_number_cw = @mp_icon_number_image.width / 10
  1393.          @mp_icon_number_ch = @mp_icon_number_image.height        
  1394.       end
  1395.       #------------------------------------------------
  1396.       # TP
  1397.       #------------------------------------------------
  1398.       if TP_NUMBER_VISIBLE
  1399.          @tp_number_image = Cache.ultima_hud("TP_Number")
  1400.          @tp_number_cw = @tp_number_image.width / 10
  1401.          if TP_NUMBER_LOW_COLOR
  1402.             @tp_number_ch = @tp_number_image.height / 2
  1403.          else
  1404.             @tp_number_ch = @tp_number_image.height
  1405.          end  
  1406.         @tp_wave_number = TP_NUMBER_WAVE_ALIGN_EFFECT
  1407.         @tp_number_ch += (@tp_number_ch / 2) if @tp_wave_number      
  1408.       end
  1409.       if TP_NUMBER_MAX_VISIBLE
  1410.          @tp_number2_image = Cache.ultima_hud("TP_Number_Max")
  1411.          @tp_number2_cw = @tp_number2_image.width / 10
  1412.          @tp_number2_ch = @tp_number2_image.height
  1413.       end
  1414.       if TP_METER_VISIBLE
  1415.          @tp_meter_image = Cache.ultima_hud("TP_Meter")
  1416.          if TP_METER_GRADIENT_ANIMATION
  1417.             @tp_meter_cw = @tp_meter_image.width / 3
  1418.          else  
  1419.             @tp_meter_cw = @tp_meter_image.width
  1420.          end  
  1421.          if TP_METER_REDUCTION_ANIMATION
  1422.             @tp_meter_ch = @tp_meter_image.height / 2      
  1423.          else
  1424.             @tp_meter_ch = @tp_meter_image.height
  1425.          end  
  1426.       end        
  1427.       if TP_ICON_VISIBLE
  1428.          @tp_icon_image = Cache.ultima_hud("TP_Icon")
  1429.          @tp_icon_cw = @tp_icon_image.width / 2
  1430.          @tp_icon_ch = @tp_icon_image.height
  1431.       end  
  1432.       if TP_ICON_EX_VISIBLE
  1433.          @tp_icon2_image = Cache.ultima_hud("TP_Icon_EX")
  1434.          @tp_icon2_cw = @tp_icon2_image.width
  1435.          @tp_icon2_ch = @tp_icon2_image.height        
  1436.       end      
  1437.       if TP_ICON_NUMBER_VISIBLE
  1438.          @tp_icon_number_image = Cache.ultima_hud("TP_Icon_Number")
  1439.          @tp_icon_number_cw = @tp_icon_number_image.width / 10
  1440.          @tp_icon_number_ch = @tp_icon_number_image.height        
  1441.       end
  1442.       #------------------------------------------------
  1443.       # LV
  1444.       #------------------------------------------------  
  1445.       if LEVEL_NUMBER_VISIBLE
  1446.          @lv_number_image = Cache.ultima_hud("LV_Number")
  1447.          @lv_number_cw = @lv_number_image.width / 10
  1448.          @lv_number_ch = @lv_number_image.height
  1449.       end      
  1450.       if LEVEL_NUMBER_EXP_VISIBLE
  1451.          @lv_number2_image = Cache.ultima_hud("LV_Number_Exp")
  1452.          @lv_number2_cw = @lv_number2_image.width / 10
  1453.          @lv_number2_ch = @lv_number2_image.height
  1454.       end      
  1455.       if LEVEL_METER_VISIBLE
  1456.          @lv_meter_image = Cache.ultima_hud("LV_Meter")
  1457.          @lv_meter_cw = @lv_meter_image.width
  1458.          @lv_meter_ch = @lv_meter_image.height      
  1459.       end      
  1460.       #------------------------------------------------
  1461.       # ICON
  1462.       #------------------------------------------------  
  1463.       if STATES_VISIBLE or EQUIPMENT_VISIBLE
  1464.          @icon_image = Cache.system("Iconset")
  1465.       end        
  1466.   end
  1467.  
  1468.   #--------------------------------------------------------------------------
  1469.   # * Check Icon Image
  1470.   #--------------------------------------------------------------------------          
  1471.   def check_icon_image
  1472.       if @icon_image == nil or @icon_image.disposed?
  1473.          @icon_image = Cache.system("Iconset")
  1474.       end  
  1475.   end  
  1476.  
  1477. end
  1478. #==============================================================================
  1479. #==============================================================================
  1480. # ** Ultima Hud (SPRITE SYSTEM)
  1481. #==============================================================================
  1482. #==============================================================================
  1483. class Ultima_Hud
  1484.  
  1485.   #--------------------------------------------------------------------------
  1486.   # * Update Number
  1487.   #--------------------------------------------------------------------------    
  1488.   def update_number(type,value)
  1489.       actor_value = @actor.hp if type == 0
  1490.       actor_value = @actor.mp if type == 1
  1491.       actor_value = @actor.tp if type == 2
  1492.       actor_value = @actor.mhp if type == 3
  1493.       actor_value = @actor.mmp if type == 4
  1494.       actor_value = @actor.max_tp if type == 5
  1495.       actor_value = $game_party.gold if type == 6
  1496.       if value < actor_value
  1497.          value += number_refresh_speed(actor_value,value)
  1498.          value = actor_value if value >= actor_value
  1499.          refresh_sprite_number(type,value)
  1500.      elsif value > actor_value
  1501.          value -= number_refresh_speed(actor_value,value)
  1502.          value = actor_value if value <= actor_value
  1503.          refresh_sprite_number(type,value)
  1504.      end  
  1505.   end
  1506.  
  1507.   #--------------------------------------------------------------------------
  1508.   # * Number Refresh Speed
  1509.   #--------------------------------------------------------------------------      
  1510.   def number_refresh_speed(actor_value,value)
  1511.       n =  1 * (actor_value - value).abs / 10
  1512.       return [[n, 99999999].min,1].max    
  1513.   end
  1514.  
  1515.   #--------------------------------------------------------------------------
  1516.   # * Update Number Fix
  1517.   #--------------------------------------------------------------------------      
  1518.   def update_number_fix(type)
  1519.       if type == 0
  1520.          @hp_number_old =  @actor.hp
  1521.          @hp_number_refresh = true
  1522.       elsif type == 1
  1523.          @mp_number_old =  @actor.mp
  1524.          @mp_number_refresh = true
  1525.       elsif type == 2
  1526.          @tp_number_old =  @actor.tp
  1527.          @tp_number_refresh = true  
  1528.       elsif type == 3
  1529.          @hp_number2_old =  @actor.mhp
  1530.          @hp_number2_refresh = true
  1531.       elsif type == 4
  1532.          @mp_number2_old =  @actor.mmp
  1533.          @mp_number2_refresh = true
  1534.       elsif type == 5
  1535.          @tp_number2_old =  @actor.max_tp
  1536.          @tp_number2_refresh = true          
  1537.       end  
  1538.   end  
  1539.  
  1540.   #--------------------------------------------------------------------------
  1541.   # * Refresh Sprite Number
  1542.   #--------------------------------------------------------------------------  
  1543.   def refresh_sprite_number(type,value)    
  1544.       @hp_number_refresh = true if type == 0
  1545.       @hp_number_old = value if type == 0
  1546.       @mp_number_refresh = true if type == 1
  1547.       @mp_number_old = value if type == 1
  1548.       @tp_number_refresh = true if type == 2
  1549.       @tp_number_old = value if type == 2
  1550.       @hp_number2_refresh = true if type == 3
  1551.       @hp_number2_old = value if type == 3
  1552.       @mp_number2_refresh = true if type == 4
  1553.       @mp_number2_old = value if type == 4
  1554.       @tp_number2_refresh = true if type == 5
  1555.       @tp_number2_old = value if type == 5
  1556.       @gold_refresh = true if type == 6
  1557.       @gold_old = value if type == 6      
  1558.   end  
  1559.  
  1560.   #--------------------------------------------------------------------------
  1561.   # * Refresh Number
  1562.   #--------------------------------------------------------------------------    
  1563.   def refresh_number(type,value,sprite,image,number_cw,number_ch,wave_number = false)
  1564.       sprite.bitmap.clear
  1565.       clear_number_refresh(type)
  1566.       number_color = low_number_color(type,number_ch)
  1567.       if type == 0 and HP_NUMBER_PERCENTAGE
  1568.          value_max = @actor.mhp
  1569.          value = value.to_f / value_max.to_f * 100
  1570.          value = 1 if (value < 0 and @actor.hp > 0) or @actor.hp == 1
  1571.       elsif type == 1 and MP_NUMBER_PERCENTAGE
  1572.          value_max = @actor.mmp
  1573.          value = value.to_f / value_max.to_f * 100
  1574.       elsif type == 2 and TP_NUMBER_PERCENTAGE
  1575.          value_max = @actor.max_tp
  1576.          value = value.to_f / value_max.to_f * 100  
  1577.       elsif type == 3 and HP_NUMBER_PERCENTAGE
  1578.          value = 100
  1579.       elsif type == 4 and MP_NUMBER_PERCENTAGE
  1580.          value = 100
  1581.       elsif type == 5 and TP_NUMBER_PERCENTAGE
  1582.          value = 100
  1583.       end
  1584.       value = 9999999 if value > 9999999
  1585.       number_value = value.truncate.abs.to_s.split(//)
  1586.       wave_h = 0
  1587.       wave_h2 = wave_number ? (number_ch / 3) : 0
  1588.       wave_h3 = number_color != 0 ? wave_h2 : 0
  1589.       for r in 0..number_value.size - 1        
  1590.          number_value_abs = number_value[r].to_i
  1591.          wh = wave_h2 * wave_h
  1592.          wh2 = wave_h == 0 ? wave_h2 : 0
  1593.          nsrc_rect = Rect.new(number_cw * number_value_abs, number_color - wave_h3, number_cw, number_ch - wh2)
  1594.          sprite.bitmap.blt(number_cw *  r, wh, image, nsrc_rect)
  1595.          wave_h = wave_h == 0 ? 1 : 0
  1596.       end
  1597.       refresh_number_position(type,number_value.size,number_cw)
  1598.   end
  1599.  
  1600.   #--------------------------------------------------------------------------
  1601.   # * Refresh Number
  1602.   #--------------------------------------------------------------------------    
  1603.   def refresh_number_position(type,number_value,number_cw)
  1604.       cx = number_value * number_cw
  1605.       if type == 0
  1606.          case HP_NUMBER_ALIGN_TYPE
  1607.            when 0; @hp_number.x = $game_system.hud_position[0] + HP_NUMBER_POSITION[0]
  1608.            when 1; @hp_number.x = $game_system.hud_position[0] + HP_NUMBER_POSITION[0] - (cx / 2)
  1609.            when 2; @hp_number.x = $game_system.hud_position[0] + HP_NUMBER_POSITION[0] - cx
  1610.          end            
  1611.       elsif type == 1
  1612.          case MP_NUMBER_ALIGN_TYPE
  1613.            when 0; @mp_number.x = $game_system.hud_position[0] + MP_NUMBER_POSITION[0]
  1614.            when 1; @mp_number.x = $game_system.hud_position[0] + MP_NUMBER_POSITION[0] - (cx / 2)
  1615.            when 2; @mp_number.x = $game_system.hud_position[0] + MP_NUMBER_POSITION[0] - cx
  1616.          end    
  1617.       elsif type == 2  
  1618.          case TP_NUMBER_ALIGN_TYPE
  1619.            when 0; @tp_number.x = $game_system.hud_position[0] + TP_NUMBER_POSITION[0]
  1620.            when 1; @tp_number.x = $game_system.hud_position[0]+ TP_NUMBER_POSITION[0] - (cx / 2)
  1621.            when 2; @tp_number.x = $game_system.hud_position[0] + TP_NUMBER_POSITION[0] - cx
  1622.          end          
  1623.       elsif type == 3  
  1624.          case HP_NUMBER_ALIGN_TYPE
  1625.            when 0; @hp_number2.x = $game_system.hud_position[0] + HP_NUMBER_MAX_POSITION[0]
  1626.            when 1; @hp_number2.x = $game_system.hud_position[0] + HP_NUMBER_MAX_POSITION[0] - (cx / 2)
  1627.            when 2; @hp_number2.x = $game_system.hud_position[0] + HP_NUMBER_MAX_POSITION[0] - cx
  1628.          end          
  1629.       elsif type ==  4
  1630.          case MP_NUMBER_ALIGN_TYPE
  1631.            when 0; @mp_number2.x = $game_system.hud_position[0] + MP_NUMBER_MAX_POSITION[0]
  1632.            when 1; @mp_number2.x = $game_system.hud_position[0] + MP_NUMBER_MAX_POSITION[0] - (cx / 2)
  1633.            when 2; @mp_number2.x = $game_system.hud_position[0] + MP_NUMBER_MAX_POSITION[0] - cx
  1634.          end          
  1635.       elsif type ==  5
  1636.          case TP_NUMBER_ALIGN_TYPE
  1637.            when 0; @tp_number2.x = $game_system.hud_position[0] + TP_NUMBER_MAX_POSITION[0]
  1638.            when 1; @tp_number2.x = $game_system.hud_position[0] + TP_NUMBER_MAX_POSITION[0] - (cx / 2)
  1639.            when 2; @tp_number2.x = $game_system.hud_position[0] + TP_NUMBER_MAX_POSITION[0] - cx
  1640.          end
  1641.       elsif type ==  6    
  1642.          case GOLD_NUMBER_ALIGN_TYPE
  1643.            when 0; @gold_number.x = @gold_pos[0]
  1644.            when 1; @gold_number.x = @gold_pos[0] - (cx / 2)
  1645.            when 2; @gold_number.x = @gold_pos[0] - cx
  1646.          end            
  1647.       end  
  1648.   end
  1649.  
  1650.   #--------------------------------------------------------------------------
  1651.   # * Low Number Color
  1652.   #--------------------------------------------------------------------------      
  1653.   def low_number_color(type,number_ch)
  1654.       if type == 0
  1655.          if HP_NUMBER_LOW_COLOR
  1656.             return @actor.low_hp? ? number_ch : 0
  1657.          else
  1658.             return 0
  1659.          end  
  1660.       elsif type == 1
  1661.          if MP_NUMBER_LOW_COLOR    
  1662.             return @actor.low_mp? ? number_ch : 0
  1663.          else
  1664.             return 0
  1665.          end          
  1666.       elsif type == 2
  1667.          if TP_NUMBER_LOW_COLOR
  1668.             return @actor.low_tp? ? number_ch : 0
  1669.          else
  1670.             return 0
  1671.          end
  1672.       else    
  1673.          return 0  
  1674.       end    
  1675.   end
  1676.  
  1677.   #--------------------------------------------------------------------------
  1678.   # * Clear Number Refresh
  1679.   #--------------------------------------------------------------------------      
  1680.   def clear_number_refresh(type)
  1681.       @hp_number_refresh = false if type == 0
  1682.       @mp_number_refresh = false if type == 1
  1683.       @tp_number_refresh = false if type == 2
  1684.       @hp_number2_refresh = false if type == 3
  1685.       @mp_number2_refresh = false if type == 4
  1686.       @tp_number2_refresh = false if type == 5
  1687.       @gold_refresh = false if type == 6
  1688.   end  
  1689.  
  1690.   #--------------------------------------------------------------------------
  1691.   # * Fade Sprite
  1692.   #--------------------------------------------------------------------------
  1693.   def fade_sprite(sprite,fade_hud)
  1694.       if @force_hide
  1695.          sprite.opacity = 0 if @force_hide_time > 5
  1696.       else
  1697.          if fade_hud
  1698.              sprite.opacity -= 15 if sprite.opacity > SMART_FADE_LIMIT
  1699.              sprite.opacity = SMART_FADE_LIMIT if sprite.opacity < SMART_FADE_LIMIT
  1700.          else  
  1701.              sprite.opacity += 15
  1702.          end
  1703.       end
  1704.   end  
  1705.  
  1706.   #--------------------------------------------------------------------------
  1707.   # * Icon Limit
  1708.   #--------------------------------------------------------------------------      
  1709.   def icon_limit(value,value_max)
  1710.       n1 = value / value_max
  1711.       n2 = value - (n1 * value_max)
  1712.       n2 = value_max if (n2 == 0 and value > 0)
  1713.       return n2
  1714.   end  
  1715.  
  1716. end
  1717. #==============================================================================
  1718. #==============================================================================
  1719. # ** Ultima Hud (LAYOUT)
  1720. #==============================================================================
  1721. #==============================================================================
  1722. class Ultima_Hud
  1723.   #--------------------------------------------------------------------------
  1724.   # * Create Layout
  1725.   #--------------------------------------------------------------------------    
  1726.   def create_layout
  1727.       @layout = Sprite.new
  1728.       @layout.bitmap = Cache.ultima_hud("Layout")
  1729.       @layout.z = HUD_Z
  1730.       @layout.x = $game_system.hud_position[0]
  1731.       @layout.y = $game_system.hud_position[1]
  1732.       @layout.opacity = 0 if !$game_system.hud_visible
  1733.       @hud_size_x = [$game_system.hud_position[0] + SMART_FADE_RANGE_X[0], $game_system.hud_position[0] + @layout.bitmap.width + SMART_FADE_RANGE_X[1]]
  1734.       @hud_size_y = [$game_system.hud_position[1] + SMART_FADE_RANGE_Y[0], $game_system.hud_position[1] + @layout.bitmap.height + SMART_FADE_RANGE_Y[1]]
  1735.   end    
  1736.  
  1737.   #--------------------------------------------------------------------------
  1738.   # * Update Layout
  1739.   #--------------------------------------------------------------------------    
  1740.   def update_layout
  1741.       return if @layout == nil
  1742.       fade_sprite(@layout,@fade_hud)
  1743.   end
  1744.  
  1745.   #--------------------------------------------------------------------------
  1746.   # * Create Layout
  1747.   #--------------------------------------------------------------------------    
  1748.   def create_layout_2
  1749.       return if !SECOND_LAYOUT
  1750.       @layout2 = Sprite.new
  1751.       @layout2.bitmap = Cache.ultima_hud("Layout_2")
  1752.       @layout2.z = HUD_Z + SECOND_LAYOUT_Z
  1753.       @layout2.x = $game_system.hud_position[0] + SECOND_LAYOUT_POSITION[0]
  1754.       @layout2.y = $game_system.hud_position[1] + SECOND_LAYOUT_POSITION[1]
  1755.       @layout2.opacity = 0 if !$game_system.hud_visible
  1756.   end    
  1757.  
  1758.   #--------------------------------------------------------------------------
  1759.   # * Update Layout
  1760.   #--------------------------------------------------------------------------    
  1761.   def update_layout_2
  1762.       return if @layout2 == nil
  1763.       fade_sprite(@layout2,@fade_hud)
  1764.   end  
  1765.  
  1766. end
  1767. #==============================================================================
  1768. #==============================================================================
  1769. # ** Ultima Hud (NAME)
  1770. #==============================================================================
  1771. #==============================================================================
  1772. class Ultima_Hud
  1773.  
  1774.   #--------------------------------------------------------------------------
  1775.   # * Create Name
  1776.   #--------------------------------------------------------------------------      
  1777.   def create_name
  1778.       return if !NAME_VISIBLE
  1779.       @name = Sprite.new
  1780.       @name.bitmap = Bitmap.new(160,32)
  1781.       @name.bitmap.font.name = NAME_FONT_NAME
  1782.       @name.bitmap.font.size = NAME_FONT_SIZE
  1783.       @name.bitmap.font.bold = NAME_FONT_BOLD
  1784.       @name.bitmap.font.italic = NAME_FONT_ITALIC
  1785.       @name.bitmap.font.color = NAME_FONT_COLOR
  1786.       @name.z = HUD_Z + NAME_Z
  1787.       @name.x = $game_system.hud_position[0] + NAME_POSITION[0]
  1788.       @name.y = $game_system.hud_position[1] + NAME_POSITION[1]
  1789.       @name.opacity = 0 if !$game_system.hud_visible
  1790.       refresh_name
  1791.   end
  1792.  
  1793.   #--------------------------------------------------------------------------
  1794.   # * Refresh Name
  1795.   #--------------------------------------------------------------------------      
  1796.   def refresh_name
  1797.       return if @name == nil
  1798.       @name.bitmap.clear
  1799.       if NAME_FONT_SHADOW
  1800.          @name.bitmap.font.color = NAME_FONT_SHADOW_COLOR
  1801.          @name.bitmap.draw_text(NAME_FONT_SHADOW_POSITION[0],NAME_FONT_SHADOW_POSITION[1],160,32,@actor.name,NAME_ALIGN_TYPE)
  1802.          @name.bitmap.font.color = NAME_FONT_COLOR
  1803.       end  
  1804.       @name.bitmap.draw_text(0,0,160,32,@actor.name,NAME_ALIGN_TYPE)
  1805.   end
  1806.  
  1807.   #--------------------------------------------------------------------------
  1808.   # * Update Name
  1809.   #--------------------------------------------------------------------------        
  1810.   def update_name
  1811.       return if @name == nil
  1812.       fade_sprite(@name,@fade_hud)
  1813.   end
  1814.  
  1815. end
  1816. #==============================================================================
  1817. #==============================================================================
  1818. # ** Ultima Hud (HP)
  1819. #==============================================================================
  1820. #==============================================================================
  1821. class Ultima_Hud
  1822.  
  1823.   #--------------------------------------------------------------------------
  1824.   # * Create HP Number
  1825.   #--------------------------------------------------------------------------  
  1826.   def create_hp_number
  1827.       return if !HP_NUMBER_VISIBLE
  1828.       @hp_number = Sprite.new
  1829.       @hp_number.bitmap = Bitmap.new(@hp_number_cw * 4,@hp_number_ch)
  1830.       @hp_number.z = HUD_Z + HP_NUMBER_Z
  1831.       @hp_number.x = $game_system.hud_position[0] + HP_NUMBER_POSITION[0]
  1832.       @hp_number.y = $game_system.hud_position[1] + HP_NUMBER_POSITION[1]
  1833.       @hp_number.opacity = 0 if !$game_system.hud_visible
  1834.   end
  1835.  
  1836.   #--------------------------------------------------------------------------
  1837.   # * Create HP Number Max
  1838.   #--------------------------------------------------------------------------  
  1839.   def create_hp_number_max
  1840.       return if !HP_NUMBER_MAX_VISIBLE
  1841.       @hp_number2 = Sprite.new
  1842.       @hp_number2.bitmap = Bitmap.new(@hp_number2_cw * 4,@hp_number2_ch)
  1843.       @hp_number2.z = HUD_Z + HP_NUMBER_Z
  1844.       @hp_number2.x = $game_system.hud_position[0] + HP_NUMBER_MAX_POSITION[0]
  1845.       @hp_number2.y = $game_system.hud_position[1] + HP_NUMBER_MAX_POSITION[1]
  1846.       @hp_number2.opacity = 0 if !$game_system.hud_visible
  1847.   end  
  1848.  
  1849.   #--------------------------------------------------------------------------
  1850.   # * Create HP Meter
  1851.   #--------------------------------------------------------------------------    
  1852.   def create_hp_meter
  1853.       return if !HP_METER_VISIBLE
  1854.       @hp_flow_max = @hp_meter_cw * 2
  1855.       @hp_flow = rand(@hp_flow_max)
  1856.       @hp_meter = Sprite.new
  1857.       @hp_meter.bitmap = Bitmap.new(@hp_meter_cw,@hp_meter_ch)
  1858.       @hp_meter.z = HUD_Z + HP_METER_Z
  1859.       @hp_meter.x = $game_system.hud_position[0] + HP_METER_POSITION[0]
  1860.       @hp_meter.y = $game_system.hud_position[1] + HP_METER_POSITION[1]
  1861.       @hp_meter.angle = HP_METER_ANGLE
  1862.       @hp_meter.mirror = HP_METER_MIRROR_EFFECT
  1863.       @hp_meter.opacity = 0 if !$game_system.hud_visible
  1864.   end
  1865.  
  1866.   #--------------------------------------------------------------------------
  1867.   # ● Update Flow HP
  1868.   #--------------------------------------------------------------------------            
  1869.   def update_flow_hp
  1870.       @hp_meter.bitmap.clear
  1871.       @hp_flow = 0 if !HP_METER_GRADIENT_ANIMATION
  1872.       meter_width = @hp_meter_cw * @actor.hp / @actor.mhp rescue nil
  1873.       meter_width = 0 if meter_width == nil
  1874.       execute_hp_damage_flow(meter_width)      
  1875.       meter_src_rect = Rect.new(@hp_flow, 0,meter_width, @hp_meter_ch)
  1876.       @hp_meter.bitmap.blt(0,0, @hp_meter_image, meter_src_rect)  
  1877.       @hp_flow += 5
  1878.       @hp_flow = 0 if @hp_flow >= @hp_flow_max
  1879.   end  
  1880.    
  1881.   #--------------------------------------------------------------------------
  1882.   # ● Execute HP Damage Flow
  1883.   #--------------------------------------------------------------------------
  1884.   def execute_hp_damage_flow(meter_width)
  1885.       return if !HP_METER_REDUCTION_ANIMATION
  1886.       return if @hp_old_meter == meter_width
  1887.       n = (@hp_old_meter - meter_width).abs * 3 / 100
  1888.       damage_flow = [[n, 2].min,0.5].max
  1889.       @hp_old_meter -= damage_flow
  1890.       @hp_old_meter = meter_width if @hp_old_meter <= meter_width
  1891.       src_rect_old = Rect.new(0,@hp_meter_ch, @hp_old_meter, @hp_meter_ch)
  1892.       @hp_meter.bitmap.blt(0,0, @hp_meter_image, src_rect_old)      
  1893.   end
  1894.   #--------------------------------------------------------------------------
  1895.   # * Create HP Icon
  1896.   #--------------------------------------------------------------------------  
  1897.   def create_hp_icon
  1898.       return if !HP_ICON_VISIBLE
  1899.       @hp_icon = Sprite.new
  1900.       icon_width = @hp_icon_col_max * (@hp_icon_cw + HP_ICON_SPACE[0].abs)
  1901.       icon_height = @hp_icon_row_max * (@hp_icon_ch + HP_ICON_SPACE[1].abs)
  1902.       @hp_icon.bitmap = Bitmap.new(icon_width,icon_height)      
  1903.       @hp_icon.z = HUD_Z + HP_ICON_Z
  1904.       @hp_icon.x = $game_system.hud_position[0] + HP_ICON_POSITION[0]
  1905.       @hp_icon.y = $game_system.hud_position[1] + HP_ICON_POSITION[1]
  1906.       @hp_icon.opacity = 0 if !$game_system.hud_visible
  1907.   end
  1908.    
  1909.   #--------------------------------------------------------------------------
  1910.   # * Refresh HP Icon
  1911.   #--------------------------------------------------------------------------    
  1912.   def refresh_hp_icon
  1913.       @hp_icon_old = @actor.hp
  1914.       @hp_icon.bitmap.clear
  1915.       max_value = (@actor.mhp / @hp_icon_real_max) * @hp_icon_real_max
  1916.       if @actor.hp > max_value
  1917.          icon_max = icon_limit(@actor.mhp,@hp_icon_real_max)
  1918.       else  
  1919.          icon_max = @actor.mhp
  1920.       end      
  1921.       for i in 0...icon_max
  1922.           break if (i / @hp_icon_col_max) >= @hp_icon_row_max
  1923.           rx = (i * (@hp_icon_cw + HP_ICON_SPACE[0]) ) - ((i / @hp_icon_col_max) * (@hp_icon_cw + HP_ICON_SPACE[0]) * @hp_icon_col_max)
  1924.           ry = (i / @hp_icon_col_max) * (@hp_icon_ch + HP_ICON_SPACE[1])
  1925.           i_scr = Rect.new(0,0,@hp_icon_cw,@hp_icon_ch)
  1926.           @hp_icon.bitmap.blt(rx,ry,@hp_icon_image ,i_scr )      
  1927.       end      
  1928.       icon_max = icon_limit(@actor.hp,@hp_icon_real_max)
  1929.       rx = 0
  1930.       ry = 0
  1931.       for i in 0...icon_max
  1932.           break if (i / @hp_icon_col_max) >= @hp_icon_row_max
  1933.           rx = (i * (@hp_icon_cw + HP_ICON_SPACE[0]) ) - ((i / @hp_icon_col_max) * (@hp_icon_cw + HP_ICON_SPACE[0]) * @hp_icon_col_max)
  1934.           ry = (i / @hp_icon_col_max) * (@hp_icon_ch + HP_ICON_SPACE[1])
  1935.           i_scr = Rect.new(@hp_icon_cw,0,@hp_icon_cw,@hp_icon_ch)
  1936.           @hp_icon.bitmap.blt(rx,ry,@hp_icon_image ,i_scr )
  1937.       end
  1938.       refresh_hp_icon_ex(rx,ry)      
  1939.   end
  1940.  
  1941.   #--------------------------------------------------------------------------
  1942.   # * Create HP Icon EX
  1943.   #--------------------------------------------------------------------------  
  1944.   def create_hp_icon_ex
  1945.       return if !HP_ICON_EX_VISIBLE
  1946.       @hp_icon3_anime_phase = 0
  1947.       @hp_icon3 = Sprite.new
  1948.       @hp_icon3.bitmap = Bitmap.new(@hp_icon2_cw,@hp_icon2_ch)
  1949.       @hp_icon3.ox = @hp_icon3.bitmap.width / 2
  1950.       @hp_icon3.oy = @hp_icon3.bitmap.height / 2
  1951.       @hp_icon3.z = HUD_Z + HP_ICON_Z + 2
  1952.       @hp_icon3_org = [$game_system.hud_position[0] + HP_ICON_POSITION[0] + HP_ICON_EX_POSITION[0] + @hp_icon3.ox,
  1953.                        $game_system.hud_position[1] + HP_ICON_POSITION[1] + HP_ICON_EX_POSITION[1] + @hp_icon3.oy]
  1954.       @hp_icon3.x = @hp_icon3_org[0]
  1955.       @hp_icon3.y = @hp_icon3_org[1]
  1956.       @hp_icon3.opacity = 0 if !$game_system.hud_visible
  1957.   end  
  1958.  
  1959.   #--------------------------------------------------------------------------
  1960.   # * Refresh HP Icon EX
  1961.   #--------------------------------------------------------------------------      
  1962.   def refresh_hp_icon_ex(rx,ry)
  1963.       return if @hp_icon3 == nil
  1964.       @hp_icon3.bitmap.clear
  1965.       return if @actor.hp == 0
  1966.       i_scr = Rect.new(0,0,@hp_icon2_cw,@hp_icon2_ch)
  1967.       @hp_icon3.bitmap.blt(0,0, @hp_icon2_image ,i_scr )
  1968.       @hp_icon3.x = @hp_icon3_org[0] + rx
  1969.       @hp_icon3.y = @hp_icon3_org[1] + ry    
  1970.   end
  1971.  
  1972.   #--------------------------------------------------------------------------
  1973.   # * Update Icon HP EX Anime
  1974.   #--------------------------------------------------------------------------  
  1975.   def update_icon_hp_ex_anime
  1976.       return if !HP_ICON_EX_ZOOM_EFFECT
  1977.       if @hp_icon3_anime_phase == 0
  1978.          @hp_icon3.zoom_x += 0.01
  1979.          if @hp_icon3.zoom_x >= 1.30
  1980.             @hp_icon3.zoom_x = 1.30
  1981.             @hp_icon3_anime_phase = 1
  1982.          end  
  1983.       else
  1984.         @hp_icon3.zoom_x -= 0.01
  1985.         if @hp_icon3.zoom_x <= 1.05
  1986.            @hp_icon3.zoom_x = 1.05
  1987.            @hp_icon3_anime_phase = 0
  1988.         end    
  1989.       end  
  1990.       @hp_icon3.zoom_y = @hp_icon3.zoom_x
  1991.   end
  1992.  
  1993.   #--------------------------------------------------------------------------
  1994.   # * Create HP Icon Nummber
  1995.   #--------------------------------------------------------------------------      
  1996.   def create_hp_icon_number
  1997.       return if !HP_ICON_NUMBER_VISIBLE
  1998.       @hp_icon_number_old = [-1,-1]
  1999.       @hp_icon_number = Sprite.new
  2000.       @hp_icon_number.bitmap = Bitmap.new(@hp_icon_number_cw * 4,@hp_icon_number_ch)
  2001.       @hp_icon_number.z = HUD_Z + HP_ICON_NUMBER_Z
  2002.       @hp_icon_number.x = $game_system.hud_position[0] + HP_ICON_NUMBER_POSITION[0]
  2003.       @hp_icon_number.y = $game_system.hud_position[1] + HP_ICON_NUMBER_POSITION[1]
  2004.       @hp_icon_number.opacity = 0 if !$game_system.hud_visible
  2005.   end
  2006.  
  2007.   #--------------------------------------------------------------------------
  2008.   # * Refresh Icon Number HP
  2009.   #--------------------------------------------------------------------------  
  2010.   def refresh_icon_number_hp
  2011.       @hp_icon_number_old[0] = @actor.hp
  2012.       @hp_icon_number_old[1] = @actor.mhp
  2013.       @hp_icon_number.bitmap.clear
  2014.       value = ((@actor.hp - 1) / @hp_icon_col_max) / @hp_icon_row_max
  2015.       value = 0 if value < 0
  2016.       number_value = value.truncate.abs.to_s.split(//)
  2017.       for r in 0..number_value.size - 1        
  2018.          number_value_abs = number_value[r].to_i
  2019.          nsrc_rect = Rect.new(@hp_icon_number_cw * number_value_abs, 0, @hp_icon_number_cw, @hp_icon_number_ch)
  2020.          @hp_icon_number.bitmap.blt(@hp_icon_number_cw *  r, 0, @hp_icon_number_image, nsrc_rect)
  2021.       end
  2022.       cx = (number_value.size * @hp_icon_number_cw)
  2023.       case HP_ICON_NUMBER_ALIGN_TYPE
  2024.          when 0; @hp_icon_number.x = $game_system.hud_position[0] + HP_ICON_NUMBER_POSITION[0]
  2025.          when 1; @hp_icon_number.x = $game_system.hud_position[0] + HP_ICON_NUMBER_POSITION[0] - (cx / 2)
  2026.          when 2; @hp_icon_number.x = $game_system.hud_position[0] + HP_ICON_NUMBER_POSITION[0] - cx
  2027.       end    
  2028.   end
  2029.   #--------------------------------------------------------------------------
  2030.   # * Can Refresh Icon Number HP
  2031.   #--------------------------------------------------------------------------  
  2032.   def can_refresh_icon_number_hp?
  2033.       return true if @hp_icon_number_old[0] != @actor.hp
  2034.       return true if @hp_icon_number_old[1] != @actor.mhp
  2035.       return false
  2036.   end
  2037.  
  2038.   #--------------------------------------------------------------------------
  2039.   # * Update HP
  2040.   #--------------------------------------------------------------------------    
  2041.   def update_hp
  2042.       if @hp_number != nil
  2043.          if HP_NUMBER_ANIMATION
  2044.             update_number(0,@hp_number_old)
  2045.          else  
  2046.             update_number_fix(0) if @hp_number_old != @actor.hp
  2047.          end  
  2048.          refresh_number(0,@hp_number_old,@hp_number,@hp_number_image,@hp_number_cw,@hp_number_ch,@hp_wave_number) if @hp_number_refresh
  2049.          fade_sprite(@hp_number,@fade_hud)
  2050.       end
  2051.       if @hp_number2 != nil
  2052.          if HP_NUMBER_ANIMATION
  2053.             update_number(3,@hp_number2_old)
  2054.          else  
  2055.             update_number_fix(3) if @hp_number2_old != @actor.mhp
  2056.          end  
  2057.          refresh_number(3,@hp_number2_old,@hp_number2,@hp_number2_image,@hp_number2_cw,@hp_number2_ch,@hp_wave_number) if @hp_number2_refresh
  2058.          fade_sprite(@hp_number2,@fade_hud)
  2059.       end
  2060.       if @hp_meter != nil
  2061.          update_flow_hp
  2062.          fade_sprite(@hp_meter,@fade_hud)
  2063.       end  
  2064.       if @hp_icon != nil
  2065.          refresh_hp_icon if @hp_icon_old != @actor.hp
  2066.          fade_sprite(@hp_icon,@fade_hud)
  2067.       end
  2068.       if @hp_icon3 != nil
  2069.          update_icon_hp_ex_anime
  2070.          fade_sprite(@hp_icon3,@fade_hud)
  2071.       end      
  2072.       if @hp_icon_number != nil
  2073.          refresh_icon_number_hp if can_refresh_icon_number_hp?
  2074.          fade_sprite(@hp_icon_number,@fade_hud)
  2075.       end  
  2076.   end  
  2077.    
  2078. end
  2079. #==============================================================================
  2080. #==============================================================================
  2081. # ** Ultima Hud (MP)
  2082. #==============================================================================
  2083. #==============================================================================
  2084. class Ultima_Hud
  2085.  
  2086.   #--------------------------------------------------------------------------
  2087.   # * Create MP Number
  2088.   #--------------------------------------------------------------------------  
  2089.   def create_mp_number
  2090.       return if !MP_NUMBER_VISIBLE
  2091.       @mp_number = Sprite.new
  2092.       @mp_number.bitmap = Bitmap.new(@mp_number_cw * 4, @mp_number_ch)
  2093.       @mp_number.z = HUD_Z + MP_NUMBER_Z
  2094.       @mp_number.x = $game_system.hud_position[0] + MP_NUMBER_POSITION[0]
  2095.       @mp_number.y = $game_system.hud_position[1] + MP_NUMBER_POSITION[1]
  2096.       @mp_number.opacity = 0 if !$game_system.hud_visible
  2097.   end
  2098.  
  2099.   #--------------------------------------------------------------------------
  2100.   # * Create MP Number Max
  2101.   #--------------------------------------------------------------------------  
  2102.   def create_mp_number_max
  2103.       return if !MP_NUMBER_MAX_VISIBLE
  2104.       @mp_number2 = Sprite.new
  2105.       @mp_number2.bitmap = Bitmap.new(@mp_number2_cw * 4, @mp_number2_ch)
  2106.       @mp_number2.z = HUD_Z + MP_NUMBER_Z
  2107.       @mp_number2.x = $game_system.hud_position[0] + MP_NUMBER_MAX_POSITION[0]
  2108.       @mp_number2.y = $game_system.hud_position[1] + MP_NUMBER_MAX_POSITION[1]
  2109.       @mp_number2.opacity = 0 if !$game_system.hud_visible
  2110.   end  
  2111.  
  2112.   #--------------------------------------------------------------------------
  2113.   # * Create MP Meter
  2114.   #--------------------------------------------------------------------------    
  2115.   def create_mp_meter
  2116.       return if !MP_METER_VISIBLE
  2117.       @mp_flow_max = @mp_meter_cw * 2
  2118.       @mp_flow = rand(@mp_flow_max)
  2119.       @mp_meter = Sprite.new
  2120.       @mp_meter.bitmap = Bitmap.new(@mp_meter_cw,@mp_meter_ch)
  2121.       @mp_meter.z = HUD_Z + MP_METER_Z
  2122.       @mp_meter.x = $game_system.hud_position[0] + MP_METER_POSITION[0]
  2123.       @mp_meter.y = $game_system.hud_position[1] + MP_METER_POSITION[1]
  2124.       @mp_meter.angle = MP_METER_ANGLE
  2125.       @mp_meter.mirror = MP_METER_MIRROR_EFFECT
  2126.       @mp_meter.opacity = 0 if !$game_system.hud_visible
  2127.   end
  2128.  
  2129.   #--------------------------------------------------------------------------
  2130.   # ● Update Flow MP
  2131.   #--------------------------------------------------------------------------            
  2132.   def update_flow_mp
  2133.       @mp_meter.bitmap.clear
  2134.       @mp_flow = 0 if !MP_METER_GRADIENT_ANIMATION
  2135.       meter_width = @mp_meter_cw * @actor.mp / @actor.mmp rescue nil
  2136.       meter_width = 0 if meter_width == nil
  2137.       execute_mp_damage_flow(meter_width)      
  2138.       meter_src_rect = Rect.new(@mp_flow, 0,meter_width, @mp_meter_ch)
  2139.       @mp_meter.bitmap.blt(0,0, @mp_meter_image, meter_src_rect)  
  2140.       @mp_flow += 5
  2141.       @mp_flow = 0 if @mp_flow >= @mp_flow_max
  2142.   end  
  2143.    
  2144.   #--------------------------------------------------------------------------
  2145.   # ● Execute MP Damage Flow
  2146.   #--------------------------------------------------------------------------
  2147.   def execute_mp_damage_flow(meter_width)
  2148.       return if !MP_METER_REDUCTION_ANIMATION
  2149.       return if @mp_old_meter == meter_width
  2150.       n = (@mp_old_meter - meter_width).abs * 3 / 100
  2151.       damage_flow = [[n, 2].min,0.5].max
  2152.       @mp_old_meter -= damage_flow      
  2153.       @mp_old_meter = meter_width if @mp_old_meter <= meter_width
  2154.       src_rect_old = Rect.new(0,@mp_meter_ch, @mp_old_meter, @mp_meter_ch)
  2155.       @mp_meter.bitmap.blt(0,0, @mp_meter_image, src_rect_old)      
  2156.   end
  2157.   #--------------------------------------------------------------------------
  2158.   # * Create MP Icon
  2159.   #--------------------------------------------------------------------------  
  2160.   def create_mp_icon
  2161.       return if !MP_ICON_VISIBLE
  2162.       @mp_icon = Sprite.new
  2163.       icon_width = @mp_icon_col_max * (@mp_icon_cw + MP_ICON_SPACE[0].abs)
  2164.       icon_height = @mp_icon_row_max * (@mp_icon_ch + MP_ICON_SPACE[1].abs)
  2165.       @mp_icon.bitmap = Bitmap.new(icon_width,icon_height)      
  2166.       @mp_icon.z = HUD_Z + MP_ICON_Z
  2167.       @mp_icon.x = $game_system.hud_position[0] + MP_ICON_POSITION[0]
  2168.       @mp_icon.y = $game_system.hud_position[1] + MP_ICON_POSITION[1]
  2169.       @mp_icon.opacity = 0 if !$game_system.hud_visible
  2170.   end
  2171.    
  2172.   #--------------------------------------------------------------------------
  2173.   # * Refresh MP Icon
  2174.   #--------------------------------------------------------------------------    
  2175.   def refresh_mp_icon
  2176.       @mp_icon_old = @actor.mp
  2177.       @mp_icon.bitmap.clear
  2178.       max_value = (@actor.mmp / @mp_icon_real_max) * @mp_icon_real_max
  2179.       if @actor.mp > max_value
  2180.          icon_max = icon_limit(@actor.mmp,@mp_icon_real_max)
  2181.       else  
  2182.          icon_max = @actor.mmp
  2183.       end      
  2184.       for i in 0...icon_max
  2185.           break if (i / @mp_icon_col_max) >= @mp_icon_row_max
  2186.           rx = (i * (@mp_icon_cw + MP_ICON_SPACE[0]) ) - ((i / @mp_icon_col_max) * (@mp_icon_cw + MP_ICON_SPACE[0]) * @mp_icon_col_max)
  2187.           ry = (i / @mp_icon_col_max) * (@mp_icon_ch + MP_ICON_SPACE[1])
  2188.           i_scr = Rect.new(0,0,@mp_icon_cw,@mp_icon_ch)
  2189.           @mp_icon.bitmap.blt(rx,ry,@mp_icon_image ,i_scr )      
  2190.       end      
  2191.       icon_max = icon_limit(@actor.mp,@mp_icon_real_max)
  2192.       rx = 0
  2193.       ry = 0
  2194.       for i in 0...icon_max
  2195.           break if (i / @mp_icon_col_max) >= @mp_icon_row_max
  2196.           rx = (i * (@mp_icon_cw + MP_ICON_SPACE[0]) ) - ((i / @mp_icon_col_max) * (@mp_icon_cw + MP_ICON_SPACE[0]) * @mp_icon_col_max)
  2197.           ry = (i / @mp_icon_col_max) * (@mp_icon_ch + MP_ICON_SPACE[1])
  2198.           i_scr = Rect.new(@mp_icon_cw,0,@mp_icon_cw,@mp_icon_ch)
  2199.           @mp_icon.bitmap.blt(rx,ry,@mp_icon_image ,i_scr )
  2200.       end
  2201.       refresh_mp_icon_ex(rx,ry)      
  2202.   end
  2203.  
  2204.   #--------------------------------------------------------------------------
  2205.   # * Create MP Icon EX
  2206.   #--------------------------------------------------------------------------  
  2207.   def create_mp_icon_ex
  2208.       return if !MP_ICON_EX_VISIBLE
  2209.       @mp_icon3_anime_phase = 0
  2210.       @mp_icon3 = Sprite.new
  2211.       @mp_icon3.bitmap = Bitmap.new(@mp_icon2_cw,@mp_icon2_ch)
  2212.       @mp_icon3.ox = @mp_icon3.bitmap.width / 2
  2213.       @mp_icon3.oy = @mp_icon3.bitmap.height / 2
  2214.       @mp_icon3.z = HUD_Z + MP_ICON_Z + 2
  2215.       @mp_icon3_org = [$game_system.hud_position[0] + MP_ICON_POSITION[0] + MP_ICON_EX_POSITION[0] + @mp_icon3.ox,
  2216.                        $game_system.hud_position[1] + MP_ICON_POSITION[1] + MP_ICON_EX_POSITION[1] + @mp_icon3.oy]
  2217.       @mp_icon3.x = @mp_icon3_org[0]
  2218.       @mp_icon3.y = @mp_icon3_org[1]
  2219.       @mp_icon3.opacity = 0 if !$game_system.hud_visible
  2220.   end  
  2221.  
  2222.   #--------------------------------------------------------------------------
  2223.   # * Refresh MP Icon EX
  2224.   #--------------------------------------------------------------------------      
  2225.   def refresh_mp_icon_ex(rx,ry)
  2226.       return if @mp_icon3 == nil
  2227.       @mp_icon3.bitmap.clear
  2228.       return if @actor.mp == 0
  2229.       i_scr = Rect.new(0,0,@mp_icon2_cw,@mp_icon2_ch)
  2230.       @mp_icon3.bitmap.blt(0,0, @mp_icon2_image ,i_scr )
  2231.       @mp_icon3.x = @mp_icon3_org[0] + rx
  2232.       @mp_icon3.y = @mp_icon3_org[1] + ry    
  2233.   end
  2234.  
  2235.   #--------------------------------------------------------------------------
  2236.   # * Update Icon MP EX Anime
  2237.   #--------------------------------------------------------------------------  
  2238.   def update_icon_mp_ex_anime
  2239.       return if !MP_ICON_EX_ZOOM_EFFECT
  2240.       if @mp_icon3_anime_phase == 0
  2241.          @mp_icon3.zoom_x += 0.01
  2242.          if @mp_icon3.zoom_x >= 1.30
  2243.             @mp_icon3.zoom_x = 1.30
  2244.             @mp_icon3_anime_phase = 1
  2245.          end  
  2246.       else
  2247.         @mp_icon3.zoom_x -= 0.01
  2248.         if @mp_icon3.zoom_x <= 1.05
  2249.            @mp_icon3.zoom_x = 1.05
  2250.            @mp_icon3_anime_phase = 0
  2251.         end  
  2252.       end  
  2253.       @mp_icon3.zoom_y = @mp_icon3.zoom_x
  2254.   end  
  2255.  
  2256.   #--------------------------------------------------------------------------
  2257.   # * Create MP Icon Number
  2258.   #--------------------------------------------------------------------------      
  2259.   def create_mp_icon_number
  2260.       return if !MP_ICON_NUMBER_VISIBLE
  2261.       @mp_icon_number_old = [-1,-1]
  2262.       @mp_icon_number = Sprite.new
  2263.       @mp_icon_number.bitmap = Bitmap.new(@mp_icon_number_cw * 4,@mp_icon_number_ch)
  2264.       @mp_icon_number.z = HUD_Z + MP_ICON_NUMBER_Z
  2265.       @mp_icon_number.x = $game_system.hud_position[0] + MP_ICON_NUMBER_POSITION[0]
  2266.       @mp_icon_number.y = $game_system.hud_position[1] + MP_ICON_NUMBER_POSITION[1]
  2267.       @mp_icon_number.opacity = 0 if !$game_system.hud_visible
  2268.   end
  2269.  
  2270.   #--------------------------------------------------------------------------
  2271.   # * Refresh Icon Number MP
  2272.   #--------------------------------------------------------------------------  
  2273.   def refresh_icon_number_mp
  2274.       @mp_icon_number_old[0] = @actor.mp
  2275.       @mp_icon_number_old[1] = @actor.mmp
  2276.       @mp_icon_number.bitmap.clear
  2277.       value = ((@actor.mp - 1) / @mp_icon_col_max) / @mp_icon_row_max
  2278.       value = 0 if value < 0
  2279.       number_value = value.truncate.abs.to_s.split(//)
  2280.       for r in 0..number_value.size - 1        
  2281.          number_value_abs = number_value[r].to_i
  2282.          nsrc_rect = Rect.new(@mp_icon_number_cw * number_value_abs, 0, @mp_icon_number_cw, @mp_icon_number_ch)
  2283.          @mp_icon_number.bitmap.blt(@mp_icon_number_cw *  r, 0, @mp_icon_number_image, nsrc_rect)
  2284.       end
  2285.       cx = (number_value.size * @mp_icon_number_cw)
  2286.       case MP_ICON_NUMBER_ALIGN_TYPE
  2287.          when 0; @mp_icon_number.x = $game_system.hud_position[0] + MP_ICON_NUMBER_POSITION[0]
  2288.          when 1; @mp_icon_number.x = $game_system.hud_position[0] + MP_ICON_NUMBER_POSITION[0] - (cx / 2)
  2289.          when 2; @mp_icon_number.x = $game_system.hud_position[0] + MP_ICON_NUMBER_POSITION[0] - cx
  2290.       end        
  2291.   end
  2292.   #--------------------------------------------------------------------------
  2293.   # * Can Refresh Icon Number MP
  2294.   #--------------------------------------------------------------------------  
  2295.   def can_refresh_icon_number_mp?
  2296.       return true if @mp_icon_number_old[0] != @actor.mp
  2297.       return true if @mp_icon_number_old[1] != @actor.mmp
  2298.       return false
  2299.   end    
  2300.  
  2301.   #--------------------------------------------------------------------------
  2302.   # * Update MP
  2303.   #--------------------------------------------------------------------------    
  2304.   def update_mp
  2305.       if @mp_number != nil
  2306.          if MP_NUMBER_ANIMATION
  2307.             update_number(1,@mp_number_old)
  2308.          else
  2309.             update_number_fix(1) if @mp_number_old != @actor.mp
  2310.          end  
  2311.          refresh_number(1,@mp_number_old,@mp_number,@mp_number_image,@mp_number_cw,@mp_number_ch,@mp_wave_number) if @mp_number_refresh
  2312.          fade_sprite(@mp_number,@fade_hud)  
  2313.       end
  2314.       if @mp_number2 != nil
  2315.          if MP_NUMBER_ANIMATION
  2316.             update_number(4,@mp_number2_old)
  2317.          else
  2318.             update_number_fix(4) if @mp_number2_old != @actor.mmp
  2319.          end  
  2320.          refresh_number(4,@mp_number2_old,@mp_number2,@mp_number2_image,@mp_number2_cw,@mp_number2_ch,@mp_wave_number) if @mp_number2_refresh
  2321.          fade_sprite(@mp_number2,@fade_hud)  
  2322.       end      
  2323.       if @mp_meter != nil
  2324.          update_flow_mp
  2325.          fade_sprite(@mp_meter,@fade_hud)
  2326.       end
  2327.       if @mp_icon != nil
  2328.          refresh_mp_icon if @mp_icon_old != @actor.mp
  2329.          fade_sprite(@mp_icon,@fade_hud)
  2330.       end
  2331.       if @mp_icon3 != nil
  2332.          update_icon_mp_ex_anime
  2333.          fade_sprite(@mp_icon3,@fade_hud)
  2334.       end          
  2335.       if @mp_icon_number != nil
  2336.          refresh_icon_number_mp if can_refresh_icon_number_mp?
  2337.          fade_sprite(@mp_icon_number,@fade_hud)
  2338.       end      
  2339.   end  
  2340.  
  2341. end
  2342. #==============================================================================
  2343. #==============================================================================
  2344. # ** Ultima Hud (TP)
  2345. #==============================================================================
  2346. #==============================================================================
  2347. class Ultima_Hud
  2348.  
  2349.   #--------------------------------------------------------------------------
  2350.   # * Create TP Number
  2351.   #--------------------------------------------------------------------------  
  2352.   def create_tp_number
  2353.       return if !TP_NUMBER_VISIBLE
  2354.       @tp_number = Sprite.new
  2355.       @tp_number.bitmap = Bitmap.new(@tp_number_cw * 3, @tp_number_ch)
  2356.       @tp_number.z = HUD_Z + TP_NUMBER_Z
  2357.       @tp_number.x = $game_system.hud_position[0] + TP_NUMBER_POSITION[0]
  2358.       @tp_number.y = $game_system.hud_position[1]+ TP_NUMBER_POSITION[1]
  2359.       @tp_number.opacity = 0 if !$game_system.hud_visible
  2360.   end
  2361.  
  2362.   #--------------------------------------------------------------------------
  2363.   # * Create TP Number MAX
  2364.   #--------------------------------------------------------------------------  
  2365.   def create_tp_number_max
  2366.       return if !TP_NUMBER_MAX_VISIBLE
  2367.       @tp_number2 = Sprite.new
  2368.       @tp_number2.bitmap = Bitmap.new(@tp_number2_cw * 3, @tp_number2_ch)
  2369.       @tp_number2.z = HUD_Z + TP_NUMBER_Z
  2370.       @tp_number2.x = $game_system.hud_position[0] + TP_NUMBER_MAX_POSITION[0]
  2371.       @tp_number2.y = $game_system.hud_position[1] + TP_NUMBER_MAX_POSITION[1]
  2372.       @tp_number2.opacity = 0 if !$game_system.hud_visible
  2373.   end  
  2374.  
  2375.   #--------------------------------------------------------------------------
  2376.   # * Create TP Meter
  2377.   #--------------------------------------------------------------------------    
  2378.   def create_tp_meter
  2379.       return if !TP_METER_VISIBLE
  2380.       @tp_flow_max = @tp_meter_cw * 2
  2381.       @tp_flow = rand(@tp_flow_max)
  2382.       @tp_meter = Sprite.new
  2383.       @tp_meter.bitmap = Bitmap.new(@tp_meter_cw,@tp_meter_ch)
  2384.       @tp_meter.z = HUD_Z + TP_METER_Z
  2385.       @tp_meter.x = $game_system.hud_position[0] + TP_METER_POSITION[0]
  2386.       @tp_meter.y = $game_system.hud_position[1] + TP_METER_POSITION[1]
  2387.       @tp_meter.angle = TP_METER_ANGLE
  2388.       @tp_meter.mirror = TP_METER_MIRROR_EFFECT
  2389.       @tp_meter.opacity = 0 if !$game_system.hud_visible
  2390.   end
  2391.  
  2392.   #--------------------------------------------------------------------------
  2393.   # ● Update Flow TP
  2394.   #--------------------------------------------------------------------------            
  2395.   def update_flow_tp
  2396.       @tp_meter.bitmap.clear      
  2397.       @tp_flow = 0 if !TP_METER_GRADIENT_ANIMATION
  2398.       meter_width = @tp_meter_cw * @actor.tp / @actor.max_tp rescue nil  
  2399.       meter_width = 0 if meter_width == nil
  2400.       execute_tp_damage_flow(meter_width)      
  2401.       meter_src_rect = Rect.new(@tp_flow, 0,meter_width, @tp_meter_ch)
  2402.       @tp_meter.bitmap.blt(0,0, @tp_meter_image, meter_src_rect)  
  2403.       @tp_flow += 5
  2404.       @tp_flow = 0 if @tp_flow >= @tp_flow_max
  2405.   end  
  2406.    
  2407.   #--------------------------------------------------------------------------
  2408.   # ● Execute TP Damage Flow
  2409.   #--------------------------------------------------------------------------
  2410.   def execute_tp_damage_flow(meter_width)
  2411.       return if !TP_METER_REDUCTION_ANIMATION
  2412.       return if @tp_old_meter == meter_width
  2413.       n = (@tp_old_meter - meter_width).abs * 3 / 100
  2414.       damage_flow = [[n, 2].min,0.5].max
  2415.       @tp_old_meter -= damage_flow
  2416.       @tp_old_meter = meter_width if @tp_old_meter <= meter_width
  2417.       src_rect_old = Rect.new(0,@tp_meter_ch, @tp_old_meter, @tp_meter_ch)
  2418.       @tp_meter.bitmap.blt(0,0, @tp_meter_image, src_rect_old)      
  2419.   end
  2420.   #--------------------------------------------------------------------------
  2421.   # * Create TP Icon
  2422.   #--------------------------------------------------------------------------  
  2423.   def create_tp_icon
  2424.       return if !TP_ICON_VISIBLE
  2425.       @tp_icon = Sprite.new
  2426.       icon_width = @tp_icon_col_max * (@tp_icon_cw + TP_ICON_SPACE[0].abs)
  2427.       icon_height = @tp_icon_row_max * (@tp_icon_ch + TP_ICON_SPACE[1].abs)
  2428.       @tp_icon.bitmap = Bitmap.new(icon_width,icon_height)      
  2429.       @tp_icon.z = HUD_Z + TP_ICON_Z
  2430.       @tp_icon.x = $game_system.hud_position[0] + TP_ICON_POSITION[0]
  2431.       @tp_icon.y = $game_system.hud_position[1] + TP_ICON_POSITION[1]
  2432.       @tp_icon.opacity = 0 if !$game_system.hud_visible
  2433.   end
  2434.    
  2435.   #--------------------------------------------------------------------------
  2436.   # * Refresh TP Icon
  2437.   #--------------------------------------------------------------------------    
  2438.   def refresh_tp_icon
  2439.       @tp_icon_old = @actor.tp
  2440.       @tp_icon.bitmap.clear
  2441.       max_value = (@actor.max_tp / @tp_icon_real_max) * @tp_icon_real_max
  2442.       if @actor.mp > max_value
  2443.          icon_max = icon_limit(@actor.max_tp,@tp_icon_real_max)
  2444.       else  
  2445.          icon_max = @actor.max_tp
  2446.       end      
  2447.       for i in 0...icon_max
  2448.           break if (i / @tp_icon_col_max) >= @tp_icon_row_max
  2449.           rx = (i * (@tp_icon_cw + TP_ICON_SPACE[0]) ) - ((i / @tp_icon_col_max) * (@tp_icon_cw + TP_ICON_SPACE[0]) * @tp_icon_col_max)
  2450.           ry = (i / @tp_icon_col_max) * (@tp_icon_ch + TP_ICON_SPACE[1])
  2451.           i_scr = Rect.new(0,0,@tp_icon_cw,@tp_icon_ch)
  2452.           @tp_icon.bitmap.blt(rx,ry,@tp_icon_image ,i_scr )      
  2453.       end      
  2454.       icon_max = icon_limit(@actor.tp,@tp_icon_real_max)
  2455.       rx = 0
  2456.       ry = 0
  2457.       for i in 0...icon_max
  2458.           break if (i / @tp_icon_col_max) >= @tp_icon_row_max
  2459.           rx = (i * (@tp_icon_cw + TP_ICON_SPACE[0]) ) - ((i / @tp_icon_col_max) * (@tp_icon_cw + TP_ICON_SPACE[0]) * @tp_icon_col_max)
  2460.           ry = (i / @tp_icon_col_max) * (@tp_icon_ch + TP_ICON_SPACE[1])
  2461.           i_scr = Rect.new(@mp_icon_cw,0,@tp_icon_cw,@tp_icon_ch)
  2462.           @tp_icon.bitmap.blt(rx,ry,@tp_icon_image ,i_scr )
  2463.       end
  2464.       refresh_tp_icon_ex(rx,ry)      
  2465.   end
  2466.  
  2467.   #--------------------------------------------------------------------------
  2468.   # * Create TP Icon EX
  2469.   #--------------------------------------------------------------------------  
  2470.   def create_tp_icon_ex
  2471.       return if !TP_ICON_EX_VISIBLE
  2472.       @tp_icon3_anime_phase = 0
  2473.       @tp_icon3 = Sprite.new
  2474.       @tp_icon3.bitmap = Bitmap.new(@tp_icon2_cw,@tp_icon2_ch)
  2475.       @tp_icon3.ox = @tp_icon3.bitmap.width / 2
  2476.       @tp_icon3.oy = @tp_icon3.bitmap.height / 2
  2477.       @tp_icon3.z = HUD_Z + TP_ICON_Z + 2
  2478.       @tp_icon3_org = [$game_system.hud_position[0] + TP_ICON_POSITION[0] + TP_ICON_EX_POSITION[0] + @tp_icon3.ox,
  2479.                        $game_system.hud_position[1] + TP_ICON_POSITION[1] + TP_ICON_EX_POSITION[1] + @tp_icon3.oy]
  2480.       @tp_icon3.x = @tp_icon3_org[0]
  2481.       @tp_icon3.y = @tp_icon3_org[1]
  2482.       @tp_icon3.opacity = 0 if !$game_system.hud_visible
  2483.   end  
  2484.  
  2485.   #--------------------------------------------------------------------------
  2486.   # * Refresh TP Icon EX
  2487.   #--------------------------------------------------------------------------      
  2488.   def refresh_tp_icon_ex(rx,ry)
  2489.       return if @tp_icon3 == nil
  2490.       @tp_icon3.bitmap.clear
  2491.       return if @actor.tp == 0
  2492.       i_scr = Rect.new(0,0,@tp_icon2_cw,@tp_icon2_ch)
  2493.       @tp_icon3.bitmap.blt(0,0, @tp_icon2_image ,i_scr )
  2494.       @tp_icon3.x = @tp_icon3_org[0] + rx
  2495.       @tp_icon3.y = @tp_icon3_org[1] + ry    
  2496.   end
  2497.  
  2498.   #--------------------------------------------------------------------------
  2499.   # * Update Icon TP EX Anime
  2500.   #--------------------------------------------------------------------------  
  2501.   def update_icon_tp_ex_anime
  2502.       return if !MP_ICON_EX_ZOOM_EFFECT
  2503.       if @tp_icon3_anime_phase == 0
  2504.          @tp_icon3.zoom_x += 0.01
  2505.          if @tp_icon3.zoom_x >= 1.30
  2506.             @tp_icon3.zoom_x = 1.30
  2507.             @tp_icon3_anime_phase = 1
  2508.          end  
  2509.       else
  2510.         @tp_icon3.zoom_x -= 0.01
  2511.         if @tp_icon3.zoom_x <= 1.05
  2512.            @tp_icon3.zoom_x = 1.05
  2513.            @tp_icon3_anime_phase = 0
  2514.         end  
  2515.       end  
  2516.       @tp_icon3.zoom_y = @tp_icon3.zoom_x
  2517.   end    
  2518.  
  2519.   #--------------------------------------------------------------------------
  2520.   # * Create HP Icon Number
  2521.   #--------------------------------------------------------------------------      
  2522.   def create_tp_icon_number
  2523.       return if !TP_ICON_NUMBER_VISIBLE
  2524.       @tp_icon_number_old = [-1,-1]
  2525.       @tp_icon_number = Sprite.new
  2526.       @tp_icon_number.bitmap = Bitmap.new(@tp_icon_number_cw * 3,@tp_icon_number_ch)
  2527.       @tp_icon_number.z = HUD_Z + TP_ICON_NUMBER_Z
  2528.       @tp_icon_number.x = $game_system.hud_position[0] + TP_ICON_NUMBER_POSITION[0]
  2529.       @tp_icon_number.y = $game_system.hud_position[1] + TP_ICON_NUMBER_POSITION[1]
  2530.       @tp_icon_number.opacity = 0 if !$game_system.hud_visible
  2531.   end
  2532.  
  2533.   #--------------------------------------------------------------------------
  2534.   # * Refresh Icon Number TP
  2535.   #--------------------------------------------------------------------------  
  2536.   def refresh_icon_number_tp
  2537.       @tp_icon_number_old[0] = @actor.tp
  2538.       @tp_icon_number_old[1] = @actor.max_tp
  2539.       @tp_icon_number.bitmap.clear
  2540.       value = ((@actor.tp - 1) / @tp_icon_col_max) / @tp_icon_row_max
  2541.       value = 0 if value < 0
  2542.       number_value = value.truncate.abs.to_s.split(//)
  2543.       for r in 0..number_value.size - 1        
  2544.          number_value_abs = number_value[r].to_i
  2545.          nsrc_rect = Rect.new(@tp_icon_number_cw * number_value_abs, 0, @tp_icon_number_cw, @tp_icon_number_ch)
  2546.          @tp_icon_number.bitmap.blt(@tp_icon_number_cw *  r, 0, @tp_icon_number_image, nsrc_rect)
  2547.       end
  2548.       cx = (number_value.size * @tp_icon_number_cw)
  2549.       case TP_ICON_NUMBER_ALIGN_TYPE
  2550.          when 0; @tp_icon_number.x = $game_system.hud_position[0] + TP_ICON_NUMBER_POSITION[0]
  2551.          when 1; @tp_icon_number.x = $game_system.hud_position[0] + TP_ICON_NUMBER_POSITION[0] - (cx / 2)
  2552.          when 2; @tp_icon_number.x = $game_system.hud_position[0] + TP_ICON_NUMBER_POSITION[0] - cx
  2553.       end        
  2554.   end
  2555.   #--------------------------------------------------------------------------
  2556.   # * Can Refresh Icon Number TP
  2557.   #--------------------------------------------------------------------------  
  2558.   def can_refresh_icon_number_tp?
  2559.       return true if @tp_icon_number_old[0] != @actor.tp
  2560.       return true if @tp_icon_number_old[1] != @actor.max_tp
  2561.       return false
  2562.   end  
  2563.  
  2564.   #--------------------------------------------------------------------------
  2565.   # * Update TP
  2566.   #--------------------------------------------------------------------------    
  2567.   def update_tp
  2568.       if @tp_number != nil
  2569.          if MP_NUMBER_ANIMATION
  2570.             update_number(2,@tp_number_old)
  2571.          else
  2572.             update_number_fix(2) if @tp_number_old != @actor.tp
  2573.          end          
  2574.          refresh_number(2,@tp_number_old,@tp_number,@tp_number_image,@tp_number_cw,@tp_number_ch,@tp_wave_number) if @tp_number_refresh        
  2575.          fade_sprite(@tp_number,@fade_hud)
  2576.       end    
  2577.       if @tp_number2 != nil
  2578.          if MP_NUMBER_ANIMATION
  2579.             update_number(5,@tp_number2_old)
  2580.          else
  2581.             update_number_fix(5) if @tp_number2_old != @actor.max_tp
  2582.          end          
  2583.          refresh_number(5,@tp_number2_old,@tp_number2,@tp_number2_image,@tp_number2_cw,@tp_number2_ch,@tp_wave_number) if @tp_number2_refresh
  2584.          fade_sprite(@tp_number2,@fade_hud)
  2585.       end        
  2586.       if @tp_meter != nil
  2587.          update_flow_tp
  2588.          fade_sprite(@tp_meter,@fade_hud)
  2589.       end
  2590.       if @tp_icon != nil
  2591.          refresh_tp_icon if @tp_icon_old != @actor.tp
  2592.          fade_sprite(@tp_icon,@fade_hud)
  2593.       end
  2594.       if @tp_icon3 != nil
  2595.          update_icon_tp_ex_anime
  2596.          fade_sprite(@tp_icon3,@fade_hud)
  2597.       end        
  2598.       if @tp_icon_number != nil
  2599.          refresh_icon_number_tp if can_refresh_icon_number_tp?
  2600.          fade_sprite(@tp_icon_number,@fade_hud)
  2601.       end  
  2602.   end  
  2603.  
  2604. end
  2605. #==============================================================================
  2606. #==============================================================================
  2607. # ** Ultima Hud (LEVEL)
  2608. #==============================================================================
  2609. #==============================================================================
  2610. class Ultima_Hud
  2611.  
  2612.   #--------------------------------------------------------------------------
  2613.   # * Create Level Number
  2614.   #--------------------------------------------------------------------------    
  2615.   def create_level_number
  2616.       return if !LEVEL_NUMBER_VISIBLE
  2617.       @old_level = -1
  2618.       @lv_number = Sprite.new
  2619.       @lv_number.bitmap = Bitmap.new(@lv_number_cw * 2, @lv_number_ch)
  2620.       @lv_number.z = HUD_Z + LEVEL_NUMBER_Z
  2621.       @lv_number.x = $game_system.hud_position[0] + LEVEL_NUMBER_POSITION[0]
  2622.       @lv_number.y = $game_system.hud_position[1] + LEVEL_NUMBER_POSITION[1]
  2623.       @lv_number.opacity = 0 if !$game_system.hud_visible
  2624.   end
  2625.  
  2626.   #--------------------------------------------------------------------------
  2627.   # * Create Level Number EXP
  2628.   #--------------------------------------------------------------------------    
  2629.   def create_level_number_exp
  2630.       return if !LEVEL_NUMBER_EXP_VISIBLE
  2631.       @old_exp = -1
  2632.       @lv_number2 = Sprite.new
  2633.       @lv_number2.bitmap = Bitmap.new(@lv_number2_cw * 7, @lv_number2_ch)
  2634.       @lv_number2.z = HUD_Z + LEVEL_NUMBER_Z
  2635.       @lv_number2.x = $game_system.hud_position[0] + LEVEL_NUMBER_EXP_POSITION[0]
  2636.       @lv_number2.y = $game_system.hud_position[1] + LEVEL_NUMBER_EXP_POSITION[1]
  2637.       @lv_number2.opacity = 0 if !$game_system.hud_visible
  2638.   end  
  2639.  
  2640.   #--------------------------------------------------------------------------
  2641.   # * Create Level Meter
  2642.   #--------------------------------------------------------------------------
  2643.   def create_level_meter
  2644.       return if !LEVEL_METER_VISIBLE
  2645.       @old_exp_meter = -1
  2646.       @lv_meter = Sprite.new
  2647.       @lv_meter.bitmap = Bitmap.new(@lv_meter_cw,@lv_meter_ch)
  2648.       @lv_meter.z = HUD_Z + LEVEL_METER_Z
  2649.       @lv_meter.x = $game_system.hud_position[0] + LEVEL_METER_POSITION[0]
  2650.       @lv_meter.y = $game_system.hud_position[1] + LEVEL_METER_POSITION[1]  
  2651.       @lv_meter.angle = LEVEL_METER_ANGLE
  2652.       @lv_meter.mirror = LEVEL_METER_MIRROR_EFFECT
  2653.       @lv_meter.opacity = 0 if !$game_system.hud_visible
  2654.   end
  2655.  
  2656.   #--------------------------------------------------------------------------
  2657.   # * Refresh Level Number
  2658.   #--------------------------------------------------------------------------  
  2659.   def refresh_level_number
  2660.       @lv_number.bitmap.clear
  2661.       @old_level = @actor.level      
  2662.       number_value = @actor.level.abs.to_s.split(//)
  2663.       for r in 0..number_value.size - 1        
  2664.          number_value_abs = number_value[r].to_i
  2665.          nsrc_rect = Rect.new(@lv_number_cw * number_value_abs, 0, @lv_number_cw, @lv_number_ch)
  2666.          @lv_number.bitmap.blt(@lv_number_cw *  r, 0, @lv_number_image, nsrc_rect)
  2667.       end
  2668.       cx = (number_value.size * @lv_number_cw)
  2669.       case LEVEL_NUMBER_ALIGN_TYPE
  2670.            when 0; @lv_number.x = $game_system.hud_position[0] + LEVEL_NUMBER_POSITION[0]
  2671.            when 1; @lv_number.x = $game_system.hud_position[0] + LEVEL_NUMBER_POSITION[0] - (cx / 2)
  2672.            when 2; @lv_number.x = $game_system.hud_position[0] + LEVEL_NUMBER_POSITION[0] - cx
  2673.       end
  2674.   end
  2675.  
  2676.   #--------------------------------------------------------------------------
  2677.   # * Refresh Level Number EXP
  2678.   #--------------------------------------------------------------------------  
  2679.   def refresh_level_number_exp
  2680.       @lv_number2.bitmap.clear
  2681.       @old_exp = @actor.exp    
  2682.       if LEVEL_NUMBER_EXP_TYPE == 0
  2683.          value = @actor.next_level_exp - @actor.exp
  2684.          value = 0 if @actor.max_level?
  2685.       else  
  2686.          value = @actor.exp
  2687.       end
  2688.       value = 9999999 if value > 9999999
  2689.       number_value = value.abs.to_s.split(//)
  2690.       for r in 0..number_value.size - 1        
  2691.          number_value_abs = number_value[r].to_i
  2692.          nsrc_rect = Rect.new(@lv_number2_cw * number_value_abs, 0, @lv_number2_cw, @lv_number2_ch)
  2693.          @lv_number2.bitmap.blt(@lv_number2_cw *  r, 0, @lv_number2_image, nsrc_rect)
  2694.       end
  2695.       cx = (number_value.size * @lv_number2_cw)
  2696.       case LEVEL_NUMBER_EXP_ALIGN_TYPE
  2697.            when 0; @lv_number2.x = $game_system.hud_position[0] + LEVEL_NUMBER_EXP_POSITION[0]
  2698.            when 1; @lv_number2.x = $game_system.hud_position[0] + LEVEL_NUMBER_EXP_POSITION[0] - (cx / 2)
  2699.            when 2; @lv_number2.x = $game_system.hud_position[0] + LEVEL_NUMBER_EXP_POSITION[0] - cx
  2700.       end      
  2701.      
  2702.   end  
  2703.  
  2704.   #--------------------------------------------------------------------------
  2705.   # * Refresh Level Meter
  2706.   #--------------------------------------------------------------------------    
  2707.   def refresh_level_meter
  2708.       @lv_meter.bitmap.clear
  2709.       @old_exp_meter = @actor.exp
  2710.       new_level = 0
  2711.       lv_width = @lv_meter_cw * @actor.remain_exp / @actor.real_next_level rescue nil
  2712.       lv_width = @lv_meter_cw if lv_width == nil or @actor.level == 99
  2713.       lv_scr = Rect.new(0,0,lv_width,@lv_meter_ch)
  2714.       @lv_meter.bitmap.blt(0,0,@lv_meter_image,lv_scr)
  2715.   end
  2716.  
  2717.   #--------------------------------------------------------------------------
  2718.   # * Update Level
  2719.   #--------------------------------------------------------------------------  
  2720.   def update_level
  2721.       if @lv_number != nil
  2722.          refresh_level_number if @old_level != @actor.level
  2723.          fade_sprite(@lv_number,@fade_hud)
  2724.       end  
  2725.       if @lv_number2 != nil
  2726.          refresh_level_number_exp if @old_exp != @actor.exp
  2727.          fade_sprite(@lv_number2,@fade_hud)
  2728.       end      
  2729.       if @lv_meter != nil
  2730.          refresh_level_meter if @old_exp_meter != @actor.exp
  2731.          fade_sprite(@lv_meter,@fade_hud)
  2732.       end  
  2733.   end
  2734.  
  2735. end
  2736. #==============================================================================
  2737. #==============================================================================
  2738. # ** Ultima Hud (STATES)
  2739. #==============================================================================
  2740. #==============================================================================
  2741. class Ultima_Hud
  2742.  
  2743.   #--------------------------------------------------------------------------
  2744.   # * Create States
  2745.   #--------------------------------------------------------------------------  
  2746.   def create_states
  2747.       return if !STATES_VISIBLE
  2748.       @status_old = nil
  2749.       @status_flow = [-24,0]
  2750.       @status = Sprite.new
  2751.       @status.bitmap = Bitmap.new(24,24)
  2752.       @status.x = $game_system.hud_position[0] + STATES_POSITION[0]
  2753.       @status.y = $game_system.hud_position[1] + STATES_POSITION[1]
  2754.       @status.z = HUD_Z + STATES_Z
  2755.       @status.angle = STATE_ANGLE
  2756.       @status.opacity = 0 if !$game_system.hud_visible
  2757.   end
  2758.  
  2759.   #--------------------------------------------------------------------------
  2760.   # * Refresh States
  2761.   #--------------------------------------------------------------------------        
  2762.   def refresh_states
  2763.       check_icon_image
  2764.       @status_old = @actor.states
  2765.       @status_flow = [0,0]
  2766.       @actor_status.dispose if @actor_status != nil
  2767.       @states_size = @actor.states.size > 0 ? (26 * @actor.states.size) : 24
  2768.       @actor_status = Bitmap.new(@states_size,24)
  2769.       index = 0
  2770.       for i in @actor.states
  2771.          rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)
  2772.          @actor_status.blt(26 * index , 0, @icon_image, rect)
  2773.          index += 1
  2774.       end
  2775.   end  
  2776.  
  2777.   #--------------------------------------------------------------------------
  2778.   # * Flow_Status
  2779.   #--------------------------------------------------------------------------          
  2780.   def flow_states
  2781.       return if @actor_status == nil
  2782.       @status.bitmap.clear
  2783.       return if @actor.states.size == 0
  2784.       st_src_rect = Rect.new(@status_flow[0],0, 24,24)
  2785.       @status.bitmap.blt(0,0, @actor_status, st_src_rect)
  2786.       if STATES_SCROLLING_ANIMATION
  2787.          @status_flow[0] += 1
  2788.          @status_flow[0] = -24 if @status_flow[0] >= @states_size + 2
  2789.       else  
  2790.          @status_flow[1] += 1 unless @actor.states.size <= 1
  2791.          if @status_flow[1] > 30
  2792.             @status_flow[1] = 0
  2793.             @status_flow[0] += 26
  2794.             @status_flow[0] = 0 if @status_flow[0] >= (@states_size - 0)
  2795.          end  
  2796.      end  
  2797.   end      
  2798.  
  2799.   #--------------------------------------------------------------------------
  2800.   # * Update States
  2801.   #--------------------------------------------------------------------------  
  2802.   def update_states
  2803.       return if @status == nil
  2804.       refresh_states if @status_old != @actor.states
  2805.       flow_states
  2806.       fade_sprite(@status,@fade_hud)
  2807.   end  
  2808.  
  2809. end
  2810. #==============================================================================
  2811. #==============================================================================
  2812. # ** Ultima Hud (FACE)
  2813. #==============================================================================
  2814. #==============================================================================
  2815. class Ultima_Hud
  2816.  
  2817.   #--------------------------------------------------------------------------
  2818.   # * Create Face
  2819.   #--------------------------------------------------------------------------    
  2820.   def create_face
  2821.       return if !FACE_VISIBLE
  2822.       @face_old_hp = @actor.hp
  2823.       @face_old_mp = @actor.mp
  2824.       @face_old_tp = @actor.tp
  2825.       @face_name = ""
  2826.       @face = Sprite.new
  2827.       @face_org = [$game_system.hud_position[0] + FACE_POSITION[0], $game_system.hud_position[1] + FACE_POSITION[1]]
  2828.       @face.x = @face_org[0]
  2829.       @face.y = @face_org[1]
  2830.       @face.z = HUD_Z + FACE_Z
  2831.       @face.opacity = 0 if !$game_system.hud_visible
  2832.       refresh_face_name
  2833.   end
  2834.   #--------------------------------------------------------------------------
  2835.   # * Refresh Face Name
  2836.   #--------------------------------------------------------------------------      
  2837.   def refresh_face_name
  2838.       @face_name = @actor.name
  2839.       @face_image.dispose if @face_image != nil
  2840.       @face.bitmap.dispose if @face.bitmap != nil
  2841.       return if @actor.name == nil or @actor.name == ""
  2842.       @face_image = Cache.ultima_hud(@actor.name + "_Face") rescue nil
  2843.       @face_image = Bitmap.new(32,32) if @face_image == nil
  2844.       @face_cw = FACE_ANIMATION ? @face_image.width / 4 : @face_image.width
  2845.       @face_ch = @face_image.height
  2846.       @face.bitmap = Bitmap.new(@face_cw,@face_ch)
  2847.       refresh_face
  2848.   end
  2849.   #--------------------------------------------------------------------------
  2850.   # * Refresh Face
  2851.   #--------------------------------------------------------------------------  
  2852.   def refresh_face
  2853.       @face_index = $game_system.hud_face[1]
  2854.       @face.bitmap.clear
  2855.       f_scr = Rect.new(@face_index * @face_cw,0,@face_cw,@face_ch)
  2856.       @face.bitmap.blt(0,0,@face_image,f_scr)
  2857.   end
  2858.    
  2859.   #--------------------------------------------------------------------------
  2860.   # * Update Face Duration
  2861.   #--------------------------------------------------------------------------    
  2862.   def update_face_duration
  2863.       return if $game_system.hud_face[0] == 0
  2864.       $game_system.hud_face[0] -= 1
  2865.       return if $game_system.hud_face[0] > 0
  2866.       $game_system.hud_face[1] = @actor.low_hp? ? 2 : 0
  2867.       refresh_face
  2868.   end
  2869.  
  2870.   #--------------------------------------------------------------------------
  2871.   # * Can Refresh Index MP TP?
  2872.   #--------------------------------------------------------------------------    
  2873.   def can_refresh_index_mp_tp?
  2874.       return true if @face_old_mp != @actor.mp
  2875.       return true if @face_old_tp != @actor.tp
  2876.       return false
  2877.   end
  2878.  
  2879.   #--------------------------------------------------------------------------
  2880.   # * Refresh Face Index HP
  2881.   #--------------------------------------------------------------------------  
  2882.   def refresh_face_index_hp
  2883.       $game_system.hud_face[0] = FACE_ANIMATION_DURATION
  2884.       $game_system.hud_face[1] = @face_old_hp > @actor.hp ? 2 : 1
  2885.       @face_old_hp = @actor.hp
  2886.   end
  2887.  
  2888.   #--------------------------------------------------------------------------
  2889.   # * Refresh Face Index MP TP
  2890.   #--------------------------------------------------------------------------  
  2891.   def refresh_face_index_mp_tp
  2892.       $game_system.hud_face[0] = FACE_ANIMATION_DURATION
  2893.       $game_system.hud_face[1] = @face_old_mp > @actor.mp ? 3 : 1
  2894.       $game_system.hud_face[1] = 3 if @face_old_tp > @actor.tp
  2895.       @face_old_mp = @actor.mp
  2896.       @face_old_tp = @actor.tp
  2897.   end  
  2898.  
  2899.   #--------------------------------------------------------------------------
  2900.   # * Update Face Shake Effect
  2901.   #--------------------------------------------------------------------------  
  2902.   def update_face_shake_effect
  2903.       return if !FACE_SHAKE_EFFECT
  2904.       if FACE_ANIMATION
  2905.          update_shake_animated_face
  2906.       else            
  2907.          update_shake_still_face
  2908.       end  
  2909.   end      
  2910.   #--------------------------------------------------------------------------
  2911.   # * Update Shake Still Effect Face
  2912.   #--------------------------------------------------------------------------    
  2913.   def update_shake_still_face
  2914.       if $game_system.hud_face[0] > 0 and $game_system.hud_face[1] == 2 and @actor.hp > 0
  2915.          $game_system.hud_face[0] -= 1
  2916.          @face.x = @face_org[0] - 4 + rand(8)
  2917.       else
  2918.          @face.x = @face_org[0]
  2919.       end    
  2920.   end
  2921.      
  2922.   #--------------------------------------------------------------------------
  2923.   # * Update Shake Animated Face
  2924.   #--------------------------------------------------------------------------    
  2925.   def update_shake_animated_face
  2926.       if $game_system.hud_face[0] == 0
  2927.          @face.x = @face_org[0]
  2928.          return
  2929.       end
  2930.       if $game_system.hud_face[1] == 2 and @actor.hp > 0
  2931.          @face.x = @face_org[0] - 4 + rand(8)
  2932.       else
  2933.          @face.x = @face_org[0]
  2934.       end        
  2935.   end
  2936.  
  2937.   #--------------------------------------------------------------------------
  2938.   # * Update Face
  2939.   #--------------------------------------------------------------------------  
  2940.   def update_face
  2941.       return if @face == nil
  2942.       fade_sprite(@face,@fade_hud)
  2943.       refresh_face_index_hp if !FACE_ANIMATION and @face_old_hp != @actor.hp
  2944.       update_face_shake_effect
  2945.       return if !FACE_ANIMATION
  2946.       update_face_duration
  2947.       refresh_face_index_mp_tp if can_refresh_index_mp_tp?
  2948.       refresh_face_index_hp if @face_old_hp != @actor.hp
  2949.       refresh_face if @face_index != $game_system.hud_face[1]
  2950.   end  
  2951.  
  2952. end
  2953.  #==============================================================================
  2954. #==============================================================================
  2955. # ** Ultima Hud (STATES)
  2956. #==============================================================================
  2957. #==============================================================================
  2958. class Ultima_Hud
  2959.  
  2960.   #--------------------------------------------------------------------------
  2961.   # * Create Equipment
  2962.   #--------------------------------------------------------------------------  
  2963.   def create_equipment
  2964.       return if !EQUIPMENT_VISIBLE
  2965.       return if @equip_layout != nil
  2966.       create_equipment_layout
  2967.       create_equipment_icons
  2968.   end
  2969.  
  2970.   #--------------------------------------------------------------------------
  2971.   # * Create Equipment Layout
  2972.   #--------------------------------------------------------------------------  
  2973.   def create_equipment_layout
  2974.       @equip_layout = Sprite.new
  2975.       @equip_layout.bitmap = Cache.ultima_hud("Equip_Layout")
  2976.       @equip_layout.z = HUD_Z + EQUIPMENT_Z
  2977.       @equip_layout.x = EQUIPMENT_POSITION[0]
  2978.       @equip_layout.y = EQUIPMENT_POSITION[1]
  2979.       @equip_smart_fade = EQUIPMENT_DETACHED_SMART_FADE
  2980.       @equip_hud_size_x = [EQUIPMENT_POSITION[0] + EQUIPMENT_SMART_FADE_RANGE_X[0], EQUIPMENT_POSITION[0] + @equip_layout.bitmap.width + EQUIPMENT_SMART_FADE_RANGE_X[1]]
  2981.       @equip_hud_size_y = [EQUIPMENT_POSITION[1] + EQUIPMENT_SMART_FADE_RANGE_Y[0], EQUIPMENT_POSITION[1] + @equip_layout.bitmap.height + EQUIPMENT_SMART_FADE_RANGE_Y[1]]
  2982.   end
  2983.  
  2984.   #--------------------------------------------------------------------------
  2985.   # * Create Icon Weapon
  2986.   #--------------------------------------------------------------------------  
  2987.   def create_equipment_icons
  2988.       @equip_icon = Sprite.new
  2989.       icon_cw = @equip_layout.bitmap.width + 48
  2990.       icon_ch = @equip_layout.bitmap.height + 48
  2991.       @equip_icon.bitmap = Bitmap.new(icon_cw,icon_ch)
  2992.       @equip_icon.z = HUD_Z + EQUIPMENT_Z + 1
  2993.       @equip_icon.x = EQUIPMENT_POSITION[0] - 24
  2994.       @equip_icon.y = EQUIPMENT_POSITION[1] - 24
  2995.       refresh_equipment
  2996.   end
  2997.      
  2998.   #--------------------------------------------------------------------------
  2999.   # * Set Equipment
  3000.   #--------------------------------------------------------------------------    
  3001.   def set_equipment
  3002.       @equip_wep = @actor != nil ? @actor.equips : nil
  3003.   end  
  3004.  
  3005.   #--------------------------------------------------------------------------
  3006.   # * Refresh Equipment
  3007.   #--------------------------------------------------------------------------  
  3008.   def refresh_equipment
  3009.       set_equipment
  3010.       return if @equip_layout == nil
  3011.       @equip_icon.bitmap.clear
  3012.       return if @actor == nil
  3013.       check_icon_image
  3014.       if @actor.equips[0] != nil and EQUIPMENT_WEAPON_VISIBLE
  3015.          icon_index = @actor.equips[0].icon_index
  3016.          icon_pos = [EQUIPMENT_WEAPON_POSITION[0],EQUIPMENT_WEAPON_POSITION[1]]
  3017.          draw_icons(@equip_icon,icon_pos[0] + 24,icon_pos[1] + 24,icon_index)
  3018.       end
  3019.       if @actor.equips[1] != nil and EQUIPMENT_SHIELD_VISIBLE
  3020.          icon_index = @actor.equips[1].icon_index
  3021.          icon_pos = [EQUIPMENT_SHIELD_POSITION[0],EQUIPMENT_SHIELD_POSITION[1]]
  3022.          draw_icons(@equip_icon,icon_pos[0] + 24,icon_pos[1] + 24,icon_index)
  3023.       end      
  3024.       if @actor.equips[2] != nil and EQUIPMENT_HEAD_VISIBLE
  3025.          icon_index = @actor.equips[2].icon_index
  3026.          icon_pos = [EQUIPMENT_HEAD_POSITION[0],EQUIPMENT_HEAD_POSITION[1]]
  3027.          draw_icons(@equip_icon,icon_pos[0] + 24,icon_pos[1] + 24,icon_index)
  3028.       end  
  3029.       if @actor.equips[3] != nil and EQUIPMENT_BODY_VISIBLE
  3030.          icon_index = @actor.equips[3].icon_index
  3031.          icon_pos = [EQUIPMENT_BODY_POSITION[0],EQUIPMENT_BODY_POSITION[1]]
  3032.          draw_icons(@equip_icon,icon_pos[0] + 24,icon_pos[1] + 24,icon_index)
  3033.       end        
  3034.       if @actor.equips[4] != nil and EQUIPMENT_ACCESSORY_VISIBLE
  3035.          icon_index = @actor.equips[4].icon_index
  3036.          icon_pos = [EQUIPMENT_ACCESSORY_POSITION[0],EQUIPMENT_ACCESSORY_POSITION[1]]
  3037.          draw_icons(@equip_icon,icon_pos[0] + 24,icon_pos[1] + 24,icon_index)
  3038.       end
  3039.   end
  3040.   #--------------------------------------------------------------------------
  3041.   # * draw_icons
  3042.   #--------------------------------------------------------------------------  
  3043.   def draw_icons(sprite,x,y,icon_index)
  3044.       icon_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  3045.       sprite.bitmap.blt(x, y, @icon_image, icon_rect)      
  3046.   end
  3047.   #--------------------------------------------------------------------------
  3048.   # * Update Equipment
  3049.   #--------------------------------------------------------------------------  
  3050.   def update_equipment
  3051.       return if @equip_layout == nil
  3052.       refresh_equipment if @equip_wep != @actor.equips
  3053.       if @equip_smart_fade
  3054.          fade_sprite(@equip_layout,@fade_hud_equip)
  3055.          fade_sprite(@equip_icon,@fade_hud_equip)
  3056.          #----------------------------------------------------------------------
  3057.          # Kadafi Edit
  3058.          #----------------------------------------------------------------------
  3059.          SceneManager.scene.toolhud.fade_skill_sprite(@force_hide,
  3060.           @force_hide_time, @fade_hud_equip) if SceneManager.scene.spriteset
  3061.          #----------------------------------------------------------------------
  3062.       else
  3063.          fade_sprite(@equip_layout,@fade_hud)
  3064.          fade_sprite(@equip_icon,@fade_hud)  
  3065.          #----------------------------------------------------------------------
  3066.          # Kadafi Edit
  3067.          #----------------------------------------------------------------------
  3068.          SceneManager.scene.toolhud.fade_skill_sprite(@force_hide,
  3069.           @force_hide_time, @fade_hud) if SceneManager.scene.spriteset
  3070.          #----------------------------------------------------------------------
  3071.      end  
  3072.   end  
  3073.  
  3074. end
  3075. #==============================================================================
  3076. #==============================================================================
  3077. # ** Ultima Hud (GOLD)
  3078. #==============================================================================
  3079. #==============================================================================
  3080. class Ultima_Hud
  3081.   #--------------------------------------------------------------------------
  3082.   # * Create Gold
  3083.   #--------------------------------------------------------------------------  
  3084.   def create_gold
  3085.       return if !GOLD_VISIBLE
  3086.       return if @gold != nil
  3087.       create_gold_layout
  3088.       create_gold_number
  3089.   end    
  3090.      
  3091.   #--------------------------------------------------------------------------
  3092.   # * Create Gold Layout
  3093.   #--------------------------------------------------------------------------    
  3094.   def create_gold_layout
  3095.       @gold = Sprite.new
  3096.       @gold.bitmap = Cache.ultima_hud("Gold_Layout")
  3097.       @gold.x = GOLD_POSITION[0]
  3098.       @gold.y = GOLD_POSITION[1]
  3099.       @gold.z = HUD_Z + GOLD_HUD_Z
  3100.       @gold_smart_fade = GOLD_DETACHED_SMART_FADE
  3101.       @gold_hud_size_x = [GOLD_POSITION[0] + GOLD_SMART_FADE_RANGE_X[0], GOLD_POSITION[0] + @gold.bitmap.width + GOLD_SMART_FADE_RANGE_X[1]]
  3102.       @gold_hud_size_y = [GOLD_POSITION[1] + GOLD_SMART_FADE_RANGE_Y[0], GOLD_POSITION[1] + @gold.bitmap.height + GOLD_SMART_FADE_RANGE_Y[1]]      
  3103.   end
  3104.  
  3105.   #--------------------------------------------------------------------------
  3106.   # * Create Gold Number
  3107.   #--------------------------------------------------------------------------  
  3108.   def create_gold_number
  3109.       @gold_old = $game_party.gold
  3110.       @gold_refresh = true
  3111.       @gold_number_image = Cache.ultima_hud("Gold_Number")
  3112.       @gold_cw = @gold_number_image.width / 10
  3113.       @gold_ch = @gold_number_image.height
  3114.       @gold_number = Sprite.new
  3115.       @gold_number.bitmap = Bitmap.new(@gold_cw *  7,@gold_ch)
  3116.       @gold_pos = [GOLD_POSITION[0] + GOLD_NUMBER_POSITION[0],
  3117.                    GOLD_POSITION[1] + GOLD_NUMBER_POSITION[1]]      
  3118.       @gold_number.x = @gold_pos[0]
  3119.       @gold_number.y = @gold_pos[1]
  3120.       @gold_number.z = HUD_Z + GOLD_HUD_Z + 1
  3121.   end
  3122.    
  3123.   #--------------------------------------------------------------------------
  3124.   # * Update Gold
  3125.   #--------------------------------------------------------------------------  
  3126.   def update_gold
  3127.       return if @gold == nil
  3128.       update_number(6,@gold_old)
  3129.       refresh_number(6,@gold_old,@gold_number,@gold_number_image,@gold_cw,@gold_ch,false)
  3130.       if @gold_smart_fade
  3131.          fade_sprite(@gold,@fade_hud_gold)
  3132.          fade_sprite(@gold_number,@fade_hud_gold)
  3133.       else  
  3134.          fade_sprite(@gold,@fade_hud)
  3135.          fade_sprite(@gold_number,@fade_hud)        
  3136.       end  
  3137.   end
  3138.    
  3139. end
  3140. #==============================================================================
  3141. #==============================================================================
  3142. # ** Ultima Hud (DISPOSE)
  3143. #==============================================================================
  3144. #==============================================================================
  3145. class Ultima_Hud
  3146.   #--------------------------------------------------------------------------
  3147.   # * Dispose
  3148.   #--------------------------------------------------------------------------  
  3149.   def dispose
  3150.       dispose_layout
  3151.       dispose_layout_2
  3152.       dispose_name
  3153.       dispose_face
  3154.       dispose_hp_number
  3155.       dispose_hp_number_max
  3156.       dispose_hp_meter
  3157.       dispose_hp_icon
  3158.       dispose_hp_icon_ex
  3159.       dispose_hp_icon_number
  3160.       dispose_mp_number
  3161.       dispose_mp_number_max
  3162.       dispose_mp_meter
  3163.       dispose_mp_icon
  3164.       dispose_mp_icon_ex
  3165.       dispose_mp_icon_number
  3166.       dispose_tp_number
  3167.       dispose_tp_number_max
  3168.       dispose_tp_meter
  3169.       dispose_tp_icon
  3170.       dispose_tp_icon_ex
  3171.       dispose_tp_icon_number
  3172.       dispose_lv_number
  3173.       dispose_lv_number_exp
  3174.       dispose_lv_meter
  3175.       dispose_states
  3176.       dispose_equipment
  3177.       dispose_gold
  3178.   end
  3179.  
  3180.   #--------------------------------------------------------------------------
  3181.   # * Dispose Layout
  3182.   #--------------------------------------------------------------------------  
  3183.   def dispose_layout
  3184.       return if @layout == nil
  3185.       @layout.bitmap.dispose
  3186.       @layout.dispose
  3187.   end
  3188.  
  3189.   #--------------------------------------------------------------------------
  3190.   # * Dispose Layout 2
  3191.   #--------------------------------------------------------------------------  
  3192.   def dispose_layout_2
  3193.       return if @layout2 == nil
  3194.       @layout2.bitmap.dispose
  3195.       @layout2.dispose
  3196.   end  
  3197.  
  3198.   #--------------------------------------------------------------------------
  3199.   # * Dispose Name
  3200.   #--------------------------------------------------------------------------          
  3201.   def dispose_name
  3202.       return if @name == nil
  3203.       @name.bitmap.dispose
  3204.       @name.dispose
  3205.   end  
  3206.  
  3207.   #--------------------------------------------------------------------------
  3208.   # * Dispose Face
  3209.   #--------------------------------------------------------------------------        
  3210.   def dispose_face
  3211.       return if @face == nil
  3212.       @face_image.dispose if @face_image != nil
  3213.       @face.bitmap.dispose if @face.bitmap != nil    
  3214.       @face.dispose
  3215.   end  
  3216.  
  3217.   #--------------------------------------------------------------------------
  3218.   # * Dispose HP Number
  3219.   #--------------------------------------------------------------------------    
  3220.   def dispose_hp_number
  3221.       return if @hp_number == nil
  3222.       @hp_number.bitmap.dispose
  3223.       @hp_number.dispose
  3224.   end
  3225.   #--------------------------------------------------------------------------
  3226.   # * Dispose HP Number Max
  3227.   #--------------------------------------------------------------------------    
  3228.   def dispose_hp_number_max
  3229.       return if @hp_number2 == nil
  3230.       @hp_number2.bitmap.dispose
  3231.       @hp_number2.dispose
  3232.   end    
  3233.  
  3234.   #--------------------------------------------------------------------------
  3235.   # * Dispose HP Meter
  3236.   #--------------------------------------------------------------------------    
  3237.   def dispose_hp_meter
  3238.       return if @hp_meter == nil
  3239.       @hp_meter.bitmap.dispose
  3240.       @hp_meter.dispose
  3241.   end  
  3242.  
  3243.   #--------------------------------------------------------------------------
  3244.   # * Dispose HP Icon
  3245.   #--------------------------------------------------------------------------      
  3246.   def dispose_hp_icon
  3247.       return if @hp_icon == nil
  3248.       @hp_icon.bitmap.dispose if @hp_icon.bitmap != nil
  3249.       @hp_icon.dispose
  3250.   end    
  3251.  
  3252.   #--------------------------------------------------------------------------
  3253.   # * Dispose HP Icon EX
  3254.   #--------------------------------------------------------------------------      
  3255.   def dispose_hp_icon_ex
  3256.       return if @hp_icon3 == nil
  3257.       @hp_icon3.bitmap.dispose
  3258.       @hp_icon3.dispose      
  3259.   end      
  3260.  
  3261.   #--------------------------------------------------------------------------
  3262.   # * Dispose HP Icon Number
  3263.   #--------------------------------------------------------------------------  
  3264.   def dispose_hp_icon_number
  3265.       return if @hp_icon_number == nil
  3266.       @hp_icon_number.bitmap.dispose
  3267.       @hp_icon_number.dispose
  3268.   end    
  3269.  
  3270.   #--------------------------------------------------------------------------
  3271.   # * Dispose MP Number
  3272.   #--------------------------------------------------------------------------    
  3273.   def dispose_mp_number
  3274.       return if @mp_number == nil
  3275.       @mp_number.bitmap.dispose
  3276.       @mp_number.dispose
  3277.   end    
  3278.  
  3279.   #--------------------------------------------------------------------------
  3280.   # * Dispose MP Number Max
  3281.   #--------------------------------------------------------------------------    
  3282.   def dispose_mp_number_max
  3283.       return if @mp_number2 == nil
  3284.       @mp_number2.bitmap.dispose
  3285.       @mp_number2.dispose
  3286.   end  
  3287.  
  3288.   #--------------------------------------------------------------------------
  3289.   # * Dispose MP Meter
  3290.   #--------------------------------------------------------------------------    
  3291.   def dispose_mp_meter
  3292.       return if @mp_meter == nil
  3293.       @mp_meter.bitmap.dispose
  3294.       @mp_meter.dispose
  3295.   end    
  3296.  
  3297.   #--------------------------------------------------------------------------
  3298.   # * Dispose MP Icon
  3299.   #--------------------------------------------------------------------------      
  3300.   def dispose_mp_icon
  3301.       return if @mp_icon == nil
  3302.       @mp_icon.bitmap.dispose if @mp_icon.bitmap != nil
  3303.       @mp_icon.dispose
  3304.   end    
  3305.  
  3306.   #--------------------------------------------------------------------------
  3307.   # * Dispose MP Icon EX
  3308.   #--------------------------------------------------------------------------      
  3309.   def dispose_mp_icon_ex
  3310.       return if @mp_icon3 == nil
  3311.       @mp_icon3.bitmap.dispose
  3312.       @mp_icon3.dispose      
  3313.   end        
  3314.  
  3315.   #--------------------------------------------------------------------------
  3316.   # * Dispose MP Icon Number
  3317.   #--------------------------------------------------------------------------  
  3318.   def dispose_mp_icon_number
  3319.       return if @mp_icon_number == nil
  3320.       @mp_icon_number.bitmap.dispose
  3321.       @mp_icon_number.dispose
  3322.   end  
  3323.    
  3324.   #--------------------------------------------------------------------------
  3325.   # * Dispose TP Number
  3326.   #--------------------------------------------------------------------------    
  3327.   def dispose_tp_number
  3328.       return if @tp_number == nil
  3329.       @tp_number.bitmap.dispose
  3330.       @tp_number.dispose
  3331.   end
  3332.  
  3333.   #--------------------------------------------------------------------------
  3334.   # * Dispose TP Number Max
  3335.   #--------------------------------------------------------------------------    
  3336.   def dispose_tp_number_max
  3337.       return if @tp_number2 == nil
  3338.       @tp_number2.bitmap.dispose
  3339.       @tp_number2.dispose
  3340.   end  
  3341.  
  3342.   #--------------------------------------------------------------------------
  3343.   # * Dispose TP Meter
  3344.   #--------------------------------------------------------------------------    
  3345.   def dispose_tp_meter
  3346.       return if @tp_meter == nil
  3347.       @tp_meter.bitmap.dispose
  3348.       @tp_meter.dispose
  3349.   end    
  3350.  
  3351.   #--------------------------------------------------------------------------
  3352.   # * Dispose TP Icon
  3353.   #--------------------------------------------------------------------------      
  3354.   def dispose_tp_icon
  3355.       return if @tp_icon == nil
  3356.       @tp_icon.bitmap.dispose if @tp_icon.bitmap != nil
  3357.       @tp_icon.dispose
  3358.   end    
  3359.  
  3360.   #--------------------------------------------------------------------------
  3361.   # * Dispose TP Icon EX
  3362.   #--------------------------------------------------------------------------      
  3363.   def dispose_tp_icon_ex
  3364.       return if @tp_icon3 == nil
  3365.       @tp_icon3.bitmap.dispose
  3366.       @tp_icon3.dispose      
  3367.   end  
  3368.  
  3369.   #--------------------------------------------------------------------------
  3370.   # * Dispose TP Icon Number
  3371.   #--------------------------------------------------------------------------  
  3372.   def dispose_tp_icon_number
  3373.       return if @tp_icon_number == nil
  3374.       @tp_icon_number.bitmap.dispose
  3375.       @tp_icon_number.dispose
  3376.   end    
  3377.  
  3378.   #--------------------------------------------------------------------------
  3379.   # * Dispose Lv Number
  3380.   #--------------------------------------------------------------------------    
  3381.   def dispose_lv_number
  3382.       return if @lv_number == nil
  3383.       @lv_number.bitmap.dispose
  3384.       @lv_number.dispose
  3385.   end
  3386.   #--------------------------------------------------------------------------
  3387.   # * Dispose Lv Number EXP
  3388.   #--------------------------------------------------------------------------    
  3389.   def dispose_lv_number_exp
  3390.       return if @lv_number2 == nil
  3391.       @lv_number2.bitmap.dispose
  3392.       @lv_number2.dispose
  3393.   end      
  3394.  
  3395.   #--------------------------------------------------------------------------
  3396.   # * Dispose Lv Meter
  3397.   #--------------------------------------------------------------------------    
  3398.   def dispose_lv_meter
  3399.       return if @lv_meter == nil
  3400.       @lv_meter.bitmap.dispose
  3401.       @lv_meter.dispose
  3402.   end      
  3403.  
  3404.   #--------------------------------------------------------------------------
  3405.   # * Dispose States
  3406.   #--------------------------------------------------------------------------      
  3407.   def dispose_states
  3408.       return if @status == nil
  3409.       @status.bitmap.dispose if @status.bitmap != nil
  3410.       @status.dispose
  3411.       @actor_status.dispose if @actor_status != nil
  3412.   end
  3413.  
  3414.   #--------------------------------------------------------------------------
  3415.   # * Dispose Equipment
  3416.   #--------------------------------------------------------------------------  
  3417.   def dispose_equipment
  3418.       return if @equip_layout == nil
  3419.       @equip_layout.bitmap.dispose
  3420.       @equip_layout.dispose
  3421.       @equip_icon.bitmap.dispose
  3422.       @equip_icon.dispose
  3423.   end
  3424.  
  3425.   #--------------------------------------------------------------------------
  3426.   # * Dispose Gold
  3427.   #--------------------------------------------------------------------------  
  3428.   def dispose_gold
  3429.       return if @gold == nil
  3430.       @gold_number.bitmap.dispose
  3431.       @gold.dispose
  3432.       @gold_number.bitmap.dispose
  3433.       @gold_number.dispose
  3434.   end  
  3435.    
  3436. end
  3437. #==============================================================================
  3438. #==============================================================================
  3439. # ** Ultima Hud (UPDATE)
  3440. #==============================================================================
  3441. #==============================================================================
  3442. class Ultima_Hud
  3443.   #--------------------------------------------------------------------------
  3444.   # * Update
  3445.   #--------------------------------------------------------------------------  
  3446.   def update
  3447.       refresh_actor if @actor != $game_party.members[0]
  3448.       return if @actor == nil
  3449.       update_visible
  3450.       update_layout
  3451.       update_layout_2
  3452.       update_name
  3453.       update_face
  3454.       update_hp
  3455.       update_mp
  3456.       update_tp
  3457.       update_level
  3458.       update_states
  3459.       update_equipment
  3460.       update_gold
  3461.   end
  3462.  
  3463.   #--------------------------------------------------------------------------
  3464.   # * Update Visible
  3465.   #--------------------------------------------------------------------------    
  3466.   def update_visible
  3467.       update_auto_hide
  3468.       return if !SMART_FADE_EFFECT
  3469.       @fade_hud = smart_fade_in_range?(@hud_size_x,@hud_size_y)
  3470.       update_gold_smart_fade
  3471.       update_equip_smart_fade
  3472.   end
  3473.  
  3474.   #--------------------------------------------------------------------------
  3475.   # * Update Auto Hide
  3476.   #--------------------------------------------------------------------------      
  3477.   def update_auto_hide
  3478.       if can_auto_hide?
  3479.          @force_hide = true
  3480.          @force_hide_time += 1
  3481.       else  
  3482.          @force_hide = false
  3483.          @force_hide_time = 0
  3484.       end    
  3485.   end
  3486.  
  3487.   #--------------------------------------------------------------------------
  3488.   # * Can Auto  Hide
  3489.   #--------------------------------------------------------------------------  
  3490.   def can_auto_hide?
  3491.       return true if !$game_system.hud_visible
  3492.       return false if !AUTO_HIDE_FOR_INTERPRETER
  3493.       return true if $game_map.interpreter.running?
  3494.       return true if $game_message.visible
  3495.       return false
  3496.   end
  3497.   #--------------------------------------------------------------------------
  3498.   # * Smart Fade In Range
  3499.   #--------------------------------------------------------------------------      
  3500.   def smart_fade_in_range?(range_x,range_y)
  3501.       if $game_player.screen_x.between?(range_x[0],range_x[1]) and
  3502.          $game_player.screen_y.between?(range_y[0],range_y[1])
  3503.          return true
  3504.       else  
  3505.          return false      
  3506.       end    
  3507.   end
  3508.  
  3509.   #--------------------------------------------------------------------------
  3510.   # * Update Gold Smart Fade
  3511.   #--------------------------------------------------------------------------      
  3512.   def update_gold_smart_fade
  3513.       return if @gold == nil
  3514.       return if !@gold_smart_fade
  3515.       @fade_hud_gold = smart_fade_in_range?(@gold_hud_size_x,@gold_hud_size_y)
  3516.   end
  3517.    
  3518.   #--------------------------------------------------------------------------
  3519.   # * Update Equip Smart Fade
  3520.   #--------------------------------------------------------------------------        
  3521.   def update_equip_smart_fade
  3522.       return if @equip_layout == nil
  3523.       return if !@equip_smart_fade
  3524.       @fade_hud_equip = smart_fade_in_range?(@equip_hud_size_x,@equip_hud_size_y)
  3525.   end
  3526.  
  3527.   #--------------------------------------------------------------------------
  3528.   # * Refresh Actor
  3529.   #--------------------------------------------------------------------------    
  3530.   def refresh_actor
  3531.       if can_initialize_hud?
  3532.          setup
  3533.          create_sprites
  3534.       end
  3535.       clear_base_parameters
  3536.   end
  3537.  
  3538.   #--------------------------------------------------------------------------
  3539.   # * Clear Base Parameters
  3540.   #--------------------------------------------------------------------------  
  3541.   def clear_base_parameters
  3542.       @actor = $game_party.members[0]
  3543.       $game_system.hud_face = [1,0]
  3544.       @hp_old_meter = 0
  3545.       @mp_old_meter = 0
  3546.       @tp_old_meter = 0
  3547.       refresh_equipment
  3548.       if @actor != nil
  3549.          if @face != nil
  3550.             refresh_face_name rescue nil
  3551.             @face_old_hp = @actor.hp
  3552.             @face_old_mp = @actor.mp
  3553.             @face_old_tp = @actor.tp
  3554.          end
  3555.          if @name != nil
  3556.             refresh_name rescue  nil
  3557.          end
  3558.       end    
  3559.   end
  3560.      
  3561.   #--------------------------------------------------------------------------
  3562.   # * Can Initialize HUD?
  3563.   #--------------------------------------------------------------------------    
  3564.   def can_initialize_hud?
  3565.       return false if @actor != nil and $game_party.members[0] != nil
  3566.       return true
  3567.   end  
  3568.  
  3569. end
  3570. $mog_rgss3_ultima_hud = true
Add Comment
Please, Sign In to add comment