Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Narzew's Limit Breaker
- #by Narzew
- #17.06.2011
- #Version 1.0
- module LIMITBREAK
- MAXHP = 10000 # Limit HP
- MAXSP = 10000 # Limit SP
- STR = 1000 # Limit siły
- DEX = 1000 # Limit zręczności
- AGI = 1000 # Limit zwinności
- INT = 1000 # Limit inteligencji
- EXP = 1000000000000 # Limit expa
- ITEM = 1000000 # Limit przedmiotów
- GOLD = 1000000000 # Limit złota
- STEP = 1000000000000 # Limit kroków
- end
- class Game_Battler
- def maxhp
- n = [[base_maxhp + @maxhp_plus, 1].max, LIMITBREAK::MAXHP].min
- for i in @states
- n *= $data_states[i].maxhp_rate / 100.0
- end
- n = [[Integer(n), 1].max, LIMITBREAK::MAXHP].min
- return n
- end
- def maxsp
- n = [[base_maxsp + @maxsp_plus, 0].max, LIMITBREAK::MAXSP].min
- for i in @states
- n *= $data_states[i].maxsp_rate / 100.0
- end
- n = [[Integer(n), 0].max, LIMITBREAK::MAXSP].min
- return n
- end
- def str
- n = [[base_str + @str_plus, 1].max, LIMITBREAK::STR].min
- for i in @states
- n *= $data_states[i].str_rate / 100.0
- end
- n = [[Integer(n), 1].max, LIMITBREAK::STR].min
- return n
- end
- def dex
- n = [[base_dex + @dex_plus, 1].max, LIMITBREAK::DEX].min
- for i in @states
- n *= $data_states[i].dex_rate / 100.0
- end
- n = [[Integer(n), 1].max, LIMITBREAK::DEX].min
- return n
- end
- def agi
- n = [[base_agi + @agi_plus, 1].max, LIMITBREAK::AGI].min
- for i in @states
- n *= $data_states[i].agi_rate / 100.0
- end
- n = [[Integer(n), 1].max, LIMITBREAK::AGI].min
- return n
- end
- def int
- n = [[base_int + @int_plus, 1].max, LIMITBREAK::INT].min
- for i in @states
- n *= $data_states[i].int_rate / 100.0
- end
- n = [[Integer(n), 1].max, LIMITBREAK::INT].min
- return n
- end
- def maxhp=(maxhp)
- @maxhp_plus += maxhp - self.maxhp
- @maxhp_plus = [[@maxhp_plus, (LIMITBREAK::MAXHP * -1)].max, LIMITBREAK::MAXHP].min
- @hp = [@hp, self.maxhp].min
- end
- def maxsp=(maxsp)
- @maxsp_plus += maxsp - self.maxsp
- @maxsp_plus = [[@maxsp_plus, (LIMITBREAK::MAXSP * -1)].max, LIMITBREAK::MAXSP].min
- @sp = [@sp, self.maxsp].min
- end
- def str=(str)
- @str_plus += str - self.str
- @str_plus = [[@str_plus, (LIMITBREAK::STR * -1)].max, LIMITBREAK::STR].min
- end
- def dex=(dex)
- @dex_plus += dex - self.dex
- @dex_plus = [[@dex_plus, (LIMITBREAK::DEX * -1)].max, LIMITBREAK::DEX].min
- end
- def agi=(agi)
- @agi_plus += agi - self.agi
- @agi_plus = [[@agi_plus, (LIMITBREAK::AGI * -1)].max, LIMITBREAK::AGI].min
- end
- def int=(int)
- @int_plus += int - self.int
- @int_plus = [[@int_plus, (LIMITBREAK::INT * -1)].max, LIMITBREAK::INT].min
- end
- end
- class Game_Actor < Game_Battler
- def maxhp
- n = [[base_maxhp + @maxhp_plus, 1].max, LIMITBREAK::MAXHP].min
- for i in @states
- n *= $data_states[i].maxhp_rate / 100.0
- end
- n = [[Integer(n), 1].max, LIMITBREAK::MAXHP].min
- return n
- end
- def base_str
- n = $data_actors[@actor_id].parameters[2, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.str_plus : 0
- n += armor1 != nil ? armor1.str_plus : 0
- n += armor2 != nil ? armor2.str_plus : 0
- n += armor3 != nil ? armor3.str_plus : 0
- n += armor4 != nil ? armor4.str_plus : 0
- return [[n, 1].max, LIMITBREAK::STR].min
- end
- def base_dex
- n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.dex_plus : 0
- n += armor1 != nil ? armor1.dex_plus : 0
- n += armor2 != nil ? armor2.dex_plus : 0
- n += armor3 != nil ? armor3.dex_plus : 0
- n += armor4 != nil ? armor4.dex_plus : 0
- return [[n, 1].max, LIMITBREAK::DEX].min
- end
- def base_agi
- n = $data_actors[@actor_id].parameters[4, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.agi_plus : 0
- n += armor1 != nil ? armor1.agi_plus : 0
- n += armor2 != nil ? armor2.agi_plus : 0
- n += armor3 != nil ? armor3.agi_plus : 0
- n += armor4 != nil ? armor4.agi_plus : 0
- return [[n, 1].max, LIMITBREAK::AGI].min
- end
- def base_int
- n = $data_actors[@actor_id].parameters[5, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += weapon != nil ? weapon.int_plus : 0
- n += armor1 != nil ? armor1.int_plus : 0
- n += armor2 != nil ? armor2.int_plus : 0
- n += armor3 != nil ? armor3.int_plus : 0
- n += armor4 != nil ? armor4.int_plus : 0
- return [[n, 1].max, LIMITBREAK::INT].min
- end
- def exp=(exp)
- @exp = [[exp, LIMITBREAK::EXP].min, 0].max
- while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
- @level += 1
- for j in $data_classes[@class_id].learnings
- if j.level == @level
- learn_skill(j.skill_id)
- end
- end
- end
- while @exp < @exp_list[@level]
- @level -= 1
- end
- @hp = [@hp, self.maxhp].min
- @sp = [@sp, self.maxsp].min
- end
- end
- class Game_Party
- def setup_battle_test_members
- @actors = []
- for battler in $data_system.test_battlers
- actor = $game_actors[battler.actor_id]
- actor.level = battler.level
- gain_weapon(battler.weapon_id, 1)
- gain_armor(battler.armor1_id, 1)
- gain_armor(battler.armor2_id, 1)
- gain_armor(battler.armor3_id, 1)
- gain_armor(battler.armor4_id, 1)
- actor.equip(0, battler.weapon_id)
- actor.equip(1, battler.armor1_id)
- actor.equip(2, battler.armor2_id)
- actor.equip(3, battler.armor3_id)
- actor.equip(4, battler.armor4_id)
- actor.recover_all
- @actors.push(actor)
- end
- @items = {}
- for i in 1...$data_items.size
- if $data_items[i].name != ""
- occasion = $data_items[i].occasion
- if occasion == 0 or occasion == 1
- @items[i] = LIMITBREAK::ITEM
- end
- end
- end
- end
- def gain_gold(n)
- @gold = [[@gold + n, 0].max, LIMITBREAK::GOLD].min
- end
- def increase_steps
- @steps = [@steps + 1, LIMITBREAK::STEP].min
- end
- def gain_item(item_id, n)
- if item_id > 0
- @items[item_id] = [[item_number(item_id) + n, 0].max, LIMITBREAK::ITEM].min
- end
- end
- def gain_weapon(weapon_id, n)
- if weapon_id > 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, LIMITBREAK::ITEM].min
- end
- end
- def gain_armor(armor_id, n)
- if armor_id > 0
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, LIMITBREAK::ITEM].min
- end
- end
- end
- class Window_ShopBuy < Window_Selectable
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.price <= $game_party.gold and number < LIMITBREAK::ITEM
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
- end
- end
- class Scene_Shop
- def update_buy
- @status_window.item = @buy_window.item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @buy_window.item
- if @item == nil or @item.price > $game_party.gold
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- if number == LIMITBREAK::ITEM
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- max = @item.price == 0 ? LIMITBREAK::ITEM : $game_party.gold / @item.price
- max = [max, LIMITBREAK::ITEM - number].min
- @buy_window.active = false
- @buy_window.visible = false
- @number_window.set(@item, max, @item.price)
- @number_window.active = true
- @number_window.visible = true
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement