赞 | 0 |
VIP | 17 |
好人卡 | 0 |
积分 | 1 |
经验 | 1022914 |
最后登录 | 2017-2-4 |
在线时间 | 10 小时 |
Lv1.梦旅人 月下可怜人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 10 小时
- 注册时间
- 2005-11-23
- 帖子
- 4085
|
替换Small_Sprite
- class Small_Sprite
-
- attr_accessor :hp
- attr_accessor :sp
- attr_accessor :str
- attr_accessor :dex
- attr_accessor :agi
- attr_accessor :int
- attr_accessor :turn
- attr_accessor :type
- attr_accessor :name
- attr_accessor :help
- attr_accessor :color
-
- def initialize
- @hp = @sp = @str = @dex = @agi = @int = @turn = @type = 0
- @name = @help = ''
- @color = 0
- end
-
- def base_value
- return [@hp, @sp, @str, @dex, @agi, @int]
- end
-
- def turn?
- return @turn < Sprite_Magic.sprite_turn(@name)
- end
-
- def _name
- turn? ? (return (@name + Sprite_Magic::WAIT)) : (return @name)
- end
-
- end
复制代码
替换Sprite_Magic
- module Sprite_Magic
-
- #精灵窗口皮肤
- SKIN = 'red'
- #待机标识
- WAIT = '〓'
-
- #HP、SP、力量、灵巧、速度、魔力、恢复回合、属性
- @magic_value = {
- '拉曼达拉(火)' => [100, 20, 25, 0, -10, 30, 5, 0],
- '沙拉曼达(火)' => [100, 20, 25, -50, -10, 30, 5, 0],
- '伊弗里特(火)' => [80, 40, -10, 20, 10, 20, 3, 0],
- '希娃(水)' => [50, 50, 10, 40, 40, 10, 4, 1],
- '温蒂尼(水)' => [60, 50, 20, 20, 40, 10, 4, 1],
- '伊夫(风)' => [10, 10, 10, 50, 80, 10, 4, 2],
- '彼得潘(风)' => [70, 50, 20, 40, 40, 10, 4, 2]
- }
-
- #精灵简介(名字 => 说明文字)
- @magic_help_text = {
- '拉曼达拉(火)' => '饱受折磨恋人的愤怒之火。',
- '沙拉曼达(火)' => '绝望沙漠地下熔岩之虫。',
- '伊弗里特(火)' => '古代众神锻造武器之焰。',
- '希娃(水)' => '托尔的老婆。',
- '温蒂尼(水)' => '性格默默,温润生命之源。',
- '伊夫(风)' => '吹拂大地的顽童,拥有翡翠之翼。',
- '彼得潘(风)' => '梦精灵实体,穿越两界滩涂。'
- }
-
- #精灵属性对应颜色
- @magic_color = {
- 0 => Color.new(255,0,0,255),
- 1 => Color.new(0,255,0,255),
- 2 => Color.new(0,255,255,255)
- }
-
- #普通组合对应特技({属性 => 数量,属性 => 数量……} => 特技id)
- @normal_skill = {
- {0 => 2} => 7,
- {1 => 2} => 2,
- {0 => 2, 1 => 1} => 8,
- {1 => 1, 2 => 1} => 4,
- {0 => 3, 1 => 1, 2 => 1} => 9
- }
-
- #固定组合对应特技([精灵1,精灵2……] => 特技id)
- @fix_skill = {
- ['伊弗里特(火)', '沙拉曼达(火)'] => 13,
- ['伊弗里特(火)', '希娃(水)'] => 11,
- ['沙拉曼达(火)', '温蒂尼(水)', '伊夫(风)'] => 26,
- ['温蒂尼(水)', '伊夫(风)'] => 6
- }
-
- #持有精灵数上限(id => max)
- @actor_max = {
- 1 => 5, 2 => 4, 3 => 6,4 => 7, 5 => 5, 6 => 5, 7 => 4, 8 => 6
- }
-
- @methed_name = ['hp','sp','str','dex','agi','int','turn','type',
- 'name','help','color']
-
- def self.find_sprite(sprite, id)
- n_spr = self.find_normal_sprite(id)
- s_spr = self.find_special_sprite(id)
- n_spr.each{|n|
- sprite.each{|spr|
- spr.turn = 0 if (spr.type == n and !spr.turn?)
- }
- }
- s_spr.each{|n|
- sprite.each{|spr|
- spr.turn = 0 if (spr.name == n and !spr.turn?)
- }
- }
- end
-
- def self.find_normal_sprite(id)
- type_hash = @normal_skill.return_key(id)
- sk_id = Array.new
- type_hash.each{|key, value| value.times{sk_id << key}}
- return sk_id
- end
-
- def self.find_special_sprite(id)
- return @fix_skill.return_key(id)
- end
-
- def self.sprite_turn(name)
- @magic_value[name].nil? ? (return nil) : (return @magic_value[name][6])
- end
-
- def self.make_sprite(name)
- return if @magic_value[name].nil?
- sprite = Small_Sprite.new
- @methed_name.size.times{|n|
- _name = @methed_name[n]
- #sprite.make_methed(_name)
- n < 8 ? class_eval("sprite.#{_name}=@magic_value[name][n]") :
- (class_eval("sprite.#{_name}=name") if n == 8
- class_eval("sprite.#{_name}=@magic_help_text[name]") if n == 9
- class_eval("sprite.#{_name}=@magic_color[sprite.#{@methed_name[7]}]") if n == 10)
- }
- return sprite
- end
-
- def self.find_skill_id(sprite, skill = nil)
- skill_id = (self.find_normal_id(sprite) + self.find_special_id(sprite)).sort!
- skill_id -= skill if skill
- return skill_id
- end
-
- def self.find_normal_id(sprite)
- temp = {}
- sprite.each{|spr|
- n = spr.type
- temp[n] ||= 0 ; temp[n] += 1
- }
- skill_id = []
- @normal_skill.each {|key, value|
- skill_id << value if key.in_all?(temp)
- }
- return skill_id
- end
-
- def self.find_special_id(sprite)
- skill_id = []
- @fix_skill.each{|key, value|
- skill_id << value if key.all?{|name| sprite.find {|spr| spr.name == name}}
- }
- return skill_id
- end
-
- def self.sprite_max(id)
- @actor_max[id].nil? ? (return nil) : (return @actor_max[id])
- end
-
- end
复制代码 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|