Advertisement
Narzew

RMXP LIMIT BREAKER

Nov 1st, 2012
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.36 KB | None | 0 0
  1. #Narzew's Limit Breaker
  2. #by Narzew
  3. #17.06.2011
  4. #Version 1.0
  5. module LIMITBREAK
  6.   MAXHP = 10000 # Limit HP
  7.   MAXSP = 10000 # Limit SP
  8.   STR = 1000 # Limit siły
  9.   DEX = 1000 # Limit zręczności
  10.   AGI = 1000 # Limit zwinności
  11.   INT = 1000 # Limit inteligencji
  12.   EXP = 1000000000000 # Limit expa
  13.   ITEM = 1000000 # Limit przedmiotów
  14.   GOLD = 1000000000 # Limit złota
  15.   STEP = 1000000000000 # Limit kroków
  16. end
  17. class Game_Battler
  18.   def maxhp
  19.     n = [[base_maxhp + @maxhp_plus, 1].max, LIMITBREAK::MAXHP].min
  20.     for i in @states
  21.       n *= $data_states[i].maxhp_rate / 100.0
  22.     end
  23.     n = [[Integer(n), 1].max, LIMITBREAK::MAXHP].min
  24.     return n
  25.   end
  26.   def maxsp
  27.     n = [[base_maxsp + @maxsp_plus, 0].max, LIMITBREAK::MAXSP].min
  28.     for i in @states
  29.       n *= $data_states[i].maxsp_rate / 100.0
  30.     end
  31.     n = [[Integer(n), 0].max, LIMITBREAK::MAXSP].min
  32.     return n
  33.   end
  34.   def str
  35.     n = [[base_str + @str_plus, 1].max, LIMITBREAK::STR].min
  36.     for i in @states
  37.       n *= $data_states[i].str_rate / 100.0
  38.     end
  39.     n = [[Integer(n), 1].max, LIMITBREAK::STR].min
  40.     return n
  41.   end
  42.   def dex
  43.     n = [[base_dex + @dex_plus, 1].max, LIMITBREAK::DEX].min
  44.     for i in @states
  45.       n *= $data_states[i].dex_rate / 100.0
  46.     end
  47.     n = [[Integer(n), 1].max, LIMITBREAK::DEX].min
  48.     return n
  49.   end
  50.   def agi
  51.     n = [[base_agi + @agi_plus, 1].max, LIMITBREAK::AGI].min
  52.     for i in @states
  53.       n *= $data_states[i].agi_rate / 100.0
  54.     end
  55.     n = [[Integer(n), 1].max, LIMITBREAK::AGI].min
  56.     return n
  57.   end
  58.   def int
  59.     n = [[base_int + @int_plus, 1].max, LIMITBREAK::INT].min
  60.     for i in @states
  61.       n *= $data_states[i].int_rate / 100.0
  62.     end
  63.     n = [[Integer(n), 1].max, LIMITBREAK::INT].min
  64.     return n
  65.   end
  66.   def maxhp=(maxhp)
  67.     @maxhp_plus += maxhp - self.maxhp
  68.     @maxhp_plus = [[@maxhp_plus, (LIMITBREAK::MAXHP * -1)].max, LIMITBREAK::MAXHP].min
  69.     @hp = [@hp, self.maxhp].min
  70.   end
  71.   def maxsp=(maxsp)
  72.     @maxsp_plus += maxsp - self.maxsp
  73.     @maxsp_plus = [[@maxsp_plus, (LIMITBREAK::MAXSP * -1)].max, LIMITBREAK::MAXSP].min
  74.     @sp = [@sp, self.maxsp].min
  75.   end
  76.   def str=(str)
  77.     @str_plus += str - self.str
  78.     @str_plus = [[@str_plus, (LIMITBREAK::STR * -1)].max, LIMITBREAK::STR].min
  79.   end
  80.   def dex=(dex)
  81.     @dex_plus += dex - self.dex
  82.     @dex_plus = [[@dex_plus, (LIMITBREAK::DEX * -1)].max, LIMITBREAK::DEX].min
  83.   end
  84.   def agi=(agi)
  85.     @agi_plus += agi - self.agi
  86.     @agi_plus = [[@agi_plus, (LIMITBREAK::AGI * -1)].max, LIMITBREAK::AGI].min
  87.   end
  88.   def int=(int)
  89.     @int_plus += int - self.int
  90.     @int_plus = [[@int_plus, (LIMITBREAK::INT * -1)].max, LIMITBREAK::INT].min
  91.   end
  92. end
  93. class Game_Actor < Game_Battler
  94.   def maxhp
  95.     n = [[base_maxhp + @maxhp_plus, 1].max, LIMITBREAK::MAXHP].min
  96.     for i in @states
  97.       n *= $data_states[i].maxhp_rate / 100.0
  98.     end
  99.     n = [[Integer(n), 1].max, LIMITBREAK::MAXHP].min
  100.     return n
  101.   end
  102.   def base_str
  103.     n = $data_actors[@actor_id].parameters[2, @level]
  104.     weapon = $data_weapons[@weapon_id]
  105.     armor1 = $data_armors[@armor1_id]
  106.     armor2 = $data_armors[@armor2_id]
  107.     armor3 = $data_armors[@armor3_id]
  108.     armor4 = $data_armors[@armor4_id]
  109.     n += weapon != nil ? weapon.str_plus : 0
  110.     n += armor1 != nil ? armor1.str_plus : 0
  111.     n += armor2 != nil ? armor2.str_plus : 0
  112.     n += armor3 != nil ? armor3.str_plus : 0
  113.     n += armor4 != nil ? armor4.str_plus : 0
  114.     return [[n, 1].max, LIMITBREAK::STR].min
  115.   end
  116.   def base_dex
  117.     n = $data_actors[@actor_id].parameters[3, @level]
  118.     weapon = $data_weapons[@weapon_id]
  119.     armor1 = $data_armors[@armor1_id]
  120.     armor2 = $data_armors[@armor2_id]
  121.     armor3 = $data_armors[@armor3_id]
  122.     armor4 = $data_armors[@armor4_id]
  123.     n += weapon != nil ? weapon.dex_plus : 0
  124.     n += armor1 != nil ? armor1.dex_plus : 0
  125.     n += armor2 != nil ? armor2.dex_plus : 0
  126.     n += armor3 != nil ? armor3.dex_plus : 0
  127.     n += armor4 != nil ? armor4.dex_plus : 0
  128.     return [[n, 1].max, LIMITBREAK::DEX].min
  129.   end
  130.   def base_agi
  131.     n = $data_actors[@actor_id].parameters[4, @level]
  132.     weapon = $data_weapons[@weapon_id]
  133.     armor1 = $data_armors[@armor1_id]
  134.     armor2 = $data_armors[@armor2_id]
  135.     armor3 = $data_armors[@armor3_id]
  136.     armor4 = $data_armors[@armor4_id]
  137.     n += weapon != nil ? weapon.agi_plus : 0
  138.     n += armor1 != nil ? armor1.agi_plus : 0
  139.     n += armor2 != nil ? armor2.agi_plus : 0
  140.     n += armor3 != nil ? armor3.agi_plus : 0
  141.     n += armor4 != nil ? armor4.agi_plus : 0
  142.     return [[n, 1].max, LIMITBREAK::AGI].min
  143.   end
  144.   def base_int
  145.     n = $data_actors[@actor_id].parameters[5, @level]
  146.     weapon = $data_weapons[@weapon_id]
  147.     armor1 = $data_armors[@armor1_id]
  148.     armor2 = $data_armors[@armor2_id]
  149.     armor3 = $data_armors[@armor3_id]
  150.     armor4 = $data_armors[@armor4_id]
  151.     n += weapon != nil ? weapon.int_plus : 0
  152.     n += armor1 != nil ? armor1.int_plus : 0
  153.     n += armor2 != nil ? armor2.int_plus : 0
  154.     n += armor3 != nil ? armor3.int_plus : 0
  155.     n += armor4 != nil ? armor4.int_plus : 0
  156.     return [[n, 1].max, LIMITBREAK::INT].min
  157.   end
  158.   def exp=(exp)
  159.     @exp = [[exp, LIMITBREAK::EXP].min, 0].max
  160.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  161.       @level += 1
  162.       for j in $data_classes[@class_id].learnings
  163.         if j.level == @level
  164.           learn_skill(j.skill_id)
  165.         end
  166.       end
  167.     end
  168.     while @exp < @exp_list[@level]
  169.       @level -= 1
  170.     end
  171.     @hp = [@hp, self.maxhp].min
  172.     @sp = [@sp, self.maxsp].min
  173.   end
  174. end
  175. class Game_Party
  176.   def setup_battle_test_members
  177.     @actors = []
  178.     for battler in $data_system.test_battlers
  179.       actor = $game_actors[battler.actor_id]
  180.       actor.level = battler.level
  181.       gain_weapon(battler.weapon_id, 1)
  182.       gain_armor(battler.armor1_id, 1)
  183.       gain_armor(battler.armor2_id, 1)
  184.       gain_armor(battler.armor3_id, 1)
  185.       gain_armor(battler.armor4_id, 1)
  186.       actor.equip(0, battler.weapon_id)
  187.       actor.equip(1, battler.armor1_id)
  188.       actor.equip(2, battler.armor2_id)
  189.       actor.equip(3, battler.armor3_id)
  190.       actor.equip(4, battler.armor4_id)
  191.       actor.recover_all
  192.       @actors.push(actor)
  193.     end
  194.     @items = {}
  195.     for i in 1...$data_items.size
  196.       if $data_items[i].name != ""
  197.         occasion = $data_items[i].occasion
  198.         if occasion == 0 or occasion == 1
  199.           @items[i] = LIMITBREAK::ITEM
  200.         end
  201.       end
  202.     end
  203.   end
  204.   def gain_gold(n)
  205.     @gold = [[@gold + n, 0].max, LIMITBREAK::GOLD].min
  206.   end
  207.   def increase_steps
  208.     @steps = [@steps + 1, LIMITBREAK::STEP].min
  209.   end
  210.   def gain_item(item_id, n)
  211.     if item_id > 0
  212.       @items[item_id] = [[item_number(item_id) + n, 0].max, LIMITBREAK::ITEM].min
  213.     end
  214.   end
  215.   def gain_weapon(weapon_id, n)
  216.     if weapon_id > 0
  217.       @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, LIMITBREAK::ITEM].min
  218.     end
  219.   end
  220.   def gain_armor(armor_id, n)
  221.     if armor_id > 0
  222.       @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, LIMITBREAK::ITEM].min
  223.     end
  224.   end
  225. end
  226. class Window_ShopBuy < Window_Selectable
  227.   def draw_item(index)
  228.     item = @data[index]
  229.     case item
  230.     when RPG::Item
  231.       number = $game_party.item_number(item.id)
  232.     when RPG::Weapon
  233.       number = $game_party.weapon_number(item.id)
  234.     when RPG::Armor
  235.       number = $game_party.armor_number(item.id)
  236.     end
  237.     if item.price <= $game_party.gold and number < LIMITBREAK::ITEM
  238.       self.contents.font.color = normal_color
  239.     else
  240.       self.contents.font.color = disabled_color
  241.     end
  242.     x = 4
  243.     y = index * 32
  244.     rect = Rect.new(x, y, self.width - 32, 32)
  245.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  246.     bitmap = RPG::Cache.icon(item.icon_name)
  247.     opacity = self.contents.font.color == normal_color ? 255 : 128
  248.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  249.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  250.     self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
  251.   end
  252. end
  253. class Scene_Shop
  254.   def update_buy
  255.     @status_window.item = @buy_window.item
  256.     if Input.trigger?(Input::B)
  257.       $game_system.se_play($data_system.cancel_se)
  258.       @command_window.active = true
  259.       @dummy_window.visible = true
  260.       @buy_window.active = false
  261.       @buy_window.visible = false
  262.       @status_window.visible = false
  263.       @status_window.item = nil
  264.       @help_window.set_text("")
  265.       return
  266.     end
  267.     if Input.trigger?(Input::C)
  268.       @item = @buy_window.item
  269.       if @item == nil or @item.price > $game_party.gold
  270.         $game_system.se_play($data_system.buzzer_se)
  271.         return
  272.       end
  273.       case @item
  274.       when RPG::Item
  275.         number = $game_party.item_number(@item.id)
  276.       when RPG::Weapon
  277.         number = $game_party.weapon_number(@item.id)
  278.       when RPG::Armor
  279.         number = $game_party.armor_number(@item.id)
  280.       end
  281.       if number == LIMITBREAK::ITEM
  282.         $game_system.se_play($data_system.buzzer_se)
  283.         return
  284.       end
  285.       $game_system.se_play($data_system.decision_se)
  286.       max = @item.price == 0 ? LIMITBREAK::ITEM : $game_party.gold / @item.price
  287.       max = [max, LIMITBREAK::ITEM - number].min
  288.       @buy_window.active = false
  289.       @buy_window.visible = false
  290.       @number_window.set(@item, max, @item.price)
  291.       @number_window.active = true
  292.       @number_window.visible = true
  293.     end
  294.   end
  295. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement