Class: Game_BattlerBase

Inherits:
Object
  • Object
show all
Defined in:
Game_BattlerBase.rb

Overview

** Game_BattlerBase


This base class handles battlers. It mainly contains methods for calculating

parameters. It is used as a super class of the Game_Battler class.

Direct Known Subclasses

Game_Battler

Constant Summary

FEATURE_ELEMENT_RATE =

  • Constants (Features)


11
FEATURE_DEBUFF_RATE =

Element Rate

12
FEATURE_STATE_RATE =

Debuff Rate

13
FEATURE_STATE_RESIST =

State Rate

14
FEATURE_PARAM =

State Resist

21
FEATURE_XPARAM =

Parameter

22
FEATURE_SPARAM =

Ex-Parameter

23
FEATURE_ATK_ELEMENT =

Sp-Parameter

31
FEATURE_ATK_STATE =

Atk Element

32
FEATURE_ATK_SPEED =

Atk State

33
FEATURE_ATK_TIMES =

Atk Speed

34
FEATURE_STYPE_ADD =

Atk Times+

41
FEATURE_STYPE_SEAL =

Add Skill Type

42
FEATURE_SKILL_ADD =

Disable Skill Type

43
FEATURE_SKILL_SEAL =

Add Skill

44
FEATURE_EQUIP_WTYPE =

Disable Skill

51
FEATURE_EQUIP_ATYPE =

Equip Weapon

52
FEATURE_EQUIP_FIX =

Equip Armor

53
FEATURE_EQUIP_SEAL =

Lock Equip

54
FEATURE_SLOT_TYPE =

Seal Equip

55
FEATURE_ACTION_PLUS =

Slot Type

61
FEATURE_SPECIAL_FLAG =

Action Times+

62
FEATURE_COLLAPSE_TYPE =

Special Flag

63
FEATURE_PARTY_ABILITY =

Collapse Effect

64
FLAG_ID_AUTO_BATTLE =

  • Constants (Feature Flags)


0
FLAG_ID_GUARD =

auto battle

1
FLAG_ID_SUBSTITUTE =

guard

2
FLAG_ID_PRESERVE_TP =

substitute

3
ICON_BUFF_START =

  • Constants (Starting Number of Buff/Debuff Icons)


64
ICON_DEBUFF_START =

buff (16 icons)

80

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Game_BattlerBase) initialize


  • Object Initialization




88
89
90
91
92
93
94
# File 'Game_BattlerBase.rb', line 88

def initialize
  @hp = @mp = @tp = 0
  @hidden = false
  clear_param_plus
  clear_states
  clear_buffs
end

Instance Attribute Details

- (Object) hp


  • Public Instance Variables




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

def hp
  @hp
end

- (Object) mp

MP



52
53
54
# File 'Game_BattlerBase.rb', line 52

def mp
  @mp
end

- (Object) tp

TP



53
54
55
# File 'Game_BattlerBase.rb', line 53

def tp
  @tp
end

Instance Method Details

- (Object) action_plus_set


  • Get Array of Additional Action Time Probabilities




407
408
409
# File 'Game_BattlerBase.rb', line 407

def action_plus_set
  features(FEATURE_ACTION_PLUS).collect {|ft| ft.value }
end

- (Boolean) actor?


  • Determine if Actor or Not


Returns:

  • (Boolean)


601
602
603
# File 'Game_BattlerBase.rb', line 601

def actor?
  return false
end

- (Object) add_param(param_id, value)


  • Increase Parameter




455
456
457
458
# File 'Game_BattlerBase.rb', line 455

def add_param(param_id, value)
  @param_plus[param_id] += value
  refresh
end

- (Object) added_skill_types


  • Get Added Skill Types




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

def added_skill_types
  features_set(FEATURE_STYPE_ADD)
end

- (Object) added_skills


  • Get Added Skills




359
360
361
# File 'Game_BattlerBase.rb', line 359

def added_skills
  features_set(FEATURE_SKILL_ADD)
end

- (Object) agi

AGI AGIlity



63
# File 'Game_BattlerBase.rb', line 63

def agi;  param(6);   end

- (Boolean) alive?


  • Determine Survival


Returns:

  • (Boolean)


565
566
567
# File 'Game_BattlerBase.rb', line 565

