rgss3_default_scripts 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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,145 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# ** Vocab
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
# This module defines terms and messages. It defines some data as constant
|
5
|
+
# variables. Terms in the database are obtained from $data_system.
|
6
|
+
#==============================================================================
|
7
|
+
|
8
|
+
module Vocab
|
9
|
+
|
10
|
+
# Shop Screen
|
11
|
+
ShopBuy = "Buy"
|
12
|
+
ShopSell = "Sell"
|
13
|
+
ShopCancel = "Cancel"
|
14
|
+
Possession = "Possession"
|
15
|
+
|
16
|
+
# Status Screen
|
17
|
+
ExpTotal = "Current Exp"
|
18
|
+
ExpNext = "To Next %s"
|
19
|
+
|
20
|
+
# Save/Load Screen
|
21
|
+
SaveMessage = "Save to which file?"
|
22
|
+
LoadMessage = "Load which file?"
|
23
|
+
File = "File"
|
24
|
+
|
25
|
+
# Display when there are multiple members
|
26
|
+
PartyName = "%s's Party"
|
27
|
+
|
28
|
+
# Basic Battle Messages
|
29
|
+
Emerge = "%s emerged!"
|
30
|
+
Preemptive = "%s got the upper hand!"
|
31
|
+
Surprise = "%s was surprised!"
|
32
|
+
EscapeStart = "%s has started to escape!"
|
33
|
+
EscapeFailure = "However, it was unable to escape!"
|
34
|
+
|
35
|
+
# Battle Ending Messages
|
36
|
+
Victory = "%s was victorious!"
|
37
|
+
Defeat = "%s was defeated."
|
38
|
+
ObtainExp = "%s EXP received!"
|
39
|
+
ObtainGold = "%s\\G found!"
|
40
|
+
ObtainItem = "%s found!"
|
41
|
+
LevelUp = "%s is now %s %s!"
|
42
|
+
ObtainSkill = "%s learned!"
|
43
|
+
|
44
|
+
# Use Item
|
45
|
+
UseItem = "%s uses %s!"
|
46
|
+
|
47
|
+
# Critical Hit
|
48
|
+
CriticalToEnemy = "An excellent hit!!"
|
49
|
+
CriticalToActor = "A painful blow!!"
|
50
|
+
|
51
|
+
# Results for Actions on Actors
|
52
|
+
ActorDamage = "%s took %s damage!"
|
53
|
+
ActorRecovery = "%s recovered %s %s!"
|
54
|
+
ActorGain = "%s gained %s %s!"
|
55
|
+
ActorLoss = "%s lost %s %s!"
|
56
|
+
ActorDrain = "%s was drained of %s %s!"
|
57
|
+
ActorNoDamage = "%s took no damage!"
|
58
|
+
ActorNoHit = "Miss! %s took no damage!"
|
59
|
+
|
60
|
+
# Results for Actions on Enemies
|
61
|
+
EnemyDamage = "%s took %s damage!"
|
62
|
+
EnemyRecovery = "%s recovered %s %s!"
|
63
|
+
EnemyGain = "%s gained %s %s!"
|
64
|
+
EnemyLoss = "%s lost %s %s!"
|
65
|
+
EnemyDrain = "Drained %s %s from %s!"
|
66
|
+
EnemyNoDamage = "%s took no damage!"
|
67
|
+
EnemyNoHit = "Missed! %s took no damage!"
|
68
|
+
|
69
|
+
# Evasion/Reflection
|
70
|
+
Evasion = "%s evaded the attack!"
|
71
|
+
MagicEvasion = "%s nullified the magic!"
|
72
|
+
MagicReflection = "%s reflected the magic!"
|
73
|
+
CounterAttack = "%s counterattacked!"
|
74
|
+
Substitute = "%s protected %s!"
|
75
|
+
|
76
|
+
# Buff/Debuff
|
77
|
+
BuffAdd = "%s's %s went up!"
|
78
|
+
DebuffAdd = "%s's %s went down!"
|
79
|
+
BuffRemove = "%s's %s returned to normal."
|
80
|
+
|
81
|
+
# Skill or Item Had No Effect
|
82
|
+
ActionFailure = "There was no effect on %s!"
|
83
|
+
|
84
|
+
# Error Message
|
85
|
+
PlayerPosError = "Player's starting position is not set."
|
86
|
+
EventOverflow = "Common event calls exceeded the limit."
|
87
|
+
|
88
|
+
# Basic Status
|
89
|
+
def self.basic(basic_id)
|
90
|
+
$data_system.terms.basic[basic_id]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Parameters
|
94
|
+
def self.param(param_id)
|
95
|
+
$data_system.terms.params[param_id]
|
96
|
+
end
|
97
|
+
|
98
|
+
# Equip Type
|
99
|
+
def self.etype(etype_id)
|
100
|
+
$data_system.terms.etypes[etype_id]
|
101
|
+
end
|
102
|
+
|
103
|
+
# Commands
|
104
|
+
def self.command(command_id)
|
105
|
+
$data_system.terms.commands[command_id]
|
106
|
+
end
|
107
|
+
|
108
|
+
# Currency Unit
|
109
|
+
def self.currency_unit
|
110
|
+
$data_system.currency_unit
|
111
|
+
end
|
112
|
+
|
113
|
+
#--------------------------------------------------------------------------
|
114
|
+
def self.level; basic(0); end # Level
|
115
|
+
def self.level_a; basic(1); end # Level (short)
|
116
|
+
def self.hp; basic(2); end # HP
|
117
|
+
def self.hp_a; basic(3); end # HP (short)
|
118
|
+
def self.mp; basic(4); end # MP
|
119
|
+
def self.mp_a; basic(5); end # MP (short)
|
120
|
+
def self.tp; basic(6); end # TP
|
121
|
+
def self.tp_a; basic(7); end # TP (short)
|
122
|
+
def self.fight; command(0); end # Fight
|
123
|
+
def self.escape; command(1); end # Escape
|
124
|
+
def self.attack; command(2); end # Attack
|
125
|
+
def self.guard; command(3); end # Guard
|
126
|
+
def self.item; command(4); end # Items
|
127
|
+
def self.skill; command(5); end # Skills
|
128
|
+
def self.equip; command(6); end # Equip
|
129
|
+
def self.status; command(7); end # Status
|
130
|
+
def self.formation; command(8); end # Change Formation
|
131
|
+
def self.save; command(9); end # Save
|
132
|
+
def self.game_end; command(10); end # Exit Game
|
133
|
+
def self.weapon; command(12); end # Weapons
|
134
|
+
def self.armor; command(13); end # Armor
|
135
|
+
def self.key_item; command(14); end # Key Items
|
136
|
+
def self.equip2; command(15); end # Change Equipment
|
137
|
+
def self.optimize; command(16); end # Ultimate Equipment
|
138
|
+
def self.clear; command(17); end # Remove All
|
139
|
+
def self.new_game; command(18); end # New Game
|
140
|
+
def self.continue; command(19); end # Continue
|
141
|
+
def self.shutdown; command(20); end # Shut Down
|
142
|
+
def self.to_title; command(21); end # Go to Title
|
143
|
+
def self.cancel; command(22); end # Cancel
|
144
|
+
#--------------------------------------------------------------------------
|
145
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# ** Window_ActorCommand
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
# This window is for selecting an actor's action on the battle screen.
|
5
|
+
#==============================================================================
|
6
|
+
|
7
|
+
class Window_ActorCommand < Window_Command
|
8
|
+
#--------------------------------------------------------------------------
|
9
|
+
# * Object Initialization
|
10
|
+
#--------------------------------------------------------------------------
|
11
|
+
def initialize
|
12
|
+
super(0, 0)
|
13
|
+
self.openness = 0
|
14
|
+
deactivate
|
15
|
+
@actor = nil
|
16
|
+
end
|
17
|
+
#--------------------------------------------------------------------------
|
18
|
+
# * Get Window Width
|
19
|
+
#--------------------------------------------------------------------------
|
20
|
+
def window_width
|
21
|
+
return 128
|
22
|
+
end
|
23
|
+
#--------------------------------------------------------------------------
|
24
|
+
# * Get Number of Lines to Show
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
def visible_line_number
|
27
|
+
return 4
|
28
|
+
end
|
29
|
+
#--------------------------------------------------------------------------
|
30
|
+
# * Create Command List
|
31
|
+
#--------------------------------------------------------------------------
|
32
|
+
def make_command_list
|
33
|
+
return unless @actor
|
34
|
+
add_attack_command
|
35
|
+
add_skill_commands
|
36
|
+
add_guard_command
|
37
|
+
add_item_command
|
38
|
+
end
|
39
|
+
#--------------------------------------------------------------------------
|
40
|
+
# * Add Attack Command to List
|
41
|
+
#--------------------------------------------------------------------------
|
42
|
+
def add_attack_command
|
43
|
+
add_command(Vocab::attack, :attack, @actor.attack_usable?)
|
44
|
+
end
|
45
|
+
#--------------------------------------------------------------------------
|
46
|
+
# * Add Skill Command to List
|
47
|
+
#--------------------------------------------------------------------------
|
48
|
+
def add_skill_commands
|
49
|
+
@actor.added_skill_types.sort.each do |stype_id|
|
50
|
+
name = $data_system.skill_types[stype_id]
|
51
|
+
add_command(name, :skill, true, stype_id)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
#--------------------------------------------------------------------------
|
55
|
+
# * Add Guard Command to List
|
56
|
+
#--------------------------------------------------------------------------
|
57
|
+
def add_guard_command
|
58
|
+
add_command(Vocab::guard, :guard, @actor.guard_usable?)
|
59
|
+
end
|
60
|
+
#--------------------------------------------------------------------------
|
61
|
+
# * Add Item Command to List
|
62
|
+
#--------------------------------------------------------------------------
|
63
|
+
def add_item_command
|
64
|
+
add_command(Vocab::item, :item)
|
65
|
+
end
|
66
|
+
#--------------------------------------------------------------------------
|
67
|
+
# * Setup
|
68
|
+
#--------------------------------------------------------------------------
|
69
|
+
def setup(actor)
|
70
|
+
@actor = actor
|
71
|
+
clear_command_list
|
72
|
+
make_command_list
|
73
|
+
refresh
|
74
|
+
select(0)
|
75
|
+
activate
|
76
|
+
open
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,571 @@
|
|
1
|
+
#==============================================================================
|
2
|
+
# ** Window_Base
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
# This is a super class of all windows within the game.
|
5
|
+
#==============================================================================
|
6
|
+
|
7
|
+
class Window_Base < Window
|
8
|
+
#--------------------------------------------------------------------------
|
9
|
+
# * Object Initialization
|
10
|
+
#--------------------------------------------------------------------------
|
11
|
+
def initialize(x, y, width, height)
|
12
|
+
super
|
13
|
+
self.windowskin = Cache.system("Window")
|
14
|
+
update_padding
|
15
|
+
update_tone
|
16
|
+
create_contents
|
17
|
+
@opening = @closing = false
|
18
|
+
end
|
19
|
+
#--------------------------------------------------------------------------
|
20
|
+
# * Free
|
21
|
+
#--------------------------------------------------------------------------
|
22
|
+
def dispose
|
23
|
+
contents.dispose unless disposed?
|
24
|
+
super
|
25
|
+
end
|
26
|
+
#--------------------------------------------------------------------------
|
27
|
+
# * Get Line Height
|
28
|
+
#--------------------------------------------------------------------------
|
29
|
+
def line_height
|
30
|
+
return 24
|
31
|
+
end
|
32
|
+
#--------------------------------------------------------------------------
|
33
|
+
# * Get Standard Padding Size
|
34
|
+
#--------------------------------------------------------------------------
|
35
|
+
def standard_padding
|
36
|
+
return 12
|
37
|
+
end
|
38
|
+
#--------------------------------------------------------------------------
|
39
|
+
# * Update Padding
|
40
|
+
#--------------------------------------------------------------------------
|
41
|
+
def update_padding
|
42
|
+
self.padding = standard_padding
|
43
|
+
end
|
44
|
+
#--------------------------------------------------------------------------
|
45
|
+
# * Calculate Width of Window Contents
|
46
|
+
#--------------------------------------------------------------------------
|
47
|
+
def contents_width
|
48
|
+
width - standard_padding * 2
|
49
|
+
end
|
50
|
+
#--------------------------------------------------------------------------
|
51
|
+
# * Calculate Height of Window Contents
|
52
|
+
#--------------------------------------------------------------------------
|
53
|
+
def contents_height
|
54
|
+
height - standard_padding * 2
|
55
|
+
end
|
56
|
+
#--------------------------------------------------------------------------
|
57
|
+
# * Calculate Height of Window Suited to Specified Number of Lines
|
58
|
+
#--------------------------------------------------------------------------
|
59
|
+
def fitting_height(line_number)
|
60
|
+
line_number * line_height + standard_padding * 2
|
61
|
+
end
|
62
|
+
#--------------------------------------------------------------------------
|
63
|
+
# * Update Tone
|
64
|
+
#--------------------------------------------------------------------------
|
65
|
+
def update_tone
|
66
|
+
self.tone.set($game_system.window_tone)
|
67
|
+
end
|
68
|
+
#--------------------------------------------------------------------------
|
69
|
+
# * Create Window Contents
|
70
|
+
#--------------------------------------------------------------------------
|
71
|
+
def create_contents
|
72
|
+
contents.dispose
|
73
|
+
if contents_width > 0 && contents_height > 0
|
74
|
+
self.contents = Bitmap.new(contents_width, contents_height)
|
75
|
+
else
|
76
|
+
self.contents = Bitmap.new(1, 1)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
#--------------------------------------------------------------------------
|
80
|
+
# * Frame Update
|
81
|
+
#--------------------------------------------------------------------------
|
82
|
+
def update
|
83
|
+
super
|
84
|
+
update_tone
|
85
|
+
update_open if @opening
|
86
|
+
update_close if @closing
|
87
|
+
end
|
88
|
+
#--------------------------------------------------------------------------
|
89
|
+
# * Update Open Processing
|
90
|
+
#--------------------------------------------------------------------------
|
91
|
+
def update_open
|
92
|
+
self.openness += 48
|
93
|
+
@opening = false if open?
|
94
|
+
end
|
95
|
+
#--------------------------------------------------------------------------
|
96
|
+
# * Update Close Processing
|
97
|
+
#--------------------------------------------------------------------------
|
98
|
+
def update_close
|
99
|
+
self.openness -= 48
|
100
|
+
@closing = false if close?
|
101
|
+
end
|
102
|
+
#--------------------------------------------------------------------------
|
103
|
+
# * Open Window
|
104
|
+
#--------------------------------------------------------------------------
|
105
|
+
def open
|
106
|
+
@opening = true unless open?
|
107
|
+
@closing = false
|
108
|
+
self
|
109
|
+
end
|
110
|
+
#--------------------------------------------------------------------------
|
111
|
+
# * Close Window
|
112
|
+
#--------------------------------------------------------------------------
|
113
|
+
def close
|
114
|
+
@closing = true unless close?
|
115
|
+
@opening = false
|
116
|
+
self
|
117
|
+
end
|
118
|
+
#--------------------------------------------------------------------------
|
119
|
+
# * Show Window
|
120
|
+
#--------------------------------------------------------------------------
|
121
|
+
def show
|
122
|
+
self.visible = true
|
123
|
+
self
|
124
|
+
end
|
125
|
+
#--------------------------------------------------------------------------
|
126
|
+
# * Hide Window
|
127
|
+
#--------------------------------------------------------------------------
|
128
|
+
def hide
|
129
|
+
self.visible = false
|
130
|
+
self
|
131
|
+
end
|
132
|
+
#--------------------------------------------------------------------------
|
133
|
+
# * Activate Window
|
134
|
+
#--------------------------------------------------------------------------
|
135
|
+
def activate
|
136
|
+
self.active = true
|
137
|
+
self
|
138
|
+
end
|
139
|
+
#--------------------------------------------------------------------------
|
140
|
+
# * Deactivate Window
|
141
|
+
#--------------------------------------------------------------------------
|
142
|
+
def deactivate
|
143
|
+
self.active = false
|
144
|
+
self
|
145
|
+
end
|
146
|
+
#--------------------------------------------------------------------------
|
147
|
+
# * Get Text Color
|
148
|
+
# n : Text color number (0..31)
|
149
|
+
#--------------------------------------------------------------------------
|
150
|
+
def text_color(n)
|
151
|
+
windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
|
152
|
+
end
|
153
|
+
#--------------------------------------------------------------------------
|
154
|
+
# * Get Text Colors
|
155
|
+
#--------------------------------------------------------------------------
|
156
|
+
def normal_color; text_color(0); end; # Normal
|
157
|
+
def system_color; text_color(16); end; # System
|
158
|
+
def crisis_color; text_color(17); end; # Crisis
|
159
|
+
def knockout_color; text_color(18); end; # Knock out
|
160
|
+
def gauge_back_color; text_color(19); end; # Gauge background
|
161
|
+
def hp_gauge_color1; text_color(20); end; # HP gauge 1
|
162
|
+
def hp_gauge_color2; text_color(21); end; # HP gauge 2
|
163
|
+
def mp_gauge_color1; text_color(22); end; # MP gauge 1
|
164
|
+
def mp_gauge_color2; text_color(23); end; # MP gauge 2
|
165
|
+
def mp_cost_color; text_color(23); end; # TP cost
|
166
|
+
def power_up_color; text_color(24); end; # Equipment power up
|
167
|
+
def power_down_color; text_color(25); end; # Equipment power down
|
168
|
+
def tp_gauge_color1; text_color(28); end; # TP gauge 1
|
169
|
+
def tp_gauge_color2; text_color(29); end; # TP gauge 2
|
170
|
+
def tp_cost_color; text_color(29); end; # TP cost
|
171
|
+
#--------------------------------------------------------------------------
|
172
|
+
# * Get Background Color of Pending Item
|
173
|
+
#--------------------------------------------------------------------------
|
174
|
+
def pending_color
|
175
|
+
windowskin.get_pixel(80, 80)
|
176
|
+
end
|
177
|
+
#--------------------------------------------------------------------------
|
178
|
+
# * Get Alpha Value of Translucent Drawing
|
179
|
+
#--------------------------------------------------------------------------
|
180
|
+
def translucent_alpha
|
181
|
+
return 160
|
182
|
+
end
|
183
|
+
#--------------------------------------------------------------------------
|
184
|
+
# * Change Text Drawing Color
|
185
|
+
# enabled : Enabled flag. When false, draw semi-transparently.
|
186
|
+
#--------------------------------------------------------------------------
|
187
|
+
def change_color(color, enabled = true)
|
188
|
+
contents.font.color.set(color)
|
189
|
+
contents.font.color.alpha = translucent_alpha unless enabled
|
190
|
+
end
|
191
|
+
#--------------------------------------------------------------------------
|
192
|
+
# * Draw Text
|
193
|
+
# args : Same as Bitmap#draw_text.
|
194
|
+
#--------------------------------------------------------------------------
|
195
|
+
def draw_text(*args)
|
196
|
+
contents.draw_text(*args)
|
197
|
+
end
|
198
|
+
#--------------------------------------------------------------------------
|
199
|
+
# * Get Text Size
|
200
|
+
#--------------------------------------------------------------------------
|
201
|
+
def text_size(str)
|
202
|
+
contents.text_size(str)
|
203
|
+
end
|
204
|
+
#--------------------------------------------------------------------------
|
205
|
+
# * Draw Text with Control Characters
|
206
|
+
#--------------------------------------------------------------------------
|
207
|
+
def draw_text_ex(x, y, text)
|
208
|
+
reset_font_settings
|
209
|
+
text = convert_escape_characters(text)
|
210
|
+
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
|
211
|
+
process_character(text.slice!(0, 1), text, pos) until text.empty?
|
212
|
+
end
|
213
|
+
#--------------------------------------------------------------------------
|
214
|
+
# * Reset Font Settings
|
215
|
+
#--------------------------------------------------------------------------
|
216
|
+
def reset_font_settings
|
217
|
+
change_color(normal_color)
|
218
|
+
contents.font.size = Font.default_size
|
219
|
+
contents.font.bold = Font.default_bold
|
220
|
+
contents.font.italic = Font.default_italic
|
221
|
+
end
|
222
|
+
#--------------------------------------------------------------------------
|
223
|
+
# * Preconvert Control Characters
|
224
|
+
# As a rule, replace only what will be changed into text strings before
|
225
|
+
# starting actual drawing. The character "\" is replaced with the escape
|
226
|
+
# character (\e).
|
227
|
+
#--------------------------------------------------------------------------
|
228
|
+
def convert_escape_characters(text)
|
229
|
+
result = text.to_s.clone
|
230
|
+
result.gsub!(/\\/) { "\e" }
|
231
|
+
result.gsub!(/\e\e/) { "\\" }
|
232
|
+
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
|
233
|
+
result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
|
234
|
+
result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
|
235
|
+
result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
|
236
|
+
result.gsub!(/\eG/i) { Vocab::currency_unit }
|
237
|
+
result
|
238
|
+
end
|
239
|
+
#--------------------------------------------------------------------------
|
240
|
+
# * Get Name of Actor Number n
|
241
|
+
#--------------------------------------------------------------------------
|
242
|
+
def actor_name(n)
|
243
|
+
actor = n >= 1 ? $game_actors[n] : nil
|
244
|
+
actor ? actor.name : ""
|
245
|
+
end
|
246
|
+
#--------------------------------------------------------------------------
|
247
|
+
# * Get Name of Party Member n
|
248
|
+
#--------------------------------------------------------------------------
|
249
|
+
def party_member_name(n)
|
250
|
+
actor = n >= 1 ? $game_party.members[n - 1] : nil
|
251
|
+
actor ? actor.name : ""
|
252
|
+
end
|
253
|
+
#--------------------------------------------------------------------------
|
254
|
+
# * Character Processing
|
255
|
+
# c : Characters
|
256
|
+
# text : A character string buffer in drawing processing (destructive)
|
257
|
+
# pos : Draw position {:x, :y, :new_x, :height}
|
258
|
+
#--------------------------------------------------------------------------
|
259
|
+
def process_character(c, text, pos)
|
260
|
+
case c
|
261
|
+
when "\n" # New line
|
262
|
+
process_new_line(text, pos)
|
263
|
+
when "\f" # New page
|
264
|
+
process_new_page(text, pos)
|
265
|
+
when "\e" # Control character
|
266
|
+
process_escape_character(obtain_escape_code(text), text, pos)
|
267
|
+
else # Normal character
|
268
|
+
process_normal_character(c, pos)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
#--------------------------------------------------------------------------
|
272
|
+
# * Normal Character Processing
|
273
|
+
#--------------------------------------------------------------------------
|
274
|
+
def process_normal_character(c, pos)
|
275
|
+
text_width = text_size(c).width
|
276
|
+
draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
|
277
|
+
pos[:x] += text_width
|
278
|
+
end
|
279
|
+
#--------------------------------------------------------------------------
|
280
|
+
# * New Line Character Processing
|
281
|
+
#--------------------------------------------------------------------------
|
282
|
+
def process_new_line(text, pos)
|
283
|
+
pos[:x] = pos[:new_x]
|
284
|
+
pos[:y] += pos[:height]
|
285
|
+
pos[:height] = calc_line_height(text)
|
286
|
+
end
|
287
|
+
#--------------------------------------------------------------------------
|
288
|
+
# * New Page Character Processing
|
289
|
+
#--------------------------------------------------------------------------
|
290
|
+
def process_new_page(text, pos)
|
291
|
+
end
|
292
|
+
#--------------------------------------------------------------------------
|
293
|
+
# * Destructively Get Control Code
|
294
|
+
#--------------------------------------------------------------------------
|
295
|
+
def obtain_escape_code(text)
|
296
|
+
text.slice!(/^[\$\.\|\^!><\{\}\\]|^[A-Z]+/i)
|
297
|
+
end
|
298
|
+
#--------------------------------------------------------------------------
|
299
|
+
# * Destructively Get Control Code Argument
|
300
|
+
#--------------------------------------------------------------------------
|
301
|
+
def obtain_escape_param(text)
|
302
|
+
text.slice!(/^\[\d+\]/)[/\d+/].to_i rescue 0
|
303
|
+
end
|
304
|
+
#--------------------------------------------------------------------------
|
305
|
+
# * Control Character Processing
|
306
|
+
# code : the core of the control character
|
307
|
+
# e.g. "C" in the case of the control character \C[1].
|
308
|
+
#--------------------------------------------------------------------------
|
309
|
+
def process_escape_character(code, text, pos)
|
310
|
+
case code.upcase
|
311
|
+
when 'C'
|
312
|
+
change_color(text_color(obtain_escape_param(text)))
|
313
|
+
when 'I'
|
314
|
+
process_draw_icon(obtain_escape_param(text), pos)
|
315
|
+
when '{'
|
316
|
+
make_font_bigger
|
317
|
+
when '}'
|
318
|
+
make_font_smaller
|
319
|
+
end
|
320
|
+
end
|
321
|
+
#--------------------------------------------------------------------------
|
322
|
+
# * Icon Drawing Process by Control Characters
|
323
|
+
#--------------------------------------------------------------------------
|
324
|
+
def process_draw_icon(icon_index, pos)
|
325
|
+
draw_icon(icon_index, pos[:x], pos[:y])
|
326
|
+
pos[:x] += 24
|
327
|
+
end
|
328
|
+
#--------------------------------------------------------------------------
|
329
|
+
# * Increase Font Size
|
330
|
+
#--------------------------------------------------------------------------
|
331
|
+
def make_font_bigger
|
332
|
+
contents.font.size += 8 if contents.font.size <= 64
|
333
|
+
end
|
334
|
+
#--------------------------------------------------------------------------
|
335
|
+
# * Decrease Font Size
|
336
|
+
#--------------------------------------------------------------------------
|
337
|
+
def make_font_smaller
|
338
|
+
contents.font.size -= 8 if contents.font.size >= 16
|
339
|
+
end
|
340
|
+
#--------------------------------------------------------------------------
|
341
|
+
# * Calculate Line Height
|
342
|
+
# restore_font_size : Return to original font size after calculating
|
343
|
+
#--------------------------------------------------------------------------
|
344
|
+
def calc_line_height(text, restore_font_size = true)
|
345
|
+
result = [line_height, contents.font.size].max
|
346
|
+
last_font_size = contents.font.size
|
347
|
+
text.slice(/^.*$/).scan(/\e[\{\}]/).each do |esc|
|
348
|
+
make_font_bigger if esc == "\e{"
|
349
|
+
make_font_smaller if esc == "\e}"
|
350
|
+
result = [result, contents.font.size].max
|
351
|
+
end
|
352
|
+
contents.font.size = last_font_size if restore_font_size
|
353
|
+
result
|
354
|
+
end
|
355
|
+
#--------------------------------------------------------------------------
|
356
|
+
# * Draw Gauge
|
357
|
+
# rate : Rate (full at 1.0)
|
358
|
+
# color1 : Left side gradation
|
359
|
+
# color2 : Right side gradation
|
360
|
+
#--------------------------------------------------------------------------
|
361
|
+
def draw_gauge(x, y, width, rate, color1, color2)
|
362
|
+
fill_w = (width * rate).to_i
|
363
|
+
gauge_y = y + line_height - 8
|
364
|
+
contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
|
365
|
+
contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
|
366
|
+
end
|
367
|
+
#--------------------------------------------------------------------------
|
368
|
+
# * Draw Icon
|
369
|
+
# enabled : Enabled flag. When false, draw semi-transparently.
|
370
|
+
#--------------------------------------------------------------------------
|
371
|
+
def draw_icon(icon_index, x, y, enabled = true)
|
372
|
+
bitmap = Cache.system("Iconset")
|
373
|
+
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
|
374
|
+
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
|
375
|
+
end
|
376
|
+
#--------------------------------------------------------------------------
|
377
|
+
# * Draw Face Graphic
|
378
|
+
# enabled : Enabled flag. When false, draw semi-transparently.
|
379
|
+
#--------------------------------------------------------------------------
|
380
|
+
def draw_face(face_name, face_index, x, y, enabled = true)
|
381
|
+
bitmap = Cache.face(face_name)
|
382
|
+
rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
|
383
|
+
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
|
384
|
+
bitmap.dispose
|
385
|
+
end
|
386
|
+
#--------------------------------------------------------------------------
|
387
|
+
# * Draw Character Graphic
|
388
|
+
#--------------------------------------------------------------------------
|
389
|
+
def draw_character(character_name, character_index, x, y)
|
390
|
+
return unless character_name
|
391
|
+
bitmap = Cache.character(character_name)
|
392
|
+
sign = character_name[/^[\!\$]./]
|
393
|
+
if sign && sign.include?('$')
|
394
|
+
cw = bitmap.width / 3
|
395
|
+
ch = bitmap.height / 4
|
396
|
+
else
|
397
|
+
cw = bitmap.width / 12
|
398
|
+
ch = bitmap.height / 8
|
399
|
+
end
|
400
|
+
n = character_index
|
401
|
+
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
|
402
|
+
contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
|
403
|
+
end
|
404
|
+
#--------------------------------------------------------------------------
|
405
|
+
# * Get HP Text Color
|
406
|
+
#--------------------------------------------------------------------------
|
407
|
+
def hp_color(actor)
|
408
|
+
return knockout_color if actor.hp == 0
|
409
|
+
return crisis_color if actor.hp < actor.mhp / 4
|
410
|
+
return normal_color
|
411
|
+
end
|
412
|
+
#--------------------------------------------------------------------------
|
413
|
+
# * Get MP Text Color
|
414
|
+
#--------------------------------------------------------------------------
|
415
|
+
def mp_color(actor)
|
416
|
+
return crisis_color if actor.mp < actor.mmp / 4
|
417
|
+
return normal_color
|
418
|
+
end
|
419
|
+
#--------------------------------------------------------------------------
|
420
|
+
# * Get TP Text Color
|
421
|
+
#--------------------------------------------------------------------------
|
422
|
+
def tp_color(actor)
|
423
|
+
return normal_color
|
424
|
+
end
|
425
|
+
#--------------------------------------------------------------------------
|
426
|
+
# * Draw Actor Walking Graphic
|
427
|
+
#--------------------------------------------------------------------------
|
428
|
+
def draw_actor_graphic(actor, x, y)
|
429
|
+
draw_character(actor.character_name, actor.character_index, x, y)
|
430
|
+
end
|
431
|
+
#--------------------------------------------------------------------------
|
432
|
+
# * Draw Actor Face Graphic
|
433
|
+
#--------------------------------------------------------------------------
|
434
|
+
def draw_actor_face(actor, x, y, enabled = true)
|
435
|
+
draw_face(actor.face_name, actor.face_index, x, y, enabled)
|
436
|
+
end
|
437
|
+
#--------------------------------------------------------------------------
|
438
|
+
# * Draw Name
|
439
|
+
#--------------------------------------------------------------------------
|
440
|
+
def draw_actor_name(actor, x, y, width = 112)
|
441
|
+
change_color(hp_color(actor))
|
442
|
+
draw_text(x, y, width, line_height, actor.name)
|
443
|
+
end
|
444
|
+
#--------------------------------------------------------------------------
|
445
|
+
# * Draw Class
|
446
|
+
#--------------------------------------------------------------------------
|
447
|
+
def draw_actor_class(actor, x, y, width = 112)
|
448
|
+
change_color(normal_color)
|
449
|
+
draw_text(x, y, width, line_height, actor.class.name)
|
450
|
+
end
|
451
|
+
#--------------------------------------------------------------------------
|
452
|
+
# * Draw Nickname
|
453
|
+
#--------------------------------------------------------------------------
|
454
|
+
def draw_actor_nickname(actor, x, y, width = 180)
|
455
|
+
change_color(normal_color)
|
456
|
+
draw_text(x, y, width, line_height, actor.nickname)
|
457
|
+
end
|
458
|
+
#--------------------------------------------------------------------------
|
459
|
+
# * Draw Level
|
460
|
+
#--------------------------------------------------------------------------
|
461
|
+
def draw_actor_level(actor, x, y)
|
462
|
+
change_color(system_color)
|
463
|
+
draw_text(x, y, 32, line_height, Vocab::level_a)
|
464
|
+
change_color(normal_color)
|
465
|
+
draw_text(x + 32, y, 24, line_height, actor.level, 2)
|
466
|
+
end
|
467
|
+
#--------------------------------------------------------------------------
|
468
|
+
# * Draw State and Buff/Debuff Icons
|
469
|
+
#--------------------------------------------------------------------------
|
470
|
+
def draw_actor_icons(actor, x, y, width = 96)
|
471
|
+
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
|
472
|
+
icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
|
473
|
+
end
|
474
|
+
#--------------------------------------------------------------------------
|
475
|
+
# * Draw Current Value/Maximum Value in Fractional Format
|
476
|
+
# current : Current value
|
477
|
+
# max : Maximum value
|
478
|
+
# color1 : Color of current value
|
479
|
+
# color2 : Color of maximum value
|
480
|
+
#--------------------------------------------------------------------------
|
481
|
+
def draw_current_and_max_values(x, y, width, current, max, color1, color2)
|
482
|
+
change_color(color1)
|
483
|
+
xr = x + width
|
484
|
+
if width < 96
|
485
|
+
draw_text(xr - 40, y, 42, line_height, current, 2)
|
486
|
+
else
|
487
|
+
draw_text(xr - 92, y, 42, line_height, current, 2)
|
488
|
+
change_color(color2)
|
489
|
+
draw_text(xr - 52, y, 12, line_height, "/", 2)
|
490
|
+
draw_text(xr - 42, y, 42, line_height, max, 2)
|
491
|
+
end
|
492
|
+
end
|
493
|
+
#--------------------------------------------------------------------------
|
494
|
+
# * Draw HP
|
495
|
+
#--------------------------------------------------------------------------
|
496
|
+
def draw_actor_hp(actor, x, y, width = 124)
|
497
|
+
draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
|
498
|
+
change_color(system_color)
|
499
|
+
draw_text(x, y, 30, line_height, Vocab::hp_a)
|
500
|
+
draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
|
501
|
+
hp_color(actor), normal_color)
|
502
|
+
end
|
503
|
+
#--------------------------------------------------------------------------
|
504
|
+
# * Draw MP
|
505
|
+
#--------------------------------------------------------------------------
|
506
|
+
def draw_actor_mp(actor, x, y, width = 124)
|
507
|
+
draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
|
508
|
+
change_color(system_color)
|
509
|
+
draw_text(x, y, 30, line_height, Vocab::mp_a)
|
510
|
+
draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
|
511
|
+
mp_color(actor), normal_color)
|
512
|
+
end
|
513
|
+
#--------------------------------------------------------------------------
|
514
|
+
# * Draw TP
|
515
|
+
#--------------------------------------------------------------------------
|
516
|
+
def draw_actor_tp(actor, x, y, width = 124)
|
517
|
+
draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
|
518
|
+
change_color(system_color)
|
519
|
+
draw_text(x, y, 30, line_height, Vocab::tp_a)
|
520
|
+
change_color(tp_color(actor))
|
521
|
+
draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
|
522
|
+
end
|
523
|
+
#--------------------------------------------------------------------------
|
524
|
+
# * Draw Simple Status
|
525
|
+
#--------------------------------------------------------------------------
|
526
|
+
def draw_actor_simple_status(actor, x, y)
|
527
|
+
draw_actor_name(actor, x, y)
|
528
|
+
draw_actor_level(actor, x, y + line_height * 1)
|
529
|
+
draw_actor_icons(actor, x, y + line_height * 2)
|
530
|
+
draw_actor_class(actor, x + 120, y)
|
531
|
+
draw_actor_hp(actor, x + 120, y + line_height * 1)
|
532
|
+
draw_actor_mp(actor, x + 120, y + line_height * 2)
|
533
|
+
end
|
534
|
+
#--------------------------------------------------------------------------
|
535
|
+
# * Draw Parameters
|
536
|
+
#--------------------------------------------------------------------------
|
537
|
+
def draw_actor_param(actor, x, y, param_id)
|
538
|
+
change_color(system_color)
|
539
|
+
draw_text(x, y, 120, line_height, Vocab::param(param_id))
|
540
|
+
change_color(normal_color)
|
541
|
+
draw_text(x + 120, y, 36, line_height, actor.param(param_id), 2)
|
542
|
+
end
|
543
|
+
#--------------------------------------------------------------------------
|
544
|
+
# * Draw Item Name
|
545
|
+
# enabled : Enabled flag. When false, draw semi-transparently.
|
546
|
+
#--------------------------------------------------------------------------
|
547
|
+
def draw_item_name(item, x, y, enabled = true, width = 172)
|
548
|
+
return unless item
|
549
|
+
draw_icon(item.icon_index, x, y, enabled)
|
550
|
+
change_color(normal_color, enabled)
|
551
|
+
draw_text(x + 24, y, width, line_height, item.name)
|
552
|
+
end
|
553
|
+
#--------------------------------------------------------------------------
|
554
|
+
# * Draw Number (Gold Etc.) with Currency Unit
|
555
|
+
#--------------------------------------------------------------------------
|
556
|
+
def draw_currency_value(value, unit, x, y, width)
|
557
|
+
cx = text_size(unit).width
|
558
|
+
change_color(normal_color)
|
559
|
+
draw_text(x, y, width - cx - 2, line_height, value, 2)
|
560
|
+
change_color(system_color)
|
561
|
+
draw_text(x, y, width, line_height, unit, 2)
|
562
|
+
end
|
563
|
+
#--------------------------------------------------------------------------
|
564
|
+
# * Get Parameter Change Color
|
565
|
+
#--------------------------------------------------------------------------
|
566
|
+
def param_change_color(change)
|
567
|
+
return power_up_color if change > 0
|
568
|
+
return power_down_color if change < 0
|
569
|
+
return normal_color
|
570
|
+
end
|
571
|
+
end
|