-
Notifications
You must be signed in to change notification settings - Fork 12
/
State Damage Using Skill.rb
122 lines (105 loc) · 3.71 KB
/
State Damage Using 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#==============================================================================
# TheoAllen - State Damage Using Skill
# Version : 1.0
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Contact :
#------------------------------------------------------------------------------
# *> Discord @ Theo#3034
#==============================================================================
($imported ||= {})[:Theo_StateSkillDamage] = true
#==============================================================================
# Change Logs:
# -----------------------------------------------------------------------------
# 2014.09.24 - Finished
#==============================================================================
%Q{
==================
|| Introduction ||
------------------
Once upon a time, a man realized that slip damage from the default system
is suck. Because it's based on percentage. So why not using a skill to create
a slip damage?
======================
|| How to use this? ||
----------------------
Put this under ▼ Materials
Use this notetag in the state notebox <skill damage: id>
Change the ID accordingly to the skill ID you want to use as the slip damage
Ex :
<skill damage: 10>
===================
|| Terms of use ||
-------------------
Credit me, TheoAllen. You are free to edit this script by your own. As long
as you don't claim it yours. For commercial purpose, don't forget to give me
a free copy of the game.
}
#==============================================================================
# End of the instruction
#==============================================================================
class RPG::State
# Store skill ID for formula damage
def skill_damage
if !@skill_damage
@skill_damage = 0
if note =~ /<skill[\s_]+damage\s*:\s*(\d+)>/i
@skill_damage = $1.to_i
end
end
return @skill_damage
end
end
class Game_Battler
alias theo_slipformula_clear_states clear_states
def clear_states
theo_slipformula_clear_states
@state_battler = {}
end
alias theo_slipformula_eff_add_state_attack item_effect_add_state_attack
def item_effect_add_state_attack(user, item, effect)
theo_slipformula_eff_add_state_attack(user, item, effect)
return unless @result.success
user.atk_states.each do |state_id|
if @states.include?(state_id)
@state_battler[state_id] = user
end
end
end
alias theo_slipformula_eff_add_state_normal item_effect_add_state_normal
def item_effect_add_state_normal(user, item, effect)
theo_slipformula_eff_add_state_normal(user, item, effect)
return unless @result.success
if @states.include?(effect.data_id)
@state_battler[effect.data_id] = user
end
end
alias theo_slipformula_erase_state erase_state
def erase_state(state_id)
theo_slipformula_erase_state(state_id)
@state_battler.delete(state_id)
end
alias theo_slipformula_turn_end on_turn_end
def on_turn_end
if alive?
perform_slip_damage_formula
end
theo_slipformula_turn_end
end
def perform_slip_damage_formula
@states.each do |state_id|
if $data_states[state_id].skill_damage > 0 && @state_battler[state_id]
skill = $data_skills[$data_states[state_id].skill_damage]
item_apply(@state_battler[state_id], skill)
self.animation_id = skill.animation_id
SceneManager.scene.log_window.display_action_results(self, skill)
if $imported["YEA-BattleEngine"] && !YEA::BATTLE::MSG_ADDED_STATES
SceneManager.scene.perform_collapse_check(self)
end
15.times {SceneManager.scene.update_basic}
end
end
end
end
class Scene_Battle
attr_reader :log_window
end