Advertisement
Vendily

auto hue but like actually hue

Feb 15th, 2019
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.25 KB | None | 0 0
  1. #===============================================================================
  2. # * Auto Hue Pokémon - by Vendily
  3. #===============================================================================
  4. # But this time it's actually hue.
  5. # Put it above Main (It's because it aliases methods in PSystem_Utilities/EBS
  6. #  and Pokemon_Sprites)
  7. #===============================================================================
  8. # If you want to use it, you can create a Multiple forms property called
  9. #  "bitmapHue", which returns a number between 0 and 360
  10. #  MultipleForms.register(:EEVEE,{
  11. #  "bitmapHue"=>proc{|pokemon|
  12. #    next if pokemon.form==0
  13. #    next 180
  14. # }
  15. # })
  16. # You can also use it for shadow pokémon, thanks to conditional registration.
  17. # MultipleForms.registerIf(proc{|species| true},{
  18. # "bitmapHue"=>proc{|pokemon|
  19. #    next 180 if (pokemon.isShadow? rescue false)
  20. #    next
  21. # }
  22. # })
  23. #===============================================================================
  24. def drawShadowPoke(bitmap,hue=nil)
  25.   shadowhue=(hue ? hue : 0)
  26.   bitmap.hue_change(shadowhue)
  27. end
  28.  
  29. alias _shadow_pbLoadPokemonBitmapSpecies pbLoadPokemonBitmapSpecies
  30. if defined?(EBUISTYLE)
  31.   def pbLoadPokemonBitmapSpecies(pokemon, species, back=false,scale=POKEMONSPRITESCALE)
  32.     ret=_shadow_pbLoadPokemonBitmapSpecies(pokemon, species, back,scale)
  33.     if ret
  34.       hue=(MultipleForms.call("bitmapHue",pokemon))
  35.       ret.prepareStrip
  36.       for i in 0...ret.totalFrames
  37.         drawShadowPoke(ret.alterBitmap(i),hue)
  38.       end
  39.       ret.compileStrip
  40.     end
  41.     return ret
  42.   end
  43. else
  44.     def pbLoadPokemonBitmapSpecies(pokemon, species, back=false)
  45.       ret=_shadow_pbLoadPokemonBitmapSpecies(pokemon, species, back)
  46.       if ret
  47.         hue=(MultipleForms.call("bitmapHue",pokemon))
  48.         animatedBitmap=ret
  49.         copiedBitmap=animatedBitmap.copy
  50.         animatedBitmap.dispose
  51.         copiedBitmap.each {|bitmap|
  52.           drawShadowPoke(bitmap,hue)
  53.         }
  54.         ret=copiedBitmap
  55.       end
  56.       return ret
  57.     end
  58. end
  59.  
  60. class PokemonIconSprite
  61.     alias _shadow_pokemon= pokemon=
  62.   def pokemon=(value)
  63.     self._shadow_pokemon=value
  64.     if pokemon
  65.       hue=(MultipleForms.call("bitmapHue",pokemon))
  66.       drawShadowPoke(self.bitmap,hue)
  67.     end
  68.   end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement