赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2415 |
最后登录 | 2023-10-3 |
在线时间 | 24 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 95
- 在线时间
- 24 小时
- 注册时间
- 2007-6-16
- 帖子
- 160
|
4楼
楼主 |
发表于 2011-1-30 00:25:28
|
只看该作者
本帖最后由 fux2 于 2011-1-30 08:06 编辑
- #--------------------------------------------------------------------------
- # ● 应用通常攻击效果
- # attacker : 攻击者 (battler)
- #--------------------------------------------------------------------------
- def attack_effect(attacker)
- # 清除会心一击标志
- self.critical = false
- # 第一命中判定
- if attacker.is_a?(Game_Actor)
- hit_result = (rand(100) < 80 + attacker.agi/20 + attacker.str/20)
- else
- hit_result = (rand(100) > self.agi/5)
- # 命中的情况下
- end
- if hit_result == true
- # 计算基本伤害
- #########################普通攻击伤害计算式改###########################
- atk = [attacker.atk-self.pdef, 0].max
- if attacker.is_a?(Game_Actor)
- self.damage = atk* (10+$game_variables[251])/10#+ attacker.str/10
- self.damage *= elements_correct(attacker.element_set)
- self.damage /= 100
- else
- self.damage = atk / (1 + $game_variables[253]/10)
- self.damage *= elements_correct(attacker.element_set)
- self.damage /= 100
- end
- # 伤害符号正确的情况下
- if self.damage > 0
- #self.damage +=rand(20)
- self.fennu += (1 + rand(10))
- # 会心一击修正
- if attacker.is_a?(Game_Actor)
- if rand(100) < 4+$game_variables[253]
- self.damage *= 2
- self.critical = true
-
- else
- if rand(100) < 4
- self.damage *= 2
- self.critical = true
- self.fennu += (1 + rand(10))
- end
- end
- end
- # 防御修正
- if self.guarding?
- self.damage /= 2
- self.fennu += (1+rand(5))
- end
- 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 = 8 * self.agi / attacker.dex + self.eva
- hit = self.damage < 0 ? 100 : 100 - eva
- hit = self.cant_evade? ? 100 : hit
- hit_result = (rand(100) < hit)
- #end
- end
- # 命中的情况下
- if hit_result == true
- # 状态冲击解除
- remove_states_shock
- # HP 的伤害计算
- if not self.state?(95) and not self.state?(94) and not self.state?(93) and not self.state?(91)
- self.hp -= self.damage
- end
-
-
-
- if self.state?(95)
- if self.sp >= self.damage*2
- self.sp -= self.damage*2
- else
- self.damage -= self.sp/2
- self.sp = 0
- self.remove_state(95)
- self.hp -= self.damage
- end
- #else
- #self.hp -= self.damage
- end
- if self.state?(94)
- if self.sp >= self.damage
- self.sp -= self.damage
- else
- self.damage -= self.sp
- self.sp = 0
- self.remove_state(94)
- self.hp -= self.damage
- end
- end
- if self.state?(93)
- if self.sp >= self.damage/2
- self.sp -= self.damage/2
- else
- self.damage -= self.sp*2
- self.sp = 0
- self.remove_state(93)
- self.hp -= self.damage
- end
- end
- if self.state?(91)
- if self.sp >= self.damage/3
- self.sp -= self.damage/3
- else
- self.damage -= self.sp*3
- self.sp = 0
- self.remove_state(91)
- self.hp -= self.damage
- end
- end
- #############################吸血#####################
- if self.state?(190) and $game_actors[7].weapon_id == 130 and not $game_actors[7].state?(1)
- $game_actors[7].hp += self.damage
- self.remove_state(190)
- end
- #############################吸血完######################
- # 状态变化
- @state_changed = false
- states_plus(attacker.plus_state_set)
- states_minus(attacker.minus_state_set)
- #end
- #################丢瓶神功######################
- if self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and $game_party.item_number(62)>0
- $game_party.gain_item(62,-1)
- self.animation_id = 15
- self.hp += 150
- elsif self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and $game_party.item_number(62)==0 and $game_party.item_number(63)>0
- $game_party.gain_item(63,-1)
- self.animation_id = 16
- self.hp+=450
- end
- ###########################丢瓶神功完###########
- if self.hp < 0
- self.hp = 0
- end
- # Miss 的情况下
- else
- # 伤害设置为 "Miss"
- self.damage = "Miss"
- self.fennu -= rand(5)
- # 清除会心一击标志
- 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)
- ####################火神挂坠火系伤害调整#################
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==122
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==133
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==266
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==267
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==268
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==270
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==269
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- #################七星耳环冰系伤害调整##########################
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==121
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==261
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==262
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==263
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==264
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==265
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==132
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- #######################九天仙铃雷系伤害调整#########################
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==123
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==134
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==271
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==272
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==273
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==274
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==275
- self.damage *= 1.5
- self.damage = self.damage.round
- end
- ############################装备影响魔法威力改完###########################
- # 过程结束
- return false
- end
- # 清除有效标志
- effective = false
- # 公共事件 ID 是有效的情况下,设置为有效标志
- effective |= skill.common_event_id > 0
- # 第一命中判定
- ################必中#########333
- if user.state?(49)
- hit = 101
- hit_result = (rand(100) < hit)
- else
- ##########################
- hit = skill.hit
- if skill.atk_f > 0 and not user.state?(49)
- hit *= user.hit / 100
- end
-
- hit_result = (rand(100) < hit)
- end
- # 不确定的特技的情况下设置为有效标志
- effective |= hit < 100
- # 命中的情况下
- if hit_result == true
- # 计算威力
- power = skill.power
- #if user.is_a?(Game_Actor)
- if skill.atk_f > 50
- power += user.atk
- #power += user.str * 5
- power -= self.pdef * skill.pdef_f / 100
- power -= self.mdef * skill.mdef_f / 100
- power -= self.dex * skill.dex_f / 100
- power = [power, 0].max
- end
- if skill.int_f > 50 #and power > 0
- power += user.int*5
- power -= self.mdef * skill.mdef_f / 100
- power -= self.pdef * skill.pdef_f / 100
- power -= self.dex * skill.dex_f / 100
- power = [power, 0].max
- end
-
- if skill.dex_f > 50 and power > 0
- power += user.dex*5
- power -= self.dex * skill.dex_f / 100
- power -= self.mdef * skill.mdef_f / 100
- power -= self.pdef * skill.pdef_f / 100
- end
- if skill.dex_f > 50 and power < 0
- power -= user.dex*5
- end
- self.damage = power
- # 属性修正
- self.damage *= elements_correct(skill.element_set)
- self.damage /= 100
- # 伤害符号正确的情况下
- if self.damage > 0
- if user.is_a?(Game_Actor)
- self.damage = power* (10+$game_variables[251])/10
-
- else
- self.damage = power / (1 + $game_variables[254]/10)
- self.fennu += (1 + rand(10))
- end
- # 修正会心一击
- if user.is_a?(Game_Actor) #and rand(100) < 4+$game_variables[254]/10
- if rand(100) < 4+$game_variables[254]/10
- self.damage *= 2
- self.critical = true
- else
- if rand(100) < 4
- self.damage *= 2
- self.critical = true
- self.fennu += (1 + rand(10))
- end
- end
- end
- else
- if user.is_a?(Game_Actor)
- if rand(101) < $game_variables[252]
- self.damage = power*2
- self.critical = true
- end
- end
- #if self.guarding?
- #self.fennu -= 1
- #end
- 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 = 8 * self.agi / user.dex + 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
- #################丢瓶神功######################
- if self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and not self.state?(104) and $game_party.item_number(62)>0
- $game_party.gain_item(62,-1)
- self.animation_id = 15
- self.hp += 150
- elsif self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and not self.state?(104) and $game_party.item_number(62)==0 and $game_party.item_number(63)>0
- $game_party.gain_item(63,-1)
- self.animation_id = 16
- self.hp+=450
- end
- ###########################丢瓶神功完###########
- # 状态变化###############冰封改#################
- @state_changed = false
- if not self.state?(104)#如果不是冰封状态
- effective |= states_plus(skill.plus_state_set)#附加状态正常
- end
- effective |= states_minus(skill.minus_state_set)#不附加任何状态
- # 如果没有解除冰封
- if self.state?(104)
- self.damage = 0 #特技伤害值为0
- end
- ####################冰封改完##################
- # HP 的伤害减法运算#########################
- if self.damage < 0 and self.state?(41)
- self.damage = -0
- last_hp = self.hp
- self.hp -= 0
- else
- last_hp = self.hp
- ########################魔力护盾##################
- if self.damage > 0
- if not self.state?(95) and not self.state?(94) and not self.state?(93) and not self.state?(91)
- self.hp -= self.damage
- end
-
-
-
- if self.state?(95)
- if self.sp >= self.damage*2
- self.sp -= self.damage*2
- else
- self.damage -= self.sp/2
- self.hp -= self.damage
- self.remove_state(95)
- self.sp = 0
- effective |= self.hp != last_hp
- end
- #else
- #self.hp -= self.damage
- #effective |= self.hp != last_hp
- end
- #end
- if self.state?(94)
- if self.sp >= self.damage
- self.sp -= self.damage
- else
- self.damage -= self.sp
- self.sp = 0
- self.remove_state(94)
- self.hp -= self.damage
- end
- end
- if self.state?(93)
- if self.sp >= self.damage/2
- self.sp -= self.damage/2
- else
- self.damage -= self.sp*2
- self.sp = 0
- self.remove_state(93)
- self.hp -= self.damage
- end
- end
- if self.state?(91)
- if self.sp >= self.damage/3
- self.sp -= self.damage/3
- else
- self.damage -= self.sp*3
- self.sp = 0
- self.remove_state(91)
- self.hp -= self.damage
- end
- end
- else
- self.hp -= self.damage
- effective |= self.hp != last_hp
- end
- end
- ##########血黄必死招##########
- if self.hp <= self.maxhp/5 and self.state?(100)
- self.damage = 9999
- self.hp -= self.damage
- effective |= self.hp != last_hp
- end
- #################3##
- if self.hp < 0
- self.hp = 0
- end
- # 威力为 0 的场合
- if skill.power == 0
- # 伤害设置为空的字串
- self.damage = 1+rand(9)
- # 状态没有变化的情况下
- unless @state_changed
- # 伤害设置为空
- self.damage = "Miss"
- end
- end
- # Miss 的情况下
- else
- # 伤害设置为 "Miss"
- self.damage = "Miss"
- self.fennu -= rand(5)
- end
- #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+item.recover_hp*$game_variables[252]/100
- recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp+item.recover_sp*$game_variables[252]/100
- 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 的回复
- ##########################禁疗############################
- if self.damage < 0 and self.state?(41)# and not self.state?(1)
- self.damage = -0
- last_hp = self.hp
- self.hp -= 0
- last_hp = self.hp
- last_sp = self.sp
- else
- self.hp += recover_hp
- self.sp += recover_sp
- #########
- if recover_sp != 0 #如果补SP的量不等于0
- self.damage = -recover_sp #伤害=SP恢复量的倒数
- if self.hp > self.maxhp
- self.hp = self.maxhp
- end
- if self.sp > self.maxsp
- self.sp = self.maxsp
- end
- end#################
- effective |= self.hp != last_hp
- effective |= self.sp != last_sp
- # 状态变化
- @state_changed = false
- effective |= states_plus(item.plus_state_set)
- effective |= states_minus(item.minus_state_set)
- end
- # 能力上升值有效的情况下
- if item.parameter_type > 0 and item.parameter_points != 0
- # 能力值的分支
- 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
- # 设置伤害为空的字符串
- 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
- # 设置伤害
- ######炎灼##################################
- if self.state?(102)
- if self.hp >= 10000
- self.damage = [self.damage,1000].max
- else
- self.damage = self.maxhp/10 + self.maxsp/10
- end
- end
- ######敌毒
- if self.state?(3)
- if self.hp >= 2000
- self.damage = [self.damage,200].max
- else
- self.damage = self.hp / 10
- end
- end###########
- # 分散
- if self.damage.abs > 0
- amp = [self.damage.abs * 15 / 100, 1].max
- self.damage += rand(amp+1) + rand(amp+1) - amp
- end
- # HP/MP 的伤害减法运算
- #if self.state?(3) and @active_battler.is_a?(Game_Actor) and @active_battler.armor4_id ==89
- #self.hp += self.damage
- #else
- if self.state?(3) and self.state?(53)
- self.hp += self.damage
- else
- if self.state?(3) and not self.state?(53)
- #self.damage = [self.damage,200].max
- self.hp -= self.damage
- self.sp -= self.maxsp/10
- self.fennu += 3
- elsif self.state?(102)
- if self.hp >= 10000
- self.damage = [self.damage,1000].max
- self.hp -= self.damage
- self.fennu += 3
- else
-
- self.hp -= self.damage
- self.fennu += 3
- end
- end
- end
- #if self.state?(3)
- #self.hp -= self.damage
- #elsif self.state?(102)
- #self.hp -= self.damage
- #end
- #if self.state?(3) and @active_battler.is_a?(Game_Actor) and not @active_battler.armor4_id ==89#self.armor4_id ==89
- # self.sp -= self.maxsp/10
- #end
- # 过程结束
- 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
复制代码 这是我的GAME_BATTLE 3计算伤害的脚本,就是它出的问题,还原成默认的GAME_BATTLE3就没问题了,、问题出在哪里呢?
daixiongwei于2011-1-30 00:32补充以下内容:
补充一句,战斗测试的时候又很好,游戏测试的战斗时,有时候会出现战斗不能还能行动的BUG,而且还有个BUG一定存在:如果有多余1个的敌人,消灭其中1个后,被消灭的敌人也可以战斗不能仍然行动,以普通攻击砍我方队员!也就是说如果不把全部敌人消灭中断战斗的话,被消灭的敌人会一直普通攻击的~~囧rz。。。 |
|