Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

ACBS - Atoa Custom Battle System 3.2

Atoa:

I have been hunting for bugs and am not finding any. Are their any particular addons or modules that you want looked at? So many combinations exist now that I could spend a long time looking through them all.

Anyway, is there a way to have those special parameters in skills and weapons (STEAL, HITS, COMBO, RANDOM, etc) be used for armor as well? I don't want to go and modify your source code if I don't have to do that.

Lastly, I'm getting ONE odd error that may have been reported. When the enemies are able to attack at the same time (thanks to 'Allow_Same_Target = true' and the like), the battle animation of the 'hit effect' clings to the last frame until another battle animation plays. The problem doesn't result in a crash, just annoyance.

Keep up the great work!
 

Atoa

Member

@MayorAnime
Thanks for the report.
The add on i was more worried was the battle zoom, but it's not showing any major bug.

The only thing i really need testing is the Dinamic actions settings. with other add-ons.
 

Yin

Member

I think you can do that by just editing your spritesheet. I do it with mine and it comes out looking good. When you said flying enemies I thought that you meant when enemies can only be hit by long range weapons or something like that.
 
If i go to the status menu i get this error.
But i have the trial from the official,EDIT: i meant so i don't have an illigal version.

naamloos23.png


how does the post script feature work again?
i get an error.

i'll post this part:
==============================================================================
# ■ Bitmap
#==============================================================================
class Bitmap
alias draw_text_original draw_text if !method_defined?:)draw_text_original)
def draw_text(x, y, width = 0, height = 0, str = '', align = 0)
last_color = font.color.dup
font.color = Color.new( 0, 0, 0,last_color.alpha)
case x
when Numeric
draw_text_original(x + 1, y + 1, width, height, str, align)
font.color = last_color
draw_text_original(x, y, width, height, str, align)
when Rect
rect = x
str = y
align = width
shadow_rect = x.dup
shadow_rect.x += 1
shadow_rect.y += 1
768: font.color = last_color
769: draw_text_original(rect, str, align)
end
end
end
 
Atoa":2qxcgnxa said:
@MayorAnime
Thanks for the report.
The add on i was more worried was the battle zoom, but it's not showing any major bug.

The only thing i really need testing is the Dinamic actions settings. with other add-ons.

Will work on that one, then!

Also, what about my question about armor? Did you catch that in my previous post?
 
Oops i said my version was illigal i meant:
i have the trial from the official site,so it's not an illigal version.
18 days left btw.
 
hello
I am in difficulty because AtoaCBS is not compatible with script of one I need for a system for improvement for weapon.
here script in question:
XRXS Libraires
Code:
# ▽△▽ XRXL 4. 第二カーソル 機構 ▽△▽ built 122410

# by 桜雅 在土

 

# XRXS Libraires

# Ce script regroupe toutes les librairies nécessaires en un seul script

# Krazplay

#=====================#

# Librairie 4                            #

#==============================================================================

# --- XRXS. 第二カーソル 機構 ---

#------------------------------------------------------------------------------

#     ウィンドウに .index2 プロパティを追加します。

#==============================================================================

module XRXS_Cursor2

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化

  #--------------------------------------------------------------------------

  def initialize(x, y, w, h)

    super(x, y, w, h)

    # 補助ウィンドウ(透明)を作成:カーソル専用

    @xrxsc2_window = Window_Selectable.new(self.x, self.y, self.width, self.height)

    @xrxsc2_window.opacity = 0

    @xrxsc2_window.active = false

    @xrxsc2_window.index = -1

  end

  #--------------------------------------------------------------------------

  # ○ 第二カーソルの設置

  #--------------------------------------------------------------------------

  def index2

    return @xrxsc2_window.index

  end

  def index2=(index)

    @xrxsc2_window.index = index

    if index == -1

      @xrxsc2_window.cursor_rect.empty

    else

      @xrxsc2_window.x = self.x

      @xrxsc2_window.y = self.y

      @xrxsc2_window.cursor_rect = self.cursor_rect

    end

  end

  #--------------------------------------------------------------------------

  # ○ 先頭の行の設定

  #--------------------------------------------------------------------------

  def top_row=(row)

    super

    # 補助ウィンドウの oy を更新

    pre_oy = @xrxsc2_window.oy

    @xrxsc2_window.oy = self.oy

    @xrxsc2_window.cursor_rect.y -= self.oy - pre_oy

  end

  #--------------------------------------------------------------------------

  # ○ 解放

  #--------------------------------------------------------------------------

  def dispose

    @xrxsc2_window.dispose

    super

  end

  #--------------------------------------------------------------------------

  # ○ X, Y 座標

  #--------------------------------------------------------------------------

  def x=(n)

    super

    @xrxsc2_window.x = self.x unless @xrxsc2_window.nil?

  end

  def y=(n)

    super

    @xrxsc2_window.y = self.y unless @xrxsc2_window.nil?

  end

  #--------------------------------------------------------------------------

  # ○ 可視状態

  #--------------------------------------------------------------------------

  def visible=(b)

    @xrxsc2_window.visible = b

    super

  end

end

 

 

 

# ▽△▽ XRXS.付加属性名称判定 ▽△▽  built 091221

# by 桜雅 在土

 

#====================#

# Librairie 5                          #

#==============================================================================

# --- XRXS. 付加属性名称判定モジュール ---

#==============================================================================

module XRXS

  #--------------------------------------------------------------------------

  # ○ 配列が指定名の属性を持つか判定

  #--------------------------------------------------------------------------

  def XRXS.element_check(set, element_name)

    returnar = [false, 0, 0, []] # 存在したか?, 固定値の合計、%値の合計

    return returnar if !set.is_a?(Array) or set.size == 0 or element_name == ""

    for i in set

      if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/

        returnar[0] = true

        if $2 == nil

          returnar[1] += $1.to_i

          returnar[3].push($1.to_i)

        else

          returnar[2] += $1.to_i

        end

      end

    end

    return returnar

  end

  def XRXS.element_include?(set, element_name)

    return element_check(set, element_name)[0]

  end

  def XRXS.element_amount(set, element_name)

    return element_check(set, element_name)[1]

  end

  def XRXS.element_percent(set, element_name)

    return element_check(set, element_name)[2]

  end

  def XRXS.element_numbers(set, element_name)

    return element_check(set, element_name)[3]

  end

end

 

 

 

# ▽△▽ XRXS. 装備属性取得機構 ▽△▽ built 092308

# by 桜雅 在土

 

#====================#

# Librairie 6                          #

#==============================================================================

# --- XRXS. 装備属性取得機構 ---

#==============================================================================

class Game_Battler

  #--------------------------------------------------------------------------

  # ○ スキルの属性取得

  #--------------------------------------------------------------------------

  def skill_element_set(skill)

    return skill.nil? ? [] : skill.element_set

  end

  #--------------------------------------------------------------------------

  # ○ 全装備の属性取得

  #--------------------------------------------------------------------------

  def equip_element_set

    return self.element_set + self.guard_element_set

  end

  #--------------------------------------------------------------------------

  # ○ 全防具の属性取得

  #--------------------------------------------------------------------------

  def guard_element_set

    return []

  end

end

class Game_Actor < Game_Battler

  def guard_element_set

    set = []

    for id in self.armor_ids

      next if id.nil?

      armor = $data_armors[id]

      set += (armor != nil ? armor.guard_element_set : [])

    end

    return set

  end

  #--------------------------------------------------------------------------

  # ○ 武器 ID配列

  #--------------------------------------------------------------------------

  def weapon_ids

    unless self.is_a?(Game_Actor)

      return []

    end

    ids    = @weapon_ids != nil ? @weapon_ids : []

    ids[0] = @weapon_id

    return ids

  end

  #--------------------------------------------------------------------------

  # ○ 防具 ID配列

  #--------------------------------------------------------------------------

  def armor_ids

    unless self.is_a?(Game_Actor)

      return []

    end

    ids    = @armor_ids != nil ? @armor_ids : []

    ids[0] = @armor1_id

    ids[1] = @armor2_id

    ids[2] = @armor3_id

    ids[3] = @armor4_id

    return ids

  end

  #--------------------------------------------------------------------------

  # ○ 装備配列の取得

  #--------------------------------------------------------------------------

  def equipments

    equipments = []

    self.weapon_ids.each {|id| equipments.push($data_weapons[id])}

    self.armor_ids.each {|id| equipments.push($data_armors[id])}

    return equipments

  end

  #--------------------------------------------------------------------------

  # ○ 装備中?

  #--------------------------------------------------------------------------

  def equiping?(item)

    case item

    when RPG::Weapon

      return self.weapon_ids.include?(item.id)

    when RPG::Armor

      return self.armor_ids.include?(item.id)

    else

      return false

    end    

  end

end

 

 

 

# ▽△▽ XRXS. コマンドウィンドウ追加機構 ▽△▽

# by 桜雅 在土

 

#====================#

# Librairie 7                          #

#==============================================================================

# --- XRXS.コマンドウィンドウ追加機構 ---

#==============================================================================

module XRXS_Window_Command

  #--------------------------------------------------------------------------

  # ○ コマンドを追加

  #--------------------------------------------------------------------------

  def add_command(command)

    #

    # 初期化されていない場合、無効化判別用の配列 @disabled の初期化

    #

    @disabled = [] if @disabled.nil?

    if @commands.size != @disabled.size

      for i in [email=0...@commands.size]0...@commands.size[/email]

        @disabled[i] = false

      end

    end

    #

    # 追加

    #

    @commands.push(command)

    @disabled.push(false)

    @item_max = @commands.size

    self.y -= 32

    self.height += 32

    self.contents.dispose

    self.contents = nil

    self.contents = Bitmap.new(self.width - 32, @item_max * 32)

    self.contents.font.name = $fontface  # Ajouté par Krazplay

    self.contents.font.size = $fontsize     # Ajouté par Krazplay

    refresh

    for i in [email=0...@commands.size]0...@commands.size[/email]

      if @disabled[i]

        disable_item(i)

      end

    end

  end

  #--------------------------------------------------------------------------

  # ○ 項目の無効化

  #     index : 項目番号

  #--------------------------------------------------------------------------

  def disable_item(index)

    @disabled = [] if @disabled.nil?

    @disabled[index] = true

    draw_item(index, disabled_color)

  end

  #--------------------------------------------------------------------------

  # ○ 項目の有効化

  #     index : 項目番号

  #--------------------------------------------------------------------------

  def enable_item(index)

    @disabled = [] if @disabled.nil?

    @disabled[index] = false

    draw_item(index, normal_color)

  end

end

class Window_Command < Window_Selectable

  #--------------------------------------------------------------------------

  # ○ インクルード

  #--------------------------------------------------------------------------

  include XRXS_Window_Command

  #--------------------------------------------------------------------------

  # ● 項目の無効化

  #--------------------------------------------------------------------------

  def disable_item(index)

    super

  end

end

 

 

 

# ▽△▽ XRXS.ウィンドウ行間可変機構 ▽△▽

# by 桜雅 在土

 

#====================#

# Librairie 10                        #

#==============================================================================

# XRXS.ウィンドウ行間可変機構

#==============================================================================

module Module_SelectableEX

  #--------------------------------------------------------------------------

  # ○ 行間

  #--------------------------------------------------------------------------

  def line_height

    return 32

  end

  #--------------------------------------------------------------------------

  # ○ 位置揃え

  #--------------------------------------------------------------------------

  attr_accessor :align

  #--------------------------------------------------------------------------

  # ○ オブジェクト初期化

  #--------------------------------------------------------------------------

  def initialize(x, y, width, height)

    super(x, y, width, height)

    @item_max = 1

    @column_max = 1

    @index = -1

    @align = 0

  end

  #--------------------------------------------------------------------------

  # ○ 項目の描画

  #--------------------------------------------------------------------------

  def draw_item(index, color)

    self.contents.font.color = color

    rect = Rect.new(4, self.line_height * index, self.contents.width - 8, self.line_height)

    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

    self.contents.draw_text(rect, @commands[index], self.align)

  end

  #--------------------------------------------------------------------------

  # ○ 先頭の行の取得

  #--------------------------------------------------------------------------

  def top_row

    # ウィンドウ内容の転送元 Y 座標を、1 行の高さ で割る

    return self.oy / self.line_height

  end

  #--------------------------------------------------------------------------

  # ○ 先頭の行の設定

  #--------------------------------------------------------------------------

  def top_row=(row)

    super

    self.oy = self.oy/32 * self.line_height

  end

  #--------------------------------------------------------------------------

  # ○ 1 ページに表示できる行数の取得

  #--------------------------------------------------------------------------

  def page_row_max

    # ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ で割る

    return (self.height - 32) / self.line_height

  end

  #--------------------------------------------------------------------------

  # ○ カーソルの矩形更新

  #--------------------------------------------------------------------------

  def update_cursor_rect

    super

    unless @index < 0

      y = (self.cursor_rect.y + self.oy) * self.line_height/32 - self.oy

      self.cursor_rect.set(0, y, self.cursor_rect.width, self.line_height)

    end

  end

end

class Window_Command < Window_Selectable

  #--------------------------------------------------------------------------

  # ◇ インクルード

  #--------------------------------------------------------------------------

  include Module_SelectableEX

  #--------------------------------------------------------------------------

  # ○ 行間

  #--------------------------------------------------------------------------

  def line_height

    return 32

  end

  #--------------------------------------------------------------------------

  # ● オブジェクト初期化 [再定義]

  #--------------------------------------------------------------------------

  def initialize(width, commands)

    # コマンドの個数からウィンドウの高さを算出

    super(0, 0, width, commands.size * self.line_height + 32)

    @item_max = commands.size

    @commands = commands

    self.contents = Bitmap.new(width - 32, @item_max * self.line_height)

    self.contents.font.name = $fontface  # Ajouté par Krazplay

    self.contents.font.size = $fontsize     # Ajouté par Krazplay

    refresh

    self.index = 0

  end

  #--------------------------------------------------------------------------

  # ● 項目の描画 [再定義]

  #--------------------------------------------------------------------------

  def draw_item(index, color)

    super

  end

end

 

 

 

# ▽△▽ XRXS. マップ名取得機構 ▽△▽

# by 桜雅 在土

 

#====================#

# Librairie 13                        #

#==============================================================================

# □ XRXS. マップ名取得機構

#==============================================================================

class Game_Map

  #--------------------------------------------------------------------------

  # ○ マップ名を取得

  #--------------------------------------------------------------------------

  def name

    $data_mapinfos = load_data("Data/MapInfos.rxdata") if $data_mapinfos.nil?

    $data_mapinfos[@map_id].name

  end

end

 

 

 

# ▽△▽ XRXS. RPGグラフィック機構 ▽△▽ built122012

# by 桜雅 在土

 

#====================#

# Librairie 14                        #

#==============================================================================

# □ Bitmapライブラリ □ 

#==============================================================================

class Bitmap

  #--------------------------------------------------------------------------

  # ○ 縁文字の描画

  #--------------------------------------------------------------------------

  def draw_hemming_text(x, y, w, h, text, align = 0)

    original_color = self.font.color.dup

    self.font.color = Color.new(0,0,0,255)

    self.draw_text(x  , y  , w, h, text, align)

    self.draw_text(x  , y+2, w, h, text, align)

    self.draw_text(x+2, y+2, w, h, text, align)

    self.draw_text(x+2, y  , w, h, text, align)

    self.font.color = original_color

    self.draw_text(x+1, y+1, w, h, text, align)

  end

end

 

#==============================================================================

# □ RPG_FileTest

#------------------------------------------------------------------------------

#  RGSS暗号化にも対応したファイルチェックのモジュールです。

#==============================================================================

module RPG_FileTest

  #--------------------------------------------------------------------------

  # ○ キャラクターファイルの有無

  #--------------------------------------------------------------------------

  def RPG_FileTest.character_exist?(filename)

    return RPG::Cache.character(filename, 0) rescue return false

  end

  #--------------------------------------------------------------------------

  # ○ ピクチャーファイルの有無

  #--------------------------------------------------------------------------

  def RPG_FileTest.picture_exist?(filename)

    return RPG::Cache.picture(filename) rescue return false

  end

  #--------------------------------------------------------------------------

  # ○ バトラーグラフィックの有無

  #--------------------------------------------------------------------------

  def RPG_FileTest.battler_exist?(filename)

    return RPG::Cache.battler(filename, 0) rescue return false

  end

end

 

#==============================================================================

# □ Sprite_Number / Spriteset_Numbers

#==============================================================================

class Sprite_Number < Sprite

  attr_reader   :w

  def initialize(font = Font.new)

    super()

    self.bitmap = Bitmap.new(1,1)

    self.bitmap.font = font

    max = s = 0

    for i in 0..9

      s = self.bitmap.text_size(i.to_s).width

      max = s if max < s

    end

    @w = max + 2

    @h = font.size + 2

    self.bitmap.dispose

    self.bitmap = Bitmap.new(@w, @h * 10)

    self.bitmap.font = font

    (0..9).each {|n| self.bitmap.draw_hemming_text(0, @h * n, @w, @h, n.to_s) }

    self.src_rect.height /= 10

  end

  def number=(n)

    self.src_rect.y = n * @h

  end

  def n=(n)

    self.number = n

  end

end

class Spriteset_Numbers

  attr_reader   :x

  attr_reader   :y

  attr_reader   :z

  attr_reader   :visible

  def initialize(font = Font.new)

    @font = font

    @numbers = []

    @x = 0

    @y = 0

    @z = 0

    @visible = true

  end

  def number=(n)

    @numbers.each{|number| number.n = 10 }

    d = (n == 0 ? 0 : Math.log10(n).to_i)

    for i in 0..d

      @numbers[i] = Sprite_Number.new(@font) if @numbers[i] == nil

      @numbers[i].n = n % 10

      @numbers[i].visible = true

      n /= 10

    end

    self.x = self.x

    self.y = self.y

    self.z = self.z

  end

  def n=(n)

    self.number=(n)

  end

  def x=(n)

    @x = n

    for i in [email=0...@numbers.size]0...@numbers.size[/email]

      @numbers[i].x = n

      n -= @numbers[i].w

    end

  end

  def y=(n)

    @y = n

    @numbers.each{|sprite| sprite.y = @y }

  end

  def z=(n)

    @z = n

    @numbers.each{|sprite| sprite.z = @z }

  end

  def visible=(b)

    @visible = b

    @numbers.each{|sprite| sprite.visible = b }

  end

  def dispose

    @numbers.each{|sprite| sprite.dispose }

  end

end

 

 

 

# ▼▲▼ XRXS_MP16. 装備・素手に出来ない ▼▲▼

# by 桜雅 在土

 

#====================#

# Librairie 16                        #

#==============================================================================

# □ カスタマイズポイント

#==============================================================================

class Scene_Equip

  #

  # 素手に出来ない種別の配列(0:武器、1:盾、2:頭...)

  #

  UNREMOVABLE_TYPES = []

  #

  # 例:武器と盾を素手にできなくする → UNREMOVABLE_TYPES = [0,1]

  #

end

 

#==============================================================================

# ■ Window_EquipItem

#==============================================================================

class Window_EquipItem < Window_Selectable

  #--------------------------------------------------------------------------

  # ○ 公開インスタンス

  #--------------------------------------------------------------------------

  attr_reader   :item_max

  #--------------------------------------------------------------------------

  # ○ 素手に出来ない

  #--------------------------------------------------------------------------

  def remove_ban_on

    @unremovable = true

    refresh

  end

  #--------------------------------------------------------------------------

  # ● リフレッシュ

  #--------------------------------------------------------------------------

  alias xrxs_mp16_refresh refresh

  def refresh

    # 呼び戻す

    xrxs_mp16_refresh

    # 

    if @unremovable

      # ビットマップを作成し、全項目を描画

      @item_max = @data.size

      self.contents = Bitmap.new(width - 32, row_max * 32)

      for i in 0...@item_max-1

        draw_item(i)

      end

      @item_max -= 1

    end

  end

end

#==============================================================================

# ■ Scene_Equip

#==============================================================================

class Scene_Equip

  #--------------------------------------------------------------------------

  # ● リフレッシュ

  #--------------------------------------------------------------------------

  alias xrxs_mp16_refresh refresh

  def refresh

    # 呼び戻す

    xrxs_mp16_refresh

    #

    if @set

      return

    end

    for type in UNREMOVABLE_TYPES

      case type

      when 0

        @item_window1.remove_ban_on

      when 1

        @item_window2.remove_ban_on

      when 2

        @item_window3.remove_ban_on

      when 3

        @item_window4.remove_ban_on

      when 4

        @item_window5.remove_ban_on

      end

    end

    @set = true

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (ライトウィンドウがアクティブの場合)

  #--------------------------------------------------------------------------

  alias xrxs_mp16_update_right update_right

  def update_right

    # C ボタンが押された場合

    if Input.trigger?(Input::C)

      if @item_window.item_max == 0

        # ブザー SE を演奏

        $game_system.se_play($data_system.buzzer_se)

        return

      end

    end

    # 呼び戻す

    xrxs_mp16_update_right

  end

end

 
XRXS ActionEX
Code:
# ▼▲▼ XRXS37. 特殊効果詰め合わせ ActionEX ver.2 ▼▲▼ built 111921

# by 桜雅 在土 (基本)

#    Tetra-Z   (修正)

 

#==============================================================================

# □ カスタマイズポイント

#==============================================================================

#

# ---

#

#------------------------------------------------------------------------------

# ▽ 特殊効果の設定 ( 名称設定、取得設定 ) 

#==============================================================================

# XRXS ActionEX

# Apporte de nouvelles possibilitées dans les combats.

# Krazplay

 

module XRXS37

  #

  # 範囲系

  # Une arme, une compétence, ou un objet avec l'un des éléments suivants verront leur 'portée'

  # modifiée, ainsi une arme peut toucher tout les ennemis en un coup avec l'élément portant le

  # nom "all enemy"

  #

  AREA_ENEMY_ALL   = "all enemy"         # Vise tout les ennemi.

  AREA_ACTOR_ALL   = "all actor"           # Vise tout les alliés.

  AREA_SELF        = "self"                # Se vise soi-même.

  AREA_WHOLE       = "whole"         # Vise tout le monde.

  AREA_ENEMY_RAND  = "rand enemy"     # Vise un ennemi au hasard.

  AREA_ACTOR_RAND  = "rand actor"       # Vise un joueur au hasard.

  AREA_ALL_RAND    = "all rand"   # Vise quelqu'un au hasard.

  AREA_ALL_RAND    = "all rand"   # 「対象ランダム」属性の名前

  SELF_EXCLUSION   = "self exclusion"       # A utiliser avec l'un des éléments au-dessus,

  # exclue l'utilisateur des cibles s'il était dedans.

  SELF_INCLUSION   = "self inclusion"           # A utiliser avec l'un des éléments au-dessus,

  # inclue l'utilisateur dans les cibles s'il n'était pas dedans.

  # 行動系

  #

  # Toujours la même chose, les éléments doivent porter le nom exact précisé (attention aux

  # aux espaces !) suivi d'un nombre si précisé dans le commentaires, exemples :

  # "frequency+3" ; "hit 4" ; "deriver 5" ; HP cost" ; "priority 99" ; etc

  #

  MOVE_TIMES       = "frequency"       # (+)(nombre)  Permet de toucher 'nombre' fois la cible

  # l'animation est répétée.

  # Donner un rang B à cet élément à un ennemi, et il pourra effectuer 'nombre' actions par tour.

  # Donner un rang A à cet élément à un ennemi, et vous jouerez 'nombre' de fois plus souvent

  # que cet ennemi.

  HIT_TIMES        = "hit "     # (nombre) Permet de toucher 'nombre' fois en un seul coup,

  # l'animation n'est pas répétée

  DERIVER          = "deriver "           # (nombre) Lance le sort dont l'id est 'nombre'

  # après que le personnage aie effectué son action. Si le personnage ne connait

  # pas le sort, ou ne respecte pas toutes les conditions (SP, PP s'il y en a...) le sort n'est pas 

  # lancé, mais sinon les SP et les PP sont consommés comme s'il avait été lancé de façon

  # naturel. Si le sort est supposé cibler un allié (Soin par exemple), il ciblera un allié (vous), 

  # même si vous visiez un ennemi à la base.

  # Un sort lancé de cette manière contenant cet élément peut tout à fait appeller un autre sort

  # après lui, on peut donc créer des boucles infinies (s'il n'y jamais de manque de SP).

  # Ajout par Krazplay :

  # Mettez l'opposé de l'id (17 => -17) pour permettre l'utilisation de la compétence même

  # si le personnage ne connait pas le sort. Nécessite le script Krazplay_Correction pour

  # fonctionner, s'il n'y est pas, cela ne provoquera pas de bug, mais il ne se passera rien.

  HP_COST          = "HP cost"         # Les HPs sont consommés à la place des SP

  SPEED_PRIORITY   = "priority "         # (nombre) L'action est effectuée en priorité, s'il y a

  # deux personnages faisant une action avec priorité, c'est celui avec le 'nombre' le plus grand

  # qui commence, sinon c'est le plus rapide des deux je pense.

  CAST_DURATION    = "charge "       # (nombre) Charge la compétence pendant 'nombre'

  # de tour avant de la lancer. Le tour où est utilisé la compétence compte comme le premier

  # tour. Ainsi "charge 1" n'a aucun interêt.

  CAST_CHANT       = "chant "       # (nombre) Même chose que charge à une nuance près :

  # le personnage acquiert un statut spécifique pendant qu'il charge sa compétence, si ce

  # statut est perdu, la compétence ne se lancera pas. Je pense que c'est pour permettre de

  # perdre la concentration lorsque l'on prend un coup (à régler vous-même dans le statut

  # correspondant).

  # Le statut acquis doit avoir le nom de la variable CHANT_STATE_NAME,

  # cad "se concentre" à la base.

  CHANT_STATE_NAME = "se concentre"   # Voir commentaire au-dessus.

  CONDITION_STATE  = "statut condition "   #  「消費ステート」属性の名前

end

class Game_BattleAction

  attr_accessor :scope_force              # 「対象強制値」  (Numeric)

  attr_accessor :self_exclusion           # 「自分以外」    (true/false)

  attr_accessor :self_inclusion           # 「諸刃」        (true/false)

  attr_accessor :sp_damage                # 「SPダメージ」  (true/false)

  attr_accessor :hp_drain                 # 「HP吸収」      (Numeric)

  attr_accessor :sp_drain                 # 「SP吸収」      (Numeric)

  attr_accessor :critical_hit             # 「必殺」        (Numeric)

  attr_accessor :certain_hit              # 「必中」        (true/false)

  attr_accessor :move_times               # 「行動回数」    (Numeric)

  attr_accessor :hit_times                # 「ヒット回数」  (Numeric)

  attr_accessor :deriver                  # 「派生」        (Numeric)

  attr_accessor :speed_priority           # 「優先度」      (Numeric)

  attr_accessor :condition_state_id       # 条件ステートID  (Numeric)

  attr_writer   :cast_duration            # ため継続ターン数(Numeric) # 実質アクセサ

  attr_accessor :turn_move_times # 現在のターンの行動済み回数(Game_Enemyのみ)

end

#------------------------------------------------------------------------------

 

#------------------------------------------------------------------------------

# ▽ 特殊効果の設定 ( 名称設定、取得設定 ) 

#==============================================================================

# ■ Game_BattleAction

#==============================================================================

class Game_BattleAction

  #--------------------------------------------------------------------------

  # ○ ため継続ターン数の取得

  #--------------------------------------------------------------------------

  def cast_duration

    @cast_duration = 0 if @cast_duration == nil

    return @cast_duration

  end

  #--------------------------------------------------------------------------

  # ● クリア

  #--------------------------------------------------------------------------

  alias xrxs37_clear clear

  def clear

    # 初期化

    return if self.cast_duration >= 2

    # 呼び戻す

    xrxs37_clear

    # 特殊効果をクリア

    clear_xrxs37_special_effect

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果をクリア

  #--------------------------------------------------------------------------

  def clear_xrxs37_special_effect

    self.cast_duration = 0

    self.speed_priority = 0

    self.condition_state_id = 0

    self.scope_force = 0

    self.turn_move_times = 0

    self.move_times      = 0

    self.hit_times       = 0

    self.deriver         = 0

    self.speed_priority  = 0

    self.condition_state_id = 0

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果を設定 (範囲)

  #--------------------------------------------------------------------------

  def set_xrxs37_special_scope(set)

    # 範囲強制値

    if XRXS.element_include?(set, XRXS37::AREA_ENEMY_ALL)

      self.scope_force = 2

    elsif XRXS.element_include?(set, XRXS37::AREA_ACTOR_ALL)

      self.scope_force = 4

    elsif XRXS.element_include?(set, XRXS37::AREA_WHOLE)

      self.scope_force = 8

    elsif XRXS.element_include?(set, XRXS37::AREA_ENEMY_RAND)

      self.scope_force = 9

    elsif XRXS.element_include?(set, XRXS37::AREA_ACTOR_RAND)

      self.scope_force = 10

    elsif XRXS.element_include?(set, XRXS37::AREA_ALL_RAND)

      self.scope_force = 11

    else

      self.scope_force = 0

    end

    # 自分以外

    self.self_exclusion = XRXS.element_include?(set, XRXS37::SELF_EXCLUSION)

    # 諸刃

    self.self_inclusion = XRXS.element_include?(set, XRXS37::SELF_INCLUSION)

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果を設定 (行動)

  #--------------------------------------------------------------------------

  def set_xrxs37_special_effect(set)

    # 行動回数

    self.move_times      = XRXS.element_amount(set, XRXS37::MOVE_TIMES)

    # ヒット回数

    self.hit_times       = XRXS.element_amount(set, XRXS37::HIT_TIMES)

    # 派生先スキルID

    self.deriver         = XRXS.element_amount(set, XRXS37::DERIVER)

    # 優先度

    self.speed_priority  = XRXS.element_amount(set, XRXS37::SPEED_PRIORITY)

    # 発動条件ステートID

    self.condition_state_id = XRXS.element_amount(set, XRXS37::CONDITION_STATE)

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果インスタンスを削除

  #--------------------------------------------------------------------------

  def nillize_xrxs37_special_effect

    self.cast_duration = nil

    self.speed_priority = nil

    self.condition_state_id = nil

    self.scope_force = nil

    self.move_times      = nil

    self.hit_times       = nil

    self.deriver         = nil

    self.speed_priority  = nil

    self.condition_state_id = nil

  end

end

#==============================================================================

# ■ Game_Battler

#==============================================================================

class Game_Battler

  attr_accessor      :fderiver  # ajouté par Krazplay

  #--------------------------------------------------------------------------

  # ○ 指定の配列の特殊効果を設定(範囲)

  #--------------------------------------------------------------------------

  def set_xrxs37_special_scope(set)

    self.current_action.set_xrxs37_special_scope(set)

  end

  #--------------------------------------------------------------------------

  # ○ 指定のスキルの特殊効果を設定(その他)

  #--------------------------------------------------------------------------

  def set_xrxs37_special_effect(set)

    self.current_action.set_xrxs37_special_effect(set)

  end

  #--------------------------------------------------------------------------

  # ● スキルの使用可能判定

  #--------------------------------------------------------------------------

  alias xrxs37_skill_can_use? skill_can_use?

  def skill_can_use?(skill_id)

    # スキルを取得

    @skill = $data_skills[skill_id]

    # 範囲を計算

    set_xrxs37_special_scope(self.skill_element_set(@skill))

    scope = @skill.scope

    scope = self.current_action.scope_force if self.current_action.scope_force > 0

    # 「自分以外」スキルの場合

    if self.current_action.self_exclusion

      # 仲間の取得

      battlers = (self.is_a?(Game_Actor) ? $game_party.actors : $game_troop.enemies)

      # 範囲によって分岐

      case scope

      when 3,4,10

        # 生存している仲間の数を取得

        n = 0

        battlers.each {|battler| n += 1 unless battler.dead?}

      when 5,6

        # 全仲間の数を取得

        n = battlers.size

      else

        n = 2

      end

      # 対象が存在できない場合

      return false if n <= 1

    end

    # 呼び戻す

    return xrxs37_skill_can_use?(skill_id)

  end

  #--------------------------------------------------------------------------

  # ● コマンド入力可能判定

  #--------------------------------------------------------------------------

  alias xrxs37_inputable? inputable?

  def inputable?

    return (xrxs37_inputable? & (self.current_action.cast_duration <= 1))

  end

end

#==============================================================================

# ■ Game_Enemy

#==============================================================================

class Game_Enemy < Game_Battler

  #--------------------------------------------------------------------------

  # ○ 公開インスタンス変数

  #--------------------------------------------------------------------------

  attr_accessor :enemy_id

  #--------------------------------------------------------------------------

  # ● アクション作成

  #--------------------------------------------------------------------------

  alias xrxs37_make_action make_action

  def make_action

    #

    return if self.current_action.cast_duration >= 2

    # 呼び戻す

    xrxs37_make_action

    # スキルの場合のみ優先度の取得へ

    return if self.current_action.kind != 1

    # スキルを取得

    skill = $data_skills[self.current_action.skill_id]

    # 特殊効果:優先度

    self.current_action.speed_priority = XRXS.element_amount(self.skill_element_set(skill), XRXS37::SPEED_PRIORITY)

  end

end

#==============================================================================

# ■ Scene_Skill

#==============================================================================

class Scene_Skill

  #--------------------------------------------------------------------------

  # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)

  #--------------------------------------------------------------------------

  alias xrxs37_update_target update_target

  def update_target

    # C ボタンが押された場合

    if Input.trigger?(Input::C)

      # 特殊効果の取得

      @actor.set_xrxs37_special_scope(@actor.skill_element_set(@skill))

      @actor.set_xrxs37_special_effect(@actor.skill_element_set(@skill))

    end

    # 呼び戻す

    xrxs37_update_target

    # 特殊効果を消去

    for actor in $game_party.actors

      actor.current_action.nillize_xrxs37_special_effect

    end

  end

end

#==============================================================================

# --- アクターカーソル # カーソル右へ ---

#==============================================================================

class Arrow_Actor < Arrow_Base

  def input_right

    @index += 1

    @index %= $game_party.actors.size

  end

end

#------------------------------------------------------------------------------

#

#

# ▽ 共通部分

#

#

#==============================================================================

# ■ Scene_Battle

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # ● メイン処理

  #--------------------------------------------------------------------------

  alias xrxs37_main main

  def main

    # 呼び戻す

    xrxs37_main

    # 特殊効果をクリア

    for actor in $game_party.actors

      actor.current_action.nillize_xrxs37_special_effect

    end

  end

  #--------------------------------------------------------------------------

  # ● 基本アクション 結果作成 [〜.basic == 0 の時のみ再定義]

  #--------------------------------------------------------------------------

  alias xrxs37_make_basic_action_result make_basic_action_result

  def make_basic_action_result

    # 攻撃の場合

    if @active_battler.current_action.basic == 0

      # アニメーション ID を設定

      @animation1_id = @active_battler.animation1_id

      @animation2_id = @active_battler.animation2_id

      # 武器IDの取得

      @weapon_id = @active_battler.is_a?(Game_Actor) ? @active_battler.weapon_id : 0

      # 使用する武器の特殊効果の取得

      @active_battler.set_xrxs37_special_scope(@active_battler.equip_element_set)

      @active_battler.set_xrxs37_special_effect(@active_battler.equip_element_set)

      # 特殊効果:行動回数

      @phase4_act_times_max = @active_battler.current_action.move_times

      @phase4_act_times_max = 1 if @phase4_act_times_max == 0 # 0は1にする

      # 特殊効果:ヒット回数

      @phase4_hit_times_max = @active_battler.current_action.hit_times

      @phase4_hit_times_max = 1 if @phase4_hit_times_max == 0 # 0は1にする

      # 基本アクションのターゲット配列作成

      make_basic_action_target_set

      # 通常攻撃の効果を適用

      for target in @target_battlers

        target.attack_effect(@active_battler)

      end

      return

    else

      xrxs37_make_basic_action_result

    end

  end

  #--------------------------------------------------------------------------

  # ● アイテムアクション 結果作成

  #--------------------------------------------------------------------------

  alias xrxs37_make_item_action_result make_item_action_result

  def make_item_action_result

    # アイテムを取得

    @item = $data_items[@active_battler.current_action.item_id]

    # アイテム切れなどで使用できなくなった場合

    unless $game_party.item_can_use?(@item.id)

      # 呼び戻す

      xrxs37_make_item_action_result

      return

    end

    # 特殊効果の設定

    @active_battler.set_xrxs37_special_scope(@item.element_set)

    @active_battler.set_xrxs37_special_effect(@item.element_set)

    # 呼び戻す

    xrxs37_make_item_action_result

    # 既に一回以上ヒット/行動している場合

    if @phase4_hit_times >= 1 or @phase4_act_times >= 1

      # ヘルプウィンドウを隠す

      @help_window.visible = false

    end

  end

end

 

#------------------------------------------------------------------------------

#

#

# ▽ 特殊効果 ( 範囲系 )

#

#

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase3_actor_select update_phase3_actor_select

  def update_phase3_actor_select

    # 呼び戻す

    xrxs37_update_phase3_actor_select

    # 「自分以外」の場合、自分を通過

    if @active_battler != nil and

       @active_battler.current_action.self_exclusion and 

       @actor_arrow != nil and 

       @actor_arrow.actor == @active_battler

      @actor_arrow.update

    end

  end

  #--------------------------------------------------------------------------

  # ● エネミー選択開始

  #--------------------------------------------------------------------------

  alias xrxs37_start_enemy_select start_enemy_select

  def start_enemy_select

    return if start_select_check

    xrxs37_start_enemy_select

  end

  #--------------------------------------------------------------------------

  # ● アクター選択開始

  #--------------------------------------------------------------------------

  alias xrxs37_start_actor_select start_actor_select

  def start_actor_select

    return if start_select_check

    xrxs37_start_actor_select

    # 「自分以外」の場合、まずカーソルを一回右にずらす

    if @active_battler.current_action.self_exclusion

      @actor_arrow.input_right

    end

  end

  #--------------------------------------------------------------------------

  # ○ 選択開始時のチェック

  #--------------------------------------------------------------------------

  def start_select_check

    # "全体化"、"全域化"、"対象ランダム"の判定

    case @active_battler.current_action.kind

    when 0 # 攻撃

      # 使用する武器の特殊効果の取得

      @active_battler.set_xrxs37_special_scope(@active_battler.equip_element_set)

      scope_force = @active_battler.current_action.scope_force

      if scope_force == 2 or scope_force == 4 or scope_force >= 8

        phase3_next_actor

        return true

      end

    when 1 # スキル

      # 使用する武器の特殊効果の取得

      @active_battler.set_xrxs37_special_scope(@active_battler.skill_element_set(@skill))

      scope_force = @active_battler.current_action.scope_force

      if scope_force == 2 or scope_force == 4 or scope_force >= 8

        end_skill_select

        phase3_next_actor

        return true

      end

    when 2 # アイテム

      @active_battler.set_xrxs37_special_scope(@item.element_set)

      scope_force = @active_battler.current_action.scope_force

      if scope_force == 2 or scope_force == 4 or scope_force >= 8

        end_item_select

        phase3_next_actor

        return true

      end

    end

    return false

  end

  #--------------------------------------------------------------------------

  # ○ 基本アクションのターゲット配列作成(1:敵単体 が基本)

  #--------------------------------------------------------------------------

  def make_basic_action_target_set

    # 行動側バトラーがエネミーの場合

    if @active_battler.is_a?(Game_Enemy)

      if @active_battler.restriction == 3

        target = $game_troop.random_target_enemy

      elsif @active_battler.restriction == 2

        target = $game_party.random_target_actor

      else

        set_target_battlers(1)

        return

      end

    # 行動側バトラーがアクターの場合

    elsif @active_battler.is_a?(Game_Actor)

      if @active_battler.restriction == 3

        target = $game_party.random_target_actor

      elsif @active_battler.restriction == 2

        target = $game_troop.random_target_enemy

      else

        set_target_battlers(1)

        return

      end

    end

    # 対象側バトラーの配列を設定

    @target_battlers = [target]

  end

  #--------------------------------------------------------------------------

  # ● スキルまたはアイテムの対象側バトラー設定 [武器もここを使用!]

  #--------------------------------------------------------------------------

  alias xrxs37_set_target_battlers set_target_battlers

  def set_target_battlers(scope)

    # 範囲強制値

    if @active_battler.current_action.scope_force > 0

      scope = @active_battler.current_action.scope_force

    end

    done = false

    #

    case scope

    when 8 # 全域化

      @target_battlers = []

      for actor in $game_party.actors

        @target_battlers.push(actor) if actor.exist?

      end

      for enemy in $game_troop.enemies

        @target_battlers.push(enemy) if enemy.exist?

      end

      # 自分以外

      if @active_battler.current_action.self_exclusion

        @target_battlers -= [@active_battler]

      end

      done = true

    when 9 # 敵ランダム

      tb_array = []

      # 行動側バトラーがエネミーの場合

      if @active_battler.is_a?(Game_Enemy)

        for actor in $game_party.actors

          tb_array.push(actor) if actor.exist?

        end

      end

      # 行動側バトラーがアクターの場合

      if @active_battler.is_a?(Game_Actor)

        for enemy in $game_troop.enemies

          tb_array.push(enemy) if enemy.exist?

        end

      end

      # 自分以外

      if @active_battler.current_action.self_exclusion

        tb_array -= [@active_battler]

      end

      @target_battlers = [tb_array[rand(tb_array.size)]]

      done = true

    when 10 # 味方ランダム

      tb_array = []

      # 行動側バトラーがエネミーの場合

      if @active_battler.is_a?(Game_Enemy)

        for enemy in $game_troop.enemies

          tb_array.push(enemy) if enemy.exist?

        end

      end

      # 行動側バトラーがアクターの場合

      if @active_battler.is_a?(Game_Actor)

        for actor in $game_party.actors

          tb_array.push(actor) if actor.exist?

        end

      end

      # 自分以外

      if @active_battler.current_action.self_exclusion

        tb_array -= [@active_battler]

      end

      @target_battlers = [tb_array[rand(tb_array.size)]]

      done = true

    when 11 # 対象ランダム

      tb_array = []

      for actor in $game_party.actors

        tb_array.push(actor) if actor.exist?

      end

      for enemy in $game_troop.enemies

        tb_array.push(enemy) if enemy.exist?

      end

      # 自分以外

      if @active_battler.current_action.self_exclusion

        tb_array -= [@active_battler]

      end

      @target_battlers = [tb_array[rand(tb_array.size)]]

      done = true

    end

    # 呼び戻す

    unless done

      # 範囲存在判定

      enemy_exist = true

      if scope == 1 or scope == 2

        enemy_exist = false

        # 行動側バトラーがエネミーの場合

        if @active_battler.is_a?(Game_Enemy)

          for actor in $game_party.actors

            enemy_exist |= actor.exist?

          end

        end

        # 行動側バトラーがアクターの場合

        if @active_battler.is_a?(Game_Actor)

          for enemy in $game_troop.enemies

            enemy_exist |= enemy.exist?

          end

        end

      end

      if enemy_exist

        xrxs37_set_target_battlers(scope)

      else

        @target_battlers = []

      end

    end

    # 特殊効果「自分以外」の処理

    if @active_battler.current_action.self_exclusion

      @target_battlers -= [@active_battler]

    end

    # 諸刃

    if @active_battler.current_action.self_inclusion

      @target_battlers.push(@active_battler) unless @target_battlers.include?(@active_battler)

    end

  end

  #--------------------------------------------------------------------------

  # ○ 生存確認

  #--------------------------------------------------------------------------

  def target_battlers_still_arive?

    #

    # 配列 @target_battlers の対象が一人でも生存しているかを判定

    #

    # ---初期化

    target_still_left = false

    random_enemy_bool = false

    random_actor_bool = false

    # ---「敵ランダム」「味方ランダム」の場合の判定は敵または味方全員で行う

    case @active_battler.current_action.kind

    when 2

      # "敵ランダム"の判定

      random_enemy_bool = XRXS.element_include?(@item.element_set, XRXS37::AREA_ENEMY_RAND)

      # "味方ランダム"の判定

      random_actor_bool = XRXS.element_include?(@item.element_set, XRXS37::AREA_ACTOR_RAND)

    else

      # "敵ランダム"の判定

      random_enemy_bool = @active_battler.current_action.scope_force ==  9

      # "味方ランダム"の判定

      random_actor_bool = @active_battler.current_action.scope_force == 10

    end

    # ---敵ターゲットの配列を取得

    tb_array = []

    # "敵ランダム"の場合

    if random_enemy_bool

      # 行動側バトラーがエネミーの場合

      if @active_battler.is_a?(Game_Enemy)

        for actor in $game_party.actors

          tb_array.push(actor) if actor.exist?

        end

      # 行動側バトラーがアクターの場合

      else

        for enemy in $game_troop.enemies

          tb_array.push(enemy) if enemy.exist?

        end

      end

    # "味方ランダム"の場合

    elsif random_actor_bool

      # 行動側バトラーがエネミーの場合

      if @active_battler.is_a?(Game_Enemy)

        for enemy in $game_troop.enemies

          tb_array.push(enemy) if enemy.exist?

        end

      # 行動側バトラーがアクターの場合

      else

        for actor in $game_party.actors

          tb_array.push(actor) if actor.exist?

        end

      end

    # その他・通常時

    else

      tb_array = @target_battlers

    end

    # ---設定した配列から生存者を探す

    for target in tb_array

      # ターゲットが生き残っているか判別

      return true if !target.dead?

    end

    return false

  end

end

 

#------------------------------------------------------------------------------

#

#

# ▽ 特殊効果 ( 行動順序系 )

#

#

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase3_basic_command update_phase3_basic_command

  def update_phase3_basic_command

    # 優先度

    @active_battler.current_action.speed_priority = 0

    # C ボタンが押された場合

    if Input.trigger?(Input::C)

      # アクターコマンドウィンドウのカーソル位置で分岐

      if @actor_command_window.index == 0  # 攻撃

        # 武器優先度の取得 # 特殊効果:優先度

        returnar = XRXS.element_check(@active_battler.equip_element_set, XRXS37::SPEED_PRIORITY)

        if returnar[0]

          @active_battler.current_action.speed_priority = returnar[1]

        else

          @active_battler.current_action.speed_priority = 0

        end

      end

    end    

    # 呼び戻す

    xrxs37_update_phase3_basic_command

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase3_skill_select update_phase3_skill_select

  def update_phase3_skill_select

    # C ボタンが押された場合

    if Input.trigger?(Input::C) and @active_battler.skill_can_use?(@skill_window.skill.id)

      # スキルウィンドウで現在選択されているデータを取得

      @skill = @skill_window.skill

      # 特殊効果:優先度

      returnar = XRXS.element_check(@active_battler.skill_element_set(@skill), XRXS37::SPEED_PRIORITY)

      if returnar[0]

        @active_battler.current_action.speed_priority = returnar[1]

      else

        @active_battler.current_action.speed_priority = 0

      end

    end

    # 呼び戻す

    xrxs37_update_phase3_skill_select

  end

  #--------------------------------------------------------------------------

  # ● 行動順序作成

  #--------------------------------------------------------------------------

  alias xrxs37_make_action_orders make_action_orders

  def make_action_orders

    xrxs37_make_action_orders

    sort_action_orders

  end

  #--------------------------------------------------------------------------

  # ○ 行動順序整列

  #--------------------------------------------------------------------------

  def sort_action_orders

    # 優先度の大きい順 (同値の場合は素早さの速い順) に並び替え

    @action_battlers.sort! do |a, b|

      if a.current_action.speed_priority > b.current_action.speed_priority

        -1

      elsif a.current_action.speed_priority < b.current_action.speed_priority

        +1

      elsif a.current_action.speed > b.current_action.speed

        -1

      elsif a.current_action.speed < b.current_action.speed

        +1

      else

        0 # a <=> b

      end

    end

  end

end

 

#------------------------------------------------------------------------------

#

#

# ▽ 「HP消費」 (現在、戦闘のみに対応)

#

#

#==============================================================================

# ■ Game_Battler

#==============================================================================

class Game_Battler

  #--------------------------------------------------------------------------

  # ○ 公開インスタンス変数

  #--------------------------------------------------------------------------

  attr_writer   :sp0_ban                  # SPの 0と最大の制限の解除

  attr_writer   :hp_cost_done             # HP消費済

  #--------------------------------------------------------------------------

  # ● スキルの使用可能判定

  #--------------------------------------------------------------------------

  alias xrxs37_hp_cost_skill_can_use? skill_can_use?

  def skill_can_use?(skill_id)

    # スキルの取得

    skill = $data_skills[skill_id]

    # HP消費スキルの場合

    if XRXS.element_include?(self.skill_element_set(skill), XRXS37::HP_COST)

      # 消費済みの場合

      if @hp_cost_done

        return true

      end

      # HPが足りるか判定

      if self.hp <= skill.sp_cost

        return false

      end

      # 保存

      last_sp      = @sp

      last_sp0_ban = @sp0_ban

      # SP消費分を回復させ、SPが足りないことによる使用不可能の判定を回避(最大値を超えて回復)

      @sp0_ban = true

      @sp += skill.sp_cost

      # 呼び戻す

      bool = xrxs37_hp_cost_skill_can_use?(skill_id)

      # 復旧

      @sp      = last_sp

      @sp0_ban = last_sp0_ban

      # 

      return bool

    end

    # 呼び戻す

    return xrxs37_hp_cost_skill_can_use?(skill_id)

  end

  #--------------------------------------------------------------------------

  # ○ スキル消費を回復させる

  #--------------------------------------------------------------------------

  def cost_restore(skill)

    if XRXS.element_include?(self.skill_element_set(skill), XRXS37::HP_COST)

      # HP消費スキルの場合

      self.hp += skill.sp_cost

    else

      # SP消費スキルの場合

      self.sp += skill.sp_cost

    end

  end

  #--------------------------------------------------------------------------

  # ● ステートの付加

  #--------------------------------------------------------------------------

  alias xrxs37_add_state add_state

  def add_state(state_id, force = false)

    # SPの保存

    last_sp = @sp

    # 呼び戻す

    xrxs37_add_state(state_id, force)

    # SPの復旧

    @sp = last_sp if @sp0_ban

  end

  #--------------------------------------------------------------------------

  # ● ステートの解除

  #--------------------------------------------------------------------------

  alias xrxs37_remove_state remove_state

  def remove_state(state_id, force = false)

    # SPの保存

    last_sp = @sp

    # 呼び戻す

    xrxs37_remove_state(state_id, force)

    # SPの復旧

    @sp = last_sp if @sp0_ban

  end

end

#==============================================================================

# ■ Game_Actor

#==============================================================================

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # ● SP の変更

  #--------------------------------------------------------------------------

  def sp=(sp)

    if @sp0_ban

      @sp = sp

    else

      super

    end

  end

end

#==============================================================================

# ■ Game_Enemy

#==============================================================================

class Game_Enemy < Game_Battler

  #--------------------------------------------------------------------------

  # ● SP の変更

  #--------------------------------------------------------------------------

  def sp=(sp)

    if @sp0_ban

      @sp = sp

    else

      super

    end

  end

end

 

#------------------------------------------------------------------------------

#

#

# ▽ 特殊効果 ( 行動回数系 ) : 「行動回数」「ヒット回数」「派生」「ため発動」

#

#

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # ● パーティコマンドフェーズ開始

  #--------------------------------------------------------------------------

  alias xrxs37_start_phase2 start_phase2

  def start_phase2

    # ターン開始時の処理

    xrxs37_beginning_of_a_turn

    # 呼び戻す

    xrxs37_start_phase2

  end

  #--------------------------------------------------------------------------

  # ○ ターン開始時の処理

  #--------------------------------------------------------------------------

  def xrxs37_beginning_of_a_turn

    # 継続チェック

    for battler in $game_party.actors + $game_troop.enemies

      next if battler.current_action.cast_duration <= 0

      # 条件ステートが解除された場合、ため/詠唱発動をキャンセルする

      if battler.current_action.condition_state_id > 0 and 

        (not battler.state?(battler.current_action.condition_state_id))

        battler.current_action.cast_duration = 0

      end

      # スキルが使用不可能に変化した場合、ため/詠唱発動をキャンセルする

      if battler.current_action.kind == 1 and

         (!battler.skill_can_use?(battler.current_action.skill_id) or

          battler.restriction >= 2)

        battler.current_action.cast_duration = 0

        battler.remove_state(battler.current_action.condition_state_id)

      end

    end

  end

  #--------------------------------------------------------------------------

  # ● バトル終了

  #--------------------------------------------------------------------------

  alias xrxs37_battle_end battle_end

  def battle_end(result)

    # 溜めを解除

    for actor in $game_party.actors

      actor.current_action.cast_duration = 0

    end

    # 呼び戻す

    xrxs37_battle_end(result)

  end

  #--------------------------------------------------------------------------

  # ● メインフェーズ開始

  #--------------------------------------------------------------------------

  alias xrxs37_start_phase4 start_phase4

  def start_phase4

    # 初期化済みフラグをクリア

    @firstival_phase4_done = false

    # 呼び戻す

    xrxs37_start_phase4

  end

  #--------------------------------------------------------------------------

  # ○ 行動の初期化

  #--------------------------------------------------------------------------

  def xrxs37_clear_actions

    # エネミーのターン回数をリセット

    @firstival_phase4_done = false if @firstival_phase4_done.nil?

    unless @firstival_phase4_done

      for enemy in $game_troop.enemies

        enemy.current_action.turn_move_times = 0

      end

    end

    @firstival_phase4_done = true

    # 初期化

    @phase4_act_times        = 0

    @phase4_act_times_max    = 1

    @phase4_hit_times        = 0

    @phase4_hit_times_max    = 1

    @skill                   = nil

    @weapon_id               = nil

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase4_step1 update_phase4_step1

  def update_phase4_step1

    # 行動の初期化

    xrxs37_clear_actions

    # 呼び戻す

    xrxs37_update_phase4_step1

    # ため継続ターン数の-1

    @active_battler.current_action.cast_duration -= 1 if @active_battler != nil

  end

  #--------------------------------------------------------------------------

  # ● スキルアクション 結果作成

  #--------------------------------------------------------------------------

  alias xrxs37_make_skill_action_result make_skill_action_result

  def make_skill_action_result

    # スキルを取得

    @skill = $data_skills[@active_battler.current_action.skill_id]

    # キャスト中でない場合

    if @active_battler.current_action.cast_duration <= 0

      # 特殊効果:詠唱発動

      returnar = XRXS.element_check(@active_battler.skill_element_set(@skill), XRXS37::CAST_CHANT)

      if returnar[0]

        @active_battler.current_action.cast_duration = returnar[1]

        state_id = get_state_id_cast_chant

        @active_battler.current_action.condition_state_id = state_id

        @active_battler.add_state(state_id) if state_id > 0 # 実際にステート付加

      end

      # 特殊効果:溜め発動

      returnar = XRXS.element_check(@active_battler.skill_element_set(@skill), XRXS37::CAST_DURATION)

      if returnar[0]

        @active_battler.current_action.cast_duration = returnar[1]

      end

    end

    # キャスト中の場合

    if @active_battler.current_action.cast_duration >= 2

      @animation1_id = @skill.animation1_id

      @animation2_id = 0

      return

    end

    # [消費ステート]の判別

    if @active_battler.current_action.condition_state_id > 0

      # 設定されている場合

      if @active_battler.state?(@active_battler.current_action.condition_state_id)

        # 条件を満たした場合 ステートを解除する

        @active_battler.remove_state(@active_battler.current_action.condition_state_id)

      else

        # 条件を満たしていない場合

        @animation1_id = 0

        @animation2_id = 0

        return

      end

    end

    # 既に一回以上行動している場合

    if @phase4_act_times >= 1 or @phase4_hit_times >= 1

      #

      # スキルの消費分を復旧させ、擬似的にHP/SPを減らさない ( HP消費に対応 )

      #

      @active_battler.cost_restore(@skill)

    else

      # 使用するスキルの特殊効果の取得

      @active_battler.set_xrxs37_special_scope(@active_battler.skill_element_set(@skill))

      @active_battler.set_xrxs37_special_effect(@active_battler.skill_element_set(@skill))

      # 特殊効果:行動回数

      @phase4_act_times_max = @active_battler.current_action.move_times

      @phase4_act_times_max = 1 if @phase4_act_times_max == 0 # 0は1にする

      # 特殊効果:ヒット回数

      @phase4_hit_times_max = @active_battler.current_action.hit_times

      @phase4_hit_times_max = 1 if @phase4_hit_times_max == 0 # 0は1にする

    end

    # HP消費スキルの場合

    if XRXS.element_include?(@active_battler.skill_element_set(@skill), XRXS37::HP_COST)

      # HPが足りるか判定

      if @active_battler.hp <= @skill.sp_cost

        # 足りない場合

        # ステップ 1 に移行

        @phase4_step = 1

        return

      end

      # SP消費分のSPを回復させて擬似的にSPを減らさない(最大値を超えて回復)

      @active_battler.sp0_ban = true

      @active_battler.sp += @skill.sp_cost

      #

      # HPを消費

      # ( make_skill_action_result メソッドにステータスウィンドウの

      #  リフレッシュがあるため、呼び戻すより前に HP を消費させる。)

      #

      @active_battler.hp -= @skill.sp_cost

      @active_battler.hp_cost_done = true

      # 呼び戻す

      xrxs37_make_skill_action_result

      # SPの制限の解除

      @active_battler.hp_cost_done = nil

      @active_battler.sp0_ban = false

    else

      # 呼び戻す

      xrxs37_make_skill_action_result

    end

    # 既に一回以上ヒット/行動している、またはため中の場合

    if (@phase4_hit_times >= 1 or @phase4_act_times >= 1) or

       (@active_battler.current_action.cast_duration >= 2)

      @help_window.visible = false

    end

    # ためスキル発動時はアニメ1を消す

    if @active_battler.current_action.cast_duration == 1

      @animation1_id = 0

    end

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase4_step2 update_phase4_step2

  def update_phase4_step2

    # 呼び戻す

    xrxs37_update_phase4_step2

    # 次のステップへいく場合

    if @phase4_step == 3

      # 連続行動中は 対象アニメへ

      @phase4_step = 4 if @phase4_act_times >= 1

      # 連続ヒット中 ダメージ表示へ

      @phase4_step = 5 if @phase4_hit_times >= 1

    end

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase4_step5 update_phase4_step5

  def update_phase4_step5

    # 呼び戻す

    xrxs37_update_phase4_step5

    # 連続行動を判定

    xrxs37_check_continuous_action

  end

  #--------------------------------------------------------------------------

  # ○ 連続行動を判定 (「行動回数」「ヒット回数」「派生」)

  #--------------------------------------------------------------------------

  def xrxs37_check_continuous_action

    # 戦闘不能による「ため」のキャンセル [Thx. - by ピニョン]

    for target in @target_battlers

      if target.dead? and target.current_action.cast_duration >= 0

        target.current_action.cast_duration = 0

      end

    end

    # 生存確認---(すぐ下にメソッドがあります)

    target_still_left = target_battlers_still_arive?

    # ヒットした回数をカウント

    @phase4_hit_times += 1

    if target_still_left and @phase4_hit_times < @phase4_hit_times_max

      @phase4_step = 2

      return

    end

    # 行動した回数をカウント

    @phase4_act_times += 1

    # 実行済み行動回数が、指定行動回数に達したかを判別      # 敵が生存している

    if @phase4_act_times < @phase4_act_times_max and target_still_left

      # /--- 達していない場合

      # 指定行動回数に満たない場合は繰り返す為、ステップ 2 に移行

      @phase4_step = 2

      @wait_count = 0

      @phase4_hit_times = 0

    else

      # /--- 達した場合

      #

      # 「派生」

      #

      # 派生するスキルIDを判定

      case @active_battler.current_action.kind

      when 0

        if @active_battler.current_action.basic == 0

          set = @active_battler.equip_element_set

        else

          set = []

        end

      when 1

        set = @skill.element_set

      else

        set = []

      end

      derived_skill_id = 0

      amounts = XRXS.element_numbers(set, XRXS37::DERIVER)

      for derive_id in amounts

        if @active_battler.skill_can_use?(derive_id) or derive_id < 0

          @active_battler.fderiver = "true" if derive_id<0 # ajouté par Krazplay

          derived_skill_id = derive_id.abs # ajouté par Krazplay

          break

        end

      end

      # 実行!!

      if derived_skill_id > 0

        # クリア

        @phase4_act_times        = 0

        @phase4_act_times_max    = 1

        @phase4_hit_times        = 0

        @phase4_hit_times_max    = 1

        # 武器攻撃ではなくなるため @weapon_id を nil 化

        @weapon_id               = nil

        # 新しいスキルID

        @active_battler.current_action.kind     = 1

        @active_battler.current_action.skill_id = derived_skill_id

        set_target_battlers($data_skills[derived_skill_id].scope)

        return if @target_battlers.empty?

        # ステップ 2 に移行

        @phase4_step = 2

        @wait_count = 0

      end

    end

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)

  #--------------------------------------------------------------------------

  alias xrxs37_update_phase4_step6 update_phase4_step6

  def update_phase4_step6

    # 呼び戻す

    xrxs37_update_phase4_step6

    # エネミー複数行動判定

    xrxs37_enemy_second_action

  end

  #--------------------------------------------------------------------------

  # ○ エネミー複数行動判定

  #--------------------------------------------------------------------------

  def xrxs37_enemy_second_action

    # 条件:エネミー、「行動回数」属性がランクB以上、

    if @active_battler.is_a?(Game_Enemy)

      move_max = 1

      er = $data_enemies[@active_battler.enemy_id].element_ranks

      for i in 1...er.xsize

        next unless $data_system.elements[i] =~ /#{XRXS37::MOVE_TIMES}([+-]?[0-9]+)?(%)?/

        case er[i]

        when 1

          move_max = $1.to_i

        when 2

          move_max = 2

        end

      end

      # カウント

      @active_battler.current_action.turn_move_times += 1

      # エネミー行動実行回数が指定回数未満の場合

      if @active_battler.current_action.turn_move_times < move_max

        # 行動回数を保存

        before = @active_battler.current_action.turn_move_times

        # アクション作成

        @active_battler.make_action

        # 行動回数を復帰

        @active_battler.current_action.turn_move_times = before

        # スピードの設定

        @active_battler.make_action_speed

        @active_battler.current_action.speed /= 2 ** @active_battler.current_action.turn_move_times

        # 行動再予約

        @action_battlers.push(@active_battler)

        sort_action_orders

      end

    end

  end

  #--------------------------------------------------------------------------

  # ○ 「 詠唱中 」ステートIDの取得

  #--------------------------------------------------------------------------

  def get_state_id_cast_chant

   # return ID # 一番左のシャープを消しIDを"詠唱中"のステートIDにすると微高速化

    for i in 1...$data_states.size

      state = $data_states[i]

      if state.name =~ /^#{XRXS37::CHANT_STATE_NAME}$/  # modifié par Krazplay

        return state.id

      end

    end

    return 0

  end

end

 
and XRXS DamageEX
Code:
# ▼▲▼ XRXS19. 特殊効果詰め合わせ DamageEX ver.2 ▼▲▼ built 102300

# by 桜雅 在土 (基本)

#    Tetra-Z   (修正)

 

#==============================================================================

# □ カスタマイズポイント

#==============================================================================

# XRXS DamageEX

# Apporte de nouvelles possibilitées dans les combats.

# Krazplay

 

module XRXS19

  #

  # Réduit de 1/3 les dégats infligés par des armes ou compétences utilisant l'absorbtion de HP,

  # MP, ou un taux de critique fixe.

  #

  DEMERIT = false

  #

  # Efficacité des dégats en SP (en %) :

  #

  SP_DAMAGE_EFFICIENCY = 100

  #

  # Coût en SP pour se défendre si le TYPE_DEF du personnage est E.

  #

  SP_GUARD_COST = 0

  #

  # 特殊効果の名称設定

  #

  SP_DAMAGE        = "SP damage"     # Les dommages ne sont pas infligés aux hp, mais aux sp

  CP_DAMAGE        = "CP damage "     # (nombre)(%) Convertit tout ou en partie des dégats

  # sur les HP en dégats sur les CP, la cible mettra donc plus de temps à jouer.

  # Noter que 100% ne remet absollument pas la barre CP à 0, cela veut simplement dire que

  # vous convertissez tout vos dommages en dégats sur les CP. Si vous essayez de lui enlever

  # plus de cp que la cible n'en possède, le reste des dégats est transformé en soins pour

  # l'adversaire.

  HP_DRAIN         = "HP drain "         # (nombre)(%)  Gagne des HP en infligeant des

        # dommages : reprend 'nombre' % des dommages infligés en HP.

  SP_DRAIN         = "SP drain "        # (nombre)(%)  Gagne des SP en infligeant des

        # dommages : reprend 'nombre' % des dommages infligés en SP.

  CRITICAL_HIT     = "critical "           # (nombre)(%)  L'attaque a 'nombre' % de chance

        # d'être une attaque critique (dommages x 2).

  CERTAIN_HIT      = "certain"           # L'attaque ne peut pas rater sa cible.

  FIXDAMAGE        = "fixdamage "   # (nombre)  L'attaque inflige exactement 'nombre' dégats.

  FIXDAMAGE_NOWHPP = "damage NOWHPP"     # Les dommages deviennent :

        # pour les armes = HP_actuels_de_la_cible / 2 + 1

        # pour les compétences = HP_actuels_de_la_cilbe * skill.power / 100

  FIXDAMAGE_MAXHPP = "damage MAXHPP" # Les dommages deviennent :

        # pour les armes = HP_max_de_la_cible / 4 + 1

        # pour les compétences =  HP_max_de_la_cible * skill.power / 100

  FIXDAMAGE_USERHP = "damage USERHP" #

        # dégats = HP actuels de l'attaquant

  FIXDAMAGE_DIFFHP = "damage DIFFHP" # 

        # dégats = HP max de l'attaquant - HP actuels de l'attaquant

  ADD_VARIANCE     = "add variance "         # (nombre)

        # Ajoute de la dispersion aux dommages, plus ce nombre est grand, plus les dégats

        #  finaux peuvent être éloignés des dégats calculés. (utile pour les armes j'imagine, la

        # variance des compétences étant éditable depuis la base de donnée).

  XRXS19::DAMAGE_HPUP = "damage HPUP"

        # Les dégats sont plus grand quand vos HP sont élevés.

        # La puissance d'attaque de la compétence devient :

        # Taux_d'effet * (hpmax - hp) / hpmax

        # Donc avec 100 % de vos hp le taux d'effet est de 0%, avec 80% de vos hp il est de 80%

        # et ainsi de suite. Ne trouvant pas cela très efficace, j'ai modifé cela, actuellement la

        # formule est :  Taux_d'effet * (hpmax - hp*2) / hpmax

        # sauf si vous avez plus de 50% de vos hp, dans ce cas-là le taux d'effet devient 0 (sinon

        # il deviendrait négatif, cad que la compétence guérirait l'ennemi!)

        # Ma formule revient à dire : il faut moins de 50% de hp pour utiliser la compétence, sinon

        # elle rate, ensuite le taux d'effet grimpe de 2% pour chaque % en dessous de 50.

        # Exemples : HP=30%, T effet = 40%                HP = 20%, T effet = 60%   etc

        # Cf ligne 236, la ligne original est toujours présente, elle juste devenue un commentaire.

  XRXS19::DAMAGE_HPDOWN = "damage HPDOWN"

        # Les dégats sont plus grand quand vos HP sont bas.

  XRXS19::DAMAGE_SPUP = "damage SPUP"

        # Les dégats sont plus grand quand vos SP sont haut.

  XRXS19::USE_ARGENT = "Use argent"

        # Les dégats sont égaux à l'argent perdu.

        # argent perdu = argent_total * variance_compétence / 100 + Taux_effet_compétence)

        # En gros la variance de la compétence représente le % d'argent perdu.

        

  XRXS19::TYPE_DEF = "type def"

        # Est utilisé dans la défense des attributs, si la défense face à ect élément est de :

        # - A : lorsque le personnage se défend, il ne subit plus de dégats.

        # - B : lorsque le personnage se défend, les domages sont réduit par 4 au lieu de 2.

        # - C : La défense est normale, les dégats sont réduits de moitié

        # - D : Une chance sur deux que les dégats soient réduit à 0

        # - E : Les dégats sont infligés aux SP au lieu des HP, sauf si SP_GUARD_COST est

        #         différent de 0, dans ce cas-là le personnage perd SP_GUARD_COST SP.

        

  NOWHPP = 2

  MAXHPP = 4

  USERHP = 5

  DIFFHP = 6

end

class Game_BattleAction

  attr_accessor :sp_damage                # 「SPダメージ」  (true/false)

  attr_accessor :cp_damage                # 「CPダメージ」% (Numeric)

  attr_accessor :hp_drain                 # 「HP吸収」      (Numeric)

  attr_accessor :sp_drain                 # 「SP吸収」      (Numeric)

  attr_accessor :critical_hit             # 「必殺」        (Numeric)

  attr_accessor :certain_hit              # 「必中」        (true/false)

  attr_accessor :special_damage_kind      # 特殊ダメージ種別(Numeric) XRXS19::定数

  attr_accessor :fix_damage               # 固定ダメージ値 (Numeric)

  attr_accessor :add_variance             # 追加分散度     (Numeric)

