Advertisement
FlipelyFlip

FFS - Stealkiller

Aug 5th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.12 KB | None | 0 0
  1. #==============================================================================
  2. # FFS - Stealkiller
  3. #==============================================================================
  4.  
  5. $imported = {} if $imported == nil
  6. $imported["Stealkiller"] = true
  7.  
  8. module Flip
  9.   COMMON_EVENT_STEALKILLER_COUNTER = 50
  10. end
  11.  
  12. #==============================================================================
  13. # RPG::Enemy
  14. #==============================================================================
  15.  
  16. class RPG::Enemy
  17.   #--------------------------------------------------------------------------
  18.   # * Friendly EXP
  19.   #--------------------------------------------------------------------------
  20.   def stealkiller_counter
  21.     return @stealkiller_counter if @stealkiller_counter != nil
  22.     self.note.split(/[\r\n]+/).each { |line|
  23.       case line
  24.       when /<(?:STEALKILLER_COUNTER|stealkiller counter):[ ](\d+)>/i
  25.         @stealkiller_counter = $1.to_i
  26.       end
  27.     }
  28.     return @stealkiller_counter
  29.   end
  30. end
  31.  
  32. #==============================================================================
  33. # ■ Game_Battler
  34. #==============================================================================
  35.  
  36. class Game_Battler
  37.   attr_accessor :stealkiller_counter
  38.  
  39.   alias initialize_stealkiller initialize
  40.   def initialize
  41.     initialize_stealkiller
  42.     @stealkiller = 0
  43.   end
  44. end
  45.  
  46. #==============================================================================
  47. # ■ Game_Enemy
  48. #==============================================================================
  49.  
  50. class Game_Enemy < Game_Battler
  51.   #--------------------------------------------------------------------------
  52.   # ● オブジェクト初期化
  53.   #     index    : 敵グループ内インデックス
  54.   #     enemy_id : 敵キャラ ID
  55.   #--------------------------------------------------------------------------
  56.   alias initialize_flip_stealkiller initialize
  57.   def initialize(index, enemy_id)
  58.     initialize_flip_stealkiller(index, enemy_id)
  59.     @stealkiller_counter = enemy.stealkiller_counter
  60.   end
  61. end
  62.  
  63. class Scene_Battle < Scene_Base
  64.   #--------------------------------------------------------------------------
  65.   # ○ 戦闘行動の実行 : 盗む
  66.   #--------------------------------------------------------------------------
  67.   def execute_action_steal
  68.     skill = @active_battler.action.skill
  69.     text = @active_battler.name + skill.message1
  70.     @message_window.add_instant_text(text)
  71.     unless skill.message2.empty?
  72.       wait(10)
  73.       @message_window.add_instant_text(skill.message2)
  74.     end
  75.     targets = @active_battler.action.make_targets
  76.     display_animation(targets, skill.animation_id)
  77.     @active_battler.mp -= @active_battler.calc_mp_cost(skill)
  78.     $game_temp.common_event_id = skill.common_event_id
  79.     for target in targets
  80.       target.skill_effect(@active_battler, skill)
  81.       display_steal_effects(target, skill)
  82.       if target.stealkiller_counter > 0
  83.         target.stealkiller_counter -= 1
  84.         if target.stealkiller_counter <= 0
  85.           $game_temp.common_event_id = Flip::COMMON_EVENT_STEALKILLER_COUNTER
  86.         end
  87.       end
  88.     end
  89.   end
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement