Project1
标题:
傷害處理有辦法代入技能的傷害嗎?
[打印本页]
作者:
鲔鱼吐司
时间:
2009-3-19 14:38
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2009-3-19 15:01
- -那么公共事件强制发动该技能就好了吧……为什么还要再代入一次- -
作者:
鲔鱼吐司
时间:
2009-3-19 15:09
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2009-3-19 15:21
- -
$data_skills[编号].power
这只是你在数据库输入的基本数值,用$game_variables代入之后如果还要计算最终结果请自行用变量操作仿照计算式计算。
作者:
鲔鱼吐司
时间:
2009-3-19 15:27
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2009-3-19 15:46
我求你先去翻翻《跟我从头学脚本》之类的东西把脚本学明白行么?
LZ我对你的印象太深刻了……这种性质的伸手真不是一次两次了orz
$game_variables代表变量,后面加上[X]代表编号X,用事件脚本作赋值,$game_variables[1] = $data_skills[1].power
接下来怎么处理那个1号变量是你的事。明白?
作者:
鲔鱼吐司
时间:
2009-3-19 16:02
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2009-3-19 16:04
打开F1,目录——RPG Maker XP——战斗计算式
作者:
鲔鱼吐司
时间:
2009-3-19 16:28
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2009-3-19 16:43
- -数学法则怎么算这就这么算。难道还有另一套运算法则不成?
作者:
鲔鱼吐司
时间:
2009-3-19 17:01
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天圣的马甲
时间:
2009-3-19 17:06
<---这个人已经无语了
……$game_variables代表变量,后面加上[X]代表编号X,用事件脚本作赋值,$game_variables[1] = $data_skills[1].power
干了这事儿了么?干了吧?没干我也不帮你。
然后,事件——变量操作——里面有代入加法减法乘法除法,看到了么?照着做。
比如加上角色阿尔西斯的力量或者魔力,除以1。
就送到这里,再不会给回答了。如果还不懂就自己去研究《跟我从头学脚本》吧- -完毕。
作者:
鲔鱼吐司
时间:
2009-3-19 17:16
提示:
作者被禁止或删除 内容自动屏蔽
作者:
redant
时间:
2009-3-19 18:27
F1 战斗计算式 结合默认的game_battle 3 参考
#修改后的战斗伤害公式
#物理伤害 = (我攻击力+我力量-敌物理防御)*2
#法术伤害 = 技威力+我魔法*技能魔力+我灵巧*技能灵巧-敌魔力防御*技能魔防
#躲闪率 = 5*被灵+速 / 攻击灵+速 - 被的躲闪
#暴击率 = 25%我 10%敌人 技能暴击率 = 15%我 8%敌人 伤害为1.5倍
#当使用技能为10号时 攻击力为普通攻击的5倍伤害
#2号或34号时,为1.5倍;3号或35号时为1.75倍 10号时5倍攻击
#防御时 会涨血和蓝 为max的4%(包括小数)具体剑scene_battle 4
#134行 类似 修改了复活药品和技能的使用限制
#个人水平有限如有错误之处,还请指出或联系蜂蜜蚂蚁 谢谢
#==============================================================================
# ■ Game_Battler (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 可以使用特技的判定
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# SP 不足的情况下不能使用
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# 战斗不能的情况下不能使用
if dead?
return false
end
# 沉默状态的情况下、物理特技以外的特技不能使用
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# 获取可以使用的时机
occasion = $data_skills[skill_id].occasion
# 战斗中的情况下
if $game_temp.in_battle
# [平时] 或者是 [战斗中] 可以使用
return (occasion == 0 or occasion == 1)
# 不是战斗中的情况下
else
# [平时] 或者是 [菜单中] 可以使用
return (occasion == 0 or occasion == 2)
end
end
#--------------------------------------------------------------------------
# ● 应用通常攻击效果
# attacker : 攻击者 (battler)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# 清除会心一击标志
self.critical = false
# 第一命中判定
hit_result = (rand(100) < attacker.hit)
# 命中的情况下
if hit_result == true
# 计算基本伤害
atk = [attacker.atk , 0].max
self.damage = (attacker.atk - self.pdef + attacker.str)*2
# 属性修正
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# 伤害符号正确的情况下
if self.damage > 0
if @battler.is_a?(Game_Enemy)
# 会心一击修正
if rand(100) < 10# 4 * attacker.dex / self.agi
self.damage *= 1.5
self.damage = self.damage.round
self.critical = true
end
else
if rand(100) < 25# 4 * attacker.dex / self.agi
self.damage *= 1.5
self.damage = self.damage.round
self.critical = true
end
end
# 防御修正
if self.guarding?
self.damage /= 2
# self.hp += 200
#self.sp += 200
end
end
if self.damage<0
self.damage = - (attacker.atk - self.pdef + attacker.str)/2
end
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 5 * (self.agi+self.dex) / (attacker.dex+attacker.agi) + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
# 命中的情况下
if hit_result == true
# 状态冲击解除
remove_states_shock
# HP 的伤害计算
self.hp -= self.damage
# 状态变化
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss"
# 清除会心一击标志
self.critical = false
end
# 过程结束
return true
end
#--------------------------------------------------------------------------
# ● 应用特技效果
# user : 特技的使用者 (battler)
# skill : 特技
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# 清除会心一击标志
self.critical = false
# 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
# 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0)# or
# ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# 过程结束
return false
end
# 清除有效标志
effective = false
# 公共事件 ID 是有效的情况下,设置为有效标志
effective |= skill.common_event_id > 0
# 第一命中判定
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# 不确定的特技的情况下设置为有效标志
effective |= hit < 100
# 命中的情况下
if hit_result == true
# 计算威力
power = skill.power + user.int * skill.int_f + user.dex * skill.dex_f
#法方-
if power > 0
# power -= self.pdef * skill.pdef_f / 200
# power -= / 200
power = [power, 0].max
end
# 计算倍率
rate = self.mdef * skill.mdef_f
# 计算基本伤害
self.damage = power - rate
# 属性修正
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
case skill.id
when 10
self.damage = (user.atk - self.pdef + user.str)*10
when 2
self.damage = (user.atk - self.pdef + user.str)*3
when 3
self.damage = (user.atk - self.pdef + user.str)*3.5
self.damage = self.damage.round
when 34
self.damage = (user.atk - self.pdef + user.str)*3
when 35
self.damage = (user.atk - self.pdef + user.str)*3.5
self.damage = self.damage.round
end
# 伤害符号正确的情况下
if self.damage > 0
if @battler.is_a?(Game_Enemy)
if rand(100) < 8# 4 * attacker.dex / self.agi
self.damage *= 1.5
self.damage = self.damage.round
self.critical = true
end
else
if rand(100) < 15# 4 * attacker.dex / self.agi
self.damage *= 1.5
self.damage = self.damage.round
self.critical = true
end
end
# 防御修正
if self.guarding?
self.damage /= 2
end
end
if self.damage < 0
self.damage = skill.power
end
# 分散
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 5 * (self.agi+self.dex) / (user.dex + user.agi) + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# 不确定的特技的情况下设置为有效标志
effective |= hit < 100
end
# 命中的情况下
if hit_result == true
# 威力 0 以外的物理攻击的情况下
if skill.power != 0 #and skill.atk_f > 0
#蚂蚁跑啊跑 和状态有关 (默认是物理)挨打都会状态解除
# 状态冲击解除
remove_states_shock
# 设置有效标志
effective = true
end
# HP 的伤害减法运算
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# 状态变化
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# 威力为 0 的场合
if skill.power == 0
# 伤害设置为空的字串
self.damage = ""
# 状态没有变化的情况下
unless @state_changed
# 伤害设置为 "Miss"
self.damage = "Miss"
end
end
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss "
end
# 不在战斗中的情况下
unless $game_temp.in_battle
# 伤害设置为 nil
self.damage = nil
end
# 过程结束
return effective
end
#--------------------------------------------------------------------------
# ● 应用物品效果
# item : 物品
#--------------------------------------------------------------------------
def item_effect(item)
# 清除会心一击标志
self.critical = false
# 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
# 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) #or
#((item.scope == 5 or item.scope == 6) and self.hp >= 1)
# 过程结束
return false
end
# 清除有效标志
effective = false
# 公共事件 ID 是有效的情况下,设置为有效标志
effective |= item.common_event_id > 0
# 命中判定
hit_result = (rand(100) < item.hit)
# 不确定的特技的情况下设置为有效标志
effective |= item.hit < 100
# 命中的情况
if hit_result == true
# 计算回复量
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
# 属性修正
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
# 分散
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
# 回复量符号为负的情况下
if recover_hp < 0
# 防御修正
if self.guarding?
recover_hp /= 2
end
end
# HP 回复量符号的反转、设置伤害值
self.damage = -recover_hp
# HP 以及 SP 的回复
last_hp = self.hp
last_sp = self.sp
self.hp += recover_hp
self.sp += recover_sp
effective |= self.hp != last_hp
effective |= self.sp != last_sp
if recover_sp != 0 #如果补SP的量不等于0
self.damage = -recover_sp #伤害=SP恢复量的倒数
end
# 状态变化
@state_changed = false
effective |= states_plus(item.plus_state_set)
effective |= states_minus(item.minus_state_set)
# 能力上升值有效的情况下
if item.recover_hp_rate == 0 and item.recover_hp == 0 and item.recover_sp_rate == 0 and item.recover_sp == 0 #原来只判断HP,现在附带判断SP
# 能力值的分支
case item.parameter_type
when 1 # MaxHP
@maxhp_plus += item.parameter_points
when 2 # MaxSP
@maxsp_plus += item.parameter_points
when 3 # 力量
@str_plus += item.parameter_points
when 4 # 灵巧
@dex_plus += item.parameter_points
when 5 # 速度
@agi_plus += item.parameter_points
when 6 # 魔力
@int_plus += item.parameter_points
end
# 设置有效标志
effective = true
end
# HP 回复率与回复量为 0 的情况下
if item.recover_hp_rate == 0 and item.recover_hp == 0 and item.recover_sp_rate == 0 and item.recover_sp == 0 #原来只判断HP,现在附带判断SP
# 设置伤害为空的字符串
self.damage = ""
# SP 回复率与回复量为 0、能力上升值无效的情况下
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
# 状态没有变化的情况下
unless @state_changed
# 伤害设置为 "Miss"
self.damage = "Miss"
end
end
end
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss"
end
# 不在战斗中的情况下
unless $game_temp.in_battle
# 伤害设置为 nil
self.damage = nil
end
# 过程结束
return effective
end
#--------------------------------------------------------------------------
# ● 应用连续伤害效果
#--------------------------------------------------------------------------
def slip_damage_effect
# 设置伤害
self.damage = self.maxhp / 20
self.damage = self.damage.round
# 分散
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
# 过程结束
return true
end
#--------------------------------------------------------------------------
# ● 属性修正计算
# element_set : 属性
#--------------------------------------------------------------------------
def elements_correct(element_set)
# 無属性的情况
if element_set == []
# 返回 100
return 100
end
# 在被赋予的属性中返回最弱的
# ※过程 element_rate 是、本类以及继承的 Game_Actor
# 和 Game_Enemy 类的定义
weakest = -100
for i in element_set
weakest = [weakest, self.element_rate(i)].max
end
return weakest
end
end
复制代码
这是改过的
联系 注释和F1看
自力更生才能体味到乐趣{/fd}
作者:
天圣的马甲
时间:
2009-3-19 18:40
= =#你怎么不直接说‘大大你帮我直接把游戏做出来’算了?
都要那么轻松简单地就能掌握还用讨论么?来这里是为了学习做游戏而不是为了伸手要,我给你的原理很简单了,基础值早就带入到1号变量里,然后用事件里的变量操作比照着计算式往里做加减乘除都不会?小学毕业了么?
作者:
塑望
时间:
2009-3-19 18:47
果然又是两页以上
作者:
hitlerson
时间:
2009-3-19 18:55
有多少能力就做多少事吧,不会脚本就安于用默认的吧
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1