搜索附件  

攻击效果.rar

 

各种攻击效果【魔法盾,吸血,吸蓝】:
无聊时做的小玩意儿,介绍请看脚本。

  1,魔法盾状态:当角色或敌人处于该状态时,总伤害 = 脚本设置的 HP 伤害百分比/100 + SP 伤害百分比/100
  2,吸血:当角色或敌人使用该吸血特技时,吸血量 = 总伤害 乘以 吸血 百分比/100
  3,吸蓝:当角色或敌人使用该吸蓝特技时,吸蓝量 = 对象 SP 减少量 乘以 百分比/100

建议下载工程,里面的东西已经调好,可直接测试。


脚本:
  1. #==============================================================================#★【攻击效果】★    《魔法盾,吸血,吸蓝》#------------------------------------------------------------------------------#   by  芯☆淡茹水#------------------------------------------------------------------------------#(该脚本为简易版,不显示角色因吸血;吸蓝等HP,SP改变而显示的数字。)#(角色具体的HP;SP改变的值,请看角色的HP;SP血槽。)#==============================================================================#◆ 使用方法:#              复制该脚本,插入到 main 前。#==============================================================================#◆ 说明:#------------------------------------------------------------------------------#Ⅰ魔法盾:     使用“魔法盾”特技,附加一个“魔法盾”的状态。当角色处于该状态#        时,受到的总伤害 = hp伤害 + sp伤害。hp,sp的具体伤害百分比,下面有设置。##              当角色 sp = 0 时,自动解除该“魔法盾”状态,受到的伤害全部恢复为#        hp 伤害。也可在数据库设置该“魔法盾”状态解除的条件。(比如持续几回合)#------------------------------------------------------------------------------#Ⅱ吸血:这个不用多介绍,下面有吸血量是总伤害的百分比设置。#  (百分比的设置:比如设置为 50  也就是 50% 。 攻击敌人的伤害是 100 的话,#    自身回复 HP 50 ;攻击敌人的伤害是 150 的话,自身回复 HP 75 ;,,,,)#------------------------------------------------------------------------------#Ⅲ吸蓝:使用吸蓝特技,被攻击者只减少 SP 。如果被攻击者 SP = 0 。使用吸蓝特技#        的伤害为 0 ,吸蓝无效。下面有吸蓝量百分比设置。#==============================================================================#◆ 设置项:#------------------------------------------------------------------------------INT_STATE_ID = 10          #“魔法盾”状态 ID 。INT_HP = 20                #“魔法盾”状态下 HP 减少的百分比。INT_SP = 80                #“魔法盾”状态下 SP 减少的百分比。SKILLRECOVER_HP_ID = 10    # 吸血特技 ID 。RECOVER_HP = 50            # 吸的 HP 量为总伤害的百分比。SKILLRECOVER_SP_ID = 11    # 吸蓝特技 ID 。RECOVER_SP = 50            # 吸收的 SP 量为对方失去 SP 的百分比。#==============================================================================class Game_Battler  #---------------------------------------------------------------------------  def attack_effect(attacker)    self.critical = false    hit_result = (rand(100) < attacker.hit)    if hit_result == true      atk = [attacker.atk - self.pdef / 2, 0].max      self.damage = atk * (20 + attacker.str) / 20      self.damage *= elements_correct(attacker.element_set)      self.damage /= 100      if self.damage > 0        if rand(100) < 4 * attacker.dex / self.agi          self.damage *= 2          self.critical = true        end        if self.guarding?          self.damage /= 2        end      end      if self.damage.abs > 0        amp = [self.damage.abs * 15 / 100, 1].max        self.damage += rand(amp+1) + rand(amp+1) - amp      end      eva = 8 * self.agi / attacker.dex + self.eva      hit = self.damage < 0 ? 100 : 100 - eva      hit = self.cant_evade? ? 100 : hit      hit_result = (rand(100) < hit)    end    if hit_result == true      remove_states_shock      if states.include?(INT_STATE_ID)        if self.sp == 0          self.hp -= self.damage          remove_state(INT_STATE_ID)        else          self.hp -= self.damage * INT_HP / 100          self.sp -= self.damage * INT_SP / 100        end      else       self.hp -= self.damage      end      @state_changed = false      states_plus(attacker.plus_state_set)      states_minus(attacker.minus_state_set)    else      self.damage = "Miss"      self.critical = false    end    return true  end  #----------------------------------------------------------------------------  def skill_effect(user, skill)    self.critical = false    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)      return false    end    effective = false    effective |= skill.common_event_id > 0    hit = skill.hit    if skill.atk_f > 0      hit *= user.hit / 100    end    hit_result = (rand(100) < hit)    effective |= hit < 100    if hit_result == true      power = skill.power + user.atk * skill.atk_f / 100      if power > 0        power -= self.pdef * skill.pdef_f / 200        power -= self.mdef * skill.mdef_f / 200        power = [power, 0].max      end      rate = 20      rate += (user.str * skill.str_f / 100)      rate += (user.dex * skill.dex_f / 100)      rate += (user.agi * skill.agi_f / 100)      rate += (user.int * skill.int_f / 100)      self.damage = power * rate / 20      self.damage *= elements_correct(skill.element_set)      self.damage /= 100      if self.damage > 0        if self.guarding?          self.damage /= 2        end      end      if skill.variance > 0 and self.damage.abs > 0        amp = [self.damage.abs * skill.variance / 100, 1].max        self.damage += rand(amp+1) + rand(amp+1) - amp      end      eva = 8 * self.agi / user.dex + self.eva      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100      hit = self.cant_evade? ? 100 : hit      hit_result = (rand(100) < hit)      effective |= hit < 100    end    if hit_result == true      if skill.power != 0 and skill.atk_f > 0        remove_states_shock        effective = true      end      last_hp = self.hp      if skill.id == SKILLRECOVER_SP_ID        if self.sp == 0          self.damage = 0          self.hp -= self.damage        else          self.sp -= self.damage          user.sp += self.damage * RECOVER_SP / 100        end      else        if states.include?(INT_STATE_ID)          if self.sp == 0            self.hp -= self.damage            remove_state(INT_STATE_ID)          else            self.hp -= self.damage * INT_HP / 100            self.sp -= self.damage * INT_SP / 100          end        else          self.hp -= self.damage        end      end      effective |= self.hp != last_hp      @state_changed = false      effective |= states_plus(skill.plus_state_set)      effective |= states_minus(skill.minus_state_set)      if skill.id == SKILLRECOVER_HP_ID        user.hp += self.damage * RECOVER_HP / 100      end      if skill.power == 0        self.damage = ""        unless @state_changed          self.damage = "Miss"        end      end    else      self.damage = "Miss"    end    unless $game_temp.in_battle      self.damage = nil    end    return effective  endend#==============================================================================复制代码
复制代码
工程:

   
             本帖来自P1论坛作者芯☆淡茹水,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=285921  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

GMT+8, 2024-9-21 12:38 , Processed in 0.037848 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部