Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # _ __ ____ ___ _ _
- # | | / / (_) \/ | | | ( )
- # | |/ / __ _ _| . . | ___ _ __ | | _____ _ _|/ ___
- # | \ / _` | | |\/| |/ _ \| '_ \| |/ / _ \ | | | / __|
- # | |\ \ (_| | | | | | (_) | | | | < __/ |_| | \__ \
- # \_| \_/\__,_|_\_| |_/\___/|_| |_|_|\_\___|\__, | |___/
- # _____ _ _ __/ |
- # / __ (_) | | |___/
- # | / \/_ _ __ ___ _ _| | __ _ _ __
- # | | | | '__/ __| | | | |/ _` | '__|
- # | \__/\ | | | (__| |_| | | (_| | |
- # \____/_|_| \___|\__,_|_|\__,_|_|
- # _____
- # | ___|
- # | |__ _ __ ___ _ __ ___ _ _
- # | __| '_ \ / _ \ '_ ` _ \| | | |
- # | |__| | | | __/ | | | | | |_| |
- # \____/_| |_|\___|_| |_| |_|\__, |
- # _____ _ _ __/ |
- # / ___| | | | | |___/
- # \ `--. ___| | ___ ___| |_ ___ _ __
- # `--. \/ _ \ |/ _ \/ __| __/ _ \| '__|
- # /\__/ / __/ | __/ (__| || (_) | |
- # \____/ \___|_|\___|\___|\__\___/|_|
- #
- #
- ##############Setup##############
- =begin
- Any enemy you want a special icon for put the tag
- <icon #> in their note box, where # is replaced with the index
- of the icon
- Any enemy you want to be placed in a particular position arround
- the circle (Such as because each enemy reperesents part of a monster) put
- <icon_angle #> in their note box, where the angle is an angle from 0 to 360
- Otherwise the icons will be placed arround the circle at intivals. (Good for
- if there are lots of unrelated enemies)
- =end
- ##########Config###########
- #default icon if none is define in the note box for the enemy
- $kaimonkey_circle_default_icon = 128;
- #==============================================================================
- # ** Window_BattleEnemy
- #------------------------------------------------------------------------------
- # Window for selecting the enemy who is the action target on the battle
- # screen.
- #==============================================================================
- class Game_Enemy < Game_Battler
- def get_tag(tag,default)
- notes = $data_enemies[@enemy_id].note
- if notes.include?("<"+tag+" ")
- return (notes.split("<"+tag)[1].split(">")[0]).to_i
- else
- return default
- end
- end
- end
- class Window_BattleEnemy < Window_Selectable
- def initialize(info_viewport)
- super(0, info_viewport.rect.y, window_width, Graphics.height-info_viewport.rect.y)
- refresh
- self.visible = false
- @info_viewport = info_viewport
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- 128
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return $game_troop.alive_members.size
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- $game_troop.alive_members.size
- end
- #--------------------------------------------------------------------------
- # * Get Enemy Object
- #--------------------------------------------------------------------------
- def enemy
- $game_troop.alive_members[@index]
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- icon = $game_troop.alive_members[index].get_tag("icon",$kaimonkey_circle_default_icon)
- r = item_rect(index)
- draw_icon(icon,r.x,r.y)
- end
- #Def itemrect
- def item_rect(index)
- theta = 360/item_max*index
- theta = $game_troop.alive_members[index].get_tag("icon_angle",theta)
- theta *= Math::PI
- theta /= 180
- mid_y = (contents_height - 20)/2.to_f
- mid_x = contents_width/2.to_f
- r = [mid_x,mid_y].min - 14
- rect = Rect.new
- rect.width = 24
- rect.height = 24
- rect.x = mid_x+Math.sin(theta)*r-12
- rect.y = mid_y-Math.cos(theta)*r-12 + 15
- rect
- end
- def update
- super
- if $game_troop.alive_members[index]
- name = $game_troop.alive_members[index].name
- mid_x = contents_width/2.to_f - text_size(name).width/2
- draw_text_ex(mid_x,0,name)
- end
- end
- def standard_padding
- return 0
- end
- #--------------------------------------------------------------------------
- # * Show Window
- #--------------------------------------------------------------------------
- def show
- if @info_viewport
- width_remain = Graphics.width - width
- self.x = width_remain
- @info_viewport.rect.width = width_remain
- select(0)
- end
- super
- end
- #--------------------------------------------------------------------------
- # * Hide Window
- #--------------------------------------------------------------------------
- def hide
- @info_viewport.rect.width = Graphics.width if @info_viewport
- super
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Right
- #--------------------------------------------------------------------------
- def cursor_right(wrap = false)
- select((index + 1) % item_max)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Left
- #--------------------------------------------------------------------------
- def cursor_left(wrap = false)
- select((index - 1 + item_max) % item_max)
- refresh
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement