Skip to content

Commit

Permalink
[Movement Speed States] added functionality
Browse files Browse the repository at this point in the history
Armour and weapons now can also alter the movement speed.
  • Loading branch information
regendo committed Apr 14, 2013
1 parent 06dc1ad commit ab7676b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Movement_Speed_States/movement_speed_states.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#
# 2.: Setting up the states
#
# This now also applies to weapons and armour parts.
#
# Choose a state (or create a new one)
# that you want to change your party's
# movement speed. Note that the movement
Expand Down Expand Up @@ -104,6 +106,16 @@ def movement_speed_modifier
end
end

class RPG::EquipItem < RPG::BaseItem
def movement_speed_increase
NoteReader.get_data(note, 'MSIncrease', :int)
end

def movement_speed_modifier
NoteReader.get_data(note, 'MSModifier', :int)
end
end

class Game_Player < Game_Character

alias real_move_speed_with_state_modifiers real_move_speed
Expand All @@ -125,6 +137,12 @@ def total_movement_speed_increases
states.each do |s|
sum += s.movement_speed_increase || 0
end
weapons.each do |w|
sum += w.movement_speed_increase || 0
end
armors.each do |a|
sum += a.movement_speed_increase || 0
end
return sum
end

Expand All @@ -134,6 +152,14 @@ def total_movement_speed_modifiers
mod *= s.movement_speed_modifier || 100
mod /= 100
end
weapons.each do |w|
mod *= w.movement_speed_modifier || 100
mod /= 100
end
armors.each do |a|
mod *= a.movement_speed_modifier || 100
mod /= 100
end
return mod
end

Expand Down

0 comments on commit ab7676b

Please sign in to comment.