查看: 1967|回复: 3

[已经解决] Enemy所拥有的的技能列表保存在哪里呢?

[复制链接]
梦石
0
星屑
65
在线时间
154 小时
注册时间
2011-2-1
回帖
41
发表于 2014-3-29 10:24:41 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 tai_tan 于 2014-3-29 10:36 编辑

单个敌人所拥有的的技能列表保存在哪里呢?就是在数据库里添加的技能,在哪里用何种方式保存呢?保存的是技能的id吗?

不在RPG::Enemy
  1. class RPG::Enemy < RPG::BaseItem
  2.   def initialize
  3.     super
  4.     @battler_name = ''
  5.     @battler_hue = 0
  6.     @params = [100,0,10,10,10,10,10,10]
  7.     [url=home.php?mod=space&uid=13302]@exp[/url] = 0
  8.     [url=home.php?mod=space&uid=236945]@gold[/url] = 0
  9.     @drop_items = Array.new(3) { RPG::Enemy::DropItem.new }
  10.     @actions = [RPG::Enemy::Action.new]
  11.     @features.push(RPG::BaseItem::Feature.new(22, 0, 0.95))
  12.     @features.push(RPG::BaseItem::Feature.new(22, 1, 0.05))
  13.     @features.push(RPG::BaseItem::Feature.new(31, 1, 0))
  14.   end
  15.   attr_accessor :battler_name
  16.   attr_accessor :battler_hue
  17.   attr_accessor :params
  18.   attr_accessor :exp
  19.   attr_accessor :gold
  20.   attr_accessor :drop_items
  21.   attr_accessor :actions
  22. end

复制代码
而RPG::Enemy::Action里只有个初始化。。。。。

  1. class RPG::Enemy::Action
  2.   def initialize
  3.     @skill_id = 1
  4.     @condition_type = 0
  5.     @condition_param1 = 0
  6.     @condition_param2 = 0
  7.     @rating = 5
  8.   end
  9.   attr_accessor :skill_id
  10.   attr_accessor :condition_type
  11.   attr_accessor :condition_param1
  12.   attr_accessor :condition_param2
  13.   attr_accessor :rating
  14. end

复制代码

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-3-29 10:29:21 | 显示全部楼层
RPG::Enemy有一个属性叫做actions,见你的第一段代码的第21行

评分

参与人数 1梦石 +1 收起 理由
迷糊的安安 + 1 谢谢哇

查看全部评分

回复

使用道具 举报

梦石
0
星屑
65
在线时间
154 小时
注册时间
2011-2-1
回帖
41
 楼主| 发表于 2014-3-29 10:32:30 | 显示全部楼层
actions是一个数组吗?要如何访问呢?

点评

不回复我我是不知道回答的……  发表于 2014-4-5 13:08
回复

使用道具 举报

梦石
0
星屑
65
在线时间
154 小时
注册时间
2011-2-1
回帖
41
 楼主| 发表于 2014-3-29 10:35:25 | 显示全部楼层
哦,是了。。。。
  1.   #--------------------------------------------------------------------------
  2.   # ● 生成战斗行动
  3.   #--------------------------------------------------------------------------
  4.   def make_actions
  5.     super
  6.     return if @actions.empty?
  7.     action_list = enemy.actions.select {|a| action_valid?(a) }
  8.     return if action_list.empty?
  9.     rating_max = action_list.collect {|a| a.rating }.max
  10.     rating_zero = rating_max - 3
  11.     action_list.reject! {|a| a.rating <= rating_zero }
  12.     @actions.each do |action|
  13.       action.set_enemy_action(select_enemy_action(action_list, rating_zero))
  14.     end
  15.   end
  16. end
复制代码
谢谢哇
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部