Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # First we'll need icons for elements.
- module PacYanEdits
- IconIDs = {
- 1 => 12, # Element ID => Icon ID
- 2 => 7,
- 5 => 26,
- 6 => 53,
- }
- IconIDs.default = 53 # Default element ID
- Element_Max = 8 # Number of elements in the database.
- Buff_Vocab = "Boons:"
- Debuff_Vocab = "Ailments:"
- Strength_Vocab = "Resistances:"
- Weak_Vocab = "Weaknesses:"
- Number_Size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE # <- Same as YEA BE
- # Size of font HP and MP gauge text is drawn in.
- Name_Size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE # <- Same as YEA BE
- # Size of font enemy name is drawn in.
- Text_Size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
- # Size of font other texts are drawn in.
- end
- # Notetag setup for buffs, debuffs, strengths and weakness check
- # Put \buff in the notebox of a state to denote it as a buff, and similarly
- # put \debuff to denote a debuff. Duh.
- # Put \strong[id] in an enemy's notebox to denote a strength to the element with
- # that ID. Similarly, use \weak[id] to denote a wekaness.
- class RPG::State
- def buff?
- return !self.note[/\\buff/i].nil?
- end
- def debuff?
- return !self.note[/\\debuff/i].nil?
- end
- end
- class RPG::Enemy < RPG::BaseItem
- def strength?(id)
- return !self.note[/\\strong\[#{id}\]/i].nil?
- end
- def weakness?(id)
- return !self.note[/\\weak\[#{id}\]/i].nil?
- end
- end
- # These methods will collect the buffs and debuffs a battler has, as well as
- # its element reactions.
- class Game_BattlerBase
- def pac_buffs
- icons = []
- @buffs.each_with_index {|lv, i|
- icons.push(buff_icon_index(lv, i)) if lv > 0 }
- for state in states
- icons.push(state.icon_index) if state.buff?
- end
- icons.delete(0)
- icons
- end
- def pac_debuffs
- icons = []
- @buffs.each_with_index {|lv, i|
- icons.push(buff_icon_index(lv, i)) if lv < 0 }
- for state in states
- icons.push(state.icon_index) if state.debuff?
- end
- icons.delete(0)
- icons
- end
- def pac_strengths
- pac_strengths = []
- for id in 1...PacYanEdits::Element_Max
- pac_strengths.push(PacYanEdits::IconIDs[id]) if enemy.strength?(id)
- end
- pac_strengths
- end
- def pac_weakness
- pac_weakness = []
- for id in 1...PacYanEdits::Element_Max
- pac_weakness.push(PacYanEdits::IconIDs[id]) if enemy.weakness?(id)
- end
- pac_weakness
- end
- end
- # Now to adjust what's drawn in the Enemy Window
- class Window_BattleHelp < Window_Help
- alias pacyan_contents_height contents_height
- def contents_height(*args)
- pacyan_contents_height(*args) * 2
- end
- #--------------------------------------------------------------------------
- # draw_enemy_icons ~ Jesus shit look at this method
- #--------------------------------------------------------------------------
- def draw_enemy_icons(actor, x, y, width = 96)
- # Draw Buffs
- text = PacYanEdits::Buff_Vocab
- w = text_size(text).width
- draw_text(128, 0, contents.width, line_height, text)
- buffs = (actor.pac_buffs)[0, width / 24]
- buffs.each_with_index {|n, i| draw_icon(n, 128 + x + w + 24 * i, y) }
- # Draw Debuffs
- text = PacYanEdits::Debuff_Vocab
- w = text_size(text).width
- draw_text(128, line_height, contents.width, line_height, text)
- debuffs = (actor.pac_debuffs)[0, width / 24]
- debuffs.each_with_index {|n, i| draw_icon(n, 128 + x + w + 24 * i,
- y + line_height) }
- # Draw Resistances
- text = PacYanEdits::Strength_Vocab
- w = text_size(text).width
- draw_text(128, line_height * 2, contents.width, line_height, text)
- strengths = (actor.pac_strengths)
- strengths.each_with_index {|n, i| draw_icon(n, 128 + x + w + 24 * i,
- y + line_height * 2) }
- # Draw Weaknesses
- text = PacYanEdits::Weak_Vocab
- w = text_size(text).width
- draw_text(128, line_height * 3, contents.width, line_height, text)
- weakness = (actor.pac_weakness)[0, width / 24]
- weakness.each_with_index {|n, i| draw_icon(n, 128 + x + w + 24 * i,
- y + line_height * 3) }
- end
- #--------------------------------------------------------------------------
- # refresh_battler_name
- #--------------------------------------------------------------------------
- def refresh_battler_name(battler)
- if enemy_window.active
- self.height = fitting_height(4)
- contents.clear
- reset_font_settings
- change_color(normal_color)
- @text = battler_name(battler)
- contents.font.size = PacYanEdits::Name_Size
- draw_text(0, 0, contents.width, line_height, @text)
- contents.font.size = PacYanEdits::Number_Size
- draw_actor_hp(battler, 0, line_height)
- draw_actor_mp(battler, 0, line_height * 2)
- contents.font.size = PacYanEdits::Text_Size
- draw_enemy_icons(battler, 0, 0, contents.width)
- else
- contents.clear
- reset_font_settings
- change_color(normal_color)
- @text = battler_name(battler)
- icons = battler.state_icons + battler.buff_icons
- dy = icons.size <= 0 ? line_height / 2 : 0
- draw_text(0, dy, contents.width, line_height, @text, 1)
- dx = (contents.width - (icons.size * 24)) / 2
- draw_actor_icons(battler, dx, line_height, contents.width)
- end
- end
- end # Window_BattleHelp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement