Nebukadnezar II
Member
Hello guys. Im using atoas acbs and his drain addon as you can see below.
It allows one to add an drain effect on skills, items, weapons.
for example:
Drain_Action['Skill'][116] = {'hp' => [50, 27, 161, true, true]}
the skill id 116 has a 50% chance to absorb 27% of the damage the user did to a monster. And the animation 161 will be shown.
But besides the skill, weapon, item option - I also want the same options for states. I want the script to be able to choose a state and as long as a battler has the certain state he will absorb a certain amount of HP or SP when performing normal attacks or skills.
It should look like this:
Drain_Action['State'][30] = {'hp' => [50, 27, 161, true, true, true, true, true]}
It means: When a battler would inflicted with state 30, he had a 50% chance to absorb 27% of the damage he dealt. 161 means animation 161 will popup when absorb works.
Note that I've put another 3 trues which are not included in the the script itself. The least 3 trues are just something I came up with. The first true makes clear that the absorb state works with normal attacks, the second true makes clear it works for physical attacks and the last true makes clear that it works with magical attacks.
So the absorb would come with any normal, magical, physical attacks as long the battler is inflicted with the state I mentioned.
I hope my english is enough to get my message out.
Thanks in advance.
It allows one to add an drain effect on skills, items, weapons.
for example:
Drain_Action['Skill'][116] = {'hp' => [50, 27, 161, true, true]}
the skill id 116 has a 50% chance to absorb 27% of the damage the user did to a monster. And the animation 161 will be shown.
But besides the skill, weapon, item option - I also want the same options for states. I want the script to be able to choose a state and as long as a battler has the certain state he will absorb a certain amount of HP or SP when performing normal attacks or skills.
It should look like this:
Drain_Action['State'][30] = {'hp' => [50, 27, 161, true, true, true, true, true]}
It means: When a battler would inflicted with state 30, he had a 50% chance to absorb 27% of the damage he dealt. 161 means animation 161 will popup when absorb works.
Note that I've put another 3 trues which are not included in the the script itself. The least 3 trues are just something I came up with. The first true makes clear that the absorb state works with normal attacks, the second true makes clear it works for physical attacks and the last true makes clear that it works with magical attacks.
So the absorb would come with any normal, magical, physical attacks as long the battler is inflicted with the state I mentioned.
I hope my english is enough to get my message out.
Thanks in advance.
Code:
#==============================================================================
# Skill Drain
# By Atoa
#==============================================================================
# This script allow to create skills and equips that adds the effect 'drain'
# of HP and SP.
# That way attacks and skills can absorb part of the damage caused
#==============================================================================
module Atoa
# Do not remove this line
Drain_Action = {'Skill' => {}, 'Weapon' => {}, 'Item' => {}}
# Do not remove this line
# Drain_Action[action_type][id] = {drain_type => [success, rate, anim_id, pop, show_excedent],...}
# action_type = action type
# action_type = 'Skill' for skills, 'Weapon' for weapons, 'Item' for items
# id = ID of the skill/weapon/item
# drain_type = drain type
# 'hp' for HP drain, 'sp' for SP drain
# success = absorb success rate
# rate = % of damage converted in HP/SP
# anim_id = ID of the animation shown when absorb HP/SP, leave nil or 0 for
# no animation
#
Drain_Action['Skill'][116] = {'hp' => [50, 27, 161, true, true]}
# 'sp' =>[100, 50, 88, true, false]}
#Drain_Action['Skill'][904] = {'hp' => [100, 100, nil, true, true]}
#Drain_Action['Skill'][308] = {'hp' => [100, 100, nil, true, true]}
Drain_Action['Weapon'][43] = {'hp' => [50, 50, nil, true, true]}
end
#==============================================================================
# ■ Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa Drain'] = true
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# Esta classe gerencia os jogadores da batalha.
# Esta classe identifica os Aliados ou Heróis como (Game_Actor) e
# os Inimigos como (Game_Enemy).
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# Variáveis Públicas
#--------------------------------------------------------------------------
attr_accessor :base_absorb
#--------------------------------------------------------------------------
# Inicialização do Objeto
#--------------------------------------------------------------------------
alias initialize_drain initialize
def initialize
initialize_drain
@base_absorb = 0
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# Esta classe processa a tela de Batalha
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# Atualização da fase 4 do personagem (parte 1)
# battler : Battler ativo
#--------------------------------------------------------------------------
alias step4_part2_drain step4_part2
def step4_part2(battler)
step4_part2_drain(battler)
set_drain_damage(battler)
end
#--------------------------------------------------------------------------
# Atualização da fase 4 do personagem (parte 3)
# battler : Battler ativo
#--------------------------------------------------------------------------
alias step4_part3_drain step4_part3
def step4_part3(battler)
step4_part3_drain(battler)
action = battler.now_action
if action != nil and Drain_Action[action.type_name] != nil and
Drain_Action[action.type_name].include?(action_id(action))
absorb_damage(battler, battler.base_absorb, Drain_Action[action.type_name][action_id(action)].dup)
end
end
#--------------------------------------------------------------------------
# Definir dano do dreno
# battler : Battler ativo
#--------------------------------------------------------------------------
def set_drain_damage(battler)
battler.base_absorb = 0
for target in battler.target_battlers
battler.base_absorb += target.damage if target.damage.numeric?
end
end
#--------------------------------------------------------------------------
# Absover dano
# battler : Battler ativo
# absorb : valor de absorção
# action : Ação
#--------------------------------------------------------------------------
def absorb_damage(battler, absorb, action)
for type in action.keys
if type == 'hp' and (action[type][0] >= rand(100))
base_absorb = ((absorb * action[type][1]) / 100).to_i
if base_absorb > 0
difference = battler.maxhp - battler.hp
base_absorb = [base_absorb, difference].min
elsif base_absorb < 0
base_absorb = [base_absorb, - battler.hp].max
end
if base_absorb != 0
battler.damage = - base_absorb
battler.hp -= battler.damage
battler.animation_id = action[type][2].nil? ? 0 : action[type][2]
battler.damage_pop = action[type][3]
wait(3) if battler.damage != 0
end
end
if type == 'sp' and (action[type][0] >= rand(100))
base_absorb = ((absorb * action[type][1]) / 100).to_i
if base_absorb > 0
difference = battler.maxsp - battler.sp
base_absorb = [base_absorb, difference].min
elsif base_absorb < 0
base_absorb = [base_absorb, - battler.sp].max
end
if base_absorb != 0
battler.damage = - base_absorb
battler.sp -= battler.damage
battler.animation_id = action[type][2].nil? ? 0 : action[type][2]
battler.damage_pop = action[type][3]
battler.sp_damage = action[type][3]
wait(3) if battler.damage != 0
end
end
end
end
end