end

#------------------------------------------------------------------------------

#==============================================================================

# ■ Game_BattleAction

#==============================================================================

class Game_BattleAction

  #--------------------------------------------------------------------------

  # ● クリア

  #--------------------------------------------------------------------------

  alias xrxs19_clear clear

  def clear

    # 呼び戻す

    xrxs19_clear

    # 特殊効果を初期化

    initialize_xrxs19_special_effect

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果を初期化

  #--------------------------------------------------------------------------

  def initialize_xrxs19_special_effect

    self.sp_damage = false

    self.cp_damage = 0

    self.hp_drain  = 0

    self.sp_drain  = 0

    self.critical_hit = 0

    self.certain_hit = false

    self.special_damage_kind = 0

    self.fix_damage = 0

    self.add_variance = 0

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果の設定

  #--------------------------------------------------------------------------

  def set_xrxs19_special_effect(set)

    # SPダメージ (true/false)

    self.sp_damage = XRXS.element_include?(set, XRXS19::SP_DAMAGE)

    # CPダメージ (true/false)

    self.cp_damage = XRXS.element_percent(set, XRXS19::CP_DAMAGE)

    # HP/SP吸収 (数値%)

    self.hp_drain  = XRXS.element_percent(set, XRXS19::HP_DRAIN)

    self.sp_drain  = XRXS.element_percent(set, XRXS19::SP_DRAIN)

    # 必殺 (数値%)

    returnar = XRXS.element_check(set, XRXS19::CRITICAL_HIT)

    percent = returnar[0] ? (returnar[2] == 0 ? 100 : returnar[2]) : 0

    self.critical_hit = percent

    # 必中 (true/false)

    self.certain_hit = XRXS.element_include?(set, XRXS19::CERTAIN_HIT)

    # 特殊ダメージ種別

    self.special_damage_kind =

      XRXS.element_include?(set, XRXS19::FIXDAMAGE_NOWHPP) ? XRXS19::NOWHPP :

      XRXS.element_include?(set, XRXS19::FIXDAMAGE_MAXHPP) ? XRXS19::MAXHPP :

      XRXS.element_include?(set, XRXS19::FIXDAMAGE_USERHP) ? XRXS19::USERHP :

      XRXS.element_include?(set, XRXS19::FIXDAMAGE_DIFFHP) ? XRXS19::DIFFHP :

      0

    # 固定ダメージ値

    self.fix_damage = XRXS.element_amount(set, XRXS19::FIXDAMAGE)

    # 追加分散度

    self.add_variance = XRXS.element_amount(set, XRXS19::ADD_VARIANCE)

  end

  #--------------------------------------------------------------------------

  # ○ 特殊効果をクリア

  #--------------------------------------------------------------------------

  def clear_xrxs19_special_effect

    self.sp_damage = nil

    self.cp_damage = nil

    self.hp_drain  = nil

    self.sp_drain  = nil

    self.critical_hit = nil

    self.certain_hit = nil

    self.special_damage_kind = nil

    self.fix_damage = nil

    self.add_variance = nil

  end

end

#==============================================================================

# ■ Game_Battler

#==============================================================================

class Game_Battler

  #--------------------------------------------------------------------------

  # ○ 公開インスタンス変数

  #--------------------------------------------------------------------------

  attr_writer   :hp0_ban                  # HP/SPの 0 化または最大制限の解除

  attr_writer   :certain_hit              # 必中受け(Trueだと攻撃を避けられない)

  #--------------------------------------------------------------------------

  # ○ 指定の配列の特殊効果を設定

  #--------------------------------------------------------------------------

  def set_xrxs19_special_effect(set)

    self.current_action.set_xrxs19_special_effect(set)

  end

  #--------------------------------------------------------------------------

  # ● ステート [攻撃を回避できない] 判定

  #--------------------------------------------------------------------------

  alias xrxs19_cant_evade? cant_evade?

  def cant_evade?

    return (@certain_hit ? true : xrxs19_cant_evade?)

  end

  #--------------------------------------------------------------------------

  # ● 通常攻撃の効果適用

  #--------------------------------------------------------------------------

  alias xrxs19_attack_effect attack_effect # alias したものは effect_it 内で使用

  def attack_effect(attacker)

    return effect_it(attacker)

  end

  #--------------------------------------------------------------------------

  # ● スキルの効果適用

  #--------------------------------------------------------------------------

  alias xrxs19_skill_effect skill_effect # alias したものは effect_it 内で使用

  def skill_effect(user, skill)

    return effect_it(user, skill)

  end

  #--------------------------------------------------------------------------

  # ○ 効果適用

  #--------------------------------------------------------------------------

  def effect_it(user, skill = nil)

    # 特殊効果予約:SPダメージ

    sp_damage_plan = user.current_action.sp_damage

    # 実行前の数値を保持

    last_hp = self.hp

    last_sp = self.sp

    last_states = self.states.dup

    # 特殊効果:必中

    if user.current_action.certain_hit

      self.certain_hit = true

    end

    # 特殊効果:現HP威力

    if skill != nil and XRXS.element_include?(user.skill_element_set(skill), XRXS19::DAMAGE_HPUP)

      skill = skill.dup

      skill.power = (1.0 * skill.power * user.hp / user.maxhp).floor

    end

    # 特殊効果:減HP威力

    if skill != nil and XRXS.element_include?(user.skill_element_set(skill), XRXS19::DAMAGE_HPDOWN)

      skill = skill.dup

      # Modification de Krazplay, la ligne originale est

      # skill.power = (1.0 * skill.power * (user.maxhp - user.hp) / user.maxhp).floor

      skill.power = (100 * user.hp / user.maxhp) >= 50 ? 0 : (1.0 * skill.power * (user.maxhp - user.hp*2) / user.maxhp).floor

    end

    # 特殊効果:現SP威力

    if skill != nil and XRXS.element_include?(user.skill_element_set(skill), XRXS19::DAMAGE_SPUP)

      skill = skill.dup

      skill.power = (1.0 * skill.power * user.sp / user.maxsp).floor

    end

    #/---

    # 基本実行、skill が nil かどうかで通常攻撃とスキルを分別

    save_in_battle = $game_temp.in_battle

    $game_temp.in_battle = true

    last_immortal = @immortal

    @immortal = !(self.dead?)

    if skill == nil

      bool = xrxs19_attack_effect(user)

    else

      bool = xrxs19_skill_effect(user, skill)

    end

    @immortal = last_immortal

    $game_temp.in_battle = save_in_battle

    #---/

    

    # HP回復スキルの判定

    if skill != nil and skill.power < 0 and !user.current_action.sp_damage

      # 既に最大HPかつステート不変かどうかで有効フラグをセット

      bool = false if (last_hp == self.maxhp and last_states == self.states)

    elsif user.current_action.sp_damage

      # SPダメージの場合は一旦trueへ (Thx. Tetra-Z)

      bool = true

    end

    # 必中の解除

    self.certain_hit = false

    #

    # --- ダメージを測定 -------------------------------------------------

    #

    damage    = self.damage

    damage_sp = 0

    #

    # --- ダメージを変化させる -------------------------------------------

    #

    # 特殊効果:消費金額に順ずる固定ダメージ

    if skill != nil and XRXS.element_include?(user.skill_element_set(skill), XRXS19::USE_ARGENT)

      # ゴールドの消費

      last_gold = $game_party.gold

      $game_party.gain_gold(-1 * ($game_party.gold * skill.variance / 100 + skill.power))

      self.hp += damage if bool

      damage = last_gold - $game_party.gold

      bool = true

    end

    # 基本実行でfalseの場合ここで終了する ("銭投げ"は確実成功)

    if !bool or !damage.is_a?(Numeric)

      return bool

    end

    # 特殊効果デメリット

    if XRXS19::DEMERIT and damage > 0 and 

       (user.current_action.hp_drain > 0 or

        user.current_action.sp_drain > 0 or 

        user.current_action.critical_hit > 0)

      damage = damage * 2/3

    end

    # 特殊効果:現HP威力

    if skill.nil? and XRXS.element_include?(user.equip_element_set, XRXS19::DAMAGE_HPUP)

      damage = (1.0 * damage * user.hp / user.maxhp).floor

    end

    # 特殊効果:減HP威力

    if skill.nil? and XRXS.element_include?(user.equip_element_set, XRXS19::DAMAGE_HPDOWN)

      damage = (1.0 * damage * (user.maxhp - user.hp) / user.maxhp).floor

    end

    # 特殊効果:防御能力の判定

    if damage > 0 and self.guarding?

      case battler_element_rank?(self, XRXS19::TYPE_DEF)

      when 1 # 特殊効果:防御能力 A(無効防御)

        damage = 0

      when 2 # 特殊効果:防御能力 B(強防御)

        damage /= 2

      when 4 # 特殊効果:防御能力 D(50%の確率で0)

        if rand(2) > 0

          damage = 0

        else

          damage *= 2

        end

      when 5 # 特殊効果:防御能力 E(SP防御)

        if XRXS19::SP_GUARD_COST != 0

          sp_cost = XRXS19::SP_GUARD_COST

        else

          sp_cost = damage

        end

        if self.sp >= sp_cost

          damage = XRXS19::SP_GUARD_COST if XRXS19::SP_GUARD_COST != 0

          sp_damage_plan = true

        end

      when 6 # 特殊効果:防御能力 F(二倍ダメージ)

        damage *= 4

      end

    end

    # 特殊効果:必殺

    if user.current_action.critical_hit > 0

      # クリティカルが発生していた場合、それを取りやめる

      if self.critical

        self.critical = false # フラグを消して

        damage /= 2           # ダメージの半分を

      end

      # クリティカル判定

      if rand(100) < user.current_action.critical_hit

        self.critical = true

        damage       *= 2

      end

    end

    # 特殊効果:固定ダメージ ( 固定ダメージ故クリティカルを禁止 )

    case user.current_action.special_damage_kind

    when XRXS19::NOWHPP # 「%ダメージ」

      if skill == nil

        damage = last_hp / 2 + 1

      else

        damage = last_hp * skill.power / 100

      end

      self.critical = false

    when XRXS19::MAXHPP # 「最大%ダメージ」

      if skill == nil

        damage = self.maxhp / 4 + 1

      else

        damage = self.maxhp * skill.power / 100

      end

      self.critical = false

    when XRXS19::USERHP # 「現在HPダメージ」

      damage = user.hp

      self.critical = false

    when XRXS19::DIFFHP # 「差分HPダメージ」

      damage = user.maxhp - user.hp

      self.critical = false

    end

    # 特殊効果「分散度」(RGSS標準仕様)

    if user.current_action.add_variance != 0

      variance = user.current_action.add_variance

      if variance > 0 and damage.abs > 0

        amp = [damage.abs * variance / 100, 1].max

        damage += rand(amp+1) + rand(amp+1) - amp

      end

    end

    # 特殊効果「固定ダメージ」

    if user.current_action.fix_damage != 0

      damage = user.current_action.fix_damage

    end

    # 特殊効果:CPダメージ

    if user.current_action.cp_damage > 0

      if defined? self.cp

        # 今回のダメージの、最大HPに対する割合を計算

        damage_cp = user.current_action.cp_damage * 65535 * damage / self.maxhp / 100

        self.cp  -= damage_cp

        damage    = damage * (100 - user.current_action.cp_damage)/100

        self.damage = damage == 0 ? nil : damage

      end

    end

    # 特殊効果:SPダメージ

    if sp_damage_plan

      damage_sp = damage * XRXS19::SP_DAMAGE_EFFICIENCY / 100

      damage    = 0

      self.damage = ""

      #

      # メモ :(RGSS標準) .damageがnilの場合、ステートの変化が即座に表示される。

      #

      # SP回復スキルの判定

      if skill != nil and skill.power < 0

        # 既に最大SPかつステート不変かどうかで有効フラグをセット (Thx. Tetra-Z)

        bool = false if (last_sp == self.maxsp and last_states == self.states)

      end

    end

    #

    # --- ダメージを適用する ---------------------------------------------

    #

    self.hp        = last_hp - damage

    self.damage    = damage if self.damage.is_a?(Numeric)

    self.sp        = last_sp - damage_sp if damage_sp != 0

    self.damage_sp = damage_sp == 0 ? nil : damage_sp

    real_damage    = (last_hp - self.hp) + (last_sp - self.sp)

    #

    # 特殊効果「HP吸収」「SP吸収」

    #

    if user.current_action.hp_drain > 0

      user.damage  = 0 if user.damage == nil # nil の場合はリセット

      drain_point  = -real_damage * user.current_action.hp_drain / 100

      user.damage += drain_point

      user.hp     -= drain_point

      if user.damage == 0

        user.damage  = nil

      end

    elsif user.current_action.sp_drain > 0

      user.damage_sp  = 0 if user.damage_sp == nil # nil の場合はリセット

      drain_point     = -real_damage * user.current_action.sp_drain / 100

      user.damage_sp += drain_point

      user.sp        -= drain_point

      if user.damage_sp == 0

        user.damage_sp  = nil

      end

    end

    # 終了

    return bool

  end

  #--------------------------------------------------------------------------

  # ○ バトラーの指定名の属性のランクを判定

  #--------------------------------------------------------------------------

  def battler_element_rank?(battler, element_name)

    for i in 1..$data_system.elements.size

      if $data_system.elements[i] == element_name

        if self.is_a?(Game_Actor)

          return $data_classes[battler.class_id].element_ranks[i]

        else

          return $data_enemies[battler.id].element_ranks[i]

        end

      end

    end

    return 3

  end

end

#==============================================================================

# ■ Scene_Skill

#==============================================================================

class Scene_Skill

  #--------------------------------------------------------------------------

  # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)

  #--------------------------------------------------------------------------

  alias xrxs19_update_target update_target

  def update_target

    # C ボタンが押された場合

    if Input.trigger?(Input::C)

      # 特殊効果の取得

      @actor.set_xrxs19_special_effect(@actor.skill_element_set(@skill))

    end

    # 呼び戻す

    xrxs19_update_target

    # 特殊効果をクリア

    for actor in $game_party.actors

      actor.current_action.clear_xrxs19_special_effect

    end

  end

end

#==============================================================================

# ■ Scene_Battle

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # ● メイン処理

  #--------------------------------------------------------------------------

  alias xrxs19_main main

  def main

    # 呼び戻す

    xrxs19_main

    # 特殊効果をクリア

    for actor in $game_party.actors

      actor.current_action.clear_xrxs19_special_effect

    end

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)

  #--------------------------------------------------------------------------

  alias xrxs19_update_phase4_step2 update_phase4_step2

  def update_phase4_step2

    # 使用者のダメージ値を nil でリセット

    @active_battler.damage = nil

    # ステップ 2 へ

    xrxs19_update_phase4_step2

  end

  #--------------------------------------------------------------------------

  # ● 基本アクション 結果作成

  #--------------------------------------------------------------------------

  alias xrxs19_make_basic_action_result make_basic_action_result

  def make_basic_action_result

    # 攻撃の場合

    if @active_battler.current_action.basic == 0

      # 使用する武器の特殊効果の取得

      @active_battler.set_xrxs19_special_effect(@active_battler.equip_element_set)

    end

    xrxs19_make_basic_action_result

  end

  #--------------------------------------------------------------------------

  # ● スキルアクション 結果作成

  #--------------------------------------------------------------------------

  alias xrxs19_make_skill_action_result make_skill_action_result

  def make_skill_action_result

    # スキルを取得

    @skill = $data_skills[@active_battler.current_action.skill_id]

    # 使用する武器の特殊効果の取得

    @active_battler.set_xrxs19_special_effect(@active_battler.skill_element_set(@skill))

    # 特殊効果:消費金額に順ずる固定ダメージ

    if XRXS.element_include?(@skill.element_set, XRXS19::USE_ARGENT)

      # ゴールドウィンドウを作成

      if @gold_window == nil or @gold_window.visible == false

        @gold_window = Window_Gold.new

        @gold_window.x = 640 - @gold_window.width

        @gold_window.y = 64

        @gold_window.opacity = 160

        @gold_window.visible = true

      end

    end

    xrxs19_make_skill_action_result

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)

  #--------------------------------------------------------------------------

  alias xrxs19_update_phase4_step4 update_phase4_step4

  def update_phase4_step4

    # ゴールドウィンドウを更新

    @gold_window.refresh if @gold_window != nil

    # 呼び戻す

    xrxs19_update_phase4_step4

  end

  #--------------------------------------------------------------------------

  # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)

  #--------------------------------------------------------------------------

  alias xrxs19_update_phase4_step5 update_phase4_step5

  def update_phase4_step5

    # 呼び戻す

    xrxs19_update_phase4_step5

    # ダメージ表示

    for target in @target_battlers

      if target.damage_sp != nil

        target.damage_pop = true

      end

    end

    # 行動者もダメージ表示

    if @active_battler.damage != nil or @active_battler.damage_sp != nil

      @active_battler.damage_pop = true 

    end

    # ゴールドウィンドウを隠す

    @gold_window.visible = false if @gold_window != nil

  end

end

#==============================================================================

# □ SPダメージ機能 (表示機能は他に任せる)

#------------------------------------------------------------------------------

#   SPダメージ機能を搭載し、ダメージ時には"SP (値)"文字列を生成します。

#==============================================================================

class Game_Battler

  attr_accessor :damage_sp                # ダメージSP値

end

 
I know that is much to require, but that will improve my plays largely.

tank
 
you know that some of that things are in the battlesystem already,no?

Anyway one of my addons does some other things you want, but its not complete yet...

pd: can you post a list of what effects exactly do that scripts?
 
@gerrtunk
I know that certain function its in the basic system.

me my problem it is that for additions the function such as:
- “Al enemy”
- “Drain HP”
ect.
it is necessary that each system is a “Element name” in the base of given so that it can be to add to the weapon and armor.

tank
 
johnseed":169nknxt said:
@gerrtunk
I know that certain function its in the basic system.

me my problem it is that for additions the function such as:
- “Al enemy”
- “Drain HP”
ect.
it is necessary that each system is a “Element name” in the base of given so that it can be to add to the weapon and armor.

tank

i doubt that can be easy to add that scripts for two reasons:
-They are based on the original DBS, and this its a lot changued
-Overwrite some atoas effects
-Atoas uses his own config style, i doubt he want to use with database settings now


Just write a complete list of what effects you think are missing and maybe i have they or y can include they in my addon.
 
@gerrtunk
thanks for agreeing to help me
Code:
 

- “SP ramming” # the damage are not inflicted with the HP, but with the sp 

- “HP drain” # (number) (%) Gagne of HP by inflicting # damage: “number” % of the damage inflicted in HP takes again.

- “SP drain” # (number) (%) SP Gain by inflicting # damage: “number” % of the damage inflicted in SP takes again.

- “critical” # (number) (%) the attack has “number” % of chance 

- “fixdamage” # (number) the attack inflicts exactly “number” damage.

-“Al enemy” # Aims all the enemy.

-“Al actor” # Aims all the allies.

-“Fall target” #permet to aim to fall allies or an enemy 

-“fall maxtarget” #permet to aim to fall all the allies or all the enemies

-“hit” # (number) Makes it possible to touch “number” time in only one blow

 
very tank
 
johnseed":2j19epja said:
@gerrtunk
thanks for agreeing to help me
Code:
 

- “SP ramming” # the damage are not inflicted with the HP, but with the sp 

- “HP drain” # (number) (%) Gagne of HP by inflicting # damage: “number” % of the damage inflicted in HP takes again.

- “SP drain” # (number) (%) SP Gain by inflicting # damage: “number” % of the damage inflicted in SP takes again.

- “critical” # (number) (%) the attack has “number” % of chance 

- “fixdamage” # (number) the attack inflicts exactly “number” damage.

-“Al enemy” # Aims all the enemy.

-“Al actor” # Aims all the allies.

-“Fall target” #permet to aim to fall allies or an enemy 

-“fall maxtarget” #permet to aim to fall all the allies or all the enemies

-“hit” # (number) Makes it possible to touch “number” time in only one blow

 
very tank

Look better. The only effects i think that arent in the main system or in addons are:
-“Fall target” #permet to aim to fall allies or an enemy
-“fall maxtarget” #permet to aim to fall all the allies or all the enemies
- “fixdamage” # (number) the attack inflicts exactly “number” damage.

I have already created the fixed damage effect, but the others two no.
 

Atoa

Member

@ johnseed
Why do you need Action EX and Damage EX when the acbs has most functions of theses scripts built in or via add-ons.

You should look better on the script.
By the way, what do you mean by
-“Fall target” #permet to aim to fall allies or an enemy
-“fall maxtarget” #permet to aim to fall all the allies or all the enemies
 
Did you just ignore me ? 0.o

Seriously,It's the trial ... so please help me :(( a few posts up

Or did you just not see my post.

Or you don't know the answer.
 
dylstew":12e0gr4m said:
Did you just ignore me ? 0.o

Seriously,It's the trial ... so please help me :(( a few posts up

Or did you just not see my post.

Or you don't know the answer.
This worked for me: remove the battle window addon.
 

Atoa

Member

@dylstew
Remove this section of the script, this is just the shadow text, i add this for stetical porpouse, but since it causes problem with some people i will even remove it from the next update. Who want it can seach for it.

by the way, even if you have now a oniginal rpg maker, if you're using files that was created using with the non legal RM, any bugs caused by it will still happen, so you need to update you Scripts.rxdata.
 
After learning a bit more Ruby, I've found a seemingly elegent solution to the CTB/Automatic Actions incompatibility. Currently, Automatic Actions works well for actors in the CTB, but it has no influence over enemy actions. This incompatability can be fix by replacing the method battler_turn(battler) in the CTB with:

Code:
  def battler_turn(battler)

    battler.turn_count += 1

    if battler.is_a?(Game_Actor)

      if battler.ctb_full? and battler.inputable? and battler.cast_action.nil?

        @input_battlers << battler

        @input_battlers.compact!

      else

        if battler.confused?

          battler.current_action.kind = 0

          battler.current_action.basic = 0

        end

        battler.defense_pose = false

        @action_battlers << battler

        @action_battlers.compact!

      end

    else

      if battler.current_action.forcing or $game_temp.forcing_battler

        battler.current_action.forcing = false

        $game_temp.forcing_battler = nil

      else

        #Begin CTB/Automatic Actions compatibility

        if battler.auto_battler?

          set_automaitc_actions(battler) 

        else battler.make_action

        #End CTB/Automatic Actions compatibility

        end

      end

      @action_battlers << battler

      @action_battlers.compact!

    end

  end

Of course, you'll only want to do this if you have Automatic Actions installed. Otherwise, it will lead to a crash.

Thanks again for sharing your script, Atoa! I've also noticed some game crashes as a result of Skill Conditions, and I'm working on that next.

Also, I've got a question about the CTB. What's the difference between Action_Cost and Cast_Time? My guess is that not every action fully drains the CTB, and this is reflected in Action_Cost. A low Action_Cost drains less of the CTB than a high Action_Cost. Meanwhile, Cast_Time is the number of frames between when the player selects a skill and when the skill activates. Please let me know if this is correct!

-tuatha
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top