New account registration is temporarily disabled.

[RMVX ACE] OLD DOG TRYING TO LEARN NEW TRICKS (BASIC QUESTIONS)

Posts

Pages: 1
Hello! Some of you might remember me from the GW days where I made some RM2k3 games! I am going to make an earnest attempt to make a quick game for the Winterruption event, but I have some (seemingly) basic questions about the capabilities and going-ons with the RPG Maker VX Ace engine. Maybe you experts can shed some light.

1. Can you make it so that skills have 100% hit chance all the time (except for when the target has an Evade chance applied, either as a class attribute, or as a status effect)?
I don't want Agility or Magic Power or whatever to affect at all whether a skill will hit and do damage.

2. For damage reduction, can I make it so that it is a flat percentage (either by equipment or status effect)?
Like, a skill/status that reduces all incoming damage by, say, 50% for 3 turns/rounds

3. Is there any way that I can have all of the heroes act first, THEN all of the monsters act next? (repeat until battle is over)
3. a) can I go further and have the user chose a hero, have that hero act out their command, then so one until each hero has acted once, then it is the monsters turn to attack?

I am flexible on this and how to rig it. iirc all skills have some sort of 'Priority' attribute, and if necessary I was just going to have all of the hero skills have high priority and all monster skills have low priority, so at least the ordering will be that heroes all act first, monsters all act last in a given round. I just really don't know what my options are regarding turns and rounds and turn order.


4. I only want a handful of stats: POWER, HP, EVADE %, DAMAGE REDUCTION %, CRITICAL %, TP/RAGE. Is this possible?
POWER - how powerful skills are
HP - life
EVADE % - chance to avoid taking damage
DAMAGE REDUCTION % - how much incoming damage is reduced by
CRITICAL CHANCE % - chance an attack damage is amplified x2
TP/RAGE - limit breaks yo!

I really don't want agility affecting things like turn order, or to hit, or whatever else might be happening under the hood. Skills don't cost MP. And how do I control rate of TP growth? it's been a while...

5. I don't want damage to be variable. If a skill does '100% POWER' and the player has 200 POWER stat, I want the skill to inflict exactly 200 damage (barring the target evading or having damage reduction %). Possible?

6. are these skills feasible?
SKILLPOWERTARGETSPECIAL
ASSAULT1SingleRaises Aggro of attacker
HOLY STRIKE0.8SingleLowest HP ally receives 40% of damage dealt as healing
DUAL STRIKE0.6x2 Single(effectively 120% damage)
FRENZY0.5x3 Random(effectively 150% damage)
HEALING STRIKE1SingleAll alies receive 15% damage dealt as healing
POISON0.25SingleTarget is poisoned for 75% damage per turn for 3 turns
SMITE0.75SingleDamage increases 2% for every 1% HP lost
CLARITY0.6All60% chance to dispel all helpful statuses
METEOR1Allnothing special
BLIZZARD0.8All15% chance to stun
THUNDERSTORM1.2x4Chain lightning jumps to up to 3 additional targets, halving damage each time (60%, 30%, 15%)
BURST0.5AllTargets are drained for 50% damage per turn for 3 turns
MUG1SingleSteal item from target
IMPALE0.2SingleTarget is bleeding for 100% damage per turn for 3 turns
BALLAD75%/25%Single/AllTarget is damaged for 75%, the rest are damaged for 25%
RAPIDFIRE0.4x4 Random
DISPEL0.8SingleDispels helpful statuses
OVERPOWER1SingleTarget is weakened, attack is reduced by 25% for 3 turns
SAP0.6SingleTarget is vulnerable, taking 25% increased damage for 3 turns
BASH1.2Single15% chance to stun


SKILLPOWERTARGETSPECIAL
PROTECT--PartyParty has incoming damage reduced by 50% for 1 turn
DEVOTION--AllyCover ability. Take damage instead of ally.
FORTITUDE--PartyParty has incoming damage reduced by 25% for 3 turns
TAUNT--AllyAlly has incoming damage reduced by 60% for 2 turns, greatly raises Aggro of Ally
HEALUS0.5PartyHeals party moderately
REGROWTH0.25PartyHeals party slightly, casts Regen on party (50% per turn 3 turns)
BLESS1.2AllyHeals and removes all bad statuses
CURE75%/25%Single/AllAlly is healed for 75%, the rest of party healed for 25%
ENRAGE--AllyRaise rage/TP of target
FROSTWALL--PartyAttackers have a chance to be frozen/stunned if attacking
ENERGIZE--AllyAttackers will receive set amount of damage per attack
ENHANCE--PartyParty has power increased by 25% for 3 turns
COUNTERSTRIKE--AllyAlly now counterstrikes if attacked for 3 turns
SHADOWCLONE--PartyParty has evade chance increased to 25%
INSPIRE--PartyRaise rage/TP of party
THORNS--PartyAttackers will receive set amount of damage per attack
CLEANSE--PartyRemove all bad statuses from party
REFLECT--AllyDamage taken is also reflected back to attacker, greatly raise aggro of ally
SHROUD--AllyAlly has evade chance increased to 50%
CHEER--AllyAlly has power increased by 60%

*edit for readibility. The power is supposed to be percentages, but Excel made them as decimal numbers. so 1 == 100%, 0.8 == 80%, etc


A year and a bit ago Trihan made some scripts for me that does what I want for THUNDERSTORM, HOLY STRIKE, SMITE and BALLAD, so that's covered... (though I haven't inspected them in depth)


What I am hoping for from you experts is getting a sense of scale and effort required to implement these ideas, and given that the event isn't very long, adjust my designs and expectations to be more feasible and achievable with regards to the engine.

Thanks!
I haven't really looked at Ace/MV for ages and I'm at work waiting for a rock analysis script to finish so I'm spitballing here. This is also with vanilla Ace/MV, there's probably some more comprehensive scripts that can do this.


1. Just give everybody a ToHit trait of 100%. Give whatever you want to evade the appropriate Evade% trait. Accuracy in vanilla Ace is two steps: A check to hit based on their ToHit%, then an evade check based on the target's Evade%. The default ToHit% is 0% so you MUST give the ToHit trait set to be 100% (or just script it out).

2. I'm pretty sure there's a trait for Damage Received, but I'm not so confident on if it's split across physical/magic damage.

3. It'll be kludge without scripting but yeah. There's a speed stat that iirc is just Agility+skill speed that affects when that skill is used. It isn't like Pokemon priority where Quick Attack has innate priority regardless of the enemy's speed (unless they use a priority move too).

4. Possible but you'll have to script some stuff out. Some UI stuff, Luck iirc affects the chance of landing a status. ATK, DEF, MAG, and MDF aren't used at all besides damage algorithms (see #5), agility is still turn order by default.

5. Totally. Each skill has its own damage algorithm that you can just set like you're coding ruby. Stuff like:
a.atk * 2
500
a.atk * 10 - b.def

First is user's attack * 2, second is flat 500, third is user's attack * 10 minus target's defense. Elemental multipliers are applied after this step though, but you can flag what element a skill is (or none).


6. rock analysis is close to done, I'll look these over later
Thanks!

Oh, that reminds me, what can I do so that a status effect has a 100% hit rate, too?
Craze
why would i heal when i could equip a morningstar
15170
https://yanflychannel.wordpress.com/category/rpg-maker/rpg-maker-vx-ace/

https://crazescriptasylum.wordpress.com/

1) use my accuracy script above. also any "perfect hit" or w/e skills (i.e. NOT selecting physical or magical in the drop-down) will always hit, but it's generally better used for heals/support moves). perfect hit also works for auto-state inflict i think

2) the PDR/MDR stats are damage resistance for phys/magic. if you set it to 50% on a state, it'll halve damage.

3) use free turn battle. it's the system i use in W&R and teenage costume squad. use a blank icon and 1 action per character if you want just phases and not any sort of weird multi-action shenanigans.

4) atk, mat, def, res all do nothing by themselves. combined with yanfly's parameters scripts, they're easy to make do what you want. speed is used as action order and luck has a minor effect on status success, but they're easy to edit out in the scripts. (if you use free turn, speed will mean nothing by itself, like atk/mat/etc., so you can rework it how you want)

5) like 2k3 there's a variance setting in the damage box

6) well
-aggro is TGR; it's a lottery system, so if you all have the base 100% TGR you are all equal. if somebody has 200% and everybody else 100%, you will be hit 2/5 of the time instead of 1/4
-holy strike requires some sorting code to figure out lowest hp but you can do it with lunatic objects script
-healing strike is easy, again use lunatic objects
-poison is actually built into one of the lunatic states scripts as stat-based degen
-clarity is super easy, you can set removal rate to 60% using the normal "remove state" effect for skills
-thunderstorm is kinda tricky unless you do some really shitty work-arounds with follow-up skills (yanfly script)
-etc. most of these are easy except thunderstorm
Status effects application is based on your characters' luck stat. Pump that up as well as the application rate and you should see it activate, especially if enemies are weak to that state in particular.

unity
You're magical to me.
12540
author=Craze
https://yanflychannel.wordpress.com/category/rpg-maker/rpg-maker-vx-ace/https://crazescriptasylum.wordpress.com/

1) use my accuracy script above. also any "perfect hit" or w/e skills (i.e. NOT selecting physical or magical in the drop-down) will always hit, but it's generally better used for heals/support moves). perfect hit also works for auto-state inflict i think

2) the PDR/MDR stats are damage resistance for phys/magic. if you set it to 50% on a state, it'll halve damage.

Yeah, I found a big problem with Certain Hit skills in one of my projects. If my tests are correct (and I ran them months ago, so I may be misremembering), skills set to Certain Hit seemed to be unaffected by PDR and MDR, where in the past I assumed they'd be affected by PDR. This makes Certain Hits, like Craze said, best for healing and support moves.

I gotta find a better way to make skills that I want to always hit to, indeed, always hit, without giving up their status as physical or magical. It looks like Craze's Accuracy Overflow script can indeed do that, so yay! That's another problem solved for me! :D
author=Craze
-etc. most of these are easy except thunderstorm

Thanks for the input! I will try to make sense of this this weekend.

def custom_formula_lightningjump(a, b)
    log_window = SceneManager.scene.log_window
    targets = a.current_action.opponents_unit.alive_members
    targets.delete(b)
    if targets.length > 3
      targets = targets.shuffle.take(3)
    end
    targets.unshift(b)
    item = a.current_action.item
    targets.each_with_index { |target, index|
      standard_formula = 200 + a.mat * 2 - target.mdf * 2
      target.result.clear
      target.result.used = item_test(a, item)
      target.result.missed = (target.result.used && rand >= item_hit(a, item))
      target.result.evaded = (!target.result.missed && rand < item_eva(a, item))
      if target.result.hit?
        unless item.damage.none?
          target.result.critical = (rand < item_cri(a, item))
          value = standard_formula - (0.25 * standard_formula * index)
          target.manual_make_damage_value(value, a, item)
          target.execute_damage(a)
          log_window.clear
          log_window.add_text("The lightning jumps!")
          log_window.display_action_results(target, item)
        end
      end
    }
    b.result.clear
    return 0
  end


???
For 3, I kinda modified Yanfly's ftb script to do just that a while ago. I''ll dig around in my pile and see if I can find it :)

Edit: Found it.

Edit2: Hide tags don't work with code tags?

# NOTE TO SELF: Truncate some more.

# Once more, I took out some stuff from this script;
# Effectively, I made it usable without YF's Battle System.
#
# I did this simply because I did not know how to make my actors
# perform their move immediately after selection. I remembered that
# this script does just that, so I decided to just use this. Stripping
# down most of what makes it a "Free Turn Battle System", this script's main
# purpose was downgraded to a mere "Whack when I tell ye" script.
#
# Not that I don't like his system and all, but I already have
# One that I built myself, so...

#==============================================================================
# 
# ? Yanfly Engine Ace - Battle System Add-On: Free Turn Battle v1.02
# -- Last Updated: 2012.01.15
# -- Level: Normal, Hard
# -- Requires: Yanfly Engine Ace - Ace Battle Engine v1.15+
# 
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-BattleSystem-FTB"] = true

#==============================================================================
# ? Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.15 - Bug fixed: Battle victory log doesn't play twice.
# 2012.01.11 - Bug fixed: Dead actors are no longer inputable.
# 2012.01.10 - Finished Script.
# 2012.01.09 - Started Script.
# 
#==============================================================================
# ? Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Free Turn Battle is a type of battle system made for Ace Battle Engine, where
# actors perform their actions immediately (unless under the effects of berserk
# or any other form of autobattle) as they're selected. After all of their
# actions have been performed, the enemies will take their turn in battling the
# actors. This becomes a system where actors and enemies will take turns
# attacking one another as a whole.
# 
#==============================================================================
# ? Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials/?? but above ? Main. Remember to save.
# 
# First, set the default battle system for your game to be :ftb by either going
# to the Ace Battle Engine script and setting DEFAULT_BATTLE_SYSTEM as :ftb or
# by using the following script call: 
# 
# $game_system:set_battle_system(:ftb)
# 
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <ftb actions: +x>
# <ftb actions: -x>
# This increases or decreases the maximum number of actions available to an
# actor by x. While an actor's individual maximum can be any value, it does not
# provide more than the party maximum applied in the module. An actor's total
# maximum cannot go below 1.
# 
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the classes notebox in the database.
# -----------------------------------------------------------------------------
# <ftb actions: +x>
# <ftb actions: -x>
# This increases or decreases the maximum number of actions available to an
# actor by x. While an actor's individual maximum can be any value, it does not
# provide more than the party maximum applied in the module. An actor's total
# maximum cannot go below 1.
# 
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skills notebox in the database.
# -----------------------------------------------------------------------------
# <ftb cost: x>
# This causes the skill to have an FTB cost of x. The FTB Cost does not occur
# for individual chain skills, individual input skills, specialized input
# skills, or instant skills. However, an FTB Cost can be used to put a specific
# requirement on those listed types of skills.
# 
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <ftb cost: x>
# This causes the item to have an FTB cost of x. The FTB Cost does not occur
# for instant items. If items cost more actions than the party has available,
# then the items will not appear in the usable item list during battle.
# 
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# <ftb actions: +x>
# <ftb actions: -x>
# This increases or decreases the maximum number of actions available to an
# actor by x. While an actor's individual maximum can be any value, it does not
# provide more than the party maximum applied in the module. An actor's total
# maximum cannot go below 1.
# 
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armour notebox in the database.
# -----------------------------------------------------------------------------
# <ftb actions: +x>
# <ftb actions: -x>
# This increases or decreases the maximum number of actions available to an
# actor by x. While an actor's individual maximum can be any value, it does not
# provide more than the party maximum applied in the module. An actor's total
# maximum cannot go below 1.
# 
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the state notebox in the database.
# -----------------------------------------------------------------------------
# <ftb actions: +x>
# <ftb actions: -x>
# This increases or decreases the maximum number of actions available to an
# actor by x. While an actor's individual maximum can be any value, it does not
# provide more than the party maximum applied in the module. An actor's total
# maximum cannot go below 1.
# 
#==============================================================================
# ? Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
# 
# This script requires Yanfly Engine Ace - Ace Battle Engine v1.15+ and the
# script must be placed under Ace Battle Engine in the script listing.
# 
#==============================================================================

module YEA
  module FTB
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - General FTB Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These settings adjust various general Free Turn Battle constants such as
    # the icons used for actions and no actions, whether or not party members
    # will have limited actions (or unlimited).
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    ICON_ACTION = 188      # Icon displayed when there are actions left.
    ICON_EMPTY  = 185      # Icon displayed to indicate a used action.
    
    # For every x% above the base AGI, actors will gain an extra action. Change
    # the value below to adjust the percentage needed.
    EXTRA_FTB_ACTION_BONUS = 10.00
    
    # This is the maximum number of actions that the party can have despite the
    # maximum number of individual actor actions totalling to more than this.
    MAXIMUM_FTB_ACTIONS = 10
    
    # If this setting is on, then each member can only perform a limited amount
    # of actions per turn as opposed to freely performing actions until the
    # party's action usage is depleted.
    LIMITED_ACTIONS_PER_MEMBER = true
    
  end # FTB
end # YEA

#==============================================================================
# ? Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================


module YEA
  module REGEXP
  module BASEITEM
    
    FTB_ACTIONS = /<(?:FTB_ACTIONS|ftb actions):[ ]([\+\-]\d+)>/i
    
  end # BASEITEM
  module USABLEITEM
    
    FTB_COST = /<(?:FTB_COST|ftb cost):[ ](\d+)>/i
    
  end # USABLEITEM
  end # REGEXP
end # YEA

#==============================================================================
# ¦ Icon
#==============================================================================

module Icon
  
  #--------------------------------------------------------------------------
  # self.ftb_action
  #--------------------------------------------------------------------------
  def self.ftb_action
    return YEA::FTB::ICON_ACTION
  end
  
  #--------------------------------------------------------------------------
  # self.ftb_empty
  #--------------------------------------------------------------------------
  def self.ftb_empty
    return YEA::FTB::ICON_EMPTY
  end
  
end # Icon

#==============================================================================
# ¦ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_ftb load_database; end
  def self.load_database
    load_database_ftb
    load_notetags_ftb
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_ftb
  #--------------------------------------------------------------------------
  def self.load_notetags_ftb
    groups = [$data_skills, $data_items, $data_actors, $data_classes,
      $data_weapons, $data_armors, $data_states]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_ftb
      end
    end
  end
  
end # DataManager

#==============================================================================
# ¦ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :ftb_actions
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_ftb
  #--------------------------------------------------------------------------
  def load_notetags_ftb
    @ftb_actions = 0
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::BASEITEM::FTB_ACTIONS
        @ftb_actions = $1.to_i
      end
    } # self.note.split
    #---
  end
  
end # RPG::BaseItem

#==============================================================================
# ¦ RPG::UsableItem
#==============================================================================

class RPG::UsableItem < RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :ftb_cost
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_ftb
  #--------------------------------------------------------------------------
  def load_notetags_ftb
    @ftb_cost = 1
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::USABLEITEM::FTB_COST
        @ftb_cost = $1.to_i
      end
    } # self.note.split
    #---
  end
  
end # RPG::UsableItem
#==============================================================================
# ¦ Icon
#==============================================================================

module Icon
  
  #--------------------------------------------------------------------------
  # self.ftb_action
  #--------------------------------------------------------------------------
  def self.ftb_action
    return YEA::FTB::ICON_ACTION
  end
  
  #--------------------------------------------------------------------------
  # self.ftb_empty
  #--------------------------------------------------------------------------
  def self.ftb_empty
    return YEA::FTB::ICON_EMPTY
  end
  
end # Icon

#==============================================================================
# ¦ BattleManager
#==============================================================================

module BattleManager
  
  #--------------------------------------------------------------------------
  # alias method: make_action_orders
  #--------------------------------------------------------------------------
  class <<self; alias make_action_orders_ftb make_action_orders; end
  def self.make_action_orders
    make_action_orders_ftb
  end
  
  #--------------------------------------------------------------------------
  # new method: make_ftb_action_orders
  #--------------------------------------------------------------------------
  def self.make_ftb_action_orders
    @action_battlers = []
    @action_battlers += $game_party.members unless @surprise
    @action_battlers += $game_troop.members unless @preemptive
    @action_battlers.each { |battler| battler.make_speed }
    @action_battlers.sort! {|a,b| a.screen_x <=> b.screen_x }
  end
  
  #--------------------------------------------------------------------------
  # alias method: judge_win_loss
  #--------------------------------------------------------------------------
  class <<self; alias judge_win_loss_ftb judge_win_loss; end
  def self.judge_win_loss
    if @phase && $game_troop.all_dead? && SceneManager.scene_is?(Scene_Battle)
    end
    judge_win_loss_ftb
  end
  
end # BattleManager

#==============================================================================
# ¡ Game_Temp
#==============================================================================

class Game_Temp
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :battle_aid
  attr_accessor :evaluating
  attr_accessor :iconset
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias game_temp_initialize_abe initialize
  def initialize
    game_temp_initialize_abe
    @iconset = Cache.system("Iconset")
  end
  
end # Game_Temp

#==============================================================================
# ¦ Game_BattlerBase
#==============================================================================

class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # new method: init_ftb_actions
  #--------------------------------------------------------------------------
  def init_ftb_actions
    @used_ftb_actions = 0
  end
  
  #--------------------------------------------------------------------------
  # new method: ftb_actions
  #--------------------------------------------------------------------------
  def ftb_actions
    init_ftb_actions if @used_ftb_actions.nil?
    return @used_ftb_actions
  end
  
  #--------------------------------------------------------------------------
  # new method: max_ftb_actions
  #--------------------------------------------------------------------------
  def max_ftb_actions
    n = make_action_times
    n += agi_bonus_max_ftb_actions
    n += trait_bonus_max_ftb_actions
    return [n, 1].max
  end
  
  #--------------------------------------------------------------------------
  # new method: agi_bonus_max_ftb_actions
  #--------------------------------------------------------------------------
  def agi_bonus_max_ftb_actions
    bonus_agi = agi - param_base(6)
    value_agi = param_base(6) * YEA::FTB::EXTRA_FTB_ACTION_BONUS
    return (bonus_agi / value_agi).to_i
  end
  
  #--------------------------------------------------------------------------
  # new method: trait_bonus_max_ftb_actions
  #--------------------------------------------------------------------------
  def trait_bonus_max_ftb_actions
    n = 0
    if actor?
      n += self.actor.ftb_actions
      n += self.class.ftb_actions
      for equip in equips
        next if equip.nil?
        n += equip.ftb_actions
      end
    end
    for state in states
      next if state.nil?
      n += state.ftb_actions
    end
    return n
  end
  
  #--------------------------------------------------------------------------
  # new method: use_ftb_action
  #--------------------------------------------------------------------------
  def use_ftb_action(value = 1)
    init_ftb_actions if @used_ftb_actions.nil?
    @used_ftb_actions += value
  end
  
  #--------------------------------------------------------------------------
  # alias method: inputable?
  #--------------------------------------------------------------------------
  alias game_battlerbase_inputable_ftb inputable?
  def inputable?
    result = game_battlerbase_inputable_ftb
    return false unless result
    return result unless SceneManager.scene_is?(Scene_Battle)
    return result unless YEA::FTB::LIMITED_ACTIONS_PER_MEMBER
    return max_ftb_actions > ftb_actions
  end
  
  #--------------------------------------------------------------------------
  # alias method: skill_conditions_met?
  #--------------------------------------------------------------------------
  alias game_battlerbase_skill_conditions_met_ftb skill_conditions_met?
  def skill_conditions_met?(skill)
    return false unless ftb_item_conditions_met?(skill)
    return game_battlerbase_skill_conditions_met_ftb(skill)
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_conditions_met?
  #--------------------------------------------------------------------------
  alias game_battlerbase_item_conditions_met_ftb item_conditions_met?
  def item_conditions_met?(item)
    return false unless ftb_item_conditions_met?(item)
    return game_battlerbase_item_conditions_met_ftb(item)
  end
  
  #--------------------------------------------------------------------------
  # new method: ftb_item_conditions_met?
  #--------------------------------------------------------------------------
  def ftb_item_conditions_met?(item)
    return true unless actor?
    return true unless SceneManager.scene_is?(Scene_Battle)
    return true if BattleManager.in_turn?
    return $game_party.ftb_actions_remaining >= item.ftb_cost
  end
  
end # Game_BattlerBase

#==============================================================================
# ¦ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_start
  #--------------------------------------------------------------------------
  alias game_battler_on_battle_start_ftb on_battle_start
  def on_battle_start
    game_battler_on_battle_start_ftb
    init_ftb_actions
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_turn_end
  #--------------------------------------------------------------------------
  alias game_battler_on_turn_end_ftb on_turn_end
  def on_turn_end
    game_battler_on_turn_end_ftb
    init_ftb_actions
  end
  
  #--------------------------------------------------------------------------
  # alias method: make_action_times
  #--------------------------------------------------------------------------
  alias game_battler_make_action_times_ftb make_action_times
  def make_action_times
    return make_ftb_action_times
  end
  
  #--------------------------------------------------------------------------
  # new method: make_ftb_action_times
  #--------------------------------------------------------------------------
  def make_ftb_action_times
    return action_plus_set.inject(1) {|r, p| p > 0.01 ? r + 1 : r }
  end
  
end # Game_Battler

#==============================================================================
# ¦ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # alias method: next_command
  #--------------------------------------------------------------------------
  alias game_actor_next_command_ftb next_command
  def next_command
    return game_actor_next_command_ftb
  end
  
  #--------------------------------------------------------------------------
  # alias method: prior_command
  #--------------------------------------------------------------------------
  alias game_actor_prior_command_ftb prior_command
  def prior_command
    return game_actor_prior_command_ftb
  end
  
end # Game_Actor

#==============================================================================
# ¦ Game_Party
#==============================================================================

class Game_Party < Game_Unit
  
  #--------------------------------------------------------------------------
  # alias method: inputable?
  #--------------------------------------------------------------------------
  alias game_party_inputable_ftb inputable?
  def inputable?
    return false unless meet_ftb_requirements?
    return game_party_inputable_ftb
  end
  
  #--------------------------------------------------------------------------
  # new method: meet_ftb_requirements?
  #--------------------------------------------------------------------------
  def meet_ftb_requirements?
    return ftb_actions_remaining > 0
  end
  
  #--------------------------------------------------------------------------
  # new method: ftb_actions_remaining
  #--------------------------------------------------------------------------
  def ftb_actions_remaining
    return ftb_actions_maximum - ftb_actions_used
  end
  
  #--------------------------------------------------------------------------
  # new method: ftb_actions_maximum
  #--------------------------------------------------------------------------
  def ftb_actions_maximum
    n = 0
    for member in $game_party.members
      next unless member.game_battlerbase_inputable_ftb
      n += member.max_ftb_actions
    end
    return [n, YEA::FTB::MAXIMUM_FTB_ACTIONS].min
  end
  
  #--------------------------------------------------------------------------
  # new method: ftb_actions_used
  #--------------------------------------------------------------------------
  def ftb_actions_used
    n = 0
    for member in $game_party.members
      next unless member.game_battlerbase_inputable_ftb
      n += member.ftb_actions
    end
    return n
  end
  
end # Game_Party

#==============================================================================
# ¡ Window_BattleActor
#==============================================================================

