Klokreations

You are not connected. Please login or register

Skill for magic and weapon using classes?

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Skill for magic and weapon using classes? on Thu Feb 21, 2013 10:16 pm

Klokinator

avatar
Admin
All right, so I'm possibly going to be adding in Sword using troubadours. I want them to have a skill that allows access to swords, but only at the cost of half POW.

How should I implement this? I'm guessing some variation of Yeti's "Academic" and "Veteran" skills, which allowed a unit to use weapons and magic up to a certain level.

Code:

  HERO_ID = [65] # To differentiate Hero and Sage
  # Veteran/Academic
  alias_method :bwd_vtrnskl_gmactr_init, :initialize
  def initialize(*args)
    bwd_vtrnskl_gmactr_init(*args)
    @previous_weapon_type = (
        HERO_ID.include?(@class_id) ? 1 : 1 + FE_Config::PHYSICAL_TYPES)
  end
 
  def set_prev_weapon_type(val)
    @previous_weapon_type = [[val, 1].max, FE_Config::WEAPON_TYPES].min
  end
 
  alias_method :bwd_vtrnskl_gmactr_promowpntypes, :promotion_weapon_types
  def promotion_weapon_types(*args)
    for i in 1..FE_Config::WEAPON_TYPES
      if weapon_levels(i) > 0
        set_prev_weapon_type(i)
        break
      end
    end
    bwd_vtrnskl_gmactr_promowpntypes(*args)
  end
 
  alias_method :bwd_vtrnskl_gmactr_weapon_levels, :weapon_levels
  def weapon_levels(type)
    if self.skill_include?('VETERAN')
      min = type <= FE_Config::PHYSICAL_TYPES ? 1 : 0
      return [bwd_vtrnskl_gmactr_weapon_levels(type), min].max
    else
      return bwd_vtrnskl_gmactr_weapon_levels(type)
    end
  end
 
  alias_method :bwd_acdmcskl_gmactr_weapon_levels, :weapon_levels
  def weapon_levels(type)
    if self.skill_include?('ACADEMIC')
      min = ((type <= (FE_Config::PHYSICAL_TYPES +
            FE_Config::MAGICAL_TYPES)) and
            (type > FE_Config::PHYSICAL_TYPES)) ? 1 : 0
      return [bwd_acdmcskl_gmactr_weapon_levels(type), min].max
    else
      return bwd_acdmcskl_gmactr_weapon_levels(type)
    end
  end
 
  alias_method :bwd_vtrnskl_gmactr_max_wpnlvl, :max_weapon_level
  def max_weapon_level(type)
    if self.skill_include?('VETERAN')
      # If can already max something higher than B, use that
      if bwd_vtrnskl_gmactr_max_wpnlvl(type) >= 5
        return bwd_vtrnskl_gmactr_max_wpnlvl(type)
      # Allow maxing weapon types that were used before promotion
      elsif type == @previous_weapon_type
        return (FE_Config::WPNLVL_THRESHOLDS.length - 1)
      # Otherwise B rank max
      elsif type <= FE_Config::PHYSICAL_TYPES
        return 4
      else
        return bwd_vtrnskl_gmactr_max_wpnlvl(type)
      end
    else
      return bwd_vtrnskl_gmactr_max_wpnlvl(type)
    end
  end
 
  alias_method :bwd_acdmcskl_gmactr_max_wpnlvl, :max_weapon_level
  def max_weapon_level(type)
    if self.skill_include?('ACADEMIC')
      # If can already max something higher than B, use that
      if bwd_acdmcskl_gmactr_max_wpnlvl(type) >= 5
        return bwd_acdmcskl_gmactr_max_wpnlvl(type)
      # Allow maxing weapon types that were used before promotion
      elsif type == @previous_weapon_type
        return (FE_Config::WPNLVL_THRESHOLDS.length - 1)
      # Otherwise B rank max
      elsif ((type <= (FE_Config::PHYSICAL_TYPES +
            FE_Config::MAGICAL_TYPES)) and
            (type > FE_Config::PHYSICAL_TYPES))
        return 4
      else
        return bwd_acdmcskl_gmactr_max_wpnlvl(type)
      end
    else
      return bwd_acdmcskl_gmactr_max_wpnlvl(type)
    end
  end
Take note that the above goes in Game_Actor skills.


Combined with maybe the Kamaitachi skill.
Code:

  # Kamaitachi
  alias_method :bwd_kamaiskl_gmevent_hit_skill, :hit_skill
  def hit_skill(n, wpn_hit, act_hit, target, weapon, magic, distance)
    if self.actor.skill_include?('KAMAI')
      if (!magic and weapon.range == 1 and distance > 1)
        n -= 40
      end
    end
    return bwd_kamaiskl_gmevent_hit_skill(n, wpn_hit, act_hit, target,
        weapon, magic, distance)
  end

Somehow combining these to make a skill that divides damage or POW by two when wielding a sword/physical weapon shouldn't be hard. Including a bonus weapon level with the skill equipped would also be ideal.


___________________________________
http://klokreations.forumotion.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum