I don't get what you mean with the weapons.
In rmxp, Attack does damage based on ATK. Equipping a weapon changes actor's states, including ATK. So weapons effect both Attack damage and Skill damage, (or non- if your weapon doesn't raise ATK). You shouldn't have a problem, as long as your non-magical skills are physical (100% Atk-f) .
[rgss]
class RPG::Skill
Non_Magic_Skill = 17 # element ID (of the 'skill' element)
def non_magic_skill?
return @element_set.include?(Non_Magic_Skill)
end
def fixed_name
nameParts = @name.split(/%/)
return nameParts[0]
end
def get_rate_from_name
data = @name.split(/%/)
skill_rate = data[1].nil? ? 100 : data[1].to_i
return skill_rate
end
end
class Game_Battler
def skill_hit?(user, skill)
if ( [3,4].include?(skill.scope) and self.hp == 0) or
( [5,6].include?(skill.scope) and self.hp >= 1)
return false
end
# else
return true
end
def damage_correct(attacker, damage)
# critical
if rand(100) < 4 * attacker.dex / self.agi
damage *= 2
self.critical = true
end
# Guard
damage /= 2 if self.guarding?
return damage
end
def attack_self_damage(attacker)
self.critical = false
# basic damage
atk = [attacker.atk - self.pdef / 2, 0].max
damage = atk * (20 + attacker.str) / 20
# Element correction
damage *= elements_correct(attacker.element_set)
damage /= 100
if (damage > 0)
damage = damage_correct(attacker, damage)
end
# Dispersion
if damage.abs > 0
amp = [damage.abs * 15 / 100, 1].max
damage += rand(amp+1) + rand(amp+1) - amp
end
return damage
end
def non_magic_skill_effect(user, skill)
# Clear critical flag
self.critical = false
return false unless skill_hit?(user, skill)
# Clear effective flag
effective = false
# Set effective flag if common ID is effective
effective |= skill.common_event_id > 0
skill_rate = skill.get_rate_from_name
#hit_result = attack_hit?(user)
# First hit detection
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
# If hit occurs
if hit_result == true
damage = attack_self_damage(user)
self.damage = damage * skill_rate / 100
# Element correction
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# State Removed by Shock
remove_states_shock
# Substract damage from HP
self.hp -= self.damage
# State change
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# When missing
else
# Set damage to "Miss"
self.damage = "Miss"
end
# If not in battle
unless $game_temp.in_battle
# Set damage to nil
self.damage = nil
end
# End Method
return effective
end
# new
alias default_skill_effect skill_effect
def skill_effect(user, skill)
if skill.non_magic_skill?
non_magic_skill_effect(user, skill)
else
default_skill_effect(user, skill)
end
end
end
class Game_Actor < Game_Battler
attr_accessor :left_skills
alias actor_init initialize
def initialize(actor_id)
#actor_init(actor_id)
@left_skills = Hash.new
@skill_level_learnt = Hash.new
actor_init(actor_id)
# fix level_learnt
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
#learn_skill(j.skill_id)
@skill_level_learnt[j.skill_id] = i
end
end
end
update_left_skills
end
def max_skill_uses(id)
lev_learnt = @skill_level_learnt[id]
max = (@level-lev_learnt)/4
max += 1
return max
end
def learn_skill(skill_id)
if skill_id > 0 and not skill_learn?(skill_id)
@skills.push(skill_id)
@skills.sort!
end
@left_skills[skill_id] = 1
@skill_level_learnt[skill_id] = @level
end
def update_left_skills
# update the number of skill uses. will return uses to max.
for id in @skills
lev_learnt = @skill_level_learnt[id]
@left_skills[id] = 1+((@level-lev_learnt)/4)
end
end
#--------------------------------------------------------------------------
# * Change Level
# level : new level
#--------------------------------------------------------------------------
def level=(level)
# Check up and down limits
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
# Change EXP
self.exp = @exp_list[level]
# edit: update skill uses to fit the new level.
update_left_skills
end
# new
#--------------------------------------------------------------------------
# * Change EXP
# exp : new EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# Level up
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# Learn skill
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
update_left_skills # edit
end
# Level down
while @exp < @exp_list[@level]
@level -= 1
update_left_skills # edit
end
# Correction if exceeding current max HP and max SP
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# * Recover All
#--------------------------------------------------------------------------
def recover_all
@hp = maxhp
@sp = maxsp
for i in @states.clone
remove_state(i)
end
@skills.each { |id| @left_skills[id] = max_skill_uses(id) }
end
def skill_can_use?(skill_id)
# --------------- edit -------------- #
not_magical = $data_skills[skill_id].non_magic_skill?
if not_magical
# If there's not enough 'uses', the skill cannot be used.
if @left_skills[skill_id] <= 0
return false
end
else # skills use SP
# If there's not enough SP, the skill cannot be used.
if $data_skills[skill_id].sp_cost > self.sp
return false
end
end
# ----------------------------------- #
if not skill_learn?(skill_id)
return false
end
# Unusable if incapacitated
if dead?
return false
end
# If silent, only physical skills can be used
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# Get usable time
occasion = $data_skills[skill_id].occasion
# If in battle
if $game_temp.in_battle
# Usable with [Normal] and [Only Battle]
return (occasion == 0 or occasion == 1)
# If not in battle
else
# Usable with [Normal] and [Only Menu]
return (occasion == 0 or occasion == 2)
end
end
end
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
# edit:
if skill.non_magic_skill?
# use skill.fixed_name, so the %x isn't shown on screen.
# replace the sp cost with: left/max uses
self.contents.draw_text(x + 28, y, 204, 32, skill.fixed_name, 0)
max = @actor.max_skill_uses(skill.id)
left = @actor.left_skills[skill.id]
self.contents.draw_text(x + 232, y, 48, 32, "#{left}/#{max}", 2)
else
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@skill.id)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
# ----------------- edit ------------------- #
unless @skill.non_magic_skill?
# Use up SP
@active_battler.sp -= @skill.sp_cost
end
# Use up 'skill times' instead
if @active_battler.is_a?(Game_Actor) and @skill.non_magic_skill?
@active_battler.left_skills[@skill.id] -= 1
end
# ------------------------------------------- #
# Refresh status window
@status_window.refresh
# Show skill name on help window
# edit: use skill.fixed_name
@help_window.set_text(@skill.fixed_name, 1)
# Set animation ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# Set command event ID
@common_event_id = @skill.common_event_id
# Set target battlers
set_target_battlers(@skill.scope)
# Apply skill effect
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
[/rgss]