Class: Game_Actor

Inherits:
Game_Battler show all
Defined in:
Game_Actor.rb

Overview

** Game_Actor


This class handles actors. It is used within the Game_Actors class

($game_actors) and is also referenced from the Game_Party class ($game_party).

Constant Summary

Constant Summary

Constants inherited from Game_Battler

Game_Battler::EFFECT_ADD_BUFF, Game_Battler::EFFECT_ADD_DEBUFF, Game_Battler::EFFECT_ADD_STATE, Game_Battler::EFFECT_COMMON_EVENT, Game_Battler::EFFECT_GAIN_TP, Game_Battler::EFFECT_GROW, Game_Battler::EFFECT_LEARN_SKILL, Game_Battler::EFFECT_RECOVER_HP, Game_Battler::EFFECT_RECOVER_MP, Game_Battler::EFFECT_REMOVE_BUFF, Game_Battler::EFFECT_REMOVE_DEBUFF, Game_Battler::EFFECT_REMOVE_STATE, Game_Battler::EFFECT_SPECIAL, Game_Battler::SPECIAL_EFFECT_ESCAPE

Constants inherited from Game_BattlerBase

Game_BattlerBase::FEATURE_ACTION_PLUS, Game_BattlerBase::FEATURE_ATK_ELEMENT, Game_BattlerBase::FEATURE_ATK_SPEED, Game_BattlerBase::FEATURE_ATK_STATE, Game_BattlerBase::FEATURE_ATK_TIMES, Game_BattlerBase::FEATURE_COLLAPSE_TYPE, Game_BattlerBase::FEATURE_DEBUFF_RATE, Game_BattlerBase::FEATURE_ELEMENT_RATE, Game_BattlerBase::FEATURE_EQUIP_ATYPE, Game_BattlerBase::FEATURE_EQUIP_FIX, Game_BattlerBase::FEATURE_EQUIP_SEAL, Game_BattlerBase::FEATURE_EQUIP_WTYPE, Game_BattlerBase::FEATURE_PARAM, Game_BattlerBase::FEATURE_PARTY_ABILITY, Game_BattlerBase::FEATURE_SKILL_ADD, Game_BattlerBase::FEATURE_SKILL_SEAL, Game_BattlerBase::FEATURE_SLOT_TYPE, Game_BattlerBase::FEATURE_SPARAM, Game_BattlerBase::FEATURE_SPECIAL_FLAG, Game_BattlerBase::FEATURE_STATE_RATE, Game_BattlerBase::FEATURE_STATE_RESIST, Game_BattlerBase::FEATURE_STYPE_ADD, Game_BattlerBase::FEATURE_STYPE_SEAL, Game_BattlerBase::FEATURE_XPARAM, Game_BattlerBase::FLAG_ID_AUTO_BATTLE, Game_BattlerBase::FLAG_ID_GUARD, Game_BattlerBase::FLAG_ID_PRESERVE_TP, Game_BattlerBase::FLAG_ID_SUBSTITUTE, Game_BattlerBase::ICON_BUFF_START, Game_BattlerBase::ICON_DEBUFF_START

Instance Attribute Summary (collapse)

Attributes inherited from Game_Battler

#action_times, #actions, #animation_id, #animation_mirror, #battler_hue, #battler_name, #last_target_index, #magic_reflection, #result, #speed, #sprite_effect_type

Attributes inherited from Game_BattlerBase

#hp, #mp, #tp

Instance Method Summary (collapse)

Methods inherited from Game_Battler

#add_buff, #add_debuff, #add_new_state, #add_state, #apply_critical, #apply_guard, #apply_variance, #attack_apply, #buff?, #buff_max?, #charge_tp_by_damage, #clear_sprite_effects, #clear_states, #clear_tp, #consume_item, #current_action, #debuff?, #debuff_max?, #die, #elements_max_rate, #erase_buff, #escape, #execute_damage, #force_action, #init_tp, #item_apply, #item_cnt, #item_cri, #item_effect_add_buff, #item_effect_add_debuff, #item_effect_add_state, #item_effect_add_state_attack, #item_effect_add_state_normal, #item_effect_apply, #item_effect_common_event, #item_effect_gain_tp, #item_effect_grow, #item_effect_learn_skill, #item_effect_recover_hp, #item_effect_recover_mp, #item_effect_remove_buff, #item_effect_remove_debuff, #item_effect_remove_state, #item_effect_special, #item_effect_test, #item_element_rate, #item_eva, #item_global_effect_apply, #item_has_any_valid_effects?, #item_hit, #item_mrf, #item_test, #item_user_effect, #luk_effect_rate, #make_action_times, #make_damage_value, #make_speed, #max_slip_damage, #on_action_end, #on_battle_end, #on_battle_start, #on_damage, #on_restrict, #on_turn_end, #opposite?, #overwrite_buff_turns, #regenerate_all, #regenerate_hp, #regenerate_mp, #regenerate_tp, #remove_all_buffs, #remove_battle_states, #remove_buff, #remove_buffs_auto, #remove_current_action, #remove_state, #remove_states_auto, #remove_states_by_damage, #reset_state_counts, #revive, #state_addable?, #state_removed?, #state_restrict?, #update_buff_turns, #update_state_turns, #use_item

Methods inherited from Game_BattlerBase

#action_plus_set, #add_param, #added_skill_types, #added_skills, #agi, #alive?, #all_features, #appear, #atk, #atk_speed, #atk_states, #atk_states_rate, #atk_times_add, #attack_skill_id, #attack_usable?, #auto_battle?, #buff_icon_index, #buff_icons, #cev, #change_hp, #clear_buffs, #clear_param_plus, #clear_states, #cnt, #collapse_type, #confusion?, #confusion_level, #cri, #dead?, #death_state?, #death_state_id, #debuff_rate, #def, #dual_wield?, #element_rate, #enemy?, #equip_atype_ok?, #equip_type_fixed?, #equip_type_sealed?, #equip_wtype_ok?, #equippable?, #erase_state, #eva, #exist?, #exr, #fdr, #features, #features_pi, #features_set, #features_sum, #features_sum_all, #features_with_id, #grd, #guard?, #guard_skill_id, #guard_usable?, #hidden?, #hide, #hit, #hp_rate, #hrg, #inputable?, #item_conditions_met?, #luk, #mat, #max_tp, #mcr, #mdf, #mdr, #mev, #mhp, #mmp, #most_important_state_text, #movable?, #mp_rate, #mrf, #mrg, #normal?, #occasion_ok?, #param, #param_buff_rate, #param_min, #param_rate, #party_ability, #pay_skill_cost, #pdr, #pha, #preserve_tp?, #rec, #recover_all, #restriction, #skill_conditions_met?, #skill_cost_payable?, #skill_mp_cost, #skill_sealed?, #skill_tp_cost, #skill_type_sealed?, #slot_type, #sort_states, #sparam, #special_flag, #state?, #state_icons, #state_rate, #state_resist?, #state_resist_set, #states, #substitute?, #tcr, #tgr, #tp_rate, #trg, #usable?, #usable_item_conditions_met?, #xparam

Constructor Details

- (Game_Actor) initialize(actor_id)


  • Object Initialization




25
26
27
28
29
# File 'Game_Actor.rb', line 25

def initialize(actor_id)
  super()
  setup(actor_id)
  @last_skill = Game_BaseItem.new
end

Instance Attribute Details

- (Object) action_input_index (readonly)

action number being input



20
21
22
# File 'Game_Actor.rb', line 20

def action_input_index
  @action_input_index
end

- (Object) character_index (readonly)

character graphic index



15
16
17
# File 'Game_Actor.rb', line 15

def character_index
  @character_index
end

- (Object) character_name (readonly)

character graphic filename



14
15
16
# File 'Game_Actor.rb', line 14

def character_name
  @character_name
end

- (Object) class_id (readonly)

class ID



18
19
20
# File 'Game_Actor.rb', line 18

def class_id
  @class_id
end

- (Object) face_index (readonly)

face graphic index



17
18
19
# File 'Game_Actor.rb', line 17

def face_index
  @face_index
end

- (Object) face_name (readonly)

face graphic filename



16
17
18
# File 'Game_Actor.rb', line 16

def face_name
  @face_name
end

- (Object) last_skill (readonly)

For cursor memorization: Skill



21
22
23
# File 'Game_Actor.rb', line 21

def last_skill
  @last_skill
end

- (Object) level (readonly)

level



19
20
21
# File 'Game_Actor.rb', line 19

def level
  @level
end

- (Object) name


  • Public Instance Variables




12
13
14
# File 'Game_Actor.rb', line 12

def name
  @name
end

- (Object) nickname

Nickname



13
14
15
# File 'Game_Actor.rb', line 13

def nickname
  @nickname
end

Instance Method Details

- (Object) actor


  • Get Actor Object




51
52
53
# File 'Game_Actor.rb', line 51

def actor
  $data_actors[@actor_id]
end

- (Boolean) actor?


  • Determine if Actor or Not


Returns:

  • (Boolean)


299
300
301
# File 'Game_Actor.rb', line 299

def actor?
  return true
end

- (Object) armors


  • Get Armor Object Array




164
165
166
# File 'Game_Actor.rb', line 164

def armors
  @equips.select {|item| item.is_armor? }.collect {|item| item.object }
end

- (Object) atk_animation_id1


  • Get Normal Attack Animation ID




386
387
388
389
390
391
392
393
# File 'Game_Actor.rb', line 386

def atk_animation_id1
  if dual_wield?
    return weapons[0].animation_id if weapons[0]
    return weapons[1] ? 0 : 1
  else
    return weapons[0] ? weapons[0].animation_id : 1
  end
end

- (Object) atk_animation_id2


  • Get Animation ID of Normal Attack (Dual Wield: Weapon 2)




397
398
399
400
401
402
403
# File 'Game_Actor.rb', line 397

def atk_animation_id2
  if dual_wield?
    return weapons[1] ? weapons[1].animation_id : 0
  else
    return 0
  end
end

- (Object) atk_elements


  • Get Attack Element




359
360
361
362
363
# File 'Game_Actor.rb', line 359

def atk_elements
  set = super
  set |= [1] if weapons.compact.empty?  # Unarmed: Physical element
  return set
end

- (Object) basic_floor_damage


  • Get Base Value for Floor Damage




652
653
654
# File 'Game_Actor.rb', line 652

def basic_floor_damage
  return 10
end

- (Boolean) battle_member?


  • Determine Battle Members


Returns:

  • (Boolean)


329
330
331
# File 'Game_Actor.rb', line 329

def battle_member?
  $game_party.battle_members.include?(self)
end

- (Object) change_class(class_id, keep_exp = false)


  • Change Class

    keep_exp:  Keep EXP



506
507
508
509
510
511
# File 'Game_Actor.rb', line 506

def change_class(class_id, keep_exp = false)
  @exp[class_id] = exp if keep_exp
  @class_id = class_id
  change_exp(@exp[@class_id] || 0, false)
  refresh
end

- (Object) change_equip(slot_id, item)


  • Change Equipment

    slot_id:  Equipment slot ID
    item:    Weapon/armor (remove equipment if nil)



187
188
189
190
191
192
# File 'Game_Actor.rb', line 187

def change_equip(slot_id, item)
  return unless trade_item_with_party(item, equips[slot_id])
  return if item && equip_slots[slot_id] != item.etype_id
  @equips[slot_id].object = item
  refresh
end

- (Object) change_equip_by_id(slot_id, item_id)


  • Change Equipment (Specify with ID)

    slot_id:  Equipment slot ID
    item_id:  Weapons/armor ID



219
220
221
222
223
224
225
# File 'Game_Actor.rb', line 219

def change_equip_by_id(slot_id, item_id)
  if equip_slots[slot_id] == 0
    change_equip(slot_id, $data_weapons[item_id])
  else
    change_equip(slot_id, $data_armors[item_id])
  end
end

- (Object) change_exp(exp, show)


  • Change Experience

    show : Level up display flag



408
409
410
411
412
413
414
415
416
# File 'Game_Actor.rb', line 408

def change_exp(exp, show)
  @exp[@class_id] = [exp, 0].max
  last_level = @level
  last_skills = skills
  level_up while !max_level? && self.exp >= next_level_exp
  level_down while self.exp < current_level_exp
  display_level_up(skills - last_skills) if show && @level > last_level
  refresh
end

- (Object) change_level(level, show)


  • Change Level

    show : Level up display flag



471
472
473
474
# File 'Game_Actor.rb', line 471

def change_level(level, show)
  level = [[level, max_level].min, 1].max
  change_exp(exp_for_level(level), show)
end

- (Object) check_floor_effect


  • Determine Floor Effect




638
639
640
# File 'Game_Actor.rb', line 638

def check_floor_effect
  execute_floor_damage if $game_player.on_damage_floor?
end

- (Object) class


  • Get Class Object




335
336
337
# File 'Game_Actor.rb', line 335

def class
  $data_classes[@class_id]
end

- (Object) clear_actions


  • Clear Actions




670
671
672
673
# File 'Game_Actor.rb', line 670

def clear_actions
  super
  @action_input_index = 0
end

- (Object) clear_equipments


  • Remove All Equipment




253
254
255
256
257
# File 'Game_Actor.rb', line 253

def clear_equipments
  equip_slots.size.times do |i|
    change_equip(i, nil) if equip_change_ok?(i)
  end
end

- (Object) current_level_exp


  • Get Minimum EXP for Current Level




84
85
86
# File 'Game_Actor.rb', line 84

def current_level_exp
  exp_for_level(@level)
end

- (Object) description


  • Get Description




499
500
501
# File 'Game_Actor.rb', line 499

def description
  actor.description
end

- (Object) discard_equip(item)


  • Discard Equipment

    item:  Weapon/armor to discard



230
231
232
233
# File 'Game_Actor.rb', line 230

def discard_equip(item)
  slot_id = equips.index(item)
  @equips[slot_id].object = nil if slot_id
end

- (Object) display_level_up(new_skills)


  • Show Level Up Message

    new_skills : Array of newly learned skills



442
443
444
445
446
447
448
# File 'Game_Actor.rb', line 442

def display_level_up(new_skills)
  $game_message.new_page
  $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))
  new_skills.each do |skill|
    $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
  end
end

- (Object) empty_slot(etype_id)


  • Convert from Equipment Type to Slot ID (Empty Take Precedence)




144
145
146
147
# File 'Game_Actor.rb', line 144

def empty_slot(etype_id)
  list = slot_list(etype_id)
  list.find {|i| @equips[i].is_nil? } || list[0]
end

- (Boolean) equip_change_ok?(slot_id)


  • Determine if Equipment Change Possible

    slot_id:  Equipment slot ID

Returns:

  • (Boolean)


177
178
179
180
181
# File 'Game_Actor.rb', line 177

def equip_change_ok?(slot_id)
  return false if equip_type_fixed?(equip_slots[slot_id])
  return false if equip_type_sealed?(equip_slots[slot_id])
  return true
end

- (Object) equip_slots


  • Get Equipment Slot Array




151
152
153
154
# File 'Game_Actor.rb', line 151

def equip_slots
  return [0,0,2,3,4] if dual_wield?       # Dual wield
  return [0,1,2,3,4]                      # Normal
end

- (Object) equips


  • Get Equipped Item Object Array




170
171
172
# File 'Game_Actor.rb', line 170

def equips
  @equips.collect {|item| item.object }
end

- (Object) execute_floor_damage


  • Floor Damage Processing




644
645
646
647
648
# File 'Game_Actor.rb', line 644

def execute_floor_damage
  damage = (basic_floor_damage * fdr).to_i
  self.hp -= [damage, max_floor_damage].min
  perform_map_damage_effect if damage > 0
end

- (Object) exp


  • Get Experience




78
79
80
# File 'Game_Actor.rb', line 78

def exp
  @exp[@class_id]
end

- (Object) exp_for_level(level)


  • Get Total EXP Required for Rising to Specified Level




66
67
68
# File 'Game_Actor.rb', line 66

def exp_for_level(level)
  self.class.exp_for_level(level)
end

- (Object) feature_objects


  • Get Array of All Objects Retaining Features




353
354
355
# File 'Game_Actor.rb', line 353

def feature_objects
  super + [actor] + [self.class] + equips.compact
end

- (Object) final_exp_rate


  • Calculate Final EXP Rate




458
459
460
# File 'Game_Actor.rb', line 458

def final_exp_rate
  exr * (battle_member? ? 1 : reserve_members_exp_rate)
end

- (Object) force_change_equip(slot_id, item)


  • Forcibly Change Equipment

    slot_id:  Equipment slot ID
    item:     Weapon/armor (remove equipment if nil)



198
199
200
201
202
# File 'Game_Actor.rb', line 198

def force_change_equip(slot_id, item)
  @equips[slot_id].object = item
  release_unequippable_items(false)
  refresh
end

- (Object) forget_skill(skill_id)


  • Forget Skill




487
488
489
# File 'Game_Actor.rb', line 487

def forget_skill(skill_id)
  @skills.delete(skill_id)
end

- (Object) friends_unit


  • Get Allied Units




305
306
307
# File 'Game_Actor.rb', line 305

def friends_unit
  $game_party
end

- (Object) gain_exp(exp)


  • Get EXP (Account for Experience Rate)




452
453
454
# File 'Game_Actor.rb', line 452

def gain_exp(exp)
  change_exp(self.exp + (exp * final_exp_rate).to_i, true)
end

- (Object) id


  • Get Actor ID




317
318
319
# File 'Game_Actor.rb', line 317

def id
  @actor_id
end

- (Object) index


  • Get Index




323
324
325
# File 'Game_Actor.rb', line 323

def index
  $game_party.members.index(self)
end

- (Object) index_to_etype_id(index)


  • Convert Index Set by Editor to Equipment Type ID




130
131
132
# File 'Game_Actor.rb', line 130

def index_to_etype_id(index)
  index == 1 && dual_wield? ? 0 : index
end

- (Object) init_equips(equips)


  • Initialize Equipment

    equips:  An array of initial equipment



118
119
120
121
122
123
124
125
126
# File 'Game_Actor.rb', line 118

def init_equips(equips)
  @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
  equips.each_with_index do |item_id, i|
    etype_id = index_to_etype_id(i)
    slot_id = empty_slot(etype_id)
    @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  end
  refresh
end

- (Object) init_exp


  • Initialize EXP




72
73
74
# File 'Game_Actor.rb', line 72

def init_exp
  @exp[@class_id] = current_level_exp
end

- (Object) init_graphics


  • Initialize Graphics




57
58
59
60
61
62
# File 'Game_Actor.rb', line 57

def init_graphics
  @character_name = actor.character_name
  @character_index = actor.character_index
  @face_name = actor.face_name
  @face_index = actor.face_index
end

- (Object) init_skills


  • Initialize Skills




108
109
110
111
112
113
# File 'Game_Actor.rb', line 108

def init_skills
  @skills = []
  self.class.learnings.each do |learning|
    learn_skill(learning.skill_id) if learning.level <= @level
  end
end

- (Object) input


  • Get Action Being Input




677
678
679
# File 'Game_Actor.rb', line 677

def input
  @actions[@action_input_index]
end

- (Object) learn_skill(skill_id)


  • Learn Skill




478
479
480
481
482
483
# File 'Game_Actor.rb', line 478

def learn_skill(skill_id)
  unless skill_learn?($data_skills[skill_id])
    @skills.push(skill_id)
    @skills.sort!
  end
end

- (Object) level_down


  • Level Down




435
436
437
# File 'Game_Actor.rb', line 435

def level_down
  @level -= 1
end

- (Object) level_up


  • Level Up




426
427
428
429
430
431
# File 'Game_Actor.rb', line 426

def level_up
  @level += 1
  self.class.learnings.each do |learning|
    learn_skill(learning.skill_id) if learning.level == @level
  end
end

- (Object) make_action_list


  • Create Action Candidate List for Auto Battle




547
548
549
550
551
552
553
554
# File 'Game_Actor.rb', line 547

def make_action_list
  list = []
  list.push(Game_Action.new(self).set_attack.evaluate)
  usable_skills.each do |skill|
    list.push(Game_Action.new(self).set_skill(skill.id).evaluate)
  end
  list
end

- (Object) make_actions


  • Create Battle Action




574
575
576
577
578
579
580
581
# File 'Game_Actor.rb', line 574

def make_actions
  super
  if auto_battle?
    make_auto_battle_actions
  elsif confusion?
    make_confusion_actions
  end
end

- (Object) make_auto_battle_actions


  • Create Action During Auto Battle




558
559
560
561
562
# File 'Game_Actor.rb', line 558

def make_auto_battle_actions
  @actions.size.times do |i|
    @actions[i] = make_action_list.max_by {|action| action.value }
  end
end

- (Object) make_confusion_actions


  • Create Action During Confusion




566
567
568
569
570
# File 'Game_Actor.rb', line 566

def make_confusion_actions
  @actions.size.times do |i|
    @actions[i].set_confusion
  end
end

- (Object) max_floor_damage


  • Get Maximum Value for Floor Damage




658
659
660
# File 'Game_Actor.rb', line 658

def max_floor_damage
  $data_system.opt_floor_death ? hp : [hp - 1, 0].max
end

- (Object) max_level


  • Maximum Level




96
97
98
# File 'Game_Actor.rb', line 96

def max_level
  actor.max_level
end

- (Boolean) max_level?


  • Determine Maximum Level


Returns:

  • (Boolean)


102
103
104
# File 'Game_Actor.rb', line 102

def max_level?
  @level >= max_level
end

- (Object) next_command


  • To Next Command Input




683
684
685
686
687
# File 'Game_Actor.rb', line 683

def next_command
  return false if @action_input_index >= @actions.size - 1
  @action_input_index += 1
  return true
end

- (Object) next_level_exp


  • Get EXP for Next Level




90
91
92
# File 'Game_Actor.rb', line 90

def next_level_exp
  exp_for_level(@level + 1)
end

- (Object) on_player_walk


  • Processing Performed When Player Takes 1 Step




585
586
587
588
589
590
591
592
593
594
# File 'Game_Actor.rb', line 585

def on_player_walk
  @result.clear
  check_floor_effect
  if $game_player.normal_walk?
    turn_end_on_map
    states.each {|state| update_state_steps(state) }
    show_added_states
    show_removed_states
  end
end

- (Object) opponents_unit


  • Get Enemy Units




311
312
313
# File 'Game_Actor.rb', line 311

def opponents_unit
  $game_troop
end

- (Object) optimize_equipments


  • Ultimate Equipment




261
262
263
264
265
266
267
268
269
270
271
# File 'Game_Actor.rb', line 261

def optimize_equipments
  clear_equipments
  equip_slots.size.times do |i|
    next if !equip_change_ok?(i)
    items = $game_party.equip_items.select do |item|
      item.etype_id == equip_slots[i] &&
      equippable?(item) && item.performance >= 0
    end
    change_equip(i, items.max_by {|item| item.performance })
  end
end

- (Object) param_base(param_id)


  • Get Base Value of Parameter




374
375
376
# File 'Game_Actor.rb', line 374

def param_base(param_id)
  self.class.params[param_id, @level]
end

- (Object) param_max(param_id)


  • Get Maximum Value of Parameter




367
368
369
370
# File 'Game_Actor.rb', line 367

def param_max(param_id)
  return 9999 if param_id == 0  # MHP
  return super
end

- (Object) param_plus(param_id)


  • Get Added Value of Parameter




380
381
382
# File 'Game_Actor.rb', line 380

def param_plus(param_id)
  equips.compact.inject(super) {|r, item| r += item.params[param_id] }
end

- (Object) perform_collapse_effect


  • Execute Collapse Effect




538
539
540
541
542
543
# File 'Game_Actor.rb', line 538

def perform_collapse_effect
  if $game_party.in_battle
    @sprite_effect_type = :collapse
    Sound.play_actor_collapse
  end
end

- (Object) perform_damage_effect


  • Execute Damage Effect




530
531
532
533
534
# File 'Game_Actor.rb', line 530

def perform_damage_effect
  $game_troop.screen.start_shake(5, 5, 10)
  @sprite_effect_type = :blink
  Sound.play_actor_damage
end

- (Object) perform_map_damage_effect


  • Execute Damage Effect on Map




664
665
666
# File 'Game_Actor.rb', line 664

def perform_map_damage_effect
  $game_map.screen.start_flash_for_damage
end

- (Object) prior_command


  • To Previous Command Input




691
692
693
694
695
# File 'Game_Actor.rb', line 691

def prior_command
  return false if @action_input_index <= 0
  @action_input_index -= 1
  return true
end

- (Object) refresh


  • Refresh




292
293
294
295
# File 'Game_Actor.rb', line 292

def refresh
  release_unequippable_items
  super
end

- (Object) release_unequippable_items(item_gain = true)


  • Remove Equipment that Cannot Be Equipped

    item_gain:  Return removed equipment to party.



238
239
240
241
242
243
244
245
246
247
248
249
# File 'Game_Actor.rb', line 238

def release_unequippable_items(item_gain = true)
  loop do
    last_equips = equips.dup
    @equips.each_with_index do |item, i|
      if !equippable?(item.object) || item.object.etype_id != equip_slots[i]
        trade_item_with_party(nil, item.object) if item_gain
        item.object = nil
      end
    end
    return if equips == last_equips
  end
end

- (Object) reserve_members_exp_rate


  • Get EXP Rate for Reserve Members




464
465
466
# File 'Game_Actor.rb', line 464

def reserve_members_exp_rate
  $data_system.opt_extra_exp ? 1 : 0
end

- (Object) set_graphic(character_name, character_index, face_name, face_index)


  • Change Graphics




515
516
517
518
519
520
# File 'Game_Actor.rb', line 515

def set_graphic(character_name, character_index, face_name, face_index)
  @character_name = character_name
  @character_index = character_index
  @face_name = face_name
  @face_index = face_index
end

- (Object) setup(actor_id)


  • Setup




33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'Game_Actor.rb', line 33

def setup(actor_id)
  @actor_id = actor_id
  @name = actor.name
  @nickname = actor.nickname
  init_graphics
  @class_id = actor.class_id
  @level = actor.initial_level
  @exp = {}
  @equips = []
  init_exp
  init_skills
  init_equips(actor.equips)
  clear_param_plus
  recover_all
end

- (Object) show_added_states


  • Show Added State




607
608
609
610
611
# File 'Game_Actor.rb', line 607

def show_added_states
  @result.added_state_objects.each do |state|
    $game_message.add(name + state.message1) unless state.message1.empty?
  end
end

- (Object) show_removed_states


  • Show Removed State




615
616
617
618
619
# File 'Game_Actor.rb', line 615

def show_removed_states
  @result.removed_state_objects.each do |state|
    $game_message.add(name + state.message4) unless state.message4.empty?
  end
end

- (Boolean) skill_learn?(skill)


  • Determine if Skill Is Already Learned


Returns:

  • (Boolean)


493
494
495
# File 'Game_Actor.rb', line 493

def skill_learn?(skill)
  skill.is_a?(RPG::Skill) && @skills.include?(skill.id)
end

- (Boolean) skill_wtype_ok?(skill)


  • Determine if Skill-Required Weapon Is Equipped


Returns:

  • (Boolean)


275
276
277
278
279
280
281
282
# File 'Game_Actor.rb', line 275

def skill_wtype_ok?(skill)
  wtype_id1 = skill.required_wtype_id1
  wtype_id2 = skill.required_wtype_id2
  return true if wtype_id1 == 0 && wtype_id2 == 0
  return true if wtype_id1 > 0 && wtype_equipped?(wtype_id1)
  return true if wtype_id2 > 0 && wtype_equipped?(wtype_id2)
  return false
end

- (Object) skills


  • Get Skill Object Array




341
342
343
# File 'Game_Actor.rb', line 341

def skills
  (@skills | added_skills).sort.collect {|id| $data_skills[id] }
end

- (Object) slot_list(etype_id)


  • Convert from Equipment Type to List of Slot IDs




136
137
138
139
140
# File 'Game_Actor.rb', line 136

def slot_list(etype_id)
  result = []
  equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
  result
end

- (Object) steps_for_turn


  • Number of Steps Regarded as One Turn in Battle




623
624
625
# File 'Game_Actor.rb', line 623

def steps_for_turn
  return 20
end

- (Object) trade_item_with_party(new_item, old_item)


  • Trade Item with Party

    new_item:  Item to get from party
    old_item:  Item to give to party



208
209
210
211
212
213
# File 'Game_Actor.rb', line 208

def trade_item_with_party(new_item, old_item)
  return false if new_item && !$game_party.has_item?(new_item)
  $game_party.gain_item(old_item, 1)
  $game_party.lose_item(new_item, 1)
  return true
end

- (Object) turn_end_on_map


  • End of Turn Processing on Map Screen




629
630
631
632
633
634
# File 'Game_Actor.rb', line 629

def turn_end_on_map
  if $game_party.steps % steps_for_turn == 0
    on_turn_end
    perform_map_damage_effect if @result.hp_damage > 0
  end
end

- (Object) update_state_steps(state)


  • Update Step Count for State




598
599
600
601
602
603
# File 'Game_Actor.rb', line 598

def update_state_steps(state)
  if state.remove_by_walking
    @state_steps[state.id] -= 1 if @state_steps[state.id] > 0
    remove_state(state.id) if @state_steps[state.id] == 0
  end
end

- (Object) usable_skills


  • Get Array of Currently Usable Skills




347
348
349
# File 'Game_Actor.rb', line 347

def usable_skills
  skills.select {|skill| usable?(skill) }
end

- (Boolean) use_sprite?


  • Use Sprites?


Returns:

  • (Boolean)


524
525
526
# File 'Game_Actor.rb', line 524

def use_sprite?
  return false
end

- (Object) weapons


  • Get Weapon Object Array




158
159
160
# File 'Game_Actor.rb', line 158

def weapons
  @equips.select {|item| item.is_weapon? }.collect {|item| item.object }
end

- (Boolean) wtype_equipped?(wtype_id)


  • Determine if Specific Type of Weapon Is Equipped


Returns:

  • (Boolean)


286
287
288
# File 'Game_Actor.rb', line 286

def wtype_equipped?(wtype_id)
  weapons.any? {|weapon| weapon.wtype_id == wtype_id }
end