class Window_BattleActor < Window_BattleStatus
  
  #--------------------------------------------------------------------------
  # overwrite method: show
  #--------------------------------------------------------------------------
  def show
    create_flags
    super
  end
  
  #--------------------------------------------------------------------------
  # new method: create_flags
  #--------------------------------------------------------------------------
  def create_flags
    set_select_flag(:any)
    select(0)
    return if $game_temp.battle_aid.nil?
    if $game_temp.battle_aid.need_selection?
      select(0)
      set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_user?
      battler = BattleManager.actor
      id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
      select(id)
      set_select_flag(:user)
    elsif $game_temp.battle_aid.for_all?
      select(0)
      set_select_flag(:all)
      set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_random?
      select(0)
      set_select_flag(:random) if $game_temp.battle_aid.for_random?
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: set_flag
  #--------------------------------------------------------------------------
  def set_select_flag(flag)
    @select_flag = flag
    case @select_flag
    when :all, :all_dead, :random
      @cursor_all = true
    else
      @cursor_all = false
    end
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: update_cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if @cursor_all
      cursor_rect.set(0, 0, contents.width, contents.height)
      self.top_row = 0
    elsif @index < 0
      cursor_rect.empty
    else
      ensure_cursor_visible
      cursor_rect.set(item_rect(@index))
    end
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: cursor_movable?
  #--------------------------------------------------------------------------
  def cursor_movable?
    return false if @select_flag == :user
    return super
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: current_item_enabled?
  #--------------------------------------------------------------------------
  def current_item_enabled?
    return true if $game_temp.battle_aid.nil?
    if $game_temp.battle_aid.need_selection?
      member = $game_party.battle_members[@index]
      return member.dead? if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_dead_friend?
      for member in $game_party.battle_members
        return true if member.dead?
      end
      return false
    end
    return true
  end
end

#==============================================================================
# ¦ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # alias method: next_command
  #--------------------------------------------------------------------------
  alias scene_battle_next_command_ftb next_command
  def next_command
    if ftb_action?
      perform_ftb_action
    else
      scene_battle_next_command_ftb
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: ftb_action?
  #--------------------------------------------------------------------------
  def ftb_action?
    return false if BattleManager.actor.nil?
    return false if BattleManager.actor.current_action.nil?
    action = BattleManager.actor.current_action.item
    return !action.nil?
  end
  
  #--------------------------------------------------------------------------
  # new method: perform_ftb_action
  #--------------------------------------------------------------------------
  def perform_ftb_action
    hide_ftb_action_windows
    @subject = BattleManager.actor
    item = @subject.current_action.item
    execute_action
    process_event
    loop do
      @subject.remove_current_action
      break if $game_troop.all_dead?
      break unless @subject.current_action
      @subject.current_action.prepare
      execute_action if @subject.current_action.valid?
    end
    return if $game_troop.alive_members.size <= 0
    process_action_end
    consume_ftb_action(item)
    @subject.make_actions
    @subject = nil
    show_ftb_action_windows
  end
  
  #--------------------------------------------------------------------------
  # new method: consume_ftb_action
  #--------------------------------------------------------------------------
  def consume_ftb_action(item)
    @subject.use_ftb_action(item.ftb_cost) unless item.nil?
  end
  
  #--------------------------------------------------------------------------
  # new method: hide_ftb_action_windows
  #--------------------------------------------------------------------------
  def hide_ftb_action_windows
    @info_viewport.visible = true
    @status_window.show
    @actor_command_window.show
  end
  
  #--------------------------------------------------------------------------
  # new method: show_ftb_action_windows
  #--------------------------------------------------------------------------
  def show_ftb_action_windows
    @info_viewport.visible = true
    end_ftb_action
  end
  
  #--------------------------------------------------------------------------
  # new method: end_ftb_action
  #--------------------------------------------------------------------------
  def end_ftb_action
    if $game_party.inputable?
      select_next_member
    else
      BattleManager.next_command
      turn_start
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: select_next_member
  #--------------------------------------------------------------------------
  def select_next_member
    last_index = $game_party.battle_members.size - 1
    for member in $game_party.battle_members.reverse
      break if member.inputable?
      last_index -= 1
    end
    next_command if next_ftb_member?(last_index)
    return if BattleManager.actor.nil?
    if BattleManager.actor.index >= last_index && !BattleManager.actor.inputable?
      prior_command
    else
      start_actor_command_selection
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: next_ftb_member?
  #--------------------------------------------------------------------------
  def next_ftb_member?(last_index)
    actor = BattleManager.actor
    return true if actor.nil?
    return false if actor.max_ftb_actions > actor.ftb_actions
    return false if BattleManager.actor.index >= last_index
    return BattleManager.actor.index != last_index
  end
  
end # Scene_Battle

#==============================================================================
# 
# ? End of File
# 
#==============================================================================
Pages: 1