def alive?
  exist? && !death_state?
end

- (Object) all_features


  • Get Array of All Feature Objects




186
187
188
# File 'Game_BattlerBase.rb', line 186

def all_features
  feature_objects.inject([]) {|r, obj| r + obj.features }
end

- (Object) appear


  • Appear




541
542
543
# File 'Game_BattlerBase.rb', line 541

def appear
  @hidden = false
end

- (Object) atk

ATK ATtacK power



59
# File 'Game_BattlerBase.rb', line 59

def atk;  param(2);   end

- (Object) atk_elements


  • Get Attack Element




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

def atk_elements
  features_set(FEATURE_ATK_ELEMENT)
end

- (Object) atk_speed


  • Get Attack Speed




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

def atk_speed
  features_sum_all(FEATURE_ATK_SPEED)
end

- (Object) atk_states


  • Get Attack State




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

def atk_states
  features_set(FEATURE_ATK_STATE)
end

- (Object) atk_states_rate(state_id)


  • Get Attack State Invocation Rate




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

def atk_states_rate(state_id)
  features_sum(FEATURE_ATK_STATE, state_id)
end

- (Object) atk_times_add


  • Get Additional Attack Times




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

def atk_times_add
  [features_sum_all(FEATURE_ATK_TIMES), 0].max
end

- (Object) attack_skill_id


  • Get Skill ID of Normal Attack




710
711
712
# File 'Game_BattlerBase.rb', line 710

def attack_skill_id
  return 1
end

- (Boolean) attack_usable?


  • Determine Usability of Normal Attack


Returns:

  • (Boolean)


722
723
724
# File 'Game_BattlerBase.rb', line 722

def attack_usable?
  usable?($data_skills[attack_skill_id])
end

- (Boolean) auto_battle?


  • Determine if Auto Battle


Returns:

  • (Boolean)


431
432
433
# File 'Game_BattlerBase.rb', line 431

def auto_battle?
  special_flag(FLAG_ID_AUTO_BATTLE)
end

- (Object) buff_icon_index(buff_level, param_id)


  • Get Icon Number Corresponding to Buff/Debuff




168
169
170
171
172
173
174
175
176
# File 'Game_BattlerBase.rb', line 168

def buff_icon_index(buff_level, param_id)
  if buff_level > 0
    return ICON_BUFF_START + (buff_level - 1) * 8 + param_id
  elsif buff_level < 0
    return ICON_DEBUFF_START + (-buff_level - 1) * 8 + param_id 
  else
    return 0
  end
end

- (Object) buff_icons


  • Get Current Buffs/Debuffs as an Array of Icon Numbers




159
160
161
162
163
164
# File 'Game_BattlerBase.rb', line 159

def buff_icons
  icons = []
  @buffs.each_with_index {|lv, i| icons.push(buff_icon_index(lv, i)) }
  icons.delete(0)
  icons
end

- (Object) cev

CEV Critical EVasion rate



68
# File 'Game_BattlerBase.rb', line 68

def cev;  xparam(3);  end

- (Object) change_hp(value, enable_death)


  • Change HP (for Events)

    value:         Amount of increase/decrease
    enable_death:  Allow knockout



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

def change_hp(value, enable_death)
  if !enable_death && @hp + value <= 0
    self.hp = 1
  else
    self.hp += value
  end
end

- (Object) clear_buffs


  • Clear Buff Information




120
121
122
123
# File 'Game_BattlerBase.rb', line 120

def clear_buffs
  @buffs = Array.new(8) { 0 }
  @buff_turns = {}
end

- (Object) clear_param_plus


  • Clear Values Added to Parameter




98
99
100
# File 'Game_BattlerBase.rb', line 98

def clear_param_plus
  @param_plus = [0] * 8
end

- (Object) clear_states


  • Clear State Information




104
105
106
107
108
# File 'Game_BattlerBase.rb', line 104

def clear_states
  @states = []
  @state_turns = {}
  @state_steps = {}
end

- (Object) cnt

CNT CouNTer attack rate



71
# File 'Game_BattlerBase.rb', line 71

def cnt;  xparam(6);  end

- (Object) collapse_type


  • Get Collapse Effect




419
420
421
# File 'Game_BattlerBase.rb', line 419

