-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlast_skill.rb
66 lines (65 loc) · 2.78 KB
/
last_skill.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#==============================================================================
# ■ スキルタイプ別選択位置記憶 RGSS3 v1.1 MIT License; see git.io/tic
#------------------------------------------------------------------------------
# 最後に選択したスキルをスキルタイプ別に記憶します。
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :last_skills # カーソル記憶用 : タイプ別スキル
#--------------------------------------------------------------------------
# ● オブジェクト初期化【エイリアス】
#--------------------------------------------------------------------------
alias toruic_initialize initialize
def initialize(actor_id)
toruic_initialize(actor_id)
@last_skills = []
end
end
#------------------------------------------------------------------------------
class Window_SkillList
#--------------------------------------------------------------------------
# ● 前回の選択位置を復帰【※再定義※】
#--------------------------------------------------------------------------
def select_last
if @actor.last_skills[@stype_id]
select(@data.index(@actor.last_skills[@stype_id].object) || 0)
else
select(0)
end
end
end
#------------------------------------------------------------------------------
class Scene_Skill
#--------------------------------------------------------------------------
# ● アイテム[決定]【エイリアス】
#--------------------------------------------------------------------------
alias toruic_on_item_ok on_item_ok
def on_item_ok
@actor.last_skills[item.stype_id] ||= Game_BaseItem.new
@actor.last_skills[item.stype_id].object = item
toruic_on_item_ok
end
end
#------------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# ● スキル[決定]【※再定義※】
#--------------------------------------------------------------------------
def on_skill_ok
@skill = @skill_window.item
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skills[@skill.stype_id] ||= Game_BaseItem.new
BattleManager.actor.last_skills[@skill.stype_id].object = @skill
BattleManager.actor.last_skill.object = @skill
if !@skill.need_selection?
@skill_window.hide
next_command
elsif @skill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
end