Project1
标题:
MP回复限制一问
[打印本页]
作者:
cheukhei96302
时间:
2012-2-3 07:01
标题:
MP回复限制一问
我想把队中其中一个角色的MP不可以由物品和队友技能回复,
只可以用该角色自己的技能回复,可以的吗? dsu_plus_rewardpost_czw
作者:
linyifei
时间:
2012-2-3 12:51
给队友技能弄上某个属性,比如起名“回复”
然后此人物对该属性的有效度为E,就不会有效果了。
#==============================================================================
# 物品的职业归属 by 沉影不器
# -----------------------------------------------------------------------------
# 功能描述:
# 让物品也跟武器防具那样,属于指定职业
# 当物品为全体有效时,也只对归属的职业同伴有效
# 使用方法:
# ① 在数据库-物品-备注]中填写 职业 = 第一种职业ID,第二种职业ID...
# (详见范例)
# ② 未填写备注的情况下,视同属于所有职业
#==============================================================================
# ■ Array
#==============================================================================
class Array
# 整个数组所有元素一起化成数值型
def to_i
array_to_i=[]
self.each{|i| array_to_i.push i.to_i}
return array_to_i
end
# 整个数组所有元素一起化成文本型
def to_s
array_to_s=[]
self.each{|s| array_to_s.push s.to_s}
return array_to_s
end
end
#==============================================================================
# ■ RPG
#==============================================================================
module RPG
class Item < UsableItem
def class_set
self.read_note('职业').split(/,/).to_i
end
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ○ 判断是否可以应用物品
# user : 物品使用者
# item : 物品
#--------------------------------------------------------------------------
def item_effective?(user, item)
if item.for_dead_friend? != dead?
return false
end
# 判断职业归属
if user.is_a?(Game_Actor) and !item.class_set.empty?
unless item.class_set.include?(user.class_id)
return false
end
end
if not $game_temp.in_battle and item.for_friend?
return item_test(user, item)
end
return true
end
end
#==============================================================================
# 读取rmvx备注栏指定字段 by 沉影不器
# -----------------------------------------------------------------------------
# 使用方法:
# 在vx数据库比如1号物品的备注栏里书写: 耐久度 = 10
# 读取时使用: p $data_items[1].read_note('耐久度')
# 几点注意:
# ① 忽略空格
# ② 返回值为文本格式
#==============================================================================
module RPG
#=============================================================================
# ■ BaseItem
#=============================================================================
class BaseItem
#-------------------------------------------------------------------------
# ○ 读取rmvx备注栏指定字段
# section : 字段名
# ignore_caps : 忽略大小写(仅字段名)
#-------------------------------------------------------------------------
def read_note(section, ignore_caps = false)
result = ''
# 忽略大小写时,全部转大写
section.upcase! if ignore_caps
# 转symbol方便比较
s = section.to_sym
self.note.each_line{|line|
temp = line.split(/=/)
# 去掉干扰字符
temp.each {|i| i.strip!}
temp[0].upcase! if ignore_caps
if temp[0].to_sym == s
unless temp[1] == nil
result = temp[1]
end
# 如果希望同名字段值覆盖前面的字段,去掉下一行
break
end
}
return result
end
end
#=============================================================================
# ■ Enemy
#=============================================================================
class Enemy
#-------------------------------------------------------------------------
# ○ 读取rmvx备注栏指定字段
# section : 字段名
# ignore_caps : 忽略大小写(仅字段名)
#-------------------------------------------------------------------------
def read_note(section, ignore_caps = false)
result = ''
# 忽略大小写时,全部转大写
section.upcase! if ignore_caps
# 转symbol方便比较
s = section.to_sym
self.note.each_line{|line|
temp = line.split(/=/)
# 去掉干扰字符
temp.each {|i| i.strip!}
temp[0].upcase! if ignore_caps
if temp[0].to_sym == s
unless temp[1] == nil
result = temp[1]
end
# 如果希望同名字段值覆盖前面的字段,去掉下一行
break
end
}
return result
end
end
#=============================================================================
# ■ State
#=============================================================================
class State
#-------------------------------------------------------------------------
# ○ 读取rmvx备注栏指定字段
# section : 字段名
# ignore_caps : 忽略大小写(仅字段名)
#-------------------------------------------------------------------------
def read_note(section, ignore_caps = false)
result = ''
# 忽略大小写时,全部转大写
section.upcase! if ignore_caps
# 转symbol方便比较
s = section.to_sym
self.note.each_line{|line|
temp = line.split(/=/)
# 去掉干扰字符
temp.each {|i| i.strip!}
temp[0].upcase! if ignore_caps
if temp[0].to_sym == s
unless temp[1] == nil
result = temp[1]
end
# 如果希望同名字段值覆盖前面的字段,去掉下一行
break
end
}
return result
end
end
end
复制代码
物品无效,可能比较麻烦。在物品栏的备注里填写职业=, , , ,这样子只对这些职业有效,不填写就是对所有职业都有效
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1