def collapse_type
  features_set(FEATURE_COLLAPSE_TYPE).max || 0
end

- (Boolean) confusion?


  • Determine if Character is Confused


Returns:

  • (Boolean)


589
590
591
# File 'Game_BattlerBase.rb', line 589

def confusion?
  exist? && restriction >= 1 && restriction <= 3
end

- (Object) confusion_level


  • Get Confusion Level




595
596
597
# File 'Game_BattlerBase.rb', line 595

def confusion_level
  confusion? ? restriction : 0
end

- (Object) cri

CRI CRItical rate



67
# File 'Game_BattlerBase.rb', line 67

def cri;  xparam(2);  end

- (Boolean) dead?


  • Determine Incapacitation


Returns:

  • (Boolean)


559
560
561
# File 'Game_BattlerBase.rb', line 559

def dead?
  exist? && death_state?
end

- (Boolean) death_state?


  • Check K.O. State


Returns:

  • (Boolean)


133
134
135
# File 'Game_BattlerBase.rb', line 133

def death_state?
  state?(death_state_id)
end

- (Object) death_state_id


  • Get State ID of K.O.




139
140
141
# File 'Game_BattlerBase.rb', line 139

def death_state_id
  return 1
end

- (Object) debuff_rate(param_id)


  • Get Debuff Rate




293
294
295
# File 'Game_BattlerBase.rb', line 293

def debuff_rate(param_id)
  features_pi(FEATURE_DEBUFF_RATE, param_id)
end

- (Object) def

DEF DEFense power



60
# File 'Game_BattlerBase.rb', line 60

def def;  param(3);   end

- (Boolean) dual_wield?


  • Determine if Dual Wield


Returns:

  • (Boolean)


401
402
403
# File 'Game_BattlerBase.rb', line 401

def dual_wield?
  slot_type == 1
end

- (Object) element_rate(element_id)


  • Get Element Rate




287
288
289
# File 'Game_BattlerBase.rb', line 287

def element_rate(element_id)
  features_pi(FEATURE_ELEMENT_RATE, element_id)
end

- (Boolean) enemy?


  • Determine if Enemy


Returns:

  • (Boolean)


607
608
609
# File 'Game_BattlerBase.rb', line 607

def enemy?
  return false
end

- (Boolean) equip_atype_ok?(atype_id)


  • Determine if Armor Can Be Equipped


Returns:

  • (Boolean)


377
378
379
# File 'Game_BattlerBase.rb', line 377

def equip_atype_ok?(atype_id)
  features_set(FEATURE_EQUIP_ATYPE).include?(atype_id)
end

- (Boolean) equip_type_fixed?(etype_id)


  • Determine if Equipment Is Locked


Returns:

  • (Boolean)


383
384
385
# File 'Game_BattlerBase.rb', line 383

def equip_type_fixed?(etype_id)
  features_set(FEATURE_EQUIP_FIX).include?(etype_id)
end

- (Boolean) equip_type_sealed?(etype_id)


  • Determine if Equipment Is Sealed


Returns:

  • (Boolean)


389
390
391
# File 'Game_BattlerBase.rb', line 389

def equip_type_sealed?(etype_id)
  features_set(FEATURE_EQUIP_SEAL).include?(etype_id)
end

- (Boolean) equip_wtype_ok?(wtype_id)


  • Determine if Weapon Can Be Equipped


Returns:

  • (Boolean)


371
372
373
# File 'Game_BattlerBase.rb', line 371

def equip_wtype_ok?(wtype_id)
  features_set(FEATURE_EQUIP_WTYPE).include?(wtype_id)
end

- (Boolean) equippable?(item)


  • Determine if Equippable


Returns:

  • (Boolean)


700
701
702
703
704
705
706
# File 'Game_BattlerBase.rb', line 700

def equippable?(item)
  return false unless item.is_a?(RPG::EquipItem)
  return false if equip_type_sealed?(item.etype_id)
  return equip_wtype_ok?(item.wtype_id) if item.is_a?(RPG::Weapon)
  return equip_atype_ok?(item.atype_id) if item.is_a?(RPG::Armor)
  return false
end

- (Object) erase_state(state_id)


  • Erase States




112
113
114
115
116
# File 'Game_BattlerBase.rb', line 112

def erase_state(state_id)
  @states.delete(state_id)
  @state_turns.delete(state_id)
  @state_steps.delete(state_id)
end

- (Object) eva

EVA EVAsion rate



66
# File 'Game_BattlerBase.rb', line 66

def eva;  xparam(1);  end

- (Boolean) exist?


  • Determine Existence


Returns:

  • (Boolean)


553
554
555
# File 'Game_BattlerBase.rb', line 553

def exist?
  !hidden?
end

- (Object) exr

EXR EXperience Rate



84
# File 'Game_BattlerBase.rb', line 84

def exr;  sparam(9);  end

- (Object) fdr

FDR Floor Damage Rate



83
# File 'Game_BattlerBase.rb', line 83

def fdr;  sparam(8);  end

- (Object) feature_objects


  • Get Array of All Objects Retaining Features




180
181
182
# File 'Game_BattlerBase.rb', line 180

def feature_objects
  states
end

- (Object) features(code)


  • Get Feature Object Array (Feature Codes Limited)




192
193
194
# File 'Game_BattlerBase.rb', line 192

def features(code)
  all_features.select {|ft| ft.code == code }
end

- (Object) features_pi(code, id)


  • Calculate Complement of Feature Values




204
205
206
# File 'Game_BattlerBase.rb', line 204

def features_pi(code, id)
  features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value }
end

- (Object) features_set(code)


  • Calculate Set Sum of Features




222
223
224
# File 'Game_BattlerBase.rb', line 222

def features_set(code)
  features(code).inject([]) {|r, ft| r |= [ft.data_id] }
end

- (Object) features_sum(code, id)


  • Calculate Sum of Feature Values (Specify Data ID)




210
211
212
# File 'Game_BattlerBase.rb', line 210

def features_sum(code, id)
  features_with_id(code, id).inject(0.0) {|r, ft| r += ft.value }
end

- (Object) features_sum_all(code)


  • Calculate Sum of Feature Values (Data ID Unspecified)




216
217
218
# File 'Game_BattlerBase.rb', line 216

def features_sum_all(code)
  features(code).inject(0.0) {|r, ft| r += ft.value }
end

- (Object) features_with_id(code, id)


  • Get Feature Object Array (Feature Codes and Data IDs Limited)




198
199
200
# File 'Game_BattlerBase.rb', line 198

def features_with_id(code, id)
  all_features.select {|ft| ft.code == code && ft.data_id == id }
end

- (Object) grd

GRD GuaRD effect rate



76
# File 'Game_BattlerBase.rb', line 76

def grd;  sparam(1);  end

- (Boolean) guard?


  • Determine if Guard


Returns:

  • (Boolean)


437
438
439
# File 'Game_BattlerBase.rb', line 437

def guard?
  special_flag(FLAG_ID_GUARD) && movable?
end

- (Object) guard_skill_id


  • Get Skill ID of Guard




716
717
718
# File 'Game_BattlerBase.rb', line 716

def guard_skill_id
  return 2
end

- (Boolean) guard_usable?


  • Determine Usability of Guard


Returns:

  • (Boolean)


728
729
730
# File 'Game_BattlerBase.rb', line 728

def guard_usable?
  usable?($data_skills[guard_skill_id])
end

- (Boolean) hidden?


  • Get Hide State


Returns:

  • (Boolean)


547
548
549
# File 'Game_BattlerBase.rb', line 547

def hidden?
  @hidden
end

- (Object) hide


  • Hide




535
536
537
# File 'Game_BattlerBase.rb', line 535

def hide
  @hidden = true
end

- (Object) hit

HIT HIT rate



65
# File 'Game_BattlerBase.rb', line 65

def hit;  xparam(0);  end

- (Object) hp_rate


  • Get Percentage of HP




517
518
519
# File 'Game_BattlerBase.rb', line 517

def hp_rate
  @hp.to_f / mhp
end

- (Object) hrg

HRG Hp ReGeneration rate



72
# File 'Game_BattlerBase.rb', line 72

def hrg;  xparam(7);  end

- (Boolean) inputable?


  • Determine if Command is Inputable


Returns:

  • (Boolean)


577
578
579
# File 'Game_BattlerBase.rb', line 577

def inputable?
  normal? && !auto_battle?
end

