Project1

标题: 求一个脚本 [打印本页]

作者: jxzz016590    时间: 2009-4-18 03:54
标题: 求一个脚本
我想实现同一个物品在不同地方售价和买价能够调节的脚本。那样我就可以做一个通过做买卖挣钱的经营养成类游戏,那位大侠肯帮我? [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: yuxuan    时间: 2009-4-18 03:59
商店价格调整
  1. class Game_Interpreter

  2.   def command_物品定价(id, percent)
  3.     $data_items[id].quotation_percent = percent
  4.   end

  5.   def command_武器定价(id, percent)
  6.     $data_weapons[id].quotation_percent = percent
  7.   end

  8.   def command_防具定价(id, percent)
  9.     $data_armors[id].quotation_percent = percent
  10.   end
  11. end

  12. module RPG
  13.   class Item
  14.     attr_accessor :quotation_percent
  15.     def price
  16.       @quotation_percent = 100 if @quotation_percent.nil?
  17.       return @price * @quotation_percent / 100
  18.     end
  19.   end
  20.   
  21.   class Weapon
  22.     attr_accessor :quotation_percent
  23.     def price
  24.       @quotation_percent = 100 if @quotation_percent.nil?
  25.       return @price * @quotation_percent / 100
  26.     end
  27.   end

  28.   class Armor
  29.     attr_accessor :quotation_percent
  30.     def price
  31.       @quotation_percent = 100 if @quotation_percent.nil?
  32.       return @price * @quotation_percent / 100
  33.     end
  34.   end
  35. end

复制代码

作者: 开心词典2    时间: 2009-4-18 04:24
提示: 作者被禁止或删除 内容自动屏蔽




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