Class: Game_Party
- Defined in:
- scripts/00600 Script_RMXP/01700 Game_Party.rb
Overview
The RPG Maker description of a Party
Instance Attribute Summary collapse
-
#actors
readonly
Returns the value of attribute actors.
-
#gold
Returns the value of attribute gold.
-
#steps
Returns the value of attribute steps.
Instance Method Summary collapse
-
#add_actor(actor_id)
Add an actor to the party.
-
#gain_gold(n)
gives gold to the party.
-
#increase_steps
Increase steps of the party.
-
#initialize ⇒ Game_Party
constructor
Default initialization.
-
#lose_gold(n)
takes gold from the party.
-
#max_level ⇒ Integer
Returns the max level in the team.
-
#refresh
Refresh the game party with right actors according to the RMXP data.
-
#remove_actor(actor_id)
Remove an actor of the party.
-
#setup_starting_members
Set up the party with default members.
Constructor Details
#initialize ⇒ Game_Party
Default initialization
10 11 12 13 14 15 16 17 18 19 20 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 10 def initialize # アクターの配列を作成 @actors = [] # ゴールドと歩数を初期化 @gold = 0 @steps = 0 # アイテム、武器、防具の所持数ハッシュを作成 @items = {} @weapons = {} @armors = {} end |
Instance Attribute Details
#actors (readonly)
Returns the value of attribute actors.
3 4 5 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 3 def actors @actors end |
#gold
Returns the value of attribute gold.
5 6 7 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 5 def gold @gold end |
#steps
Returns the value of attribute steps.
7 8 9 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 7 def steps @steps end |
Instance Method Details
#add_actor(actor_id)
Add an actor to the party
53 54 55 56 57 58 59 60 61 62 63 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 53 def add_actor(actor_id) # アクターを取得 actor = $game_actors[actor_id] # パーティ人数が 4 人未満で、このアクターがパーティにいない場合 if @actors.size < 4 and not @actors.include?(actor) # アクターを追加 @actors.push(actor) # プレイヤーをリフレッシュ $game_player.refresh end end |
#gain_gold(n)
gives gold to the party
76 77 78 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 76 def gain_gold(n) @gold = [[@gold + n, 0].max, 9999999].min end |
#increase_steps
Increase steps of the party
88 89 90 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 88 def increase_steps @steps = [@steps + 1, 9999999].min end |
#lose_gold(n)
takes gold from the party
82 83 84 85 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 82 def lose_gold(n) # 数値を逆転して gain_gold を呼ぶ gain_gold(-n) end |
#max_level ⇒ Integer
Returns the max level in the team
47 48 49 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 47 def max_level return 1 end |
#refresh
Refresh the game party with right actors according to the RMXP data
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 32 def refresh # ゲームデータをロードした直後はアクターオブジェクトが # $game_actors から分離してしまっている。 # ロードのたびにアクターを再設定することで問題を回避する。 new_actors = [] for i in 0...@actors.size if $data_actors[@actors[i].id] != nil new_actors.push($game_actors[@actors[i].id]) end end @actors = new_actors end |
#remove_actor(actor_id)
Remove an actor of the party
67 68 69 70 71 72 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 67 def remove_actor(actor_id) # アクターを削除 @actors.delete($game_actors[actor_id]) # プレイヤーをリフレッシュ $game_player.refresh end |
#setup_starting_members
Set up the party with default members
23 24 25 26 27 28 29 |
# File 'scripts/00600 Script_RMXP/01700 Game_Party.rb', line 23 def setup_starting_members @actors = [] log_info("Initial party members : #{$data_system.party_members}") for i in $data_system.party_members @actors.push($game_actors[i]) end end |