- (Boolean) item_conditions_met?(item)


  • Check Usability Conditions for Item


Returns:

  • (Boolean)


686
687
688
# File 'Game_BattlerBase.rb', line 686

def item_conditions_met?(item)
  usable_item_conditions_met?(item) && $game_party.has_item?(item)
end

- (Object) luk

LUK LUcK



64
# File 'Game_BattlerBase.rb', line 64

def luk;  param(7);   end

- (Object) mat

MAT Magic ATtack power



61
# File 'Game_BattlerBase.rb', line 61

def mat;  param(4);   end

- (Object) max_tp


  • Get Maximum Value of TP




494
495
496
# File 'Game_BattlerBase.rb', line 494

def max_tp
  return 100
end

- (Object) mcr

MCR Mp Cost Rate



79
# File 'Game_BattlerBase.rb', line 79

def mcr;  sparam(4);  end

- (Object) mdf

MDF Magic DeFense power



62
# File 'Game_BattlerBase.rb', line 62

def mdf;  param(5);   end

- (Object) mdr

MDR Magical Damage Rate



82
# File 'Game_BattlerBase.rb', line 82

def mdr;  sparam(7);  end

- (Object) mev

MEV Magic EVasion rate



69
# File 'Game_BattlerBase.rb', line 69

def mev;  xparam(4);  end

- (Object) mhp


  • Access Method by Parameter Abbreviations




57
# File 'Game_BattlerBase.rb', line 57

def mhp;  param(0);   end

- (Object) mmp

MMP Maximum Magic Points



58
# File 'Game_BattlerBase.rb', line 58

def mmp;  param(1);   end

- (Object) most_important_state_text


  • Get Most Important State Continuation Message




628
629
630
631
# File 'Game_BattlerBase.rb', line 628

def most_important_state_text
  states.each {|state| return state.message3 unless state.message3.empty? }
  return ""
end

- (Boolean) movable?


  • Determine if Action is Possible


Returns:

  • (Boolean)


583
584
585
# File 'Game_BattlerBase.rb', line 583

def movable?
  exist? && restriction < 4
end

- (Object) mp_rate


  • Get Percentage of MP




523
524
525
# File 'Game_BattlerBase.rb', line 523

def mp_rate
  mmp > 0 ? @mp.to_f / mmp : 0
end

- (Object) mrf

MRF Magic ReFlection rate



70
# File 'Game_BattlerBase.rb', line 70

def mrf;  xparam(5);  end

- (Object) mrg

MRG Mp ReGeneration rate



73
# File 'Game_BattlerBase.rb', line 73

def mrg;  xparam(8);  end

- (Boolean) normal?


  • Determine Normality


Returns:

  • (Boolean)


571
572
573
# File 'Game_BattlerBase.rb', line 571

def normal?
  exist? && restriction == 0
end

- (Boolean) occasion_ok?(item)


  • Check When Skill/Item Can Be Used


Returns:

  • (Boolean)


666
667
668
# File 'Game_BattlerBase.rb', line 666

def occasion_ok?(item)
  $game_party.in_battle ? item.battle_ok? : item.menu_ok?
end

- (Object) param(param_id)


  • Get Parameter




267
268
269
270
271
# File 'Game_BattlerBase.rb', line 267

