Advertisement
Zetu

ExActExtAce v1.02

Dec 10th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Z04 #Executable Actions Extention (EXACTExt) v1.02
  2.     CMDS = [
  3.         :attack,
  4.         :exact,
  5.         :skill,
  6.         :guard,
  7.         :skillid, 5,
  8.         :item
  9.     ]
  10.     module REGEXP
  11.         NOCONDITION = /<exact>/i
  12.         CONDITIONAL = /<exact[:]*\s*(\d+)>/i
  13.     end
  14. end
  15.  
  16. class Window_ActorCommand < Window_Command
  17.     attr_reader :skillsincmd
  18.     def make_command_list
  19.         return unless @actor
  20.         index=0
  21.         while index<Z04::CMDS.size
  22.             case Z04::CMDS[index]
  23.             when :attack;  add_attack_command
  24.             when :skill;   add_skill_commands
  25.             when :guard;   add_guard_command
  26.             when :item;    add_item_command
  27.             when :skillid; add_skill_command_by_id(Z04::CMDS[index+1]); index +=1
  28.             when :exact;   add_noninclusive_skill_commands
  29.             end
  30.             index+=1
  31.         end
  32.     end
  33.    
  34.     def add_noninclusive_skill_commands
  35.         for skill in @actor.skills
  36.             add_skill_exact(skill) unless Z04::CMDS.include?(skill.id)
  37.         end
  38.     end
  39.    
  40.     def add_skill_command_by_id(id)
  41.         add_skill_exact($data_skills[id])
  42.     end
  43.  
  44.     def add_skill_exact(skill)
  45.         return unless skill.command_condition_met?
  46.         add_command(skill.name, :exactskill, @actor.skill_conditions_met?(skill), skill.id)
  47.         print "Added Command: #{skill.name}\n"
  48.     end
  49.    
  50. end
  51.  
  52. class Scene_Battle < Scene_Base
  53.    
  54.     def skill_exact
  55.         @skill = $data_skills[@actor_command_window.current_ext]
  56.         print @actor_command_window.current_ext
  57.         BattleManager.actor.input.set_skill(@skill.id)
  58.         BattleManager.actor.last_skill.object = @skill
  59.         if !@skill.need_selection?
  60.             next_command
  61.         elsif @skill.for_opponent?
  62.             select_enemy_selection
  63.         else
  64.             select_actor_selection
  65.         end
  66.     end
  67.    
  68.     alias z04cacw create_actor_command_window unless $@
  69.     def create_actor_command_window
  70.         z04cacw
  71.         @actor_command_window.set_handler(:exactskill, method(:skill_exact))
  72.     end
  73.    
  74. end
  75.  
  76. class Window_BattleSkill < Window_SkillList
  77.     def include?(item)
  78.         (item && item.stype_id == @stype_id) and not item.command?
  79.     end
  80. end
  81.  
  82. class RPG::Skill < RPG::UsableItem
  83.     def command?
  84.         self.note.scan(Z04::NOCONDITION){return true}
  85.         self.note.scan(Z04::CONDITIONAL){return true}
  86.     end
  87.    
  88.     def command_condition_met?
  89.         self.note.scan(Z04::CONDITIONAL){return false unless $game_switches[$1.to_i]}
  90.         return command?
  91.     end
  92.    
  93. end
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement