RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Soulpour777 – Magic Critical Orpheus

0 Members and 1 Guest are viewing this topic.

*
Scripter
Rep:
Level 40
Crownless King
Magic Critial Orpheus
Version: 1.0
Author: Soulpour777
Date: 8 / 14 / 2014 - 1:11AM

Description


Description:
This script allows the developer to create a Magic Critical chance and damage. This makes not only physical attacks gain a critical hit by default but also gains a magic critical when certain magic is applied to the enemy when a certain armor is equipped. These armors that can cause a magic critical are bound by a certain notetag.

In addition, the magic critical's formula is as follows:

item.damage.critical ? user.mat * (Subtract_to_Mev_Initial - mev) : 0
or in other words, it bases on the user's magical attack multiplied by the result of the Subtract_to_Mev_Initial and Magical Evasion Rate. This is based from how critical hits are defaultly done.

Features

  • You can assign the Mev Initial Value
  • You can assign the damage multiplied to the original damage during Mag Crit
  • Add customized dialogs to show the result in each.

Instructions

Note Tags:
To make an armor create a Magic Critical, put this on the armor's notes:
<magcrit>

Script


Code: [Select]
#==============================================================================
# ** Magic Critical Orpheus
# Author: Soulpour777
# Web URL: infinitytears.wordpress.com
# 8 / 14 / 2014 - 1:11AM
#------------------------------------------------------------------------------
# Description:
# This script allows the developer to create a Magic Critical chance and
# damage. This makes not only physical attacks gain a critical hit by default
# but also gains a magic critical when certain magic is applied to the enemy
# when a certain armor is equipped. These armors that can cause a magic critical
# are bound by a certain notetag.
# In addition, the magic critical's formula is as follows:
# item.damage.critical ? user.mat * (Subtract_to_Mev_Initial - mev) : 0
# or in other words, it bases on the user's magical attack multiplied by
# the result of the Subtract_to_Mev_Initial and Magical Evasion Rate. This
# is based from how critical hits are defaultly done.
#------------------------------------------------------------------------------
# Features:
# The developer has the following features to look at:
# 1. You can assign the Mev Initial Value
# 2. You can assign the damage multiplied to the original damage during Mag Crit
# 3. Add customized dialogs to show the result in each.
#------------------------------------------------------------------------------
# Note Tags:
# To make an armor create a Magic Critical, put this on the armor's notes:
# /<magcrit>/i
#------------------------------------------------------------------------------
# Terms of Use:
# This script is originally written by Soulpour777. Therefore, the script
# below is under his terms of use. This script is free for both commercial
# and non commercial use. If this script is used, please give proper credit.
#------------------------------------------------------------------------------
# The user is free to:
# Modify the script
# Adapt the script
#------------------------------------------------------------------------------
#==============================================================================
module Soulpour
  module Magic_Critical_Orpheus
    # The Initial Value Subtracted to the Actor's Magical Evasion Rate
    Subtract_to_Mev_Initial = 1
    # The damage multiplied to the original damage as Magic Critical
    Mag_Crit_Damage = 3 #=> Same Default as Critical Hits
    # Magic Critical Damage when applied to actor
    MagCrit_To_Actor = "A magnificent magical blow!"
    # Magic Critical Damage when applied to enemy
    MagCrit_To_Enemy = "A powerful magical attack!"
  end
end


class Game_ActionResult
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor                                                   :magcrit
  #--------------------------------------------------------------------------
  # * Alias Listings
  #-------------------------------------------------------------------------- 
  alias :soul_magic_critical_rgss_clear_hit_flags            :clear_hit_flags
  alias :soul_magic_critical_rgss_make_damage                    :make_damage
  #--------------------------------------------------------------------------
  # * Clear Hit Flags
  #--------------------------------------------------------------------------
  def clear_hit_flags
    soul_magic_critical_rgss_clear_hit_flags
    @magcrit = false
  end 
 
  #--------------------------------------------------------------------------
  # * Create Damage
  #--------------------------------------------------------------------------
  def make_damage(value, item)
    @magcrit = false if value == 0
    soul_magic_critical_rgss_make_damage(value, item)
  end 
 
