加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 无忧谷主幻 于 2026-5-11 02:50 编辑
分享几个超实用的状态实现技巧——无需新增任何脚本,仅需修改原生脚本的几行代码,就能轻松做出各类战斗状态效果!
本文收录的所有方法,都是基于基础脚本的微调,新手也能快速上手
后续会持续更新不同状态的修改思路,欢迎大家在评论区交流自己的脚本修改小技巧
(状态名称仅供参考)
1,不屈:角色受到致命伤时,保留1HP
Game_Battler 1 第265行
- #--------------------------------------------------------------------------
- # ● 战斗不能判定
- #--------------------------------------------------------------------------
- def dead?
- return (@hp == 0 and not @immortal)
- end
复制代码
将其改为
- #--------------------------------------------------------------------------
- # ● 战斗不能判定
- #--------------------------------------------------------------------------
- def dead?
- if @hp == 0 and @states.include?(100)
- @hp+=1
- return false
- else
- return (@hp == 0 and not @immortal)
- end
- end
复制代码
1.1,不屈·改:角色受到致命伤时,保留1HP,之后移除该状态
- #--------------------------------------------------------------------------
- # ● 战斗不能判定
- #--------------------------------------------------------------------------
- def dead?
- if @hp == 0 and @states.include?(100)
- @hp += 1 # 濒死保护:HP+1
- @states.delete(100)
- return false # 判定为未死亡
- else
- # 普通死亡判定
- return (@hp == 0 and not @immortal)
- end
- end
复制代码
2,减伤:按照百分百,减免部分伤害
Game_Battler 3 62行与147行
- # 防御修正
- if self.guarding?
- self.damage /= 2
- end
- end
复制代码
统统改成
- # 防御修正
- self.damage /= 2 if self.guarding?
- # 101号状态减伤30%
- self.damage = (self.damage * 7) / 10 if self.state?(101)
- end
复制代码
PS:253行也有一个防御修正,但这个应该不需要改,毕竟敌人是不会使用道具的,你自己应该也不会用道具打自己
2.1,免伤:将受到的伤害直接降为0
- # 防御修正
- self.damage /= 2 if self.guarding?
- self.damage = 0 if self.state?(101) # 101号状态触发100%免伤
- end
复制代码
3,增幅:增加特定属性的威力百分百
Game_Battler 3 173行
- # 计算威力
- power = skill.power + user.atk * skill.atk_f / 100
- if power > 0
- power -= self.pdef * skill.pdef_f / 200
- power -= self.mdef * skill.mdef_f / 200
- power = [power, 0].max
- end
复制代码
将其改成
- # 计算威力
- power = skill.power + user.atk * skill.atk_f / 100
- sz = [[11,38,15],[11,39,13]]
- # 使用带11号属性的技能,在38号状态的作用下,威力1.5倍,在39号状态的作用下,威力1.3倍
- for i in 0...sz.size
- if skill.element_set.include?(sz[i][0]) and user.state?(sz[i][1])
- power *= sz[i][2]
- power /= 10
- end
- end
- if power > 0
- power -= self.pdef * skill.pdef_f / 200
- power -= self.mdef * skill.mdef_f / 200
- power = [power, 0].max
- end
复制代码
4,属性护盾:受到特定属性攻击时,按百分比减免伤害
Game_Battler 3 55行与145行
- # 伤害符号正确的情况下
- if self.damage > 0
复制代码
将其改成
- # 伤害符号正确的情况下
- if self.damage > 0
- if self.state?(103)
- end
- if skill.element_set.include?(14)
- self.damage = self.damage*60/100
- #处于103号状态,受到带有14号属性的攻击时,伤害变成原本的60%
- end
复制代码
若想添加多个属性的减伤也是可以的
- # 伤害符号正确的情况下
- if self.damage > 0
- if self.state?(103)
- if skill.element_set.include?(6)
- self.damage=self.damage*0/100
- end
- if skill.element_set.include?(14)
- self.damage=self.damage*60/100
- end
- end
复制代码
5,愈合:每回合自动回复一定比例的HP
Scene_Battle 4 129~133行
- # 连续伤害
- if @active_battler.hp > 0 and @active_battler.slip_damage?
- @active_battler.slip_damage_effect
- @active_battler.damage_pop = true
- end
复制代码
下面(注意!是下面,不是覆盖)
- if @active_battler.state?(105) and @active_battler.hp >0 #105号状态恢复生命
- @active_battler.damage=-@active_battler.maxhp/10 #恢复生命百分比,这里设置为10%,也可设置固定值
- @active_battler.damage=@active_battler.damage.to_i
- @active_battler.hp-=@active_battler.damage
- @active_battler.animation_id = 4 #自动补血动画编号
- @active_battler.damage_pop = true
- end
复制代码
5.5:回蓝:每回合自动回复一定数值的MP
- # 判定105号状态,恢复500点SP
- if @active_battler.is_a?(Game_Actor)
- if @active_battler.hp > 0 and @active_battler.state?(105)
- @active_battler.sp += 500
- end
- end
复制代码
6,狂战:HP越少,攻击力越高
Game_Actor 264行
- #--------------------------------------------------------------------------
- # ● 获取基本攻击力
- #--------------------------------------------------------------------------
- def base_atk
- weapon = $data_weapons[@weapon_id]
- return weapon != nil ? weapon.atk : 0
- end
复制代码
将其改成
- #--------------------------------------------------------------------------
- # ● 获取基本攻击力
- #--------------------------------------------------------------------------
- def base_atk
- n = 0
- if @weapon_id > 0
- weapon = $data_weapons[@weapon_id]
- n += weapon.atk
- end
- if self.state?(106)
- n += n*(100-self.hp*100/self.maxhp)/100
- end
- return n
- end
复制代码
7,多种毒( 别问为什么只有3种,我也想多写几个,但是想不到还能写什么效果了)
①风毒:每回合按扣除10%MP
②水毒:每回合扣除剩余HP的10%
③火毒:每回合扣除1000点HP
Game_Battler 3 318行
- #--------------------------------------------------------------------------
- # ● 应用连续伤害效果
- #--------------------------------------------------------------------------
- def slip_damage_effect
- # 设置伤害
- self.damage = self.maxhp / 10
- # 分散
- if self.damage.abs > 0
- amp = [self.damage.abs * 15 / 100, 1].max
- self.damage += rand(amp+1) + rand(amp+1) - amp
- end
- # HP 的伤害减法运算
- self.hp -= self.damage
复制代码
将其改成
- #--------------------------------------------------------------------------
- # ● 应用连续伤害效果
- #--------------------------------------------------------------------------
- def slip_damage_effect
- if self.state?(3) #默认的毒效果
- # 设置伤害
- self.damage = self.maxhp / 10
- # 分散
- if self.damage.abs > 0
- amp = [self.damage.abs * 15 / 100, 1].max
- self.damage += rand(amp+1) + rand(amp+1) - amp
- end
- # HP 的伤害减法运算
- self.hp -= self.damage
- end
- # 风毒:每回合扣除最大SP的10%
- if self.state?(17)
- sp_dmg = self.maxsp * 10 / 100
- self.damage = sp_dmg # 记录伤害数值(用于战斗界面显示)
- self.sp -= sp_dmg # 扣减SP
- self.sp = [self.sp, 0].max # 限制SP下限,避免出现负数
- end
- # 水毒:每回合扣除剩余HP的10%
- if self.state?(18)
- self.damage = self.hp * 1 / 10
- self.hp -= self.damage
- end
- # 火毒:每回合扣除固定1000点HP
- if self.state?(19)
- self.damage = 1000
- self.hp -= self.damage
- end
复制代码
8,增伤:提升技能伤害百分百
Game_Battler 3 140~141行
# 计算基本伤害 self.damage = power * rate / 20
# 计算基本伤害
self.damage = power * rate / 20
下面
# 状态加成 技能伤害增加30% if user.state?(107) self.damage = self.damage * 130 / 100 # 对使用者的技能伤害加成30% end
# 状态加成 技能伤害增加30%
if user.state?(107)
self.damage = self.damage * 130 / 100 # 对使用者的技能伤害加成30%
end
PS:只对技能有效,若想对普通攻击也有效,在上面的应用通常攻击效果也加一遍 |