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

Project1

 找回密码
 注册会员
搜索
123
返回列表 发新帖
楼主: 芯☆淡茹水
打印 上一主题 下一主题

[原创发布] 【武器随机】 也叫 【武器属性自行设定】

[复制链接]

Lv4.逐梦者

梦石
1
星屑
9037
在线时间
4375 小时
注册时间
2005-10-22
帖子
6768

开拓者贵宾

21
发表于 2013-3-16 03:57:08 | 只看该作者
本帖最后由 orochi2k 于 2013-3-16 03:58 编辑

石器欺负小朋友系列:(N年前的东西,目前基本退役)
module RWEAPON
  #武器组件通用表
  W_ATTLIST1 = ["fire1","highatk1","poison1","expensive","killevil","mabi1","defender","terri","zhenghan","ice1","broken","thunder1","highatk2","desposer1","slot1","xixue002"]
  W_EVILLIST = ["fire1","highatk1","poison1","terri","dark1","bloody1","ice1","hunduns","anithuman","highatk2","desposer1","slot2","xixue002"]
  W_TIEJIANGLIST1 = ["fire1","highatk1","slot1","slot2","slot3","poison1","expensive","mabi1","killevil"]
  W_GUNLIST1 = ["gunpower1","gunpower2","gunammo1","gunpowerlow1","gunauto","expensive"]
  #检查独一无二物品编号
  def RWEAPON::CheckUnique(special)
    n = -1
    for i in $data_weapons
      if i != nil and i.spcical == special
        return i.id
      end
    end
    return n
  end
  #获取可用ID
  def RWEAPON::getid
    i = 2000
    while($game_party.get_un_w.keys.include?(i))
      i += 1
    end
    return i
  end
  #复制母板
  def RWEAPON::makecopy(from,to)
    #$data_weapons[to] = $data_weapons[from].clone
    $data_weapons[to] = Marshal.load(Marshal.dump($data_weapons[from]))
    $data_weapons[to].id = to
    $data_weapons[to].equalerid = $data_armors[from].equalerid
    #$data_weapons[to].element_set = $data_weapons[from].element_set.clone
    #$data_weapons[to].plus_state_set = $data_weapons[from].plus_state_set.clone
    #$data_weapons[to].minus_state_set = $data_weapons[from].minus_state_set.clone
  end
  def RWEAPON::makecopyS(item,to)
   # $data_weapons[to] = item.clone
    $data_weapons[to] = Marshal.load(Marshal.dump(item))
    $data_weapons[to].id = to
    $data_weapons[to].equalerid = item.equalerid
   # $data_weapons[to].element_set = item.element_set.clone
   # $data_weapons[to].plus_state_set = item.clone
   # $data_weapons[to].minus_state_set = item.clone
  end
  #简略封装部件追加函数
  def RWEAPON::addcot(to,name)
    a = eval("RWEAPON::w_att_#{name}_add(#{to})")
    return a
  end
  #部件选取函数
  def RWEAPON::choicepart(list,num)
    a = []
    while(num > 0 )
      k = list[rand(list.size)]
      unless a.include?(k)
        a.push(k)
        num -= 1
      end
    end
    return a
  end   
  #根据列表逐个追加部件
  def RWEAPON::addcotlist(to,list)
    sce = 0
    fail = 0
     for i in list
        if RWEAPON::addcot(to,i)
          sce += 1
        else
          fail += 1
        end
     end
  end
  #武器成品留档
  def RWEAPON::done(id)
    $game_party.get_un_w[id] = Marshal.load(Marshal.dump($data_weapons[id])) #$data_weapons[id].clone
    $game_party.get_un_w[id].buff = []
    $game_party.get_un_w[id].buff_end = {}
  end
  
  #随机武器生成部件##########################
  def  RWEAPON::w_att_fire1_add(to) #追加灼热烧伤攻击效果
    if $data_weapons[to].plus_state_set.include?(72)
      return false
    end  
    $data_weapons[to].plus_state_set.push(72)
    $data_weapons[to].name = "烈焰"+ $data_weapons[to].name
    $data_weapons[to].description = "攻击附带烧伤效果 " + $data_weapons[to].w_description
    $data_weapons[to].price += (1000 + rand(1000))
    $data_weapons[to].atk += rand(20)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_highatk1_add(to) #追加33%攻击力
    k = ($data_weapons[to].atk / 3)
    $data_weapons[to].description = "额外#{k}的攻击力 " + $data_weapons[to].w_description
    $data_weapons[to].name = "强攻"+ $data_weapons[to].name
    $data_weapons[to].price += ($data_weapons[to].price / 5 + rand($data_weapons[to].price / 5) )
   $data_weapons[to].atk += rand($data_weapons[to].atk / 8)
    $data_weapons[to].atk += k
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_defender_add(to) #武器有+25再乘2防御
    k = ((25 + $data_weapons[to].pdef ) * 2)
    $data_weapons[to].description = "额外#{k}的防御力 " + $data_weapons[to].w_description
    $data_weapons[to].name = "坚守"+ $data_weapons[to].name
    $data_weapons[to].price += ($data_weapons[to].price / 5 + rand($data_weapons[to].price / 5) )
    $data_weapons[to].pdef += k
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  
  def  RWEAPON::w_att_poison1_add(to) #追加毒攻击效果
    if $data_weapons[to].plus_state_set.include?(3)
      return false
    end  
    $data_weapons[to].plus_state_set.push(3)
    $data_weapons[to].name = "毒性"+ $data_weapons[to].name
    $data_weapons[to].description = "攻击附带中毒效果 " + $data_weapons[to].w_description
    $data_weapons[to].price += (1200 + rand(1000))
    $data_weapons[to].atk += rand($data_weapons[to].atk / 8)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_expensive_add(to) #只是单纯的价格比较高 囧
    $data_weapons[to].name = "高贵"+ $data_weapons[to].name
    $data_weapons[to].description = "该武器拥有华丽的外观 " + $data_weapons[to].w_description
    $data_weapons[to].price += rand(2 * $data_weapons[to].price)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 6) + rand(34))
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_killevil_add(to) #对不死和恶魔额外伤害
    $data_weapons[to].name = "破邪"+ $data_weapons[to].name
    $data_weapons[to].description = "对邪恶生物额外伤害" + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 10)
    $data_weapons[to].element_set.push(15)
    $data_weapons[to].element_set.push(9)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 8) + rand(25))
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_mabi1_add(to) #追加麻痹效果
    if $data_weapons[to].plus_state_set.include?(8)
      return false
    end  
    $data_weapons[to].name = "麻痹"+ $data_weapons[to].name
    $data_weapons[to].description = "攻击附带麻痹效果" + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 10)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 8) + rand(15))
    $data_weapons[to].plus_state_set.push(8)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_terri_add(to) #追加恐惧效果
    if $data_weapons[to].plus_state_set.include?(37)
      return false
    end  
    $data_weapons[to].name = "恐怖"+ $data_weapons[to].name
    $data_weapons[to].description = "攻击附带恐吓效果 " + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 5)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 8) + rand(22))
    $data_weapons[to].plus_state_set.push(37)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_zhenghan_add(to) #追加晕眩效果
    if $data_weapons[to].plus_state_set.include?(2)
      return false
    end  
    $data_weapons[to].name = "震撼"+ $data_weapons[to].name
    $data_weapons[to].description = "攻击附带眩晕效果 " + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 3)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 10) + rand(12))
    $data_weapons[to].plus_state_set.push(2)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_dark1_add(to) #追加失明效果,武器暗属性
    $data_weapons[to].name = "黑暗"+ $data_weapons[to].name
    $data_weapons[to].description = "暗属性,攻击附带失明效果 " + $data_weapons[to].w_description
    $data_weapons[to].price +=  (500 + rand($data_weapons[to].price / 10))
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 10) + rand(32))
    $data_weapons[to].plus_state_set.push(39)
    $data_weapons[to].element_set.push(8)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_bloody1_add(to) #攻击吸血10%
    $data_weapons[to].name = "嗜血"+ $data_weapons[to].name
    $data_weapons[to].description = "物理伤害10%吸收为生命 " + $data_weapons[to].w_description
    $data_weapons[to].price +=  (500 + rand($data_weapons[to].price / 5))
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 10) + rand(42))
    $data_weapons[to].element_set.push(101)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_ice1_add(to) #冰属性带麻痹
    if $data_weapons[to].plus_state_set.include?(8)
      return false
    end  
    $data_weapons[to].name = "寒冷"+ $data_weapons[to].name
    $data_weapons[to].description = "冰属性,攻击附带麻痹效果" + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 8)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 10) + rand(22))
    $data_weapons[to].plus_state_set.push(8)
    $data_weapons[to].element_set.push(2)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_broken_add(to) #损坏的
    $data_weapons[to].name = "破旧的"+ $data_weapons[to].name
    $data_weapons[to].description = "有所破损的" + $data_weapons[to].w_description
    $data_weapons[to].price -= rand($data_weapons[to].price / 4)
    $data_weapons[to].atk -= rand($data_weapons[to].atk / 2)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_hunduns_add(to)
    $data_weapons[to].name = "混沌"+ $data_weapons[to].name
    $data_weapons[to].description = "属性严重扭曲的" + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price * 2)
    $data_weapons[to].atk += (rand($data_weapons[to].atk * 2) - $data_weapons[to].atk)
    $data_weapons[to].pdef += (10 + rand($data_weapons[to].pdef * 2) - $data_weapons[to].pdef)
    $data_weapons[to].mdef += (10 + rand($data_weapons[to].mdef * 2) - $data_weapons[to].mdef)
    $data_weapons[to].str_plus += (10 + rand($data_weapons[to].str_plus * 2) - $data_weapons[to].str_plus)
    $data_weapons[to].dex_plus += (10 + rand($data_weapons[to].dex_plus * 2) - $data_weapons[to].dex_plus)
    $data_weapons[to].agi_plus += (10 + rand($data_weapons[to].agi_plus * 2) - $data_weapons[to].agi_plus)
    $data_weapons[to].int_plus += (10 + rand($data_weapons[to].int_plus * 2) - $data_weapons[to].int_plus)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_anithuman_add(to)
    $data_weapons[to].name = "反人类"+ $data_weapons[to].name
    $data_weapons[to].description = "对人类拥有额外伤害效果" + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 5)
    $data_weapons[to].atk += rand(21)
    $data_weapons[to].element_set.push(11)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_thunder1_add(to) #雷属性带麻痹
    if $data_weapons[to].plus_state_set.include?(8)
      return false
    end  
    $data_weapons[to].name = "雷鸣"+ $data_weapons[to].name
    $data_weapons[to].description = "雷属性,攻击附带麻痹效果" + $data_weapons[to].w_description
    $data_weapons[to].price += rand($data_weapons[to].price / 8)
    $data_weapons[to].atk += (rand($data_weapons[to].atk / 10) + rand(22))
    $data_weapons[to].plus_state_set.push(8)
    $data_weapons[to].element_set.push(3)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_highatk2_add(to) #追加50%攻击力 但其它属性下降
    k = ($data_weapons[to].atk / 2)
    $data_weapons[to].description = "额外#{k}的攻击力 但其余属性受影响" + $data_weapons[to].w_description
    $data_weapons[to].name = "背水"+ $data_weapons[to].name
    $data_weapons[to].price += ($data_weapons[to].price / 5 + rand($data_weapons[to].price / 5) )
   $data_weapons[to].atk += rand($data_weapons[to].atk / 8)
    $data_weapons[to].atk += k
    $data_weapons[to].agi_plus -= k * 2
    $data_weapons[to].dex_plus  -= k * 2
    $data_weapons[to].pdef  = 0
    $data_weapons[to].mdef  = 0
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_desposer1_add(to) #净化
    $data_weapons[to].description = "可消除攻击目标的一些正面状态" + $data_weapons[to].w_description
    $data_weapons[to].name = "净化"+ $data_weapons[to].name
    $data_weapons[to].price += ($data_weapons[to].price / 10 + rand($data_weapons[to].price / 5) )
    $data_weapons[to].minus_state_set.push(13,14,20,22,33,52,53,54)
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_slot1_add(to) #一格武器凹槽
    if $data_weapons[to].insertpoint != nil and $data_weapons[to].insertpoint >= 1
      return false
    end
    $data_weapons[to].description = "拥有一个凹槽 " + $data_weapons[to].w_description
    $data_weapons[to].price += ($data_weapons[to].price / 10)
    $data_weapons[to].insertpoint = 1
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_slot2_add(to) #2格武器凹槽
    if $data_weapons[to].insertpoint != nil and $data_weapons[to].insertpoint != 0
      return false
    end
    $data_weapons[to].description = "拥有两个凹槽 " + $data_weapons[to].w_description
    $data_weapons[to].price += ($data_weapons[to].price / 5)
    $data_weapons[to].insertpoint = 2
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def  RWEAPON::w_att_slot3_add(to) #3格武器凹槽
    if $data_weapons[to].insertpoint != nil and $data_weapons[to].insertpoint != 0
      return false
    end
    $data_weapons[to].description = "拥有三个凹槽 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 2
    $data_weapons[to].insertpoint = 3
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_xixue002_add(to) #2%吸血
    if $data_weapons[to].co["vampiric"] != nil
      return false
    end
    $data_weapons[to].name = "吸血的"+ $data_weapons[to].name
    $data_weapons[to].description = "物理攻击2%吸血效果 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 1.2
    $data_weapons[to].price = $data_weapons[to].price.to_i
    $data_weapons[to].co["vampiric"] = 0.02
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  #######################################################
  #枪械类
  def RWEAPON::w_att_gunpower1_add(to) #伤害加强
    $data_weapons[to].name = "大口径"+ $data_weapons[to].name
    $data_weapons[to].description = "拥有较大威力和后坐力 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 1.3
    $data_weapons[to].price = $data_weapons[to].price.to_i
    $data_weapons[to].gun_power *= 1.2
    $data_weapons[to].gun_power = $data_weapons[to].gun_power.to_i
    $data_weapons[to].gun_recoil *= 1.2
    $data_weapons[to].gun_recoil = $data_weapons[to].gun_recoil.to_i
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_gunpower2_add(to) #伤害加强
    $data_weapons[to].name = "超大口径"+ $data_weapons[to].name
    $data_weapons[to].description = "拥有较大威力和后坐力 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 1.6
    $data_weapons[to].price = $data_weapons[to].price.to_i
    $data_weapons[to].gun_power *= 1.5
    $data_weapons[to].gun_power = $data_weapons[to].gun_power.to_i
    $data_weapons[to].gun_recoil *= 1.5
    $data_weapons[to].gun_recoil = $data_weapons[to].gun_recoil.to_i
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_gunammo1_add(to) #弹药增加
    $data_weapons[to].name = "大弹夹"+ $data_weapons[to].name
    $data_weapons[to].description = "拥有较多弹药 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 1.5
    $data_weapons[to].price = $data_weapons[to].price.to_i
    $data_weapons[to].gun_ammo *= 1.33
    $data_weapons[to].gun_ammo = $data_weapons[to].gun_ammo.to_i
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_gunpowerlow1_add(to) #威力降低
    $data_weapons[to].name = "破损的"+ $data_weapons[to].name
    $data_weapons[to].description = "威力有所降低 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 0.8
    $data_weapons[to].price = $data_weapons[to].price.to_i
    $data_weapons[to].gun_power *= 0.8
    $data_weapons[to].gun_power = $data_weapons[to].gun_power.to_i
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  def RWEAPON::w_att_gunauto_add(to) #自动化
    if($data_weapons[to].gun_autofire == true)
      return false
    end
    $data_weapons[to].name = "自动化"+ $data_weapons[to].name
    $data_weapons[to].description = "可以进行扫射 " + $data_weapons[to].w_description
    $data_weapons[to].price *= 1.2
    $data_weapons[to].price = $data_weapons[to].price.to_i
    $data_weapons[to].gun_autofire = true
    $data_weapons[to].ico_hue = rand(250)
    return true
  end
  
  
  
  #######################################################
end
回复 支持 反对

使用道具 举报

Lv2.观梦者

故九江太守

梦石
0
星屑
418
在线时间
2103 小时
注册时间
2012-12-5
帖子
4421
22
发表于 2013-3-16 19:35:29 | 只看该作者
这样就不用一个个去设置属性了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
865 小时
注册时间
2010-6-27
帖子
131
23
发表于 2013-3-19 10:45:25 | 只看该作者
请问楼主有没装备打造系统的脚本,就是用多个物品,例如铁矿石、铜矿等来打造自己的武器,可以设置武器的种类、属性等,以前那个下不了了。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
865 小时
注册时间
2010-6-27
帖子
131
24
发表于 2013-3-19 14:32:30 | 只看该作者
就是这个,不过现在下不了了,哪位高人有啊

QQ截图20130319143009.png (131.61 KB, 下载次数: 14)

QQ截图20130319143009.png

点评

想法很好,可考虑做一个。  发表于 2013-3-20 00:04
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

25
发表于 2013-3-24 21:36:54 | 只看该作者
是随机武器属性还是随即给武器···

点评

那样的话合成脚本岂不是会和这个有冲突  发表于 2013-3-24 22:09
根据队伍等级随机设定空白数据库武器ID,包括各属性,图标,名字等。相当于给一把随机武器,好与坏看个人 RP  发表于 2013-3-24 22:02
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
371
在线时间
120 小时
注册时间
2012-11-20
帖子
64
26
发表于 2013-3-30 21:09:18 | 只看该作者
简直偶像
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
56 小时
注册时间
2012-8-26
帖子
129
27
发表于 2013-3-31 16:01:57 | 只看该作者
搞这么多,还不如看懂然后自己写的好
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
152
在线时间
201 小时
注册时间
2014-2-24
帖子
125
28
发表于 2014-5-19 13:54:30 | 只看该作者
orochi2k 发表于 2013-3-16 03:57
石器欺负小朋友系列:(N年前的东西,目前基本退役)
module RWEAPON
  #武器组件通用表

你的这个咋用我不知道
好尴尬
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
161 小时
注册时间
2013-8-12
帖子
58
29
发表于 2014-5-20 19:49:15 | 只看该作者
@芯☆淡茹水,下载的文件不存在啦!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
161 小时
注册时间
2013-8-12
帖子
58
30
发表于 2014-5-20 19:50:34 | 只看该作者

点评

这个已经不适用了,有时间写个新的  发表于 2014-5-20 20:05
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 03:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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