じ☆ve冰风 发表于 2026-7-12 09:25:50

KBareHands XP

KBareHands XP
v1.0.2

by Kyonides Arkanthes​


Introduction

This scriptlet lets you add base attack, physical and magical defense to any hero. It could be especially useful for barehanded martial artists.

Those stats might also get increased per every level the hero gains. They can be increased or decreased by using script calls.

If you ever consider that to be pretty boring, then let me tell you that you got an alternative, namely the "Preferred Stat" option!

It will add the totals of all 3 stats to the preferred one while the others get no boost at all. This can be altered in game at any given time.

There are also the Base Stat and Stat Increase Lottos!

A given stat might get an increase or decrease depending on your luck.

Take into consideration that you need to configure several Constants found in the module below or you could just set the generic default values there and take care of the rest in game via calling the script...

You can also seal and unlock an hero's preferred stat.

There is no screenshot for obvious reasons.
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

The Script​

                Code:        
# * KBareHands XP
#   Scripter : Kyonides Arkanthes
#   2021-09-02 - v1.0.2
#   Not a Plug & Play Script!

# This scriptlet lets you add base attack, physical and magical defense to any
# hero. It could be especially useful for barehanded martial artists.
# Those stats might also get increased per every level the hero gains.
# They can be increased or decreased by using script calls.

# If you ever consider that to be pretty boring, then let me tell you that you
# got an alternative, namely the "Preferred Stat" option!
# It will add the totals of all 3 stats to the preferred one while the others
# get no boost at all. This can be altered in game at any given time.

# There are also the Base Stat and Stat Increase Lottos!
# A given stat might get an increase or decrease depending on your luck.

# Take into consideration that you need to configure several Constants found in
# the module below or you could just set the generic default values there and
# take care of the rest in game via calling the script...

# * Aliased Methods * #
# Game_Actor#base_atk
# Game_Actor#base_pdef
# Game_Actor#base_mdef

# Stat stands for either :atk or :pdef or :mdef
# PreferredStat stands for either nil or :atk or :pdef or :mdef

# * Script Calls * #

# Set Bare Hands Preferred Stat In Game
# $game_actors.prefer_stat = PreferredStat

# Seal or Unseal Bare Hands Preferred Stat In Game
# $game_actors.seal_stat = true or false

# Set Bare Hands Stat In Game
# $game_actors.hands_stat = Number
# $game_actors.hands_atk = Number
# $game_actors.hands_pdef = Number
# $game_actors.hands_mdef = Number

# Set Bare Hands Increase In Game
# $game_actors.hands_step = Number
# $game_actors.step_atk = Number
# $game_actors.step_pdef = Number
# $game_actors.step_mdef = Number

# Bare Hands Stat Lotto ( Between -50% and +50% )
# $game_actors.hands_stat_lotto(Stat)

# Bare Hands Increase Lotto ( Between -50% and +50% )
# $game_actors.hands_step_lotto(Stat)

module KBareHands
# Better leave the following 4 lines alone!
PREFERRED_STAT = {}
BASE_ATTACK = {}
BASE_PDEF = {}
BASE_MDEF = {}
# Base Stat and Increase per Level for Actors not listed below
PREFERRED_STAT.default = nil # Options: nil, :atk, :pdef, :mdef
BASE_ATTACK.default =
BASE_PDEF.default =
BASE_MDEF.default =
# = nil or :atk or :pdef or :mdef
PREFERRED_STAT = :pdef
# =
BASE_ATTACK =
# =
BASE_PDEF =
# =
BASE_MDEF =
end

class Game_Actor
alias :kyon_hands_gm_actor_setup :setup
alias :kyon_hands_gm_actor_base_atk :base_atk
alias :kyon_hands_gm_actor_base_pdef :base_pdef
alias :kyon_hands_gm_actor_base_mdef :base_mdef
def setup(actor_id)
    kyon_hands_gm_actor_setup(actor_id)
    bsatk, incr = KBareHands::BASE_ATTACK
    bpdef, pinc = KBareHands::BASE_PDEF
    bmdef, minc = KBareHands::BASE_MDEF
    @hands_stats = { :atk => bsatk, :pdef => bpdef, :mdef => bmdef }
    @hands_step = { :atk => incr, :pdef => pinc, :mdef => minc }
    @prefer_stat = KBareHands::PREFERRED_STAT
end

def hands_stat_lotto(key)
    stat = @hands_stats
    @hands_stats = stat / 2 + rand(stat + 1)
end

def hands_step_lotto(key)
    stat = @hands_step
    @hands_step = stat / 2 + rand(stat + 1)
end

def bare_calc(stat)
    if @prefer_stat == stat
      st = @hands_stats.values.inject{|a,b| a + b }
      st + @level * @hands_step.values.inject{|a,b| a + b }
    elsif @prefer_stat == nil
      @hands_stats + @hands_step * @level
    else
      0
    end
end

def base_atk
    kyon_hands_gm_actor_base_atk + barehands_calc(:atk)
end

def base_pdef
    kyon_hands_gm_actor_base_pdef + barehands_calc(:pdef)
end

def base_mdef
    kyon_hands_gm_actor_base_mdef + barehands_calc(:mdef)
end
def prefer_stat=(stat) @prefer_stat = @seal_stat ? @prefer_stat : statend
def hands_atk() @hands_stats[:atk] end
def hands_pdef() @hands_stats[:pdef] end
def hands_mdef() @hands_stats[:mdef] end
def hands_atk=(n) @hands_stats[:atk] = n end
def hands_pdef=(n) @hands_stats[:pdef] = n end
def hands_mdef=(n) @hands_stats[:mdef] = n end
def step_atk() @hands_step[:atk] end
def step_pdef() @hands_step[:pdef] end
def step_mdef() @hands_step[:mdef] end
def step_atk=(n) @hands_step[:atk] = n end
def step_pdef=(n) @hands_step[:pdef] = n end
def step_mdef=(n) @hands_step[:mdef] = n end
attr_reader :hands_stats, :hands_step, :prefer_stat
attr_accessor :seal_stat
end

class Game_Actors
def initialize
    $data_weapons = RPG::Weapon.new
    $data_armors = RPG::Armor.new
    @data = []
end
end



Terms & Conditions

Feel free to use it anywhere but not as a punch bag.
Include me in your game credits!
Do not repost this script!


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