| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 4 |  
| 经验 | 868 |  
| 最后登录 | 2014-6-14 |  
| 在线时间 | 628 小时 |  
 Lv2.观梦者 
	梦石0 星屑448 在线时间628 小时注册时间2011-9-27帖子3996 | 
| 来源地址 http://rpg.blue/forum.php?mod=vi ... D100%26typeid%3D100
 复制代码#==============================================================================
# ★ ExEnemy_DoubleAction
#------------------------------------------------------------------------------
#  设置让敌人一定机率出现连续行动。
#==============================================================================
# 能够连续行动的敌人识別用文字。
# 在敌人的「备注」栏中填写:
# 识別用文字 + [机率],也就是说:可以设定不同敌人的机率
# 出现连续行动的机率、每回合判断一次。
# 例) 50%机率出现连续行动 => *DOUBLE_ACTION[50]
EXENM_DOUBLEACT_SIGNATURE = "*DOUBLE_ACTION"
# 连续行動的默认机率。
# 当识別用文字中没有设置时调用的机率、请指定为1~100(%)。
EXENM_DOUBLEACT_PROBARITY = 100
#------------------------------------------------------------------------------
class Game_Enemy
  alias _exedblact_initialize initialize
  #--------------------------------------------------------------------------
  # ○ 定義實例變量 (追加定义)
  #--------------------------------------------------------------------------
  attr_accessor :attacked                 # 「已经攻击一次」标记
  #--------------------------------------------------------------------------
  # ○ 初始化对象 (追加定义)
  #     index    : 隊伍中索引
  #     enemy_id : 敵人 ID
  #--------------------------------------------------------------------------
  def initialize(index, enemy_id)
    _exedblact_initialize(index, enemy_id)
    @attacked = false
  end
  #--------------------------------------------------------------------------
  # ☆ 判定能否连续行动
  #--------------------------------------------------------------------------
  def double_action?
    return false if @attacked
    sig = EXENM_DOUBLEACT_SIGNATURE
    return false unless enemy.note[/#{Regexp.quote sig}\[?(\d*)\]?/].to_a[0]
    prob = $1.to_i
    prob = EXENM_DOUBLEACT_PROBARITY if prob == 0
    @attacked = true
    return rand(100) < prob
  end
end
class Game_Troop
  alias _exedblact_increase_turn increase_turn
  #--------------------------------------------------------------------------
  # ○ 增加回合数 (追加定义)
  #--------------------------------------------------------------------------
  def increase_turn
    _exedblact_increase_turn
    for enemy in members
      enemy.attacked = false
    end
  end
end
class Scene_Battle
  alias _exedblact_set_next_active_battler set_next_active_battler
  #--------------------------------------------------------------------------
  # ○ 設置下一戰鬥者行動 (追加定义)
  #--------------------------------------------------------------------------
  def set_next_active_battler
    if @active_battler.is_a?(Game_Enemy)
      return @active_battler.make_action if @active_battler.double_action?
    end
    _exedblact_set_next_active_battler
  end
end
 | 
 |