Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Dhoom
- module PartyGuest
- #To set guest bonus for the party, use notetag in actor note.
- #The syntax: <g_(attribute) (0 for exact value and 1 percentage),value>
- #The attribute is: hp, mp, atk, def, matk, mdef, agi, and luk
- #for example:
- # <g_def 0,100> this will give 100 defensive bonus to the whole party
- # <g_hp 1,10> this wil give 10% hp bonus to the whole party
- #
- #Commands:
- # - guest_included?(actor id)
- # - add_guest(actor id)
- # - remove_guest(actor id)
- # - remove_all_guest
- Max_Guest = 2 #MAX GUEST PARTY
- end
- end
- class RPG::Actor < RPG::BaseItem
- attr_reader :guest_attribute
- def initialize_guest_attribute
- @guest_attribute = []
- if @note =~ /<g_hp (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([0,ar[0],ar[1]])
- end
- if @note =~ /<g_mp (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([1,ar[0],ar[1]])
- end
- if @note =~ /<g_atk (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([2,ar[0],ar[1]])
- end
- if @note =~ /<g_def (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([3,ar[0],ar[1]])
- end
- if @note =~ /<g_matk (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([4,ar[0],ar[1]])
- end
- if @note =~ /<g_mdef (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([5,ar[0],ar[1]])
- end
- if @note =~ /<g_agi (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([6,ar[0],ar[1]])
- end
- if @note =~ /<g_luk (.*)>/i
- ar = []
- for x in $1.split(",")
- ar.push(x.to_i)
- end
- @guest_attribute.push([7,ar[0],ar[1]])
- end
- end
- end
- class Game_Actor < Game_Battler
- def param_base(param_id)
- if $game_party.guests.empty?
- self.class.params[param_id, @level]
- else
- value = self.class.params[param_id, @level]
- for id in $game_party.guests
- for at in $data_actors[id].guest_attribute
- if at[0] == param_id
- if at[1] == 0
- value += at[2]
- else
- value += value*at[2]/100
- end
- end
- end
- end
- return value
- end
- end
- end
- class Game_Party < Game_Unit
- attr_accessor :guests
- alias dhoom_guest_game_party_init initialize
- def initialize
- dhoom_guest_game_party_init
- @guests = []
- end
- def add_guest(actor_id)
- return if @guests.include?(actor_id) or @guests.size == Dhoom::PartyGuest::Max_Guest
- @guests.push(actor_id)
- remove_actor(actor_id)
- $game_player.refresh
- $game_map.need_refresh = true
- end
- def remove_guest(actor_id)
- return if !@guests.include?(actor_id) or @guests.empty?
- @guests.delete(actor_id)
- $game_player.refresh
- $game_map.need_refresh = true
- end
- def remove_all_guest
- @guests.clear
- $game_player.refresh
- $game_map.need_refresh = true
- end
- alias dhoom_guest_game_party_add_actor add_actor
- def add_actor(actor_id)
- @guests.delete(actor_id) if @guests.include?(actor_id)
- dhoom_guest_game_party_add_actor(actor_id)
- end
- end
- class Game_Interpreter
- def add_guest(actor_id)
- $game_party.add_guest(actor_id)
- end
- def remove_guest(actor_id)
- $game_party.remove_guest(actor_id)
- end
- def remove_all_guest
- $game_party.remove_all_guest
- end
- def guest_included?(actor_id)
- $game_party.guests.include?(actor_id)
- end
- end
- class Scene_Title < Scene_Base
- alias dhoom_guest_scene_title_start start
- def start
- dhoom_guest_scene_title_start
- for actor in $data_actors
- actor.initialize_guest_attribute if !actor.nil?
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement