Project1

标题: 关于回复为负数的显示问题 [打印本页]

作者: zgm1100    时间: 2011-7-15 14:15
标题: 关于回复为负数的显示问题
一个物品信息显示脚本。。当回复为负数时。显示(伤害:   )



if @item.recover_hp!=0
      x=0
      y+=1      
      text="回复HP:"[email protected]_hp.to_s
      self.contents.font.color = normal_color
      self.contents.font.size=14   
      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
    enddsu_plus_rewardpost_czw
作者: 仲秋启明    时间: 2011-7-15 15:08
恢复HP是这么定义的:
  1.   #--------------------------------------------------------------------------
  2.   # ● 计算使用物品的体力回复量
  3.   #--------------------------------------------------------------------------
  4.   def calc_hp_recovery(user, item)
  5.     result = maxhp * item.hp_recovery_rate / 100 + item.hp_recovery
  6.     result *= 2 if user.pharmacology    # 「药物知识」效果加成2倍
  7.     return result
  8.   end
复制代码
所以,要改成item.hp_recovery 或者 item.hp_recovery_rate
作者: fux2    时间: 2011-7-15 15:58
if @item.recover_hp!=0
  x=0
  y+=1      
  text=(@item.recover_hp > 0 ? "回复HP:" : "损失HP:")[email protected]_hp.to_s
  self.contents.font.color = normal_color
  self.contents.font.size=14   
  self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
end
作者: zgm1100    时间: 2011-7-15 16:11
多谢。多谢!!!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1