def param(param_id)
  value = param_base(param_id) + param_plus(param_id)
  value *= param_rate(param_id) * param_buff_rate(param_id)
  [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end

- (Object) param_base(param_id)


  • Get Base Value of Parameter




228
229
230
# File 'Game_BattlerBase.rb', line 228

def param_base(param_id)
  return 0
end

- (Object) param_buff_rate(param_id)


  • Get Rate of Change Due to Parameter Buff/Debuff




261
262
263
# File 'Game_BattlerBase.rb', line 261

def param_buff_rate(param_id)
  @buffs[param_id] * 0.25 + 1.0
end

- (Object) param_max(param_id)


  • Get Maximum Value of Parameter




247
248
249
250
251
# File 'Game_BattlerBase.rb', line 247

def param_max(param_id)
  return 999999 if param_id == 0  # MHP
  return 9999   if param_id == 1  # MMP
  return 999
end

- (Object) param_min(param_id)


  • Get Reduced Value of Parameter




240
241
242
243
# File 'Game_BattlerBase.rb', line 240

def param_min(param_id)
  return 0 if param_id == 1  # MMP
  return 1
end

- (Object) param_plus(param_id)


  • Get Added Value of Parameter




234
235
236
# File 'Game_BattlerBase.rb', line 234

def param_plus(param_id)
  @param_plus[param_id]
end

- (Object) param_rate(param_id)


  • Get Rate of Parameter Change




255
256
257
# File 'Game_BattlerBase.rb', line 255

def param_rate(param_id)
  features_pi(FEATURE_PARAM, param_id)
end

- (Object) party_ability(ability_id)


  • Determine Party Ability




425
426
427
# File 'Game_BattlerBase.rb', line 425

def party_ability(ability_id)
  features(FEATURE_PARTY_ABILITY).any? {|ft| ft.data_id == ability_id }
end

- (Object) pay_skill_cost(skill)


  • Pay Cost of Using Skill




659
660
661
662
# File 'Game_BattlerBase.rb', line 659

def pay_skill_cost(skill)
  self.mp -= skill_mp_cost(skill)
  self.tp -= skill_tp_cost(skill)
end

- (Object) pdr

PDR Physical Damage Rate



81
# File 'Game_BattlerBase.rb', line 81

def pdr;  sparam(6);  end

- (Object) pha

PHA PHArmacology



78
# File 'Game_BattlerBase.rb', line 78

def pha;  sparam(3);  end

- (Boolean) preserve_tp?


  • Determine if Preserve TP


Returns:

  • (Boolean)


449
450
451
# File 'Game_BattlerBase.rb', line 449

def preserve_tp?
  special_flag(FLAG_ID_PRESERVE_TP)
end

- (Object) rec

REC RECovery effect rate



77
# File 'Game_BattlerBase.rb', line 77

def rec;  sparam(2);  end

- (Object) recover_all


  • Recover All




509
510
511
512
513
# File 'Game_BattlerBase.rb', line 509

def recover_all
  clear_states
  @hp = mhp
  @mp = mmp
end

- (Object) refresh


  • Refresh




500
501
502
503
504
505
# File 'Game_BattlerBase.rb', line 500

def refresh
  state_resist_set.each {|state_id| erase_state(state_id) }
  @hp = [[@hp, mhp].min, 0].max
  @mp = [[@mp, mmp].min, 0].max
  @hp == 0 ? add_state(death_state_id) : remove_state(death_state_id)
end

- (Object) restriction


  • Get Restriction

    Get the largest restriction from the currently added states.



622
623
624
# File 'Game_BattlerBase.rb', line 622

def restriction
  states.collect {|state| state.restriction }.push(0).max
end

- (Boolean) skill_conditions_met?(skill)


  • Check Usability Conditions for Skill


Returns:

  • (Boolean)


678
679
680
681
682
# File 'Game_BattlerBase.rb', line 678

def skill_conditions_met?(skill)
  usable_item_conditions_met?(skill) &&
  skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&
  !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)
end

- (Boolean) skill_cost_payable?(skill)


  • Determine if Cost of Using Skill Can Be Paid


Returns:

  • (Boolean)


653
654
655
# File 'Game_BattlerBase.rb', line 653

def skill_cost_payable?(skill)
  tp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill)
end

- (Object) skill_mp_cost(skill)


  • Calculate Skill's MP Cost




641
642
643
# File 'Game_BattlerBase.rb', line 641

def skill_mp_cost(skill)
  (skill.mp_cost * mcr).to_i
end

- (Boolean) skill_sealed?(skill_id)


  • Determine if Skill Is Disabled


Returns:

  • (Boolean)


365
366
367
# File 'Game_BattlerBase.rb', line 365

def skill_sealed?(skill_id)
  features_set(FEATURE_SKILL_SEAL).include?(skill_id)
end

- (Object) skill_tp_cost(skill)


  • Calculate Skill's TP Cost




647
648
649
# File 'Game_BattlerBase.rb', line 647

def skill_tp_cost(skill)
  skill.tp_cost
end

- (Boolean) skill_type_sealed?(stype_id)


  • Determine if Skill Type Is Disabled


Returns:

  • (Boolean)


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

def skill_type_sealed?(stype_id)
  features_set(FEATURE_STYPE_SEAL).include?(stype_id)
