本帖最后由 无忧谷主幻 于 2026-4-28 01:28 编辑
我帮你写一个吧,不过我的技术不如楼上,估计有些繁琐
第一步,确定一个变量
Game_Battler 3
# HP 的伤害计算 self.hp -= self.damage
# HP 的伤害计算
self.hp -= self.damage
下面加上
# 带有10号状态且受到大于0的伤害时,变量增加 if self.damage > 0 and self.state?(10) $game_variables[1] += 1 end
# 带有10号状态且受到大于0的伤害时,变量增加
if self.damage > 0 and self.state?(10)
$game_variables[1] += 1
end
特技也要加,在这下面
# HP 的伤害减法运算 last_hp = self.hp self.hp -= self.damage effective |= self.hp != last_hp
# HP 的伤害减法运算
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
道具的话看情况,毕竟敌人是不会用道具的,你自己应该也不会用道具打自己
第二步,把这个变量应用于状态中
Game_Battler 1
#-------------------------------------------------------------------------- # ● 获取力量 #-------------------------------------------------------------------------- def str n = [[base_str + @str_plus, 1].max, 999].min for i in @states n *= $data_states[i].str_rate / 100.0 end n = [[Integer(n), 1].max, 999].min return n end
#--------------------------------------------------------------------------
# ● 获取力量
#--------------------------------------------------------------------------
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
将其改成
# ● 获取力量 def str n = [[base_str + @str_plus, 1].max, 999].min for i in @states n *= $data_states[i].str_rate / 100.0 end # 带有10号状态时,力量增加变量1的数值 if self.state?(10) n += $game_variables[1] end n = [[Integer(n), 1].max, 999].min return n end
# ● 获取力量
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
# 带有10号状态时,力量增加变量1的数值
if self.state?(10)
n += $game_variables[1]
end
n = [[Integer(n), 1].max, 999].min
return n
end
如果你想改成魔力之类的,也是差不多的改法
第三步,也就是最重要的,如何在战斗结束后重置
#-------------------------------------------------------------------------- # ● 胜负判定 #-------------------------------------------------------------------------- def judge # 全灭判定是真、并且同伴人数为 0 的情况下 if $game_party.all_dead? or $game_party.actors.size == 0 # 允许失败的情况下 if $game_temp.battle_can_lose # 还原为战斗开始前的 BGM $game_system.bgm_play($game_temp.map_bgm)
#--------------------------------------------------------------------------
# ● 胜负判定
#--------------------------------------------------------------------------
def judge
# 全灭判定是真、并且同伴人数为 0 的情况下
if $game_party.all_dead? or $game_party.actors.size == 0
# 允许失败的情况下
if $game_temp.battle_can_lose
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 如果存在任意 1 个敌人就返回 false for enemy in $game_troop.enemies if enemy.exist? return false end end
# 如果存在任意 1 个敌人就返回 false
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# 逃跑成功判定 success = rand(100) < 50 * actors_agi / enemies_agi # 成功逃跑的情况下 if success
# 逃跑成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 成功逃跑的情况下
if success
的下面,统统加上
最后放上工程
Project2.zip
(201.97 KB, 下载次数: 2)
|