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

Project1

 找回密码
 注册会员
搜索
查看: 1669|回复: 6
打印 上一主题 下一主题

[已经解决] 怎么制作造成伤害翻倍的技能?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
292 小时
注册时间
2012-1-26
帖子
56
跳转到指定楼层
1
发表于 2012-2-20 19:15:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如题

本人是新手,拜托了!

点评

话说,如果你的问题描述是”如题“的话,版主看到可能会扣分诶=。=  发表于 2012-2-21 21:07

Lv1.梦旅人

梦石
0
星屑
55
在线时间
138 小时
注册时间
2010-6-20
帖子
46
2
发表于 2012-2-20 20:17:32 | 只看该作者
搞个状态,把全属性都提升了伤害不就高了。。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
46
在线时间
1527 小时
注册时间
2012-1-12
帖子
1716

贵宾

3
发表于 2012-2-20 20:25:01 | 只看该作者
本帖最后由 cxpagy 于 2012-2-20 20:26 编辑

暴击?
  1. module RPG
  2.   class Sprite < ::Sprite
  3.     @@_animations = []
  4.     @@_reference_count = {}
  5.     def initialize(viewport = nil)
  6.       super(viewport)
  7.       @_whiten_duration = 0
  8.       @_appear_duration = 0
  9.       @_escape_duration = 0
  10.       @_collapse_duration = 0
  11.       @_damage_duration = 0
  12.       @_animation_duration = 0
  13.       @_blink = false
  14.     end
  15.     def dispose
  16.       dispose_damage
  17.       dispose_animation
  18.       dispose_loop_animation
  19.       super
  20.     end
  21.     def whiten
  22.       self.blend_type = 0
  23.       self.color.set(255, 255, 255, 128)
  24.       self.opacity = 255
  25.       @_whiten_duration = 16
  26.       @_appear_duration = 0
  27.       @_escape_duration = 0
  28.       @_collapse_duration = 0
  29.     end
  30.     def appear
  31.       self.blend_type = 0
  32.       self.color.set(0, 0, 0, 0)
  33.       self.opacity = 0
  34.       @_appear_duration = 16
  35.       @_whiten_duration = 0
  36.       @_escape_duration = 0
  37.       @_collapse_duration = 0
  38.     end
  39.     def escape
  40.       self.blend_type = 0
  41.       self.color.set(0, 0, 0, 0)
  42.       self.opacity = 255
  43.       @_escape_duration = 32
  44.       @_whiten_duration = 0
  45.       @_appear_duration = 0
  46.       @_collapse_duration = 0
  47.     end
  48.     def collapse
  49.       self.blend_type = 1
  50.       self.color.set(255, 64, 64, 255)
  51.       self.opacity = 255
  52.       @_collapse_duration = 48
  53.       @_whiten_duration = 0
  54.       @_appear_duration = 0
  55.       @_escape_duration = 0
  56.     end
  57.     def damage(value, critical)
  58.       dispose_damage
  59.       if value.is_a?(Numeric)
  60.         damage_string = value.abs.to_s
  61.       else
  62.         damage_string = value.to_s
  63.       end
  64.       bitmap = Bitmap.new(160, 48)
  65.       bitmap.font.name = "Arial Black"
  66.       bitmap.font.size = 32
  67.       bitmap.font.color.set(0, 0, 0)
  68.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  69.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  70.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  71.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  72.       if value.is_a?(Numeric) and value < 0
  73.         bitmap.font.color.set(176, 255, 144)
  74.       else
  75.         bitmap.font.color.set(255, 255, 255)
  76.       end
  77.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  78.       if critical
  79.         bitmap.font.size = 20
  80.         bitmap.font.color.set(0, 0, 0)
  81.         bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
  82.         bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
  83.         bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
  84.         bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
  85.         bitmap.font.color.set(255, 255, 255)
  86.         bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
  87.         animation = $data_animations[100]
  88.         animation(animation, true)
  89.       end
  90.       @_damage_sprite = ::Sprite.new(self.viewport)
  91.       @_damage_sprite.bitmap = bitmap
  92.       @_damage_sprite.ox = 80
  93.       @_damage_sprite.oy = 20
  94.       @_damage_sprite.x = self.x
  95.       @_damage_sprite.y = self.y - self.oy / 2
  96.       @_damage_sprite.z = 3000
  97.       @_damage_duration = 40
  98.     end
  99.     def animation(animation, hit)
  100.       dispose_animation
  101.       @_animation = animation
  102.       return if @_animation == nil
  103.       @_animation_hit = hit
  104.       @_animation_duration = @_animation.frame_max
  105.       animation_name = @_animation.animation_name
  106.       animation_hue = @_animation.animation_hue
  107.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  108.       if @@_reference_count.include?(bitmap)
  109.         @@_reference_count[bitmap] += 1
  110.       else
  111.         @@_reference_count[bitmap] = 1
  112.       end
  113.       @_animation_sprites = []
  114.       if @_animation.position != 3 or not @@_animations.include?(animation)
  115.         for i in 0..15
  116.           sprite = ::Sprite.new(self.viewport)
  117.           sprite.bitmap = bitmap
  118.           sprite.visible = false
  119.           @_animation_sprites.push(sprite)
  120.         end
  121.         unless @@_animations.include?(animation)
  122.           @@_animations.push(animation)
  123.         end
  124.       end
  125.       update_animation
  126.     end
  127.     def loop_animation(animation)
  128.       return if animation == @_loop_animation
  129.       dispose_loop_animation
  130.       @_loop_animation = animation
  131.       return if @_loop_animation == nil
  132.       @_loop_animation_index = 0
  133.       animation_name = @_loop_animation.animation_name
  134.       animation_hue = @_loop_animation.animation_hue
  135.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  136.       if @@_reference_count.include?(bitmap)
  137.         @@_reference_count[bitmap] += 1
  138.       else
  139.         @@_reference_count[bitmap] = 1
  140.       end
  141.       @_loop_animation_sprites = []
  142.       for i in 0..15
  143.         sprite = ::Sprite.new(self.viewport)
  144.         sprite.bitmap = bitmap
  145.         sprite.visible = false
  146.         @_loop_animation_sprites.push(sprite)
  147.       end
  148.       update_loop_animation
  149.     end
  150.     def dispose_damage
  151.       if @_damage_sprite != nil
  152.         @_damage_sprite.bitmap.dispose
  153.         @_damage_sprite.dispose
  154.         @_damage_sprite = nil
  155.         @_damage_duration = 0
  156.       end
  157.     end
  158.     def dispose_animation
  159.       if @_animation_sprites != nil
  160.         sprite = @_animation_sprites[0]
  161.         if sprite != nil
  162.           @@_reference_count[sprite.bitmap] -= 1
  163.           if @@_reference_count[sprite.bitmap] == 0
  164.             sprite.bitmap.dispose
  165.           end
  166.         end
  167.         for sprite in @_animation_sprites
  168.           sprite.dispose
  169.         end
  170.         @_animation_sprites = nil
  171.         @_animation = nil
  172.       end
  173.     end
  174.     def dispose_loop_animation
  175.       if @_loop_animation_sprites != nil
  176.         sprite = @_loop_animation_sprites[0]
  177.         if sprite != nil
  178.           @@_reference_count[sprite.bitmap] -= 1
  179.           if @@_reference_count[sprite.bitmap] == 0
  180.             sprite.bitmap.dispose
  181.           end
  182.         end
  183.         for sprite in @_loop_animation_sprites
  184.           sprite.dispose
  185.         end
  186.         @_loop_animation_sprites = nil
  187.         @_loop_animation = nil
  188.       end
  189.     end
  190.     def blink_on
  191.       unless @_blink
  192.         @_blink = true
  193.         @_blink_count = 0
  194.       end
  195.     end
  196.     def blink_off
  197.       if @_blink
  198.         @_blink = false
  199.         self.color.set(0, 0, 0, 0)
  200.       end
  201.     end
  202.     def blink?
  203.       @_blink
  204.     end
  205.     def effect?
  206.       @_whiten_duration > 0 or
  207.       @_appear_duration > 0 or
  208.       @_escape_duration > 0 or
  209.       @_collapse_duration > 0 or
  210.       @_damage_duration > 0 or
  211.       @_animation_duration > 0
  212.     end
  213.     def update
  214.       super
  215.       if @_whiten_duration > 0
  216.         @_whiten_duration -= 1
  217.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  218.       end
  219.       if @_appear_duration > 0
  220.         @_appear_duration -= 1
  221.         self.opacity = (16 - @_appear_duration) * 16
  222.       end
  223.       if @_escape_duration > 0
  224.         @_escape_duration -= 1
  225.         self.opacity = 256 - (32 - @_escape_duration) * 10
  226.       end
  227.       if @_collapse_duration > 0
  228.         @_collapse_duration -= 1
  229.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  230.       end
  231.       if @_damage_duration > 0
  232.         @_damage_duration -= 1
  233.         case @_damage_duration
  234.         when 38..39
  235.           @_damage_sprite.y -= 4
  236.         when 36..37
  237.           @_damage_sprite.y -= 2
  238.         when 34..35
  239.           @_damage_sprite.y += 2
  240.         when 28..33
  241.           @_damage_sprite.y += 4
  242.         end
  243.         @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
  244.         if @_damage_duration == 0
  245.           dispose_damage
  246.         end
  247.       end
  248.       if @_animation != nil and (Graphics.frame_count % 2 == 0)
  249.         @_animation_duration -= 1
  250.         update_animation
  251.       end
  252.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  253.         update_loop_animation
  254.         @_loop_animation_index += 1
  255.         @_loop_animation_index %= @_loop_animation.frame_max
  256.       end
  257.       if @_blink
  258.         @_blink_count = (@_blink_count + 1) % 32
  259.         if @_blink_count < 16
  260.           alpha = (16 - @_blink_count) * 6
  261.         else
  262.           alpha = (@_blink_count - 16) * 6
  263.         end
  264.         self.color.set(255, 255, 255, alpha)
  265.       end
  266.       @@_animations.clear
  267.     end
  268.     def update_animation
  269.       if @_animation_duration > 0
  270.         frame_index = @_animation.frame_max - @_animation_duration
  271.         cell_data = @_animation.frames[frame_index].cell_data
  272.         position = @_animation.position
  273.         animation_set_sprites(@_animation_sprites, cell_data, position)
  274.         for timing in @_animation.timings
  275.           if timing.frame == frame_index
  276.             animation_process_timing(timing, @_animation_hit)
  277.           end
  278.         end
  279.       else
  280.         dispose_animation
  281.       end
  282.     end
  283.     def update_loop_animation
  284.       frame_index = @_loop_animation_index
  285.       cell_data = @_loop_animation.frames[frame_index].cell_data
  286.       position = @_loop_animation.position
  287.       animation_set_sprites(@_loop_animation_sprites, cell_data, position)
  288.       for timing in @_loop_animation.timings
  289.         if timing.frame == frame_index
  290.           animation_process_timing(timing, true)
  291.         end
  292.       end
  293.     end
  294.     def animation_set_sprites(sprites, cell_data, position)
  295.       for i in 0..15
  296.         sprite = sprites[i]
  297.         pattern = cell_data[i, 0]
  298.         if sprite == nil or pattern == nil or pattern == -1
  299.           sprite.visible = false if sprite != nil
  300.           next
  301.         end
  302.         sprite.visible = true
  303.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  304.         if position == 3
  305.           if self.viewport != nil
  306.             sprite.x = self.viewport.rect.width / 2
  307.             sprite.y = self.viewport.rect.height - 160
  308.           else
  309.             sprite.x = 320
  310.             sprite.y = 240
  311.           end
  312.         else
  313.           sprite.x = self.x - self.ox + self.src_rect.width / 2
  314.           sprite.y = self.y - self.oy + self.src_rect.height / 2
  315.           sprite.y -= self.src_rect.height / 4 if position == 0
  316.           sprite.y += self.src_rect.height / 4 if position == 2
  317.         end
  318.         sprite.x += cell_data[i, 1]
  319.         sprite.y += cell_data[i, 2]
  320.         sprite.z = 2000
  321.         sprite.ox = 96
  322.         sprite.oy = 96
  323.         sprite.zoom_x = cell_data[i, 3] / 100.0
  324.         sprite.zoom_y = cell_data[i, 3] / 100.0
  325.         sprite.angle = cell_data[i, 4]
  326.         sprite.mirror = (cell_data[i, 5] == 1)
  327.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  328.         sprite.blend_type = cell_data[i, 7]
  329.       end
  330.     end
  331.     def animation_process_timing(timing, hit)
  332.       if (timing.condition == 0) or
  333.          (timing.condition == 1 and hit == true) or
  334.          (timing.condition == 2 and hit == false)
  335.         if timing.se.name != ""
  336.           se = timing.se
  337.           Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  338.         end
  339.         case timing.flash_scope
  340.         when 1
  341.           self.flash(timing.flash_color, timing.flash_duration * 2)
  342.         when 2
  343.           if self.viewport != nil
  344.             self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  345.           end
  346.         when 3
  347.           self.flash(nil, timing.flash_duration * 2)
  348.         end
  349.       end
  350.     end
  351.     def x=(x)
  352.       sx = x - self.x
  353.       if sx != 0
  354.         if @_animation_sprites != nil
  355.           for i in 0..15
  356.             @_animation_sprites[i].x += sx
  357.           end
  358.         end
  359.         if @_loop_animation_sprites != nil
  360.           for i in 0..15
  361.             @_loop_animation_sprites[i].x += sx
  362.           end
  363.         end
  364.       end
  365.       super
  366.     end
  367.     def y=(y)
  368.       sy = y - self.y
  369.       if sy != 0
  370.         if @_animation_sprites != nil
  371.           for i in 0..15
  372.             @_animation_sprites[i].y += sy
  373.           end
  374.         end
  375.         if @_loop_animation_sprites != nil
  376.           for i in 0..15
  377.             @_loop_animation_sprites[i].y += sy
  378.           end
  379.         end
  380.       end
  381.       super
  382.     end
  383.   end
  384. end
复制代码
放在Main前,脚本88行的100是动画编号自己改。
脚本是<飘渺北极雪>写的

如果是技能加几回合属性的话,在技能栏里面就能改了
=。=
                    ↑↑↑↑本人所发帖多为玩笑逗大家一乐,不用太当真↑↑↑↑
-------------------------------------分割线---------------------------------------
                                                      
                                  以下六人为本人爱妃团,严禁NTR
                  iisnowbbh梦回碧落迷糊的安安pigsss
tianlluo
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
110
在线时间
323 小时
注册时间
2012-2-20
帖子
236

开拓者

4
发表于 2012-2-20 20:32:27 | 只看该作者
本帖最后由 ArcDriver 于 2012-2-20 20:33 编辑

恩木,状态法是一个好方法~
除了LSS所说的办法外也可以通过稍微修改下脚本来实现~
简单说就是在释放技能后给角色附加状态,然后在战斗脚本的skill_effect和attack_effect部分判定一下,在这种状态下把伤害公式翻倍就好了~
附上饭粒一枚供参考,这里我只修改了skill_effect部分,全局搜索ArcDriver就能找到,如果想在翻倍状态下普通攻击也翻倍的话就在attack_effect部分依葫芦画瓢就好了咩~
伤害翻倍小饭粒.rar (188.16 KB, 下载次数: 53)
Glimmer系列应援~

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
309 小时
注册时间
2010-12-11
帖子
1434
5
发表于 2012-2-20 20:52:36 | 只看该作者
额, 不就是一个技能伤害数值那里加多一倍就行了吗,楼上那么复杂干什么呀

点评

既然那样也不复杂呀,加个状态力量和魔力都加20就行乐~  发表于 2012-2-20 21:18
LZ要的应该是使用了之后所有技能的伤害都翻倍的技能吧?  发表于 2012-2-20 20:58
NPC也是有名字的,我叫\c[2]\n[9]\c[0]....
(额..我不介意你们叫我小木的..)
快毕业了,最近忙里忙外的闲着
回复

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

6
发表于 2012-2-21 08:49:44 | 只看该作者
1.数据库-状态(把攻击力上升或防御力下降状态调到你想要的值)
2.给一个技能设定和攻击力相同,该攻击的属性为XX(在数据库-系统添加),在数据库-敌人中设定每个敌人对该属性都为A。

点评

对不起打错字orz..纯事件..  发表于 2012-2-21 20:18
哦哦,方法2倒是相当简单的蠢事件方法呢XD  发表于 2012-2-21 20:16
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
292 小时
注册时间
2012-1-26
帖子
56
7
 楼主| 发表于 2012-2-22 10:37:42 | 只看该作者
算了,算了,随便找个人结贴好了!
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 04:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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