end

- (Boolean) skill_wtype_ok?(skill)


  • Determine if Skill-Required Weapon Is Equipped


Returns:

  • (Boolean)


635
636
637
# File 'Game_BattlerBase.rb', line 635

def skill_wtype_ok?(skill)
  return true
end

- (Object) slot_type


  • Get Slot Type




395
396
397
# File 'Game_BattlerBase.rb', line 395

def slot_type
  features_set(FEATURE_SLOT_TYPE).max || 0
end

- (Object) sort_states


  • Sorting States

    Sort the content of the @states array, with higher priority states
    coming first.



615
616
617
# File 'Game_BattlerBase.rb', line 615

def sort_states
  @states = @states.sort_by {|id| [-$data_states[id].priority, id] }
end

- (Object) sparam(sparam_id)


  • Get Sp-Parameter




281
282
283
# File 'Game_BattlerBase.rb', line 281

def sparam(sparam_id)
  features_pi(FEATURE_SPARAM, sparam_id)
end

- (Object) special_flag(flag_id)


  • Determine if Special Flag




413
414
415
# File 'Game_BattlerBase.rb', line 413

def special_flag(flag_id)
  features(FEATURE_SPECIAL_FLAG).any? {|ft| ft.data_id == flag_id }
end

- (Boolean) state?(state_id)


  • Check State


Returns:

  • (Boolean)


127
128
129
# File 'Game_BattlerBase.rb', line 127

def state?(state_id)
  @states.include?(state_id)
end

- (Object) state_icons


  • Get Current States as an Array of Icon Numbers




151
152
153
154
155
# File 'Game_BattlerBase.rb', line 151

def state_icons
  icons = states.collect {|state| state.icon_index }
  icons.delete(0)
  icons
end

- (Object) state_rate(state_id)


  • Get State Rate




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

def state_rate(state_id)
  features_pi(FEATURE_STATE_RATE, state_id)
end

- (Boolean) state_resist?(state_id)


  • Determine if State Is Resisted


Returns:

  • (Boolean)


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

def state_resist?(state_id)
  state_resist_set.include?(state_id)
end

- (Object) state_resist_set


  • Get Array of States to Resist




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

def state_resist_set
  features_set(FEATURE_STATE_RESIST)
end

- (Object) states


  • Get Current States as an Object Array




145
146
147
# File 'Game_BattlerBase.rb', line 145

def states
  @states.collect {|id| $data_states[id] }
end

- (Boolean) substitute?


  • Determine if Substitute


Returns:

  • (Boolean)


443
444
445
# File 'Game_BattlerBase.rb', line 443

def substitute?
  special_flag(FLAG_ID_SUBSTITUTE) && movable?
end

- (Object) tcr

TCR Tp Charge Rate



80
# File 'Game_BattlerBase.rb', line 80

def tcr;  sparam(5);  end

- (Object) tgr

TGR TarGet Rate



75
# File 'Game_BattlerBase.rb', line 75

def tgr;  sparam(0);  end

- (Object) tp_rate


  • Get Percentage of TP




529
530
531
# File 'Game_BattlerBase.rb', line 529

def tp_rate
  @tp.to_f / 100
end

- (Object) trg

TRG Tp ReGeneration rate



74
# File 'Game_BattlerBase.rb', line 74

def trg;  xparam(9);  end

- (Boolean) usable?(item)


  • Determine Skill/Item Usability


Returns:

  • (Boolean)


692
693
694
695
696
# File 'Game_BattlerBase.rb', line 692

def usable?(item)
  return skill_conditions_met?(item) if item.is_a?(RPG::Skill)
  return item_conditions_met?(item)  if item.is_a?(RPG::Item)
  return false
end

- (Boolean) usable_item_conditions_met?(item)


  • Check Common Usability Conditions for Skill/Item


Returns:

  • (Boolean)


672
673
674
# File 'Game_BattlerBase.rb', line 672

def usable_item_conditions_met?(item)
  movable? && occasion_ok?(item)
end

- (Object) xparam(xparam_id)


  • Get Ex-Parameter




275
276
277
# File 'Game_BattlerBase.rb', line 275

def xparam(xparam_id)
  features_sum(FEATURE_XPARAM, xparam_id)
end