Advertisement
roninator2

CSCA Encyclopedia addon - States

Dec 7th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.50 KB | None | 0 0
  1. # Show state features in CSCA encyclopedia
  2. # Roninator2
  3. # requires
  4. # CSCA Core
  5. # CSCA Menu organizer (for menu command, unless you have your own way.)
  6. # CSCA encyclopedia
  7. # Kread-Ex Traits Namer
  8.  
  9. class CSCA_Window_EncyclopediaInfo < Window_Base
  10.   include KRX::TraitsNamer
  11.  
  12.   def draw_state_information(item)
  13.     csca_draw_icon(item)
  14.     csca_draw_name(item)
  15.     contents.font.size = 16
  16.     change_color(system_color)
  17.     draw_text(72,line_height,contents.width,line_height,"Restriction:")
  18.     draw_text(72,line_height*2-4,contents.width,line_height,"Priority:")
  19.     draw_text(0,line_height*3,contents.width,line_height,"Minimum Turns:")
  20.     draw_text(0,line_height*4-4,contents.width,line_height,"Maximum Turns:")
  21.     change_color(normal_color)
  22.     restriction_string = item.restriction
  23.     case restriction_string
  24.     when 0; restriction_string = "None"
  25.     when 1; restriction_string = "Attack Enemies"
  26.     when 2; restriction_string = "Attack Anyone"
  27.     when 3; restriction_string = "Attack Allies"
  28.     when 4; restriction_string = "Can't Move"
  29.     end
  30.     if item.auto_removal_timing != 1 && item.auto_removal_timing != 2
  31.       max_turn = "N/A"
  32.       min_turn = "N/A"
  33.     else
  34.       max_turn = item.max_turns.to_s
  35.       min_turn = item.min_turns.to_s
  36.     end
  37.     item.remove_at_battle_end ? b_remove = "Yes" : b_remove = "No"
  38.     item.remove_by_restriction ? r_remove = "Yes" : r_remove = "No"
  39.     if item.remove_by_damage
  40.       d_remove = "Yes"
  41.       d_chance = item.chance_by_damage.to_s + "%"
  42.     else
  43.       d_remove = "No"
  44.       d_chance = "N/A"
  45.     end
  46.     if item.remove_by_walking
  47.       w_remove = "Yes"
  48.       w_steps = item.steps_to_remove.to_s
  49.     else
  50.       w_remove = "No"
  51.       w_steps = "N/A"
  52.     end
  53.     draw_text(170,line_height,contents.width,line_height,restriction_string)
  54.     draw_text(147,line_height*2-4,contents.width,line_height,item.priority.to_s)
  55.     draw_text(115,line_height*3,contents.width,line_height,min_turn)
  56.     draw_text(115,line_height*4-4,contents.width,line_height,max_turn)
  57.     d = line_height * 5 - 5 unless d == 0
  58.         @item = item
  59.     item.features.each_with_index do |data, e|
  60.       code = @item.features[e].code
  61.       data_id = @item.features[e].data_id
  62.       value = @item.features[e].value
  63.       string = KRX::TraitsNamer.feature_name(code, data_id, value)
  64.       draw_text(5, d, contents.width, line_height, string)
  65.       d += line_height - 5
  66.     end
  67.     csca_draw_custom_note(0,line_height*11-12,contents.width,line_height,item)
  68.   end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement