SHARE
TWEET

Untitled

marlosgama Apr 7th, 2020 403 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def in_area?
  2.     Mouse.x >= self.x - width / 2 && Mouse.x <= self.x + width / 2 && Mouse.y >= self.y - height && Mouse.y <= self.y
  3.   end
  4.  
  5.   def select_player_target
  6.     return unless Mouse.click?(:L)
  7.     return if @character.is_a?(Game_Player)
  8.     return if @character.character_name.empty?
  9.     return unless in_area?
  10.     return unless @character.actor?
  11.     return if $game_player.over_window?
  12.     if $game_player.target == self
  13.       $game_player.clear_target
  14.     else
  15.       target_type = @character.is_a?(Game_NetPlayer) ? Constants::TARGET_PLAYER : Constants::TARGET_ENEMY
  16.       $network.send_target(@character.id, target_type)
  17.     end
  18.   end
  19.  
  20.   def update_sprites
  21.     return if @character.is_a?(Game_Vehicle) || @character.is_a?(Game_Follower)
  22.     select_player_target
  23.     update_paperdolls unless @character.is_a?(Game_Event)
  24.     if @character.actor? && @character.actor.result.hp_damage
  25.       refresh_damage(@character.actor.result.hp_damage, @character.actor.result.mp_damage, @character.actor.result.critical)
  26.       @character.actor.result.hp_damage = nil
  27.       @character.actor.result.mp_damage = 0
  28.       @character.actor.result.critical = false
  29.     end
  30.     # Se é um inimigo, jogador ou evento não apagado (erased)
  31.     if @character.actor? || @character.event.name.start_with?('$') && !@character.character_name.empty?
  32.       refresh_name if name_changed?
  33.       @name_sprite.x = x
  34.       # Atualiza de acordo com a altura do character
  35.       #que pode ter sido alterada
  36.       @name_sprite.y = y - height
  37.     else
  38.       dispose_name
  39.     end
  40.     if !@character.is_a?(Game_Event) && !@character.actor.guild.empty?
  41.       refresh_guild_name if guild_changed?
  42.       @guild_sprite.x = x
  43.       @guild_sprite.y = y - height
  44.     else
  45.       dispose_guild_name
  46.     end
  47.     if @character.is_a?(Game_Event) && @character.quest_not_started?
  48.       create_quest_icon unless @quest_sprite
  49.       @quest_sprite.x = x
  50.       @quest_sprite.y = y - height
  51.     else
  52.       dispose_quest_icon
  53.     end
  54.     if @character.boss?
  55.       refresh_boss_hp_bar if hp_changed?
  56.       # Possibilita que a barra possa ser arrastada
  57.       @hp_sprite.update
  58.     elsif @character.actor? && @character.actor.hp < @character.actor.mhp
  59.       refresh_hp_bar if hp_changed?
  60.       @hp_sprite.x = x
  61.       @hp_sprite.y = y
  62.     else
  63.       dispose_hp_bar
  64.     end
  65.     unless @character.message.empty?
  66.       create_message(@character.message)
  67.       @character.message.clear
  68.     end
  69.     if @damage_duration > 0
  70.       @damage_sprite.x = x
  71.       @damage_sprite.y = y - height + @damage_duration
  72.       @damage_duration -= 1
  73.     else
  74.       dispose_damage
  75.     end
  76.     if @message_duration > 0
  77.       @message_sprite.x = x
  78.       @message_sprite.y = y
  79.       @message_duration -= 1
  80.     else
  81.       dispose_message
  82.     end
  83.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top