Class: Game_BattlerBase
- Inherits:
-
Object
- Object
- Game_BattlerBase
- Defined in:
- lib/rgss3_default_scripts/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
Constant Summary collapse
- 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
-
#hp ⇒ Object
————————————————————————– * Public Instance Variables ————————————————————————–.
-
#mp ⇒ Object
MP.
-
#tp ⇒ Object
TP.
Instance Method Summary collapse
-
#action_plus_set ⇒ Object
————————————————————————– * Get Array of Additional Action Time Probabilities ————————————————————————–.
-
#actor? ⇒ Boolean
————————————————————————– * Determine if Actor or Not ————————————————————————–.
-
#add_param(param_id, value) ⇒ Object
————————————————————————– * Increase Parameter ————————————————————————–.
-
#added_skill_types ⇒ Object
————————————————————————– * Get Added Skill Types ————————————————————————–.
-
#added_skills ⇒ Object
————————————————————————– * Get Added Skills ————————————————————————–.
-
#agi ⇒ Object
AGI AGIlity.
-
#alive? ⇒ Boolean
————————————————————————– * Determine Survival ————————————————————————–.
-
#all_features ⇒ Object
————————————————————————– * Get Array of All Feature Objects ————————————————————————–.
-
#appear ⇒ Object
————————————————————————– * Appear ————————————————————————–.
-
#atk ⇒ Object
ATK ATtacK power.
-
#atk_elements ⇒ Object
————————————————————————– * Get Attack Element ————————————————————————–.
-
#atk_speed ⇒ Object
————————————————————————– * Get Attack Speed ————————————————————————–.
-
#atk_states ⇒ Object
————————————————————————– * Get Attack State ————————————————————————–.
-
#atk_states_rate(state_id) ⇒ Object
————————————————————————– * Get Attack State Invocation Rate ————————————————————————–.
-
#atk_times_add ⇒ Object
————————————————————————– * Get Additional Attack Times ————————————————————————–.
-
#attack_skill_id ⇒ Object
————————————————————————– * Get Skill ID of Normal Attack ————————————————————————–.
-
#attack_usable? ⇒ Boolean
————————————————————————– * Determine Usability of Normal Attack ————————————————————————–.
-
#auto_battle? ⇒ Boolean
————————————————————————– * Determine if Auto Battle ————————————————————————–.
-
#buff_icon_index(buff_level, param_id) ⇒ Object
————————————————————————– * Get Icon Number Corresponding to Buff/Debuff ————————————————————————–.
-
#buff_icons ⇒ Object
————————————————————————– * Get Current Buffs/Debuffs as an Array of Icon Numbers ————————————————————————–.
-
#cev ⇒ Object
CEV Critical EVasion rate.
-
#change_hp(value, enable_death) ⇒ Object
————————————————————————– * Change HP (for Events) value: Amount of increase/decrease enable_death: Allow knockout ————————————————————————–.
-
#clear_buffs ⇒ Object
————————————————————————– * Clear Buff Information ————————————————————————–.
-
#clear_param_plus ⇒ Object
————————————————————————– * Clear Values Added to Parameter ————————————————————————–.
-
#clear_states ⇒ Object
————————————————————————– * Clear State Information ————————————————————————–.
-
#cnt ⇒ Object
CNT CouNTer attack rate.
-
#collapse_type ⇒ Object
————————————————————————– * Get Collapse Effect ————————————————————————–.
-
#confusion? ⇒ Boolean
————————————————————————– * Determine if Character is Confused ————————————————————————–.
-
#confusion_level ⇒ Object
————————————————————————– * Get Confusion Level ————————————————————————–.
-
#cri ⇒ Object
CRI CRItical rate.
-
#dead? ⇒ Boolean
————————————————————————– * Determine Incapacitation ————————————————————————–.
-
#death_state? ⇒ Boolean
————————————————————————– * Check K.O.
-
#death_state_id ⇒ Object
————————————————————————– * Get State ID of K.O.
-
#debuff_rate(param_id) ⇒ Object
————————————————————————– * Get Debuff Rate ————————————————————————–.
-
#def ⇒ Object
DEF DEFense power.
-
#dual_wield? ⇒ Boolean
————————————————————————– * Determine if Dual Wield ————————————————————————–.
-
#element_rate(element_id) ⇒ Object
————————————————————————– * Get Element Rate ————————————————————————–.
-
#enemy? ⇒ Boolean
————————————————————————– * Determine if Enemy ————————————————————————–.
-
#equip_atype_ok?(atype_id) ⇒ Boolean
————————————————————————– * Determine if Armor Can Be Equipped ————————————————————————–.
-
#equip_type_fixed?(etype_id) ⇒ Boolean
————————————————————————– * Determine if Equipment Is Locked ————————————————————————–.
-
#equip_type_sealed?(etype_id) ⇒ Boolean
————————————————————————– * Determine if Equipment Is Sealed ————————————————————————–.
-
#equip_wtype_ok?(wtype_id) ⇒ Boolean
————————————————————————– * Determine if Weapon Can Be Equipped ————————————————————————–.
-
#equippable?(item) ⇒ Boolean
————————————————————————– * Determine if Equippable ————————————————————————–.
-
#erase_state(state_id) ⇒ Object
————————————————————————– * Erase States ————————————————————————–.
-
#eva ⇒ Object
EVA EVAsion rate.
-
#exist? ⇒ Boolean
————————————————————————– * Determine Existence ————————————————————————–.
-
#exr ⇒ Object
EXR EXperience Rate.
-
#fdr ⇒ Object
FDR Floor Damage Rate.
-
#feature_objects ⇒ Object
————————————————————————– * Get Array of All Objects Retaining Features ————————————————————————–.
-
#features(code) ⇒ Object
————————————————————————– * Get Feature Object Array (Feature Codes Limited) ————————————————————————–.
-
#features_pi(code, id) ⇒ Object
————————————————————————– * Calculate Complement of Feature Values ————————————————————————–.
-
#features_set(code) ⇒ Object
————————————————————————– * Calculate Set Sum of Features ————————————————————————–.
-
#features_sum(code, id) ⇒ Object
————————————————————————– * Calculate Sum of Feature Values (Specify Data ID) ————————————————————————–.
-
#features_sum_all(code) ⇒ Object
————————————————————————– * Calculate Sum of Feature Values (Data ID Unspecified) ————————————————————————–.
-
#features_with_id(code, id) ⇒ Object
————————————————————————– * Get Feature Object Array (Feature Codes and Data IDs Limited) ————————————————————————–.
-
#grd ⇒ Object
GRD GuaRD effect rate.
-
#guard? ⇒ Boolean
————————————————————————– * Determine if Guard ————————————————————————–.
-
#guard_skill_id ⇒ Object
————————————————————————– * Get Skill ID of Guard ————————————————————————–.
-
#guard_usable? ⇒ Boolean
————————————————————————– * Determine Usability of Guard ————————————————————————–.
-
#hidden? ⇒ Boolean
————————————————————————– * Get Hide State ————————————————————————–.
-
#hide ⇒ Object
————————————————————————– * Hide ————————————————————————–.
-
#hit ⇒ Object
HIT HIT rate.
-
#hp_rate ⇒ Object
————————————————————————– * Get Percentage of HP ————————————————————————–.
-
#hrg ⇒ Object
HRG Hp ReGeneration rate.
-
#initialize ⇒ Game_BattlerBase
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#inputable? ⇒ Boolean
————————————————————————– * Determine if Command is Inputable ————————————————————————–.
-
#item_conditions_met?(item) ⇒ Boolean
————————————————————————– * Check Usability Conditions for Item ————————————————————————–.
-
#luk ⇒ Object
LUK LUcK.
-
#mat ⇒ Object
MAT Magic ATtack power.
-
#max_tp ⇒ Object
————————————————————————– * Get Maximum Value of TP ————————————————————————–.
-
#mcr ⇒ Object
MCR Mp Cost Rate.
-
#mdf ⇒ Object
MDF Magic DeFense power.
-
#mdr ⇒ Object
MDR Magical Damage Rate.
-
#mev ⇒ Object
MEV Magic EVasion rate.
-
#mhp ⇒ Object
————————————————————————– * Access Method by Parameter Abbreviations ————————————————————————–.
-
#mmp ⇒ Object
MMP Maximum Magic Points.
-
#most_important_state_text ⇒ Object
————————————————————————– * Get Most Important State Continuation Message ————————————————————————–.
-
#movable? ⇒ Boolean
————————————————————————– * Determine if Action is Possible ————————————————————————–.
-
#mp_rate ⇒ Object
————————————————————————– * Get Percentage of MP ————————————————————————–.
-
#mrf ⇒ Object
MRF Magic ReFlection rate.
-
#mrg ⇒ Object
MRG Mp ReGeneration rate.
-
#normal? ⇒ Boolean
————————————————————————– * Determine Normality ————————————————————————–.
-
#occasion_ok?(item) ⇒ Boolean
————————————————————————– * Check When Skill/Item Can Be Used ————————————————————————–.
-
#param(param_id) ⇒ Object
————————————————————————– * Get Parameter ————————————————————————–.
-
#param_base(param_id) ⇒ Object
————————————————————————– * Get Base Value of Parameter ————————————————————————–.
-
#param_buff_rate(param_id) ⇒ Object
————————————————————————– * Get Rate of Change Due to Parameter Buff/Debuff ————————————————————————–.
-
#param_max(param_id) ⇒ Object
————————————————————————– * Get Maximum Value of Parameter ————————————————————————–.
-
#param_min(param_id) ⇒ Object
————————————————————————– * Get Reduced Value of Parameter ————————————————————————–.
-
#param_plus(param_id) ⇒ Object
————————————————————————– * Get Added Value of Parameter ————————————————————————–.
-
#param_rate(param_id) ⇒ Object
————————————————————————– * Get Rate of Parameter Change ————————————————————————–.
-
#party_ability(ability_id) ⇒ Object
————————————————————————– * Determine Party Ability ————————————————————————–.
-
#pay_skill_cost(skill) ⇒ Object
————————————————————————– * Pay Cost of Using Skill ————————————————————————–.
-
#pdr ⇒ Object
PDR Physical Damage Rate.
-
#pha ⇒ Object
PHA PHArmacology.
-
#preserve_tp? ⇒ Boolean
————————————————————————– * Determine if Preserve TP ————————————————————————–.
-
#rec ⇒ Object
REC RECovery effect rate.
-
#recover_all ⇒ Object
————————————————————————– * Recover All ————————————————————————–.
-
#refresh ⇒ Object
————————————————————————– * Refresh ————————————————————————–.
-
#restriction ⇒ Object
————————————————————————– * Get Restriction Get the largest restriction from the currently added states.
-
#skill_conditions_met?(skill) ⇒ Boolean
————————————————————————– * Check Usability Conditions for Skill ————————————————————————–.
-
#skill_cost_payable?(skill) ⇒ Boolean
————————————————————————– * Determine if Cost of Using Skill Can Be Paid ————————————————————————–.
-
#skill_mp_cost(skill) ⇒ Object
————————————————————————– * Calculate Skill’s MP Cost ————————————————————————–.
-
#skill_sealed?(skill_id) ⇒ Boolean
————————————————————————– * Determine if Skill Is Disabled ————————————————————————–.
-
#skill_tp_cost(skill) ⇒ Object
————————————————————————– * Calculate Skill’s TP Cost ————————————————————————–.
-
#skill_type_sealed?(stype_id) ⇒ Boolean
————————————————————————– * Determine if Skill Type Is Disabled ————————————————————————–.
-
#skill_wtype_ok?(skill) ⇒ Boolean
————————————————————————– * Determine if Skill-Required Weapon Is Equipped ————————————————————————–.
-
#slot_type ⇒ Object
————————————————————————– * Get Slot Type ————————————————————————–.
-
#sort_states ⇒ Object
————————————————————————– * Sorting States Sort the content of the @states array, with higher priority states coming first.
-
#sparam(sparam_id) ⇒ Object
————————————————————————– * Get Sp-Parameter ————————————————————————–.
-
#special_flag(flag_id) ⇒ Object
————————————————————————– * Determine if Special Flag ————————————————————————–.
-
#state?(state_id) ⇒ Boolean
————————————————————————– * Check State ————————————————————————–.
-
#state_icons ⇒ Object
————————————————————————– * Get Current States as an Array of Icon Numbers ————————————————————————–.
-
#state_rate(state_id) ⇒ Object
————————————————————————– * Get State Rate ————————————————————————–.
-
#state_resist?(state_id) ⇒ Boolean
————————————————————————– * Determine if State Is Resisted ————————————————————————–.
-
#state_resist_set ⇒ Object
————————————————————————– * Get Array of States to Resist ————————————————————————–.
-
#states ⇒ Object
————————————————————————– * Get Current States as an Object Array ————————————————————————–.
-
#substitute? ⇒ Boolean
————————————————————————– * Determine if Substitute ————————————————————————–.
-
#tcr ⇒ Object
TCR Tp Charge Rate.
-
#tgr ⇒ Object
TGR TarGet Rate.
-
#tp_rate ⇒ Object
————————————————————————– * Get Percentage of TP ————————————————————————–.
-
#trg ⇒ Object
TRG Tp ReGeneration rate.
-
#usable?(item) ⇒ Boolean
————————————————————————– * Determine Skill/Item Usability ————————————————————————–.
-
#usable_item_conditions_met?(item) ⇒ Boolean
————————————————————————– * Check Common Usability Conditions for Skill/Item ————————————————————————–.
-
#xparam(xparam_id) ⇒ Object
————————————————————————– * Get Ex-Parameter ————————————————————————–.
Constructor Details
#initialize ⇒ Game_BattlerBase
-
Object Initialization
88 89 90 91 92 93 94 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 88 def initialize @hp = @mp = @tp = 0 @hidden = false clear_param_plus clear_states clear_buffs end |
Instance Attribute Details
#hp ⇒ Object
-
Public Instance Variables
51 52 53 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 51 def hp @hp end |
#mp ⇒ Object
MP
52 53 54 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 52 def mp @mp end |
#tp ⇒ Object
TP
53 54 55 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 53 def tp @tp end |
Instance Method Details
#action_plus_set ⇒ Object
-
Get Array of Additional Action Time Probabilities
407 408 409 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 407 def action_plus_set features(FEATURE_ACTION_PLUS).collect {|ft| ft.value } end |
#actor? ⇒ Boolean
-
Determine if Actor or Not
601 602 603 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 601 def actor? return false end |
#add_param(param_id, value) ⇒ Object
-
Increase Parameter
455 456 457 458 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 455 def add_param(param_id, value) @param_plus[param_id] += value refresh end |
#added_skill_types ⇒ Object
-
Get Added Skill Types
347 348 349 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 347 def added_skill_types features_set(FEATURE_STYPE_ADD) end |
#added_skills ⇒ Object
-
Get Added Skills
359 360 361 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 359 def added_skills features_set(FEATURE_SKILL_ADD) end |
#agi ⇒ Object
AGI AGIlity
63 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 63 def agi; param(6); end |
#alive? ⇒ Boolean
-
Determine Survival
565 566 567 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 565 def alive? exist? && !death_state? end |
#all_features ⇒ Object
-
Get Array of All Feature Objects
186 187 188 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 186 def all_features feature_objects.inject([]) {|r, obj| r + obj.features } end |
#appear ⇒ Object
-
Appear
541 542 543 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 541 def appear @hidden = false end |
#atk ⇒ Object
ATK ATtacK power
59 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 59 def atk; param(2); end |
#atk_elements ⇒ Object
-
Get Attack Element
317 318 319 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 317 def atk_elements features_set(FEATURE_ATK_ELEMENT) end |
#atk_speed ⇒ Object
-
Get Attack Speed
335 336 337 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 335 def atk_speed features_sum_all(FEATURE_ATK_SPEED) end |
#atk_states ⇒ Object
-
Get Attack State
323 324 325 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 323 def atk_states features_set(FEATURE_ATK_STATE) end |
#atk_states_rate(state_id) ⇒ Object
-
Get Attack State Invocation Rate
329 330 331 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 329 def atk_states_rate(state_id) features_sum(FEATURE_ATK_STATE, state_id) end |
#atk_times_add ⇒ Object
-
Get Additional Attack Times
341 342 343 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 341 def atk_times_add [features_sum_all(FEATURE_ATK_TIMES), 0].max end |
#attack_skill_id ⇒ Object
-
Get Skill ID of Normal Attack
710 711 712 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 710 def attack_skill_id return 1 end |
#attack_usable? ⇒ Boolean
-
Determine Usability of Normal Attack
722 723 724 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 722 def attack_usable? usable?($data_skills[attack_skill_id]) end |
#auto_battle? ⇒ Boolean
-
Determine if Auto Battle
431 432 433 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 431 def auto_battle? special_flag(FLAG_ID_AUTO_BATTLE) end |
#buff_icon_index(buff_level, param_id) ⇒ Object
-
Get Icon Number Corresponding to Buff/Debuff
168 169 170 171 172 173 174 175 176 |
# File 'lib/rgss3_default_scripts/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 |
#buff_icons ⇒ Object
-
Get Current Buffs/Debuffs as an Array of Icon Numbers
159 160 161 162 163 164 |
# File 'lib/rgss3_default_scripts/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 |
#cev ⇒ Object
CEV Critical EVasion rate
68 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 68 def cev; xparam(3); end |
#change_hp(value, enable_death) ⇒ Object
-
Change HP (for Events)
value: Amount of increase/decrease enable_death: Allow knockout
478 479 480 481 482 483 484 |
# File 'lib/rgss3_default_scripts/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 |
#clear_buffs ⇒ Object
-
Clear Buff Information
120 121 122 123 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 120 def clear_buffs @buffs = Array.new(8) { 0 } @buff_turns = {} end |
#clear_param_plus ⇒ Object
-
Clear Values Added to Parameter
98 99 100 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 98 def clear_param_plus @param_plus = [0] * 8 end |
#clear_states ⇒ Object
-
Clear State Information
104 105 106 107 108 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 104 def clear_states @states = [] @state_turns = {} @state_steps = {} end |
#cnt ⇒ Object
CNT CouNTer attack rate
71 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 71 def cnt; xparam(6); end |
#collapse_type ⇒ Object
-
Get Collapse Effect
419 420 421 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 419 def collapse_type features_set(FEATURE_COLLAPSE_TYPE).max || 0 end |
#confusion? ⇒ Boolean
-
Determine if Character is Confused
589 590 591 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 589 def confusion? exist? && restriction >= 1 && restriction <= 3 end |
#confusion_level ⇒ Object
-
Get Confusion Level
595 596 597 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 595 def confusion_level confusion? ? restriction : 0 end |
#cri ⇒ Object
CRI CRItical rate
67 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 67 def cri; xparam(2); end |
#dead? ⇒ Boolean
-
Determine Incapacitation
559 560 561 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 559 def dead? exist? && death_state? end |
#death_state? ⇒ Boolean
-
Check K.O. State
133 134 135 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 133 def death_state? state?(death_state_id) end |
#death_state_id ⇒ Object
-
Get State ID of K.O.
139 140 141 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 139 def death_state_id return 1 end |
#debuff_rate(param_id) ⇒ Object
-
Get Debuff Rate
293 294 295 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 293 def debuff_rate(param_id) features_pi(FEATURE_DEBUFF_RATE, param_id) end |
#def ⇒ Object
DEF DEFense power
60 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 60 def def; param(3); end |
#dual_wield? ⇒ Boolean
-
Determine if Dual Wield
401 402 403 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 401 def dual_wield? slot_type == 1 end |
#element_rate(element_id) ⇒ Object
-
Get Element Rate
287 288 289 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 287 def element_rate(element_id) features_pi(FEATURE_ELEMENT_RATE, element_id) end |
#enemy? ⇒ Boolean
-
Determine if Enemy
607 608 609 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 607 def enemy? return false end |
#equip_atype_ok?(atype_id) ⇒ Boolean
-
Determine if Armor Can Be Equipped
377 378 379 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 377 def equip_atype_ok?(atype_id) features_set(FEATURE_EQUIP_ATYPE).include?(atype_id) end |
#equip_type_fixed?(etype_id) ⇒ Boolean
-
Determine if Equipment Is Locked
383 384 385 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 383 def equip_type_fixed?(etype_id) features_set(FEATURE_EQUIP_FIX).include?(etype_id) end |
#equip_type_sealed?(etype_id) ⇒ Boolean
-
Determine if Equipment Is Sealed
389 390 391 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 389 def equip_type_sealed?(etype_id) features_set(FEATURE_EQUIP_SEAL).include?(etype_id) end |
#equip_wtype_ok?(wtype_id) ⇒ Boolean
-
Determine if Weapon Can Be Equipped
371 372 373 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 371 def equip_wtype_ok?(wtype_id) features_set(FEATURE_EQUIP_WTYPE).include?(wtype_id) end |
#equippable?(item) ⇒ Boolean
-
Determine if Equippable
700 701 702 703 704 705 706 |
# File 'lib/rgss3_default_scripts/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 |
#erase_state(state_id) ⇒ Object
-
Erase States
112 113 114 115 116 |
# File 'lib/rgss3_default_scripts/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 |
#eva ⇒ Object
EVA EVAsion rate
66 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 66 def eva; xparam(1); end |
#exist? ⇒ Boolean
-
Determine Existence
553 554 555 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 553 def exist? !hidden? end |
#exr ⇒ Object
EXR EXperience Rate
84 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 84 def exr; sparam(9); end |
#fdr ⇒ Object
FDR Floor Damage Rate
83 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 83 def fdr; sparam(8); end |
#feature_objects ⇒ Object
-
Get Array of All Objects Retaining Features
180 181 182 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 180 def feature_objects states end |
#features(code) ⇒ Object
-
Get Feature Object Array (Feature Codes Limited)
192 193 194 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 192 def features(code) all_features.select {|ft| ft.code == code } end |
#features_pi(code, id) ⇒ Object
-
Calculate Complement of Feature Values
204 205 206 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 204 def features_pi(code, id) features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value } end |
#features_set(code) ⇒ Object
-
Calculate Set Sum of Features
222 223 224 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 222 def features_set(code) features(code).inject([]) {|r, ft| r |= [ft.data_id] } end |
#features_sum(code, id) ⇒ Object
-
Calculate Sum of Feature Values (Specify Data ID)
210 211 212 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 210 def features_sum(code, id) features_with_id(code, id).inject(0.0) {|r, ft| r += ft.value } end |
#features_sum_all(code) ⇒ Object
-
Calculate Sum of Feature Values (Data ID Unspecified)
216 217 218 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 216 def features_sum_all(code) features(code).inject(0.0) {|r, ft| r += ft.value } end |
#features_with_id(code, id) ⇒ Object
-
Get Feature Object Array (Feature Codes and Data IDs Limited)
198 199 200 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 198 def features_with_id(code, id) all_features.select {|ft| ft.code == code && ft.data_id == id } end |
#grd ⇒ Object
GRD GuaRD effect rate
76 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 76 def grd; sparam(1); end |
#guard? ⇒ Boolean
-
Determine if Guard
437 438 439 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 437 def guard? special_flag(FLAG_ID_GUARD) && movable? end |
#guard_skill_id ⇒ Object
-
Get Skill ID of Guard
716 717 718 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 716 def guard_skill_id return 2 end |
#guard_usable? ⇒ Boolean
-
Determine Usability of Guard
728 729 730 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 728 def guard_usable? usable?($data_skills[guard_skill_id]) end |
#hidden? ⇒ Boolean
-
Get Hide State
547 548 549 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 547 def hidden? @hidden end |
#hide ⇒ Object
-
Hide
535 536 537 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 535 def hide @hidden = true end |
#hit ⇒ Object
HIT HIT rate
65 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 65 def hit; xparam(0); end |
#hp_rate ⇒ Object
-
Get Percentage of HP
517 518 519 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 517 def hp_rate @hp.to_f / mhp end |
#hrg ⇒ Object
HRG Hp ReGeneration rate
72 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 72 def hrg; xparam(7); end |
#inputable? ⇒ Boolean
-
Determine if Command is Inputable
577 578 579 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 577 def inputable? normal? && !auto_battle? end |
#item_conditions_met?(item) ⇒ Boolean
-
Check Usability Conditions for Item
686 687 688 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 686 def item_conditions_met?(item) usable_item_conditions_met?(item) && $game_party.has_item?(item) end |
#luk ⇒ Object
LUK LUcK
64 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 64 def luk; param(7); end |
#mat ⇒ Object
MAT Magic ATtack power
61 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 61 def mat; param(4); end |
#max_tp ⇒ Object
-
Get Maximum Value of TP
494 495 496 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 494 def max_tp return 100 end |
#mcr ⇒ Object
MCR Mp Cost Rate
79 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 79 def mcr; sparam(4); end |
#mdf ⇒ Object
MDF Magic DeFense power
62 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 62 def mdf; param(5); end |
#mdr ⇒ Object
MDR Magical Damage Rate
82 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 82 def mdr; sparam(7); end |
#mev ⇒ Object
MEV Magic EVasion rate
69 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 69 def mev; xparam(4); end |
#mhp ⇒ Object
-
Access Method by Parameter Abbreviations
57 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 57 def mhp; param(0); end |
#mmp ⇒ Object
MMP Maximum Magic Points
58 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 58 def mmp; param(1); end |
#most_important_state_text ⇒ Object
-
Get Most Important State Continuation Message
628 629 630 631 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 628 def most_important_state_text states.each {|state| return state. unless state..empty? } return "" end |
#movable? ⇒ Boolean
-
Determine if Action is Possible
583 584 585 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 583 def movable? exist? && restriction < 4 end |
#mp_rate ⇒ Object
-
Get Percentage of MP
523 524 525 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 523 def mp_rate mmp > 0 ? @mp.to_f / mmp : 0 end |
#mrf ⇒ Object
MRF Magic ReFlection rate
70 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 70 def mrf; xparam(5); end |
#mrg ⇒ Object
MRG Mp ReGeneration rate
73 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 73 def mrg; xparam(8); end |
#normal? ⇒ Boolean
-
Determine Normality
571 572 573 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 571 def normal? exist? && restriction == 0 end |
#occasion_ok?(item) ⇒ Boolean
-
Check When Skill/Item Can Be Used
666 667 668 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 666 def occasion_ok?(item) $game_party.in_battle ? item.battle_ok? : item. end |
#param(param_id) ⇒ Object
-
Get Parameter
267 268 269 270 271 |
# File 'lib/rgss3_default_scripts/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 |
#param_base(param_id) ⇒ Object
-
Get Base Value of Parameter
228 229 230 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 228 def param_base(param_id) return 0 end |
#param_buff_rate(param_id) ⇒ Object
-
Get Rate of Change Due to Parameter Buff/Debuff
261 262 263 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 261 def param_buff_rate(param_id) @buffs[param_id] * 0.25 + 1.0 end |
#param_max(param_id) ⇒ Object
-
Get Maximum Value of Parameter
247 248 249 250 251 |
# File 'lib/rgss3_default_scripts/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 |
#param_min(param_id) ⇒ Object
-
Get Reduced Value of Parameter
240 241 242 243 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 240 def param_min(param_id) return 0 if param_id == 1 # MMP return 1 end |
#param_plus(param_id) ⇒ Object
-
Get Added Value of Parameter
234 235 236 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 234 def param_plus(param_id) @param_plus[param_id] end |
#param_rate(param_id) ⇒ Object
-
Get Rate of Parameter Change
255 256 257 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 255 def param_rate(param_id) features_pi(FEATURE_PARAM, param_id) end |
#party_ability(ability_id) ⇒ Object
-
Determine Party Ability
425 426 427 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 425 def party_ability(ability_id) features(FEATURE_PARTY_ABILITY).any? {|ft| ft.data_id == ability_id } end |
#pay_skill_cost(skill) ⇒ Object
-
Pay Cost of Using Skill
659 660 661 662 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 659 def pay_skill_cost(skill) self.mp -= skill_mp_cost(skill) self.tp -= skill_tp_cost(skill) end |
#pdr ⇒ Object
PDR Physical Damage Rate
81 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 81 def pdr; sparam(6); end |
#pha ⇒ Object
PHA PHArmacology
78 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 78 def pha; sparam(3); end |
#preserve_tp? ⇒ Boolean
-
Determine if Preserve TP
449 450 451 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 449 def preserve_tp? special_flag(FLAG_ID_PRESERVE_TP) end |
#rec ⇒ Object
REC RECovery effect rate
77 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 77 def rec; sparam(2); end |
#recover_all ⇒ Object
-
Recover All
509 510 511 512 513 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 509 def recover_all clear_states @hp = mhp @mp = mmp end |
#refresh ⇒ Object
-
Refresh
500 501 502 503 504 505 |
# File 'lib/rgss3_default_scripts/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 |
#restriction ⇒ Object
-
Get Restriction
Get the largest restriction from the currently added states.
622 623 624 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 622 def restriction states.collect {|state| state.restriction }.push(0).max end |
#skill_conditions_met?(skill) ⇒ Boolean
-
Check Usability Conditions for Skill
678 679 680 681 682 |
# File 'lib/rgss3_default_scripts/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 |
#skill_cost_payable?(skill) ⇒ Boolean
-
Determine if Cost of Using Skill Can Be Paid
653 654 655 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 653 def skill_cost_payable?(skill) tp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill) end |
#skill_mp_cost(skill) ⇒ Object
-
Calculate Skill’s MP Cost
641 642 643 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 641 def skill_mp_cost(skill) (skill.mp_cost * mcr).to_i end |
#skill_sealed?(skill_id) ⇒ Boolean
-
Determine if Skill Is Disabled
365 366 367 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 365 def skill_sealed?(skill_id) features_set(FEATURE_SKILL_SEAL).include?(skill_id) end |
#skill_tp_cost(skill) ⇒ Object
-
Calculate Skill’s TP Cost
647 648 649 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 647 def skill_tp_cost(skill) skill.tp_cost end |
#skill_type_sealed?(stype_id) ⇒ Boolean
-
Determine if Skill Type Is Disabled
353 354 355 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 353 def skill_type_sealed?(stype_id) features_set(FEATURE_STYPE_SEAL).include?(stype_id) end |
#skill_wtype_ok?(skill) ⇒ Boolean
-
Determine if Skill-Required Weapon Is Equipped
635 636 637 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 635 def skill_wtype_ok?(skill) return true end |
#slot_type ⇒ Object
-
Get Slot Type
395 396 397 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 395 def slot_type features_set(FEATURE_SLOT_TYPE).max || 0 end |
#sort_states ⇒ Object
-
Sorting States
Sort the content of the @states array, with higher priority states coming first.
615 616 617 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 615 def sort_states @states = @states.sort_by {|id| [-$data_states[id].priority, id] } end |
#sparam(sparam_id) ⇒ Object
-
Get Sp-Parameter
281 282 283 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 281 def sparam(sparam_id) features_pi(FEATURE_SPARAM, sparam_id) end |
#special_flag(flag_id) ⇒ Object
-
Determine if Special Flag
413 414 415 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 413 def special_flag(flag_id) features(FEATURE_SPECIAL_FLAG).any? {|ft| ft.data_id == flag_id } end |
#state?(state_id) ⇒ Boolean
-
Check State
127 128 129 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 127 def state?(state_id) @states.include?(state_id) end |
#state_icons ⇒ Object
-
Get Current States as an Array of Icon Numbers
151 152 153 154 155 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 151 def state_icons icons = states.collect {|state| state.icon_index } icons.delete(0) icons end |
#state_rate(state_id) ⇒ Object
-
Get State Rate
299 300 301 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 299 def state_rate(state_id) features_pi(FEATURE_STATE_RATE, state_id) end |
#state_resist?(state_id) ⇒ Boolean
-
Determine if State Is Resisted
311 312 313 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 311 def state_resist?(state_id) state_resist_set.include?(state_id) end |
#state_resist_set ⇒ Object
-
Get Array of States to Resist
305 306 307 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 305 def state_resist_set features_set(FEATURE_STATE_RESIST) end |
#states ⇒ Object
-
Get Current States as an Object Array
145 146 147 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 145 def states @states.collect {|id| $data_states[id] } end |
#substitute? ⇒ Boolean
-
Determine if Substitute
443 444 445 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 443 def substitute? special_flag(FLAG_ID_SUBSTITUTE) && movable? end |
#tcr ⇒ Object
TCR Tp Charge Rate
80 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 80 def tcr; sparam(5); end |
#tgr ⇒ Object
TGR TarGet Rate
75 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 75 def tgr; sparam(0); end |
#tp_rate ⇒ Object
-
Get Percentage of TP
529 530 531 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 529 def tp_rate @tp.to_f / 100 end |
#trg ⇒ Object
TRG Tp ReGeneration rate
74 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 74 def trg; xparam(9); end |
#usable?(item) ⇒ Boolean
-
Determine Skill/Item Usability
692 693 694 695 696 |
# File 'lib/rgss3_default_scripts/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 |
#usable_item_conditions_met?(item) ⇒ Boolean
-
Check Common Usability Conditions for Skill/Item
672 673 674 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 672 def usable_item_conditions_met?(item) movable? && occasion_ok?(item) end |
#xparam(xparam_id) ⇒ Object
-
Get Ex-Parameter
275 276 277 |
# File 'lib/rgss3_default_scripts/Game_BattlerBase.rb', line 275 def xparam(xparam_id) features_sum(FEATURE_XPARAM, xparam_id) end |