じ☆ve冰风 发表于 2026-8-2 14:36:05

KEndure ACE

KEndure ACE

by Kyonides Arkanthes​


Introduction

Use note tags to implement some Endure or Sturdy kind of passive skill or state.
You're free to define how many HP the hero or monster will get in return for surviving.
Since it's a state, its effects will definitely wear off at some point.
You may only take advantage of this feature once per battle.
Please follow the script instructions and set STATE_ID constat to your chosen State ID.

Download the DEMO​

Script Section

                Code:       
# * KEndure ACE
#   Scripter : Kyonides Arkanthes
#   2020-08-04

# This scriptlet allows you to set Endure like states in your games!
# Your hero will not die for n turns.
# If he's cursed, he won't be able to get healed.

# * Note Tags * #
# -endure 25-      # 25 will be the hero's new HP
# -endure 1 curse- # 1 HP and cannot heal

# * Toggle Hero's No Heal Curse In Game - Position 0 through MAX
# $game_party.members.endure_no_heal = true # Or false

module KEndure
STATE_ID = 26
HEAL_REMOVE_ENDURE = true # Remove Endure after being healed?
end

class Game_Battler
alias :kyon_endure_gm_battler_hp :hp=
alias :kyon_endure_gm_battler_obe :on_battle_end
def no_endure?(nhp) nhp > @endure_hp and KEndure::HEAL_REMOVE_ENDURE end
def hp=(nhp)
    if nhp < 1
      return @hp if state?(KEndure::STATE_ID)
      if !@used_endure and @endure_hp != 0
      add_state(KEndure::STATE_ID)
      @used_endure = true
      return @hp = [@endure_hp, mhp].min
      end
    end
    return @hp if @endure_no_heal
    remove_state(KEndure::STATE_ID) if no_endure?(nhp)
    kyon_endure_gm_battler_hp(nhp)
end

def on_battle_end
    kyon_endure_gm_battler_obe
    @used_endure = nil
end

def parse_endure_note(note)
    note = note[/-endure \w+-/i] || ''
    @endure_hp = note.scan(/\d+/).to_i
    @endure_no_heal = true if note
end
attr_accessor :endure_hp, :used_endure, :endure_no_heal
end

class Game_Actor
alias :kyon_endure_gm_actor_init :initialize
def initialize(actor_id)
    kyon_endure_gm_actor_init(actor_id)
    parse_endure_note($data_actors[@actor_id].note)
end
end

class Game_Enemy
alias :kyon_endure_gm_enemy_init :initialize
def initialize(index, enemy_id)
    kyon_endure_gm_enemy_init(index, enemy_id)
    parse_endure_note($data_enemies.note)
end
end


Terms & Conditions

Free for use in any game.
Include my nickname in your game credits. Mention this forum as well.


本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kendure-ace.124924/
页: [1]
查看完整版本: KEndure ACE