Project1

标题: 仿仙剑连击 [打印本页]

作者: dbshy    时间: 2009-7-8 21:52
标题: 仿仙剑连击
本帖最后由 dbshy 于 2009-7-15 17:32 编辑
  1. #   仿仙剑连击
  2. #              by 快感炮王
  3. #
  4. #   老衲最近闲的蛋疼,不读佛经写脚本  
  5. #   以前看师弟玩过仙剑4,战斗里面有个连击的设定
  6. #   某队员攻击后,有一定几率出现动画,双击后让队友对所攻击目标进行连击
  7. #   有BUG的话通知老衲吧,阿弥陀佛  

  8. module DOUBLE_HIT
  9.   
  10.   DOUBLE_CLICK_TIME = 15
  11.   
  12.   APPEAR_PROBABILITY = 100
  13.   
  14.   ANIMATION_ID = 1

  15. end

  16. class << Input
  17.   
  18.   def double_click?(key)
  19.    
  20.     if Input.trigger?(key) then
  21.       
  22.       if @key !=key then
  23.         @key = key
  24.         return false
  25.       else
  26.         @key = nil
  27.         return true
  28.       end
  29.       
  30.     end
  31.    
  32.   end
  33.   
  34.   alias old_update update
  35.   def update
  36.    
  37.     @wait_count = 0 if @wait_count == nil
  38.     @wait_count += 1 if @key != nil
  39.     if @wait_count > DOUBLE_HIT::DOUBLE_CLICK_TIME then
  40.       @key = nil
  41.       @wait_count = 0
  42.     end
  43.     old_update
  44.    
  45.   end
  46.   
  47. end

  48. class Scene_Battle

  49.   alias old_main main
  50.   def main
  51.     @judge_double_hit = false
  52.     old_main
  53.   end


  54.   alias old_ups6 update_phase4_step6
  55.   def update_phase4_step6
  56.     if rand(100) < DOUBLE_HIT::APPEAR_PROBABILITY and @active_battler.current_action.basic == 0 and $game_party.actors.size > 1 and !@target_battlers[0].dead? and !@judge_double_hit and @active_battler.is_a?(Game_Actor) then
  57.       
  58.       @double_sprite = RPG::Sprite.new
  59.       @double_sprite.x = 320
  60.       @double_sprite.y = 240
  61.       @double_sprite.animation($data_animations[DOUBLE_HIT::ANIMATION_ID],true)
  62.       @max_hit_duration = $data_animations[DOUBLE_HIT::ANIMATION_ID].frame_max
  63.       @count = 0
  64.       
  65.       loop do
  66.         Graphics.update
  67.         Input.update
  68.         @count += 1
  69.         @double_sprite.update
  70.         if Input.double_click?(Input::C) then
  71.          
  72.           double_hit_preparation
  73.           break
  74.          
  75.         end
  76.         break if @count > @max_hit_duration + 100
  77.       end
  78.       
  79.      end
  80.      @double_sprite.dispose if @double_sprite != nil
  81.      if @phase4_step == 3 then
  82.        return
  83.      else
  84.      @judge_double_hit = false
  85.      old_ups6
  86.      end
  87.      
  88.    end
  89.    
  90.    def min_cp_actor
  91.      @min_cp = 65535
  92.      @actor = nil
  93.      
  94.      for actor in $game_party.actors
  95.       if actor.cp < @min_cp and actor.cp != 0 and !actor.dead? then
  96.         @min_cp = actor.cp
  97.         @actor = actor
  98.       end
  99.      end   
  100.      
  101.      return @actor
  102.    end
  103.    
  104.    
  105.    def double_hit_preparation
  106.      @active_battler = min_cp_actor
  107.      @active_battler.current_action.kind = 0
  108.      @active_battler.current_action.basic = 0
  109.      @animation1_id = @active_battler.animation1_id
  110.      @animation2_id = @active_battler.animation2_id
  111.      @judge_double_hit = true
  112.      for target in @target_battlers
  113.         target.attack_effect(@active_battler)
  114.      end
  115.      @phase4_step = 3
  116.    end
  117.       
  118. end
复制代码

作者: angelwangm    时间: 2009-7-8 22:01
好东西,顶!
楼主加油!
作者: 飞锋    时间: 2009-7-10 20:59
提示: 作者被禁止或删除 内容自动屏蔽
作者: 柳橙汁    时间: 2009-7-13 00:07
目前發現兩個重大BUG!

1、敵人攻擊我方時,也會出現連擊動畫提示
2、當我方某個角色死亡時,其他角色攻擊敵人後,出現連擊動畫提示時,死亡的角色也會攻擊敵人 = = 
作者: redant    时间: 2009-7-13 11:31
类似仙剑4的那个按钮连击?
支持一下 快感囧王= =
作者: dbshy    时间: 2009-7-13 13:03
4# 柳橙汁
老衲疏忽了,谢施主提醒
贫僧会尽快解决
作者: 柳橙汁    时间: 2009-7-13 17:20
話說老衲可以嘗試寫一個「擊退」系統 像「軒轅劍肆」那樣 
根據攻擊的傷害程度 使敵人(包含我方角色)的圖標往後退一些位置 感覺會很有意思~ 
提供給老衲參考~ =ˇ=
作者: dbshy    时间: 2009-7-15 17:34
更正两个严重BUG,再次感谢柳橙汁施主

ps:施主说的击退效果,只是图标的位置变化,感觉意义不大
作者: 封神魔剑传说    时间: 2010-2-15 20:44
提示: 作者被禁止或删除 内容自动屏蔽
作者: 天涯    时间: 2010-3-14 12:34
与仙四那个某人打完后双击另一个队员打的,顶一个
作者: 煌拓    时间: 2010-5-1 07:57
厉害!
作者: youxiyonghuming    时间: 2010-5-1 09:32
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1