rgss3_default_scripts 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +9 -0
- data/Rakefile +2 -0
- data/lib/rgss3_default_scripts.rb +109 -0
- data/lib/rgss3_default_scripts/BattleManager.rb +392 -0
- data/lib/rgss3_default_scripts/Cache.rb +134 -0
- data/lib/rgss3_default_scripts/DataManager.rb +267 -0
- data/lib/rgss3_default_scripts/Game_Action.rb +262 -0
- data/lib/rgss3_default_scripts/Game_ActionResult.rb +159 -0
- data/lib/rgss3_default_scripts/Game_Actor.rb +696 -0
- data/lib/rgss3_default_scripts/Game_Actors.rb +22 -0
- data/lib/rgss3_default_scripts/Game_BaseItem.rb +51 -0
- data/lib/rgss3_default_scripts/Game_Battler.rb +824 -0
- data/lib/rgss3_default_scripts/Game_BattlerBase.rb +731 -0
- data/lib/rgss3_default_scripts/Game_Character.rb +396 -0
- data/lib/rgss3_default_scripts/Game_CharacterBase.rb +443 -0
- data/lib/rgss3_default_scripts/Game_CommonEvent.rb +41 -0
- data/lib/rgss3_default_scripts/Game_Enemy.rb +264 -0
- data/lib/rgss3_default_scripts/Game_Event.rb +308 -0
- data/lib/rgss3_default_scripts/Game_Follower.rb +74 -0
- data/lib/rgss3_default_scripts/Game_Followers.rb +112 -0
- data/lib/rgss3_default_scripts/Game_Interpreter.rb +1413 -0
- data/lib/rgss3_default_scripts/Game_Map.rb +704 -0
- data/lib/rgss3_default_scripts/Game_Message.rb +101 -0
- data/lib/rgss3_default_scripts/Game_Party.rb +418 -0
- data/lib/rgss3_default_scripts/Game_Picture.rb +161 -0
- data/lib/rgss3_default_scripts/Game_Pictures.rb +28 -0
- data/lib/rgss3_default_scripts/Game_Player.rb +488 -0
- data/lib/rgss3_default_scripts/Game_Screen.rb +234 -0
- data/lib/rgss3_default_scripts/Game_SelfSwitches.rb +35 -0
- data/lib/rgss3_default_scripts/Game_Switches.rb +35 -0
- data/lib/rgss3_default_scripts/Game_System.rb +122 -0
- data/lib/rgss3_default_scripts/Game_Temp.rb +45 -0
- data/lib/rgss3_default_scripts/Game_Timer.rb +56 -0
- data/lib/rgss3_default_scripts/Game_Troop.rb +205 -0
- data/lib/rgss3_default_scripts/Game_Unit.rb +131 -0
- data/lib/rgss3_default_scripts/Game_Variables.rb +34 -0
- data/lib/rgss3_default_scripts/Game_Vehicle.rb +193 -0
- data/lib/rgss3_default_scripts/SceneManager.rb +94 -0
- data/lib/rgss3_default_scripts/Scene_Base.rb +132 -0
- data/lib/rgss3_default_scripts/Scene_Battle.rb +693 -0
- data/lib/rgss3_default_scripts/Scene_Debug.rb +87 -0
- data/lib/rgss3_default_scripts/Scene_End.rb +61 -0
- data/lib/rgss3_default_scripts/Scene_Equip.rb +144 -0
- data/lib/rgss3_default_scripts/Scene_File.rb +203 -0
- data/lib/rgss3_default_scripts/Scene_Gameover.rb +85 -0
- data/lib/rgss3_default_scripts/Scene_Item.rb +75 -0
- data/lib/rgss3_default_scripts/Scene_ItemBase.rb +147 -0
- data/lib/rgss3_default_scripts/Scene_Load.rb +40 -0
- data/lib/rgss3_default_scripts/Scene_Map.rb +276 -0
- data/lib/rgss3_default_scripts/Scene_Menu.rb +127 -0
- data/lib/rgss3_default_scripts/Scene_MenuBase.rb +63 -0
- data/lib/rgss3_default_scripts/Scene_Name.rb +32 -0
- data/lib/rgss3_default_scripts/Scene_Save.rb +38 -0
- data/lib/rgss3_default_scripts/Scene_Shop.rb +299 -0
- data/lib/rgss3_default_scripts/Scene_Skill.rb +108 -0
- data/lib/rgss3_default_scripts/Scene_Status.rb +25 -0
- data/lib/rgss3_default_scripts/Scene_Title.rb +137 -0
- data/lib/rgss3_default_scripts/Sound.rb +135 -0
- data/lib/rgss3_default_scripts/Sprite_Base.rb +232 -0
- data/lib/rgss3_default_scripts/Sprite_Battler.rb +231 -0
- data/lib/rgss3_default_scripts/Sprite_Character.rb +226 -0
- data/lib/rgss3_default_scripts/Sprite_Picture.rb +82 -0
- data/lib/rgss3_default_scripts/Sprite_Timer.rb +77 -0
- data/lib/rgss3_default_scripts/Spriteset_Battle.rb +389 -0
- data/lib/rgss3_default_scripts/Spriteset_Map.rb +273 -0
- data/lib/rgss3_default_scripts/Spriteset_Weather.rb +184 -0
- data/lib/rgss3_default_scripts/Vocab.rb +145 -0
- data/lib/rgss3_default_scripts/Window_ActorCommand.rb +78 -0
- data/lib/rgss3_default_scripts/Window_Base.rb +571 -0
- data/lib/rgss3_default_scripts/Window_BattleActor.rb +38 -0
- data/lib/rgss3_default_scripts/Window_BattleEnemy.rb +70 -0
- data/lib/rgss3_default_scripts/Window_BattleItem.rb +40 -0
- data/lib/rgss3_default_scripts/Window_BattleLog.rb +425 -0
- data/lib/rgss3_default_scripts/Window_BattleSkill.rb +34 -0
- data/lib/rgss3_default_scripts/Window_BattleStatus.rb +111 -0
- data/lib/rgss3_default_scripts/Window_ChoiceList.rb +88 -0
- data/lib/rgss3_default_scripts/Window_Command.rb +152 -0
- data/lib/rgss3_default_scripts/Window_DebugLeft.rb +104 -0
- data/lib/rgss3_default_scripts/Window_DebugRight.rb +119 -0
- data/lib/rgss3_default_scripts/Window_EquipCommand.rb +36 -0
- data/lib/rgss3_default_scripts/Window_EquipItem.rb +78 -0
- data/lib/rgss3_default_scripts/Window_EquipSlot.rb +111 -0
- data/lib/rgss3_default_scripts/Window_EquipStatus.rb +97 -0
- data/lib/rgss3_default_scripts/Window_GameEnd.rb +38 -0
- data/lib/rgss3_default_scripts/Window_Gold.rb +47 -0
- data/lib/rgss3_default_scripts/Window_Help.rb +43 -0
- data/lib/rgss3_default_scripts/Window_HorzCommand.rb +106 -0
- data/lib/rgss3_default_scripts/Window_ItemCategory.rb +54 -0
- data/lib/rgss3_default_scripts/Window_ItemList.rb +117 -0
- data/lib/rgss3_default_scripts/Window_KeyItem.rb +55 -0
- data/lib/rgss3_default_scripts/Window_MapName.rb +96 -0
- data/lib/rgss3_default_scripts/Window_MenuActor.rb +43 -0
- data/lib/rgss3_default_scripts/Window_MenuCommand.rb +106 -0
- data/lib/rgss3_default_scripts/Window_MenuStatus.rb +85 -0
- data/lib/rgss3_default_scripts/Window_Message.rb +397 -0
- data/lib/rgss3_default_scripts/Window_NameEdit.rb +129 -0
- data/lib/rgss3_default_scripts/Window_NameInput.rb +253 -0
- data/lib/rgss3_default_scripts/Window_NumberInput.rb +148 -0
- data/lib/rgss3_default_scripts/Window_PartyCommand.rb +47 -0
- data/lib/rgss3_default_scripts/Window_SaveFile.rb +69 -0
- data/lib/rgss3_default_scripts/Window_ScrollText.rb +90 -0
- data/lib/rgss3_default_scripts/Window_Selectable.rb +442 -0
- data/lib/rgss3_default_scripts/Window_ShopBuy.rb +115 -0
- data/lib/rgss3_default_scripts/Window_ShopCommand.rb +36 -0
- data/lib/rgss3_default_scripts/Window_ShopNumber.rb +137 -0
- data/lib/rgss3_default_scripts/Window_ShopSell.rb +27 -0
- data/lib/rgss3_default_scripts/Window_ShopStatus.rb +124 -0
- data/lib/rgss3_default_scripts/Window_SkillCommand.rb +76 -0
- data/lib/rgss3_default_scripts/Window_SkillList.rb +121 -0
- data/lib/rgss3_default_scripts/Window_SkillStatus.rb +38 -0
- data/lib/rgss3_default_scripts/Window_Status.rb +125 -0
- data/lib/rgss3_default_scripts/Window_TitleCommand.rb +45 -0
- data/rgss3_default_scripts.gemspec +23 -0
- metadata +186 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# ** Game_ActionResult
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# This class handles the results of battle actions. It is used internally for
|
|
5
|
+
# the Game_Battler class.
|
|
6
|
+
#==============================================================================
|
|
7
|
+
|
|
8
|
+
class Game_ActionResult
|
|
9
|
+
#--------------------------------------------------------------------------
|
|
10
|
+
# * Public Instance Variables
|
|
11
|
+
#--------------------------------------------------------------------------
|
|
12
|
+
attr_accessor :used # used flag
|
|
13
|
+
attr_accessor :missed # missed flag
|
|
14
|
+
attr_accessor :evaded # evaded flag
|
|
15
|
+
attr_accessor :critical # critical flag
|
|
16
|
+
attr_accessor :success # success flag
|
|
17
|
+
attr_accessor :hp_damage # HP damage
|
|
18
|
+
attr_accessor :mp_damage # MP damage
|
|
19
|
+
attr_accessor :tp_damage # TP damage
|
|
20
|
+
attr_accessor :hp_drain # HP drain
|
|
21
|
+
attr_accessor :mp_drain # MP drain
|
|
22
|
+
attr_accessor :added_states # added states
|
|
23
|
+
attr_accessor :removed_states # removed states
|
|
24
|
+
attr_accessor :added_buffs # added buffs
|
|
25
|
+
attr_accessor :added_debuffs # added debuffs
|
|
26
|
+
attr_accessor :removed_buffs # removed buffs/debuffs
|
|
27
|
+
#--------------------------------------------------------------------------
|
|
28
|
+
# * Object Initialization
|
|
29
|
+
#--------------------------------------------------------------------------
|
|
30
|
+
def initialize(battler)
|
|
31
|
+
@battler = battler
|
|
32
|
+
clear
|
|
33
|
+
end
|
|
34
|
+
#--------------------------------------------------------------------------
|
|
35
|
+
# * Clear
|
|
36
|
+
#--------------------------------------------------------------------------
|
|
37
|
+
def clear
|
|
38
|
+
clear_hit_flags
|
|
39
|
+
clear_damage_values
|
|
40
|
+
clear_status_effects
|
|
41
|
+
end
|
|
42
|
+
#--------------------------------------------------------------------------
|
|
43
|
+
# * Clear Hit Flags
|
|
44
|
+
#--------------------------------------------------------------------------
|
|
45
|
+
def clear_hit_flags
|
|
46
|
+
@used = false
|
|
47
|
+
@missed = false
|
|
48
|
+
@evaded = false
|
|
49
|
+
@critical = false
|
|
50
|
+
@success = false
|
|
51
|
+
end
|
|
52
|
+
#--------------------------------------------------------------------------
|
|
53
|
+
# * Clear Damage Values
|
|
54
|
+
#--------------------------------------------------------------------------
|
|
55
|
+
def clear_damage_values
|
|
56
|
+
@hp_damage = 0
|
|
57
|
+
@mp_damage = 0
|
|
58
|
+
@tp_damage = 0
|
|
59
|
+
@hp_drain = 0
|
|
60
|
+
@mp_drain = 0
|
|
61
|
+
end
|
|
62
|
+
#--------------------------------------------------------------------------
|
|
63
|
+
# * Create Damage
|
|
64
|
+
#--------------------------------------------------------------------------
|
|
65
|
+
def make_damage(value, item)
|
|
66
|
+
@critical = false if value == 0
|
|
67
|
+
@hp_damage = value if item.damage.to_hp?
|
|
68
|
+
@mp_damage = value if item.damage.to_mp?
|
|
69
|
+
@mp_damage = [@battler.mp, @mp_damage].min
|
|
70
|
+
@hp_drain = @hp_damage if item.damage.drain?
|
|
71
|
+
@mp_drain = @mp_damage if item.damage.drain?
|
|
72
|
+
@hp_drain = [@battler.hp, @hp_drain].min
|
|
73
|
+
@success = true if item.damage.to_hp? || @mp_damage != 0
|
|
74
|
+
end
|
|
75
|
+
#--------------------------------------------------------------------------
|
|
76
|
+
# * Clear Status Effects
|
|
77
|
+
#--------------------------------------------------------------------------
|
|
78
|
+
def clear_status_effects
|
|
79
|
+
@added_states = []
|
|
80
|
+
@removed_states = []
|
|
81
|
+
@added_buffs = []
|
|
82
|
+
@added_debuffs = []
|
|
83
|
+
@removed_buffs = []
|
|
84
|
+
end
|
|
85
|
+
#--------------------------------------------------------------------------
|
|
86
|
+
# * Get Added States as an Object Array
|
|
87
|
+
#--------------------------------------------------------------------------
|
|
88
|
+
def added_state_objects
|
|
89
|
+
@added_states.collect {|id| $data_states[id] }
|
|
90
|
+
end
|
|
91
|
+
#--------------------------------------------------------------------------
|
|
92
|
+
# * Get Removed States as an Object Array
|
|
93
|
+
#--------------------------------------------------------------------------
|
|
94
|
+
def removed_state_objects
|
|
95
|
+
@removed_states.collect {|id| $data_states[id] }
|
|
96
|
+
end
|
|
97
|
+
#--------------------------------------------------------------------------
|
|
98
|
+
# * Determine Whether Some Sort of Status (Parameter or State) Was Affected
|
|
99
|
+
#--------------------------------------------------------------------------
|
|
100
|
+
def status_affected?
|
|
101
|
+
!(@added_states.empty? && @removed_states.empty? &&
|
|
102
|
+
@added_buffs.empty? && @added_debuffs.empty? && @removed_buffs.empty?)
|
|
103
|
+
end
|
|
104
|
+
#--------------------------------------------------------------------------
|
|
105
|
+
# * Determine Final Hit
|
|
106
|
+
#--------------------------------------------------------------------------
|
|
107
|
+
def hit?
|
|
108
|
+
@used && !@missed && !@evaded
|
|
109
|
+
end
|
|
110
|
+
#--------------------------------------------------------------------------
|
|
111
|
+
# * Get Text for HP Damage
|
|
112
|
+
#--------------------------------------------------------------------------
|
|
113
|
+
def hp_damage_text
|
|
114
|
+
if @hp_drain > 0
|
|
115
|
+
fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
|
|
116
|
+
sprintf(fmt, @battler.name, Vocab::hp, @hp_drain)
|
|
117
|
+
elsif @hp_damage > 0
|
|
118
|
+
fmt = @battler.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage
|
|
119
|
+
sprintf(fmt, @battler.name, @hp_damage)
|
|
120
|
+
elsif @hp_damage < 0
|
|
121
|
+
fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
|
|
122
|
+
sprintf(fmt, @battler.name, Vocab::hp, -hp_damage)
|
|
123
|
+
else
|
|
124
|
+
fmt = @battler.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
|
|
125
|
+
sprintf(fmt, @battler.name)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
#--------------------------------------------------------------------------
|
|
129
|
+
# * Get Text for MP Damage
|
|
130
|
+
#--------------------------------------------------------------------------
|
|
131
|
+
def mp_damage_text
|
|
132
|
+
if @mp_drain > 0
|
|
133
|
+
fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
|
|
134
|
+
sprintf(fmt, @battler.name, Vocab::mp, @mp_drain)
|
|
135
|
+
elsif @mp_damage > 0
|
|
136
|
+
fmt = @battler.actor? ? Vocab::ActorLoss : Vocab::EnemyLoss
|
|
137
|
+
sprintf(fmt, @battler.name, Vocab::mp, @mp_damage)
|
|
138
|
+
elsif @mp_damage < 0
|
|
139
|
+
fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
|
|
140
|
+
sprintf(fmt, @battler.name, Vocab::mp, -@mp_damage)
|
|
141
|
+
else
|
|
142
|
+
""
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
#--------------------------------------------------------------------------
|
|
146
|
+
# * Get Text for TP Damage
|
|
147
|
+
#--------------------------------------------------------------------------
|
|
148
|
+
def tp_damage_text
|
|
149
|
+
if @tp_damage > 0
|
|
150
|
+
fmt = @battler.actor? ? Vocab::ActorLoss : Vocab::EnemyLoss
|
|
151
|
+
sprintf(fmt, @battler.name, Vocab::tp, @tp_damage)
|
|
152
|
+
elsif @tp_damage < 0
|
|
153
|
+
fmt = @battler.actor? ? Vocab::ActorGain : Vocab::EnemyGain
|
|
154
|
+
sprintf(fmt, @battler.name, Vocab::tp, -@tp_damage)
|
|
155
|
+
else
|
|
156
|
+
""
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# ** Game_Actor
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# This class handles actors. It is used within the Game_Actors class
|
|
5
|
+
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
|
|
6
|
+
#==============================================================================
|
|
7
|
+
|
|
8
|
+
class Game_Actor < Game_Battler
|
|
9
|
+
#--------------------------------------------------------------------------
|
|
10
|
+
# * Public Instance Variables
|
|
11
|
+
#--------------------------------------------------------------------------
|
|
12
|
+
attr_accessor :name # Name
|
|
13
|
+
attr_accessor :nickname # Nickname
|
|
14
|
+
attr_reader :character_name # character graphic filename
|
|
15
|
+
attr_reader :character_index # character graphic index
|
|
16
|
+
attr_reader :face_name # face graphic filename
|
|
17
|
+
attr_reader :face_index # face graphic index
|
|
18
|
+
attr_reader :class_id # class ID
|
|
19
|
+
attr_reader :level # level
|
|
20
|
+
attr_reader :action_input_index # action number being input
|
|
21
|
+
attr_reader :last_skill # For cursor memorization: Skill
|
|
22
|
+
#--------------------------------------------------------------------------
|
|
23
|
+
# * Object Initialization
|
|
24
|
+
#--------------------------------------------------------------------------
|
|
25
|
+
def initialize(actor_id)
|
|
26
|
+
super()
|
|
27
|
+
setup(actor_id)
|
|
28
|
+
@last_skill = Game_BaseItem.new
|
|
29
|
+
end
|
|
30
|
+
#--------------------------------------------------------------------------
|
|
31
|
+
# * Setup
|
|
32
|
+
#--------------------------------------------------------------------------
|
|
33
|
+
def setup(actor_id)
|
|
34
|
+
@actor_id = actor_id
|
|
35
|
+
@name = actor.name
|
|
36
|
+
@nickname = actor.nickname
|
|
37
|
+
init_graphics
|
|
38
|
+
@class_id = actor.class_id
|
|
39
|
+
@level = actor.initial_level
|
|
40
|
+
@exp = {}
|
|
41
|
+
@equips = []
|
|
42
|
+
init_exp
|
|
43
|
+
init_skills
|
|
44
|
+
init_equips(actor.equips)
|
|
45
|
+
clear_param_plus
|
|
46
|
+
recover_all
|
|
47
|
+
end
|
|
48
|
+
#--------------------------------------------------------------------------
|
|
49
|
+
# * Get Actor Object
|
|
50
|
+
#--------------------------------------------------------------------------
|
|
51
|
+
def actor
|
|
52
|
+
$data_actors[@actor_id]
|
|
53
|
+
end
|
|
54
|
+
#--------------------------------------------------------------------------
|
|
55
|
+
# * Initialize Graphics
|
|
56
|
+
#--------------------------------------------------------------------------
|
|
57
|
+
def init_graphics
|
|
58
|
+
@character_name = actor.character_name
|
|
59
|
+
@character_index = actor.character_index
|
|
60
|
+
@face_name = actor.face_name
|
|
61
|
+
@face_index = actor.face_index
|
|
62
|
+
end
|
|
63
|
+
#--------------------------------------------------------------------------
|
|
64
|
+
# * Get Total EXP Required for Rising to Specified Level
|
|
65
|
+
#--------------------------------------------------------------------------
|
|
66
|
+
def exp_for_level(level)
|
|
67
|
+
self.class.exp_for_level(level)
|
|
68
|
+
end
|
|
69
|
+
#--------------------------------------------------------------------------
|
|
70
|
+
# * Initialize EXP
|
|
71
|
+
#--------------------------------------------------------------------------
|
|
72
|
+
def init_exp
|
|
73
|
+
@exp[@class_id] = current_level_exp
|
|
74
|
+
end
|
|
75
|
+
#--------------------------------------------------------------------------
|
|
76
|
+
# * Get Experience
|
|
77
|
+
#--------------------------------------------------------------------------
|
|
78
|
+
def exp
|
|
79
|
+
@exp[@class_id]
|
|
80
|
+
end
|
|
81
|
+
#--------------------------------------------------------------------------
|
|
82
|
+
# * Get Minimum EXP for Current Level
|
|
83
|
+
#--------------------------------------------------------------------------
|
|
84
|
+
def current_level_exp
|
|
85
|
+
exp_for_level(@level)
|
|
86
|
+
end
|
|
87
|
+
#--------------------------------------------------------------------------
|
|
88
|
+
# * Get EXP for Next Level
|
|
89
|
+
#--------------------------------------------------------------------------
|
|
90
|
+
def next_level_exp
|
|
91
|
+
exp_for_level(@level + 1)
|
|
92
|
+
end
|
|
93
|
+
#--------------------------------------------------------------------------
|
|
94
|
+
# * Maximum Level
|
|
95
|
+
#--------------------------------------------------------------------------
|
|
96
|
+
def max_level
|
|
97
|
+
actor.max_level
|
|
98
|
+
end
|
|
99
|
+
#--------------------------------------------------------------------------
|
|
100
|
+
# * Determine Maximum Level
|
|
101
|
+
#--------------------------------------------------------------------------
|
|
102
|
+
def max_level?
|
|
103
|
+
@level >= max_level
|
|
104
|
+
end
|
|
105
|
+
#--------------------------------------------------------------------------
|
|
106
|
+
# * Initialize Skills
|
|
107
|
+
#--------------------------------------------------------------------------
|
|
108
|
+
def init_skills
|
|
109
|
+
@skills = []
|
|
110
|
+
self.class.learnings.each do |learning|
|
|
111
|
+
learn_skill(learning.skill_id) if learning.level <= @level
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
#--------------------------------------------------------------------------
|
|
115
|
+
# * Initialize Equipment
|
|
116
|
+
# equips: An array of initial equipment
|
|
117
|
+
#--------------------------------------------------------------------------
|
|
118
|
+
def init_equips(equips)
|
|
119
|
+
@equips = Array.new(equip_slots.size) { Game_BaseItem.new }
|
|
120
|
+
equips.each_with_index do |item_id, i|
|
|
121
|
+
etype_id = index_to_etype_id(i)
|
|
122
|
+
slot_id = empty_slot(etype_id)
|
|
123
|
+
@equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
|
|
124
|
+
end
|
|
125
|
+
refresh
|
|
126
|
+
end
|
|
127
|
+
#--------------------------------------------------------------------------
|
|
128
|
+
# * Convert Index Set by Editor to Equipment Type ID
|
|
129
|
+
#--------------------------------------------------------------------------
|
|
130
|
+
def index_to_etype_id(index)
|
|
131
|
+
index == 1 && dual_wield? ? 0 : index
|
|
132
|
+
end
|
|
133
|
+
#--------------------------------------------------------------------------
|
|
134
|
+
# * Convert from Equipment Type to List of Slot IDs
|
|
135
|
+
#--------------------------------------------------------------------------
|
|
136
|
+
def slot_list(etype_id)
|
|
137
|
+
result = []
|
|
138
|
+
equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
|
|
139
|
+
result
|
|
140
|
+
end
|
|
141
|
+
#--------------------------------------------------------------------------
|
|
142
|
+
# * Convert from Equipment Type to Slot ID (Empty Take Precedence)
|
|
143
|
+
#--------------------------------------------------------------------------
|
|
144
|
+
def empty_slot(etype_id)
|
|
145
|
+
list = slot_list(etype_id)
|
|
146
|
+
list.find {|i| @equips[i].is_nil? } || list[0]
|
|
147
|
+
end
|
|
148
|
+
#--------------------------------------------------------------------------
|
|
149
|
+
# * Get Equipment Slot Array
|
|
150
|
+
#--------------------------------------------------------------------------
|
|
151
|
+
def equip_slots
|
|
152
|
+
return [0,0,2,3,4] if dual_wield? # Dual wield
|
|
153
|
+
return [0,1,2,3,4] # Normal
|
|
154
|
+
end
|
|
155
|
+
#--------------------------------------------------------------------------
|
|
156
|
+
# * Get Weapon Object Array
|
|
157
|
+
#--------------------------------------------------------------------------
|
|
158
|
+
def weapons
|
|
159
|
+
@equips.select {|item| item.is_weapon? }.collect {|item| item.object }
|
|
160
|
+
end
|
|
161
|
+
#--------------------------------------------------------------------------
|
|
162
|
+
# * Get Armor Object Array
|
|
163
|
+
#--------------------------------------------------------------------------
|
|
164
|
+
def armors
|
|
165
|
+
@equips.select {|item| item.is_armor? }.collect {|item| item.object }
|
|
166
|
+
end
|
|
167
|
+
#--------------------------------------------------------------------------
|
|
168
|
+
# * Get Equipped Item Object Array
|
|
169
|
+
#--------------------------------------------------------------------------
|
|
170
|
+
def equips
|
|
171
|
+
@equips.collect {|item| item.object }
|
|
172
|
+
end
|
|
173
|
+
#--------------------------------------------------------------------------
|
|
174
|
+
# * Determine if Equipment Change Possible
|
|
175
|
+
# slot_id: Equipment slot ID
|
|
176
|
+
#--------------------------------------------------------------------------
|
|
177
|
+
def equip_change_ok?(slot_id)
|
|
178
|
+
return false if equip_type_fixed?(equip_slots[slot_id])
|
|
179
|
+
return false if equip_type_sealed?(equip_slots[slot_id])
|
|
180
|
+
return true
|
|
181
|
+
end
|
|
182
|
+
#--------------------------------------------------------------------------
|
|
183
|
+
# * Change Equipment
|
|
184
|
+
# slot_id: Equipment slot ID
|
|
185
|
+
# item: Weapon/armor (remove equipment if nil)
|
|
186
|
+
#--------------------------------------------------------------------------
|
|
187
|
+
def change_equip(slot_id, item)
|
|
188
|
+
return unless trade_item_with_party(item, equips[slot_id])
|
|
189
|
+
return if item && equip_slots[slot_id] != item.etype_id
|
|
190
|
+
@equips[slot_id].object = item
|
|
191
|
+
refresh
|
|
192
|
+
end
|
|
193
|
+
#--------------------------------------------------------------------------
|
|
194
|
+
# * Forcibly Change Equipment
|
|
195
|
+
# slot_id: Equipment slot ID
|
|
196
|
+
# item: Weapon/armor (remove equipment if nil)
|
|
197
|
+
#--------------------------------------------------------------------------
|
|
198
|
+
def force_change_equip(slot_id, item)
|
|
199
|
+
@equips[slot_id].object = item
|
|
200
|
+
release_unequippable_items(false)
|
|
201
|
+
refresh
|
|
202
|
+
end
|
|
203
|
+
#--------------------------------------------------------------------------
|
|
204
|
+
# * Trade Item with Party
|
|
205
|
+
# new_item: Item to get from party
|
|
206
|
+
# old_item: Item to give to party
|
|
207
|
+
#--------------------------------------------------------------------------
|
|
208
|
+
def trade_item_with_party(new_item, old_item)
|
|
209
|
+
return false if new_item && !$game_party.has_item?(new_item)
|
|
210
|
+
$game_party.gain_item(old_item, 1)
|
|
211
|
+
$game_party.lose_item(new_item, 1)
|
|
212
|
+
return true
|
|
213
|
+
end
|
|
214
|
+
#--------------------------------------------------------------------------
|
|
215
|
+
# * Change Equipment (Specify with ID)
|
|
216
|
+
# slot_id: Equipment slot ID
|
|
217
|
+
# item_id: Weapons/armor ID
|
|
218
|
+
#--------------------------------------------------------------------------
|
|
219
|
+
def change_equip_by_id(slot_id, item_id)
|
|
220
|
+
if equip_slots[slot_id] == 0
|
|
221
|
+
change_equip(slot_id, $data_weapons[item_id])
|
|
222
|
+
else
|
|
223
|
+
change_equip(slot_id, $data_armors[item_id])
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
#--------------------------------------------------------------------------
|
|
227
|
+
# * Discard Equipment
|
|
228
|
+
# item: Weapon/armor to discard
|
|
229
|
+
#--------------------------------------------------------------------------
|
|
230
|
+
def discard_equip(item)
|
|
231
|
+
slot_id = equips.index(item)
|
|
232
|
+
@equips[slot_id].object = nil if slot_id
|
|
233
|
+
end
|
|
234
|
+
#--------------------------------------------------------------------------
|
|
235
|
+
# * Remove Equipment that Cannot Be Equipped
|
|
236
|
+
# item_gain: Return removed equipment to party.
|
|
237
|
+
#--------------------------------------------------------------------------
|
|
238
|
+
def release_unequippable_items(item_gain = true)
|
|
239
|
+
loop do
|
|
240
|
+
last_equips = equips.dup
|
|
241
|
+
@equips.each_with_index do |item, i|
|
|
242
|
+
if !equippable?(item.object) || item.object.etype_id != equip_slots[i]
|
|
243
|
+
trade_item_with_party(nil, item.object) if item_gain
|
|
244
|
+
item.object = nil
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
return if equips == last_equips
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
#--------------------------------------------------------------------------
|
|
251
|
+
# * Remove All Equipment
|
|
252
|
+
#--------------------------------------------------------------------------
|
|
253
|
+
def clear_equipments
|
|
254
|
+
equip_slots.size.times do |i|
|
|
255
|
+
change_equip(i, nil) if equip_change_ok?(i)
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
#--------------------------------------------------------------------------
|
|
259
|
+
# * Ultimate Equipment
|
|
260
|
+
#--------------------------------------------------------------------------
|
|
261
|
+
def optimize_equipments
|
|
262
|
+
clear_equipments
|
|
263
|
+
equip_slots.size.times do |i|
|
|
264
|
+
next if !equip_change_ok?(i)
|
|
265
|
+
items = $game_party.equip_items.select do |item|
|
|
266
|
+
item.etype_id == equip_slots[i] &&
|
|
267
|
+
equippable?(item) && item.performance >= 0
|
|
268
|
+
end
|
|
269
|
+
change_equip(i, items.max_by {|item| item.performance })
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
#--------------------------------------------------------------------------
|
|
273
|
+
# * Determine if Skill-Required Weapon Is Equipped
|
|
274
|
+
#--------------------------------------------------------------------------
|
|
275
|
+
def skill_wtype_ok?(skill)
|
|
276
|
+
wtype_id1 = skill.required_wtype_id1
|
|
277
|
+
wtype_id2 = skill.required_wtype_id2
|
|
278
|
+
return true if wtype_id1 == 0 && wtype_id2 == 0
|
|
279
|
+
return true if wtype_id1 > 0 && wtype_equipped?(wtype_id1)
|
|
280
|
+
return true if wtype_id2 > 0 && wtype_equipped?(wtype_id2)
|
|
281
|
+
return false
|
|
282
|
+
end
|
|
283
|
+
#--------------------------------------------------------------------------
|
|
284
|
+
# * Determine if Specific Type of Weapon Is Equipped
|
|
285
|
+
#--------------------------------------------------------------------------
|
|
286
|
+
def wtype_equipped?(wtype_id)
|
|
287
|
+
weapons.any? {|weapon| weapon.wtype_id == wtype_id }
|
|
288
|
+
end
|
|
289
|
+
#--------------------------------------------------------------------------
|
|
290
|
+
# * Refresh
|
|
291
|
+
#--------------------------------------------------------------------------
|
|
292
|
+
def refresh
|
|
293
|
+
release_unequippable_items
|
|
294
|
+
super
|
|
295
|
+
end
|
|
296
|
+
#--------------------------------------------------------------------------
|
|
297
|
+
# * Determine if Actor or Not
|
|
298
|
+
#--------------------------------------------------------------------------
|
|
299
|
+
def actor?
|
|
300
|
+
return true
|
|
301
|
+
end
|
|
302
|
+
#--------------------------------------------------------------------------
|
|
303
|
+
# * Get Allied Units
|
|
304
|
+
#--------------------------------------------------------------------------
|
|
305
|
+
def friends_unit
|
|
306
|
+
$game_party
|
|
307
|
+
end
|
|
308
|
+
#--------------------------------------------------------------------------
|
|
309
|
+
# * Get Enemy Units
|
|
310
|
+
#--------------------------------------------------------------------------
|
|
311
|
+
def opponents_unit
|
|
312
|
+
$game_troop
|
|
313
|
+
end
|
|
314
|
+
#--------------------------------------------------------------------------
|
|
315
|
+
# * Get Actor ID
|
|
316
|
+
#--------------------------------------------------------------------------
|
|
317
|
+
def id
|
|
318
|
+
@actor_id
|
|
319
|
+
end
|
|
320
|
+
#--------------------------------------------------------------------------
|
|
321
|
+
# * Get Index
|
|
322
|
+
#--------------------------------------------------------------------------
|
|
323
|
+
def index
|
|
324
|
+
$game_party.members.index(self)
|
|
325
|
+
end
|
|
326
|
+
#--------------------------------------------------------------------------
|
|
327
|
+
# * Determine Battle Members
|
|
328
|
+
#--------------------------------------------------------------------------
|
|
329
|
+
def battle_member?
|
|
330
|
+
$game_party.battle_members.include?(self)
|
|
331
|
+
end
|
|
332
|
+
#--------------------------------------------------------------------------
|
|
333
|
+
# * Get Class Object
|
|
334
|
+
#--------------------------------------------------------------------------
|
|
335
|
+
def class
|
|
336
|
+
$data_classes[@class_id]
|
|
337
|
+
end
|
|
338
|
+
#--------------------------------------------------------------------------
|
|
339
|
+
# * Get Skill Object Array
|
|
340
|
+
#--------------------------------------------------------------------------
|
|
341
|
+
def skills
|
|
342
|
+
(@skills | added_skills).sort.collect {|id| $data_skills[id] }
|
|
343
|
+
end
|
|
344
|
+
#--------------------------------------------------------------------------
|
|
345
|
+
# * Get Array of Currently Usable Skills
|
|
346
|
+
#--------------------------------------------------------------------------
|
|
347
|
+
def usable_skills
|
|
348
|
+
skills.select {|skill| usable?(skill) }
|
|
349
|
+
end
|
|
350
|
+
#--------------------------------------------------------------------------
|
|
351
|
+
# * Get Array of All Objects Retaining Features
|
|
352
|
+
#--------------------------------------------------------------------------
|
|
353
|
+
def feature_objects
|
|
354
|
+
super + [actor] + [self.class] + equips.compact
|
|
355
|
+
end
|
|
356
|
+
#--------------------------------------------------------------------------
|
|
357
|
+
# * Get Attack Element
|
|
358
|
+
#--------------------------------------------------------------------------
|
|
359
|
+
def atk_elements
|
|
360
|
+
set = super
|
|
361
|
+
set |= [1] if weapons.compact.empty? # Unarmed: Physical element
|
|
362
|
+
return set
|
|
363
|
+
end
|
|
364
|
+
#--------------------------------------------------------------------------
|
|
365
|
+
# * Get Maximum Value of Parameter
|
|
366
|
+
#--------------------------------------------------------------------------
|
|
367
|
+
def param_max(param_id)
|
|
368
|
+
return 9999 if param_id == 0 # MHP
|
|
369
|
+
return super
|
|
370
|
+
end
|
|
371
|
+
#--------------------------------------------------------------------------
|
|
372
|
+
# * Get Base Value of Parameter
|
|
373
|
+
#--------------------------------------------------------------------------
|
|
374
|
+
def param_base(param_id)
|
|
375
|
+
self.class.params[param_id, @level]
|
|
376
|
+
end
|
|
377
|
+
#--------------------------------------------------------------------------
|
|
378
|
+
# * Get Added Value of Parameter
|
|
379
|
+
#--------------------------------------------------------------------------
|
|
380
|
+
def param_plus(param_id)
|
|
381
|
+
equips.compact.inject(super) {|r, item| r += item.params[param_id] }
|
|
382
|
+
end
|
|
383
|
+
#--------------------------------------------------------------------------
|
|
384
|
+
# * Get Normal Attack Animation ID
|
|
385
|
+
#--------------------------------------------------------------------------
|
|
386
|
+
def atk_animation_id1
|
|
387
|
+
if dual_wield?
|
|
388
|
+
return weapons[0].animation_id if weapons[0]
|
|
389
|
+
return weapons[1] ? 0 : 1
|
|
390
|
+
else
|
|
391
|
+
return weapons[0] ? weapons[0].animation_id : 1
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
#--------------------------------------------------------------------------
|
|
395
|
+
# * Get Animation ID of Normal Attack (Dual Wield: Weapon 2)
|
|
396
|
+
#--------------------------------------------------------------------------
|
|
397
|
+
def atk_animation_id2
|
|
398
|
+
if dual_wield?
|
|
399
|
+
return weapons[1] ? weapons[1].animation_id : 0
|
|
400
|
+
else
|
|
401
|
+
return 0
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
#--------------------------------------------------------------------------
|
|
405
|
+
# * Change Experience
|
|
406
|
+
# show : Level up display flag
|
|
407
|
+
#--------------------------------------------------------------------------
|
|
408
|
+
def change_exp(exp, show)
|
|
409
|
+
@exp[@class_id] = [exp, 0].max
|
|
410
|
+
last_level = @level
|
|
411
|
+
last_skills = skills
|
|
412
|
+
level_up while !max_level? && self.exp >= next_level_exp
|
|
413
|
+
level_down while self.exp < current_level_exp
|
|
414
|
+
display_level_up(skills - last_skills) if show && @level > last_level
|
|
415
|
+
refresh
|
|
416
|
+
end
|
|
417
|
+
#--------------------------------------------------------------------------
|
|
418
|
+
# * Get Experience
|
|
419
|
+
#--------------------------------------------------------------------------
|
|
420
|
+
def exp
|
|
421
|
+
@exp[@class_id]
|
|
422
|
+
end
|
|
423
|
+
#--------------------------------------------------------------------------
|
|
424
|
+
# * Level Up
|
|
425
|
+
#--------------------------------------------------------------------------
|
|
426
|
+
def level_up
|
|
427
|
+
@level += 1
|
|
428
|
+
self.class.learnings.each do |learning|
|
|
429
|
+
learn_skill(learning.skill_id) if learning.level == @level
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
#--------------------------------------------------------------------------
|
|
433
|
+
# * Level Down
|
|
434
|
+
#--------------------------------------------------------------------------
|
|
435
|
+
def level_down
|
|
436
|
+
@level -= 1
|
|
437
|
+
end
|
|
438
|
+
#--------------------------------------------------------------------------
|
|
439
|
+
# * Show Level Up Message
|
|
440
|
+
# new_skills : Array of newly learned skills
|
|
441
|
+
#--------------------------------------------------------------------------
|
|
442
|
+
def display_level_up(new_skills)
|
|
443
|
+
$game_message.new_page
|
|
444
|
+
$game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))
|
|
445
|
+
new_skills.each do |skill|
|
|
446
|
+
$game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
#--------------------------------------------------------------------------
|
|
450
|
+
# * Get EXP (Account for Experience Rate)
|
|
451
|
+
#--------------------------------------------------------------------------
|
|
452
|
+
def gain_exp(exp)
|
|
453
|
+
change_exp(self.exp + (exp * final_exp_rate).to_i, true)
|
|
454
|
+
end
|
|
455
|
+
#--------------------------------------------------------------------------
|
|
456
|
+
# * Calculate Final EXP Rate
|
|
457
|
+
#--------------------------------------------------------------------------
|
|
458
|
+
def final_exp_rate
|
|
459
|
+
exr * (battle_member? ? 1 : reserve_members_exp_rate)
|
|
460
|
+
end
|
|
461
|
+
#--------------------------------------------------------------------------
|
|
462
|
+
# * Get EXP Rate for Reserve Members
|
|
463
|
+
#--------------------------------------------------------------------------
|
|
464
|
+
def reserve_members_exp_rate
|
|
465
|
+
$data_system.opt_extra_exp ? 1 : 0
|
|
466
|
+
end
|
|
467
|
+
#--------------------------------------------------------------------------
|
|
468
|
+
# * Change Level
|
|
469
|
+
# show : Level up display flag
|
|
470
|
+
#--------------------------------------------------------------------------
|
|
471
|
+
def change_level(level, show)
|
|
472
|
+
level = [[level, max_level].min, 1].max
|
|
473
|
+
change_exp(exp_for_level(level), show)
|
|
474
|
+
end
|
|
475
|
+
#--------------------------------------------------------------------------
|
|
476
|
+
# * Learn Skill
|
|
477
|
+
#--------------------------------------------------------------------------
|
|
478
|
+
def learn_skill(skill_id)
|
|
479
|
+
unless skill_learn?($data_skills[skill_id])
|
|
480
|
+
@skills.push(skill_id)
|
|
481
|
+
@skills.sort!
|
|
482
|
+
end
|
|
483
|
+
end
|
|
484
|
+
#--------------------------------------------------------------------------
|
|
485
|
+
# * Forget Skill
|
|
486
|
+
#--------------------------------------------------------------------------
|
|
487
|
+
def forget_skill(skill_id)
|
|
488
|
+
@skills.delete(skill_id)
|
|
489
|
+
end
|
|
490
|
+
#--------------------------------------------------------------------------
|
|
491
|
+
# * Determine if Skill Is Already Learned
|
|
492
|
+
#--------------------------------------------------------------------------
|
|
493
|
+
def skill_learn?(skill)
|
|
494
|
+
skill.is_a?(RPG::Skill) && @skills.include?(skill.id)
|
|
495
|
+
end
|
|
496
|
+
#--------------------------------------------------------------------------
|
|
497
|
+
# * Get Description
|
|
498
|
+
#--------------------------------------------------------------------------
|
|
499
|
+
def description
|
|
500
|
+
actor.description
|
|
501
|
+
end
|
|
502
|
+
#--------------------------------------------------------------------------
|
|
503
|
+
# * Change Class
|
|
504
|
+
# keep_exp: Keep EXP
|
|
505
|
+
#--------------------------------------------------------------------------
|
|
506
|
+
def change_class(class_id, keep_exp = false)
|
|
507
|
+
@exp[class_id] = exp if keep_exp
|
|
508
|
+
@class_id = class_id
|
|
509
|
+
change_exp(@exp[@class_id] || 0, false)
|
|
510
|
+
refresh
|
|
511
|
+
end
|
|
512
|
+
#--------------------------------------------------------------------------
|
|
513
|
+
# * Change Graphics
|
|
514
|
+
#--------------------------------------------------------------------------
|
|
515
|
+
def set_graphic(character_name, character_index, face_name, face_index)
|
|
516
|
+
@character_name = character_name
|
|
517
|
+
@character_index = character_index
|
|
518
|
+
@face_name = face_name
|
|
519
|
+
@face_index = face_index
|
|
520
|
+
end
|
|
521
|
+
#--------------------------------------------------------------------------
|
|
522
|
+
# * Use Sprites?
|
|
523
|
+
#--------------------------------------------------------------------------
|
|
524
|
+
def use_sprite?
|
|
525
|
+
return false
|
|
526
|
+
end
|
|
527
|
+
#--------------------------------------------------------------------------
|
|
528
|
+
# * Execute Damage Effect
|
|
529
|
+
#--------------------------------------------------------------------------
|
|
530
|
+
def perform_damage_effect
|
|
531
|
+
$game_troop.screen.start_shake(5, 5, 10)
|
|
532
|
+
@sprite_effect_type = :blink
|
|
533
|
+
Sound.play_actor_damage
|
|
534
|
+
end
|
|
535
|
+
#--------------------------------------------------------------------------
|
|
536
|
+
# * Execute Collapse Effect
|
|
537
|
+
#--------------------------------------------------------------------------
|
|
538
|
+
def perform_collapse_effect
|
|
539
|
+
if $game_party.in_battle
|
|
540
|
+
@sprite_effect_type = :collapse
|
|
541
|
+
Sound.play_actor_collapse
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
#--------------------------------------------------------------------------
|
|
545
|
+
# * Create Action Candidate List for Auto Battle
|
|
546
|
+
#--------------------------------------------------------------------------
|
|
547
|
+
def make_action_list
|
|
548
|
+
list = []
|
|
549
|
+
list.push(Game_Action.new(self).set_attack.evaluate)
|
|
550
|
+
usable_skills.each do |skill|
|
|
551
|
+
list.push(Game_Action.new(self).set_skill(skill.id).evaluate)
|
|
552
|
+
end
|
|
553
|
+
list
|
|
554
|
+
end
|
|
555
|
+
#--------------------------------------------------------------------------
|
|
556
|
+
# * Create Action During Auto Battle
|
|
557
|
+
#--------------------------------------------------------------------------
|
|
558
|
+
def make_auto_battle_actions
|
|
559
|
+
@actions.size.times do |i|
|
|
560
|
+
@actions[i] = make_action_list.max_by {|action| action.value }
|
|
561
|
+
end
|
|
562
|
+
end
|
|
563
|
+
#--------------------------------------------------------------------------
|
|
564
|
+
# * Create Action During Confusion
|
|
565
|
+
#--------------------------------------------------------------------------
|
|
566
|
+
def make_confusion_actions
|
|
567
|
+
@actions.size.times do |i|
|
|
568
|
+
@actions[i].set_confusion
|
|
569
|
+
end
|
|
570
|
+
end
|
|
571
|
+
#--------------------------------------------------------------------------
|
|
572
|
+
# * Create Battle Action
|
|
573
|
+
#--------------------------------------------------------------------------
|
|
574
|
+
def make_actions
|
|
575
|
+
super
|
|
576
|
+
if auto_battle?
|
|
577
|
+
make_auto_battle_actions
|
|
578
|
+
elsif confusion?
|
|
579
|
+
make_confusion_actions
|
|
580
|
+
end
|
|
581
|
+
end
|
|
582
|
+
#--------------------------------------------------------------------------
|
|
583
|
+
# * Processing Performed When Player Takes 1 Step
|
|
584
|
+
#--------------------------------------------------------------------------
|
|
585
|
+
def on_player_walk
|
|
586
|
+
@result.clear
|
|
587
|
+
check_floor_effect
|
|
588
|
+
if $game_player.normal_walk?
|
|
589
|
+
turn_end_on_map
|
|
590
|
+
states.each {|state| update_state_steps(state) }
|
|
591
|
+
show_added_states
|
|
592
|
+
show_removed_states
|
|
593
|
+
end
|
|
594
|
+
end
|
|
595
|
+
#--------------------------------------------------------------------------
|
|
596
|
+
# * Update Step Count for State
|
|
597
|
+
#--------------------------------------------------------------------------
|
|
598
|
+
def update_state_steps(state)
|
|
599
|
+
if state.remove_by_walking
|
|
600
|
+
@state_steps[state.id] -= 1 if @state_steps[state.id] > 0
|
|
601
|
+
remove_state(state.id) if @state_steps[state.id] == 0
|
|
602
|
+
end
|
|
603
|
+
end
|
|
604
|
+
#--------------------------------------------------------------------------
|
|
605
|
+
# * Show Added State
|
|
606
|
+
#--------------------------------------------------------------------------
|
|
607
|
+
def show_added_states
|
|
608
|
+
@result.added_state_objects.each do |state|
|
|
609
|
+
$game_message.add(name + state.message1) unless state.message1.empty?
|
|
610
|
+
end
|
|
611
|
+
end
|
|
612
|
+
#--------------------------------------------------------------------------
|
|
613
|
+
# * Show Removed State
|
|
614
|
+
#--------------------------------------------------------------------------
|
|
615
|
+
def show_removed_states
|
|
616
|
+
@result.removed_state_objects.each do |state|
|
|
617
|
+
$game_message.add(name + state.message4) unless state.message4.empty?
|
|
618
|
+
end
|
|
619
|
+
end
|
|
620
|
+
#--------------------------------------------------------------------------
|
|
621
|
+
# * Number of Steps Regarded as One Turn in Battle
|
|
622
|
+
#--------------------------------------------------------------------------
|
|
623
|
+
def steps_for_turn
|
|
624
|
+
return 20
|
|
625
|
+
end
|
|
626
|
+
#--------------------------------------------------------------------------
|
|
627
|
+
# * End of Turn Processing on Map Screen
|
|
628
|
+
#--------------------------------------------------------------------------
|
|
629
|
+
def turn_end_on_map
|
|
630
|
+
if $game_party.steps % steps_for_turn == 0
|
|
631
|
+
on_turn_end
|
|
632
|
+
perform_map_damage_effect if @result.hp_damage > 0
|
|
633
|
+
end
|
|
634
|
+
end
|
|
635
|
+
#--------------------------------------------------------------------------
|
|
636
|
+
# * Determine Floor Effect
|
|
637
|
+
#--------------------------------------------------------------------------
|
|
638
|
+
def check_floor_effect
|
|
639
|
+
execute_floor_damage if $game_player.on_damage_floor?
|
|
640
|
+
end
|
|
641
|
+
#--------------------------------------------------------------------------
|
|
642
|
+
# * Floor Damage Processing
|
|
643
|
+
#--------------------------------------------------------------------------
|
|
644
|
+
def execute_floor_damage
|
|
645
|
+
damage = (basic_floor_damage * fdr).to_i
|
|
646
|
+
self.hp -= [damage, max_floor_damage].min
|
|
647
|
+
perform_map_damage_effect if damage > 0
|
|
648
|
+
end
|
|
649
|
+
#--------------------------------------------------------------------------
|
|
650
|
+
# * Get Base Value for Floor Damage
|
|
651
|
+
#--------------------------------------------------------------------------
|
|
652
|
+
def basic_floor_damage
|
|
653
|
+
return 10
|
|
654
|
+
end
|
|
655
|
+
#--------------------------------------------------------------------------
|
|
656
|
+
# * Get Maximum Value for Floor Damage
|
|
657
|
+
#--------------------------------------------------------------------------
|
|
658
|
+
def max_floor_damage
|
|
659
|
+
$data_system.opt_floor_death ? hp : [hp - 1, 0].max
|
|
660
|
+
end
|
|
661
|
+
#--------------------------------------------------------------------------
|
|
662
|
+
# * Execute Damage Effect on Map
|
|
663
|
+
#--------------------------------------------------------------------------
|
|
664
|
+
def perform_map_damage_effect
|
|
665
|
+
$game_map.screen.start_flash_for_damage
|
|
666
|
+
end
|
|
667
|
+
#--------------------------------------------------------------------------
|
|
668
|
+
# * Clear Actions
|
|
669
|
+
#--------------------------------------------------------------------------
|
|
670
|
+
def clear_actions
|
|
671
|
+
super
|
|
672
|
+
@action_input_index = 0
|
|
673
|
+
end
|
|
674
|
+
#--------------------------------------------------------------------------
|
|
675
|
+
# * Get Action Being Input
|
|
676
|
+
#--------------------------------------------------------------------------
|
|
677
|
+
def input
|
|
678
|
+
@actions[@action_input_index]
|
|
679
|
+
end
|
|
680
|
+
#--------------------------------------------------------------------------
|
|
681
|
+
# * To Next Command Input
|
|
682
|
+
#--------------------------------------------------------------------------
|
|
683
|
+
def next_command
|
|
684
|
+
return false if @action_input_index >= @actions.size - 1
|
|
685
|
+
@action_input_index += 1
|
|
686
|
+
return true
|
|
687
|
+
end
|
|
688
|
+
#--------------------------------------------------------------------------
|
|
689
|
+
# * To Previous Command Input
|
|
690
|
+
#--------------------------------------------------------------------------
|
|
691
|
+
def prior_command
|
|
692
|
+
return false if @action_input_index <= 0
|
|
693
|
+
@action_input_index -= 1
|
|
694
|
+
return true
|
|
695
|
+
end
|
|
696
|
+
end
|