设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1762|回复: 4
打印 上一主题 下一主题

[已经解决] 如何制作消耗HP的技能?

[复制链接]

Lv3.寻梦者 (版主)

八宝粥的基叔

梦石
0
星屑
4509
在线时间
5228 小时
注册时间
2009-4-29
帖子
14318

贵宾

1
发表于 2013-6-22 21:46:57 | 显示全部楼层
本帖最后由 protosssonny 于 2013-6-22 22:03 编辑

1、Game_Battler类下找到:
  1.   #--------------------------------------------------------------------------
  2.   # ● 可以使用技能的判定
  3.   #     skill : 技能
  4.   #--------------------------------------------------------------------------
  5.   def skill_can_use?(skill)
  6.     return false unless skill.is_a?(RPG::Skill)
  7.     return false unless movable?
  8.     return false if silent? and skill.spi_f > 0
  9.     return false if calc_mp_cost(skill) > mp
  10.     return false if skill.id == xx and @hp < yy # 请自己设定技能ID为xx且当HP小于yy不能使用
  11.     if $game_temp.in_battle
  12.       return skill.battle_ok?
  13.     else
  14.       return skill.menu_ok?
  15.     end
  16.   end
复制代码
2、Scene_Battle类下找到:
  1.   #--------------------------------------------------------------------------
  2.   # ● 执行战斗行动:使用技能
  3.   #--------------------------------------------------------------------------
  4.   def execute_action_skill
  5.     skill = @active_battler.action.skill
  6.     text = @active_battler.name + skill.message1
  7.     @message_window.add_instant_text(text)
  8.     unless skill.message2.empty?
  9.       wait(10)
  10.       @message_window.add_instant_text(skill.message2)
  11.     end
  12.     targets = @active_battler.action.make_targets
  13.     display_animation(targets, skill.animation_id)
  14.     @active_battler.mp -= @active_battler.calc_mp_cost(skill)
  15.     @active_battler.hp -= yy if skill.id == xx # 刚才xx、yy是多少这里就写多少
  16.     $game_temp.common_event_id = skill.common_event_id
  17.     for target in targets
  18.       target.skill_effect(@active_battler, skill)
  19.       display_action_effects(target, skill)
  20.     end
  21.   end
复制代码
3、Scene_Skill类下找到:
  1.   #--------------------------------------------------------------------------
  2.   # ● 非同伴目标使用物品
  3.   #--------------------------------------------------------------------------
  4.   def use_skill_nontarget
  5.     Sound.play_use_skill
  6.     @actor.mp -= @actor.calc_mp_cost(@skill)
  7.     @actor.hp -= yy if @skill.id == xx # 刚才xx、yy是多少这里就写多少
  8.     @status_window.refresh
  9.     @skill_window.refresh
  10.     @target_window.refresh
  11.     if $game_party.all_dead?
  12.       $scene = Scene_Gameover.new
  13.     elsif @skill.common_event_id > 0
  14.       $game_temp.common_event_id = @skill.common_event_id
  15.       $scene = Scene_Map.new
  16.     end
  17.   end
复制代码

点评

OTZ不好意思没看到  发表于 2013-6-22 22:54
我似乎做得麻烦了……原来可以直接调用@hp OTZ  发表于 2013-6-22 22:29
哎呀……来晚了!  发表于 2013-6-22 22:28
解决,非常感谢~  发表于 2013-6-22 22:07
OTZ谢谢P叔,但是第2第3是不是写错了?应该是扣除HP而不是MP吧?  发表于 2013-6-22 22:01

评分

参与人数 1星屑 +160 收起 理由
Password + 160 精品文章

查看全部评分

《逝去的回忆3:四叶草之梦》真情发布,欢迎点击图片下载试玩喵。

《逝去的回忆3》的讨论群:
一群:192885514
二群:200460747
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-10 10:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表