end

class Game_System
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias :soul_magic_critical_display_initialize                   :initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor                                      :magcrit_display_message
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    soul_magic_critical_display_initialize
    @magcrit_display_message = nil
  end
end


class Game_Battler < Game_BattlerBase
  include Soulpour::Magic_Critical_Orpheus
  #--------------------------------------------------------------------------
  # * Calculate Critical Rate of Skill/Item
  #--------------------------------------------------------------------------
  def mag_cri(user, item)
    item.damage.critical ? user.mat * (Subtract_to_Mev_Initial - mev) : 0
  end 
  #--------------------------------------------------------------------------
  # * Apply Critical
  #--------------------------------------------------------------------------
  def apply_magcrit(damage)
    damage * Mag_Crit_Damage
  end
  #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = (!@result.missed && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        @result.magcrit = (rand < mag_cri(user, item))
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end 
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    value *= pdr if item.physical?
    if item.magical?
      if user.is_a?(Game_Actor)
        user.equips.each do |equip|
          next unless equip
          if equip.note=~ /<magcrit>/i
            value *= mdr + apply_magcrit(value)
          else
            value *= mdr
          end
        end
      else
        value *= mdr
      end
    end
    value *= rec if item.damage.recover?
    value = apply_critical(value) if @result.critical
    $game_system.magcrit_display_message = true if @result.magcrit
    value = apply_magcrit(value) if @result.magcrit
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    @result.make_damage(value.to_i, item)
  end
end

class Window_BattleLog < Window_Selectable
  include Soulpour::Magic_Critical_Orpheus
  #--------------------------------------------------------------------------
  # * Display Critical Hit
  #--------------------------------------------------------------------------
  def display_magic_critical(target, item)
    if $game_system.magcrit_display_message
      text = target.actor? ? MagCrit_To_Actor : MagCrit_To_Enemy
      add_text(text)
      wait
    end
  end
  #--------------------------------------------------------------------------
  # * Display Action Results
  #--------------------------------------------------------------------------
  def display_action_results(target, item)
    if target.result.used
      last_line_number = line_number
      display_magic_critical(target, item)
      display_damage(target, item)
      display_affected_status(target, item)
      display_failure(target, item)
      wait if line_number > last_line_number
      back_to(last_line_number)
    end
  end 
end

Credit


  • Soulpour777

Support


For support, please comment down or PM me at this forum.

Known Compatibility Issues

None

Author's Notes


If you are wondering why all my new scripts are entitled with Orpheus, its a Phi Brain reference.

Terms of Use


Terms of Use:
This script is originally written by Soulpour777. Therefore, the script below is under his terms of use. This script is free for both commercial and non commercial use. If this script is used, please give proper credit.

The user is free to:
Modify the script
Adapt the script
« Last Edit: August 13, 2014, 05:45:14 PM by SoulPour777 »


If you like my work, please do support me on Patreon.
https://www.patreon.com/Soulpour777?ty=h

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Thanks for sharing that Soulpour. I guess I had never noticed that magic attacks couldn't critical.

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
I like this idea. Magic is typically explained away as being a product of the caster's intellect or spiritual bond to the elements. It would make sense then that if something in their head just *clicked* at the right moment and they had an epiphany, or if they happened to be tapping into an especially rich reserve of energy, they'd get a bigger boom.

Do you think it would be possible to add support for unique magi-crit animations?

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - Story2014 Queen of RMRKProject of the Year 20142011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
Thanks for sharing that Soulpour. I guess I had never noticed that magic attacks couldn't critical.

Huh. o.o I didn't notice that either...

Seems like a pretty cool script to even things out for the magic users! B) I've considered games where some characters fight with magical attacks only, and this will come in handy! Thanks, soulpour! Your scripts are awesome, as usual. :)
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]