Bug in Default VX Ace Code - Change Enemy HP command

I discovered a moderately impactful bug in VX Ace's default code tonight, so I'd like to report it.  This is not user error and it's not a matter of outside scripts; however, I don't think I've updated my Ace version in a while, so I apologize for wasting your time if this bug has already been found and corrected in the most recent version.


The back-end coding for the "Change Enemy HP" command, found as Command 331 in Game_Interpreter, is:

Code:
  #--------------------------------------------------------------------------
  # * Change Enemy HP
  #--------------------------------------------------------------------------
  def command_331
    value = operate_value(@params[1], @params[2], @params[3])
    iterate_enemy_index(@params[0]) do |enemy|
      return if enemy.dead?
      enemy.change_hp(value, @params[4])
      enemy.perform_collapse_effect if enemy.dead?
    end
  end

The problem with this is that as soon as the "return" is hit, the command stops processing.  So, for example, if the user chooses "Entire Troop" as the scope for the command, but enemy #1 is already dead, then the remaining enemies will not have their HP affected.


I think it should read "next if" instead of "return if" - I personally corrected it by turning the whole things into an "unless" branch instead.

Original thread: https://forums.rpgmakerweb.com/threads/bug-in-default-vx-ace-code-change-enemy-hp-command.61479/