赞 | 1 |
VIP | 255 |
好人卡 | 52 |
积分 | 1 |
经验 | 77416 |
最后登录 | 2016-1-18 |
在线时间 | 1269 小时 |
Lv1.梦旅人 薄凉看客
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1269 小时
- 注册时间
- 2010-6-20
- 帖子
- 1316
|
本帖最后由 恐惧剑刃 于 2014-11-18 23:31 编辑
吸血脚本- #==============================================================================
- # - 普通攻击简易吸血 -
- # 只有学会特定技能的角色或敌人才可以吸血;
- # 敌人要设置发动特技的条件,一个永远不被打开的开关;
- # 为了方便起见,技能id越大视为吸血效果越好。
- #==============================================================================
- module Battler_XiXue
- Attack_Setup = {}
- #----------------------------------------------------------------------------
- # Attack_Setup[技能id] = [回复率, 触发概率, 分散度]
- #----------------------------------------------------------------------------
- Attack_Setup[57] = [10, 100, 20]
- end
- #==============================================================================
- # - Game_Battler
- #==============================================================================
- class Game_Battler
- #----------------------------------------------------------------------------
- # 应用普通攻击效果
- #----------------------------------------------------------------------------
- alias :attack_effect_xixue_old :attack_effect
- def attack_effect(attacker)
- attack_effect_xixue_old(attacker)
- #--------------------------------------------------------------------------
- # 吸血判断
- #--------------------------------------------------------------------------
- if attacker.is_a?(Game_Actor)
- jj = attacker.skills & Battler_XiXue::Attack_Setup.keys
- else
- s = []
- for i in $data_enemies[attacker.id].actions
- s << i.skill_id
- end
- jj = s & Battler_XiXue::Attack_Setup.keys
- end
- #--------------------------------------------------------------------------
- # 吸血效果
- #--------------------------------------------------------------------------
- if jj.size > 0
- d = Battler_XiXue::Attack_Setup[jj.max]
- if self.damage.is_a?(Numeric) and self.damage > 0 and rand(100) < d[1]
- attacker.damage = 0 - self.damage * d[0] / 100
- d = attacker.damage * d[2] / 100
- d += 1 if d == 0
- f = 0 - d
- e = 0 - f
- v = [*e..f]
- attacker.damage += v[rand(v.size)]
- attacker.hp -= attacker.damage
- end
- end
- end
- end
- #==============================================================================
- # - Scene_Battle 显示吸血效果 默认用
- #==============================================================================
- class Scene_Battle
- alias :update_phase4_step5_xixue_old :update_phase4_step5
- def update_phase4_step5
- update_phase4_step5_xixue_old
- if @active_battler.damage
- @active_battler.damage_pop = true
- end
- end
- end
- =begin
- #==============================================================================
- # - Scene_Battle 显示吸血效果 真移位用
- #==============================================================================
- class Scene_Battle
- alias :update_phase4_step4_xixue_old :update_phase4_step4
- def update_phase4_step4
- if @active_battler.damage
- @active_battler.damage_pop = true
- end
- update_phase4_step4_xixue_old
- end
- end
- #==============================================================================
- # - Scene_Battle 显示吸血效果(字体颜色) 真移位追加
- #==============================================================================
- class Bitmap
- def draw_number(x, y, number,o,picture = RPG::Cache.system("number"))
- w = picture.width / 10
- h = picture.height / 5
- rect = Rect.new(0,0,w,h)
- if number.is_a?(Numeric)
- rect.set(0,h*2,w,h) if number < 0
- number = number.abs
- end
- number = number.to_s
- array = number.split(//)
- for i in 0...array.size
- array[i] = array[i].to_i
- end
- case o
- when 1
- x += 81 - (array.size * 9)
- when 2
- end
- if number == "Miss"
- self.blt(x,y,picture,Rect.new(0,h*3,picture.width,h))
- return
- end
- for sz in array
- rect.x = sz * w
- self.blt(x,y,picture,rect)
- x += w
- end
- end
- end
- module RPG
- class Sprite < ::Sprite
- def damage(value, critical)
- dispose_damage
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "Arial Black"
- bitmap.font.size = 32
- if value.is_a?(Numeric) and value < 0
- bitmap.font.color.set(176, 255, 144)
- else
- bitmap.font.color.set(255, 255, 255)
- end
- bitmap.draw_number(0, 12, value, 1)
- if critical
- bitmap.font.size = 20
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
- bitmap.font.color.set(255, 255, 255)
- bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
- end
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x
- @_damage_sprite.y = self.y - self.oy / 2
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- end
- end
- =end
复制代码 技能书脚本- module Battler_XiXue
- Item_ID = [1, 2, 3, 4, 5] # 作为技能书的物品id
- Skill_ID = [1, 2, 3, 4, 5] # 技能书对应习得的技能
- end
复制代码 Scene_Item 168行下加- if Battler_XiXue::Item_ID.include?(@item.id)
- ii = Battler_XiXue::Item_ID.index(@item.id)
- target.learn_skill(Battler_XiXue::Skill_ID[ii])
- used = true if !used
- end
复制代码 |
|