#==============================================================================
# ** Doom States, Items & Skills
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2007-11-27
# SDK : Version 2.0+, Part I
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2007-11-27)
#------------------------------------------------------------------------------
# * Requirements :
#
# Method & Class Library (2.2+)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to inflict a "Doom" state on battlers. After a
# battler passes through x turns, doom will be cast and the battler will be
# KO'd right away. States, Items & Skills may cast, and cure the Doom state.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
#------------------------------------------------------------------------------
# * Customization :
#
# Doom Word when counting down
# - Word_Countdown = 'word'
# Doom Word when countdown finished
# - Word_Finish = 'word'
#
# Doom Inflicting States, Items & Skills
# - Doom_Inflicting_States = {state_id => turns, ...}
# - Doom_Inflicting_Items = {item_id => turns, ...}
# - Doom_Inflicting_Skills = {skill_id => turns, ...}
#
# Forms of turns :
# n - Direct number of turns
# min..max - Random number between min and max
# [min, max] - Random number between min and max
#
# Doom Removing States, Items & Skills
# - Doom_Removing_States = [state_id, ...]
# - Doom_Removing_Items = [item_id, ...]
# - Doom_Removing_Skills = [skill_id, ...]
#------------------------------------------------------------------------------
# * Syntax :
#
# Changing/Reading Doom Counter
# - <game_battler>.doom_counter = nil or nil
#
# Item, State or Skill Doom Settings
# - <rpg::object>.adds_doom?
# - <rpg::object>.removes_doom?
# - <rpg::object>.doon_turns
#------------------------------------------------------------------------------
# * Terms & Conditions :
#
# Free - Non-Commercial Game
# 10 USD - Commercial License
#
# This script is not to be modified or redistributed without the author's
# consent.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Doom States, Items & Skills', 'SephirothSpawn', 1.0, '2007-')
SDK.check_requirements(2.0, [], {'Method & Class Library' => 2.1})
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Doom States, Items & Skills')
#==============================================================================
# ** Doom
#==============================================================================
module Doom
#--------------------------------------------------------------------------
# * Doom Word
#--------------------------------------------------------------------------
Word_Countdown = 'Doom'
Word_Finish = 'DOOM !'
#--------------------------------------------------------------------------
# * Doom Inflicting States, Items & Skills
#
# Doom_Inflicting_States = {state_id => turns, ...}
# Doom_Inflicting_Items = {item_id => turns, ...}
# Doom_Inflicting_Skills = {skill_id => turns, ...}
#
# Forms of turns
#
# n - Direct number of turns
# min..max - Random number between min and max
# [min, max] - Random number between min and max
#--------------------------------------------------------------------------
Doom_Inflicting_States = {}
Doom_Inflicting_Items = {}
Doom_Inflicting_Skills = {}
# State 17 - Random Number between 3 & 5
Doom_Inflicting_States[17] = 3..5
#--------------------------------------------------------------------------
# * Doom Removing States, Items & Skills
#
# Doom_Removing_States = [state_id, ...]
# Doom_Removing_Items = [item_id, ...]
# Doom_Removing_Skills = [skill_id, ...]
#--------------------------------------------------------------------------
Doom_Removing_States = []
Doom_Removing_Items = []
Doom_Removing_Skills = []
end
#==============================================================================
# ** RPG::State
#==============================================================================
class RPG::State
#--------------------------------------------------------------------------
# * Adds Doom?
#--------------------------------------------------------------------------
def adds_doom?
return Doom::Doom_Inflicting_States.has_key?(@id)
end
#--------------------------------------------------------------------------
# * Removes Doom?
#--------------------------------------------------------------------------
def removes_doom?
return Doom::Doom_Removing_States.include?(@id)
end
#--------------------------------------------------------------------------
# * Doom Turns
#--------------------------------------------------------------------------
def doom_turns
# Return 0 if Doesn't Add Doom
return 0 unless adds_doom?
# Gets Turn
turn = Doom::Doom_Inflicting_States[@id]
# Fix Turn
turn = turn.random if turn.is_a?(Array) || turn.is_a?(Range)
# Return Turn
return turn
end
end
#==============================================================================
# ** RPG::Item
#==============================================================================
class RPG::Item
#--------------------------------------------------------------------------
# * Adds Doom?
#--------------------------------------------------------------------------
def adds_doom?
return Doom::Doom_Inflicting_Items.has_key?(@id)
end
#--------------------------------------------------------------------------
# * Removes Doom?
#--------------------------------------------------------------------------
def removes_doom?
return Doom::Doom_Removing_Items.include?(@id)
end
#--------------------------------------------------------------------------
# * Doom Turns
#--------------------------------------------------------------------------
def doom_turns
# Return 0 if Doesn't Add Doom
return 0 unless adds_doom?
# Gets Turn
turn = Doom::Doom_Inflicting_Items[@id]
# Fix Turn
turn = turn.random if turn.is_a?(Array) || turn.is_a?(Range)
# Return Turn
return turn
end
end
#==============================================================================
# ** RPG::Skills
#==============================================================================
class RPG::Skills
#--------------------------------------------------------------------------
# * Adds Doom?
#--------------------------------------------------------------------------
def adds_doom?
return Doom::Doom_Inflicting_Skills.has_key?(@id)
end
#--------------------------------------------------------------------------
# * Removes Doom?
#--------------------------------------------------------------------------
def removes_doom?
return Doom::Doom_Removing_Skills.include?(@id)
end
#--------------------------------------------------------------------------
# * Doom Turns
#--------------------------------------------------------------------------
def doom_turns
# Return 0 if Doesn't Add Doom
return 0 unless adds_doom?
# Gets Turn
turn = Doom::Doom_Inflicting_Skills[@id]
# Fix Turn
turn = turn.random if turn.is_a?(Array) || turn.is_a?(Range)
# Return Turn
return turn
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :doom_counter
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_doomskill_gmbtlr_as, :add_state
alias_method :seph_doomskill_gmbtlr_se, :skill_effect
alias_method :seph_doomskill_gmbtlr_ie, :item_effect
#--------------------------------------------------------------------------
# * Add State
#--------------------------------------------------------------------------
def add_state(state_id, force = false)
# Checks if state already included
has_state = @states.include?(state_id)
# Original Add State
seph_doomskill_gmbtlr_as(state_id, force)
# If state is now included and wasn't before
if has_state == false && @states.include?(state_id)
# Gets state data
state = $data_states[state_id]
# If Adds Doom
if state.adds_doom?
# Sets Doom Counter
@doom_counter = (@doom_counter.nil? ? state.doom_turns :
[@doom_counter, state.doom_turns].min)
# If Removes Doom
elsif state.removes_doom?
# Clear Doom Counter
@doom_counter = nil
end
end
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# Gets Original Result
result = seph_doomskill_gmbtlr_se(user, skill)
# If Effective
if result
# If Adds Doom
if skill.adds_doom?
# Sets Doom Counter
@doom_counter = (@doom_counter.nil? ? skill.doom_turns :
[@doom_counter, skill.doom_turns].min)
# If Removes Doom
elsif skill.removes_doom?
# Clear Doom Counter
@doom_counter = nil
end
end
# Return Effective
return result
end
#--------------------------------------------------------------------------
# * Application of Item Effects
#--------------------------------------------------------------------------
def item_effect(item)
# Gets Original Result
result = seph_doomskill_gmbtlr_ie(item)
# If Effective
if result
# If Adds Doom
if item.adds_doom?
# Sets Doom Counter
@doom_counter = (@doom_counter.nil? ? item.doom_turns :
[@doom_counter, item.doom_turns].min)
# If Removes Doom
elsif item.removes_doom?
# Clear Doom Counter
@doom_counter = nil
end
end
# Return Effective
return result
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_doom_scnbtl_up4s2, :update_phase4_step2
#--------------------------------------------------------------------------
# * Frame Update : Phase 4 - Step 2
#--------------------------------------------------------------------------
def update_phase4_step2
# If active battler has doom counter
if @active_battler.doom_counter != nil
# Decrease counter
@active_battler.doom_counter -= 1
# If counter finished
if @active_battler.doom_counter < 0
# Clear Doom Counter
@active_battler.doom_counter = nil
# Set Damage String
@active_battler.damage = DoomStates::Word_Finish
@active_battler.damage_pop = true
# Subtract HP
@active_battler.hp -= @active_battler.hp
# Set Wait Count
@wait_count = 8
return
end
# Set Damage String
w, n = DoomStates::Word_Countdown, @active_battler.doom_counter
@active_battler.damage = "#{w} #{n}"
@active_battler.damage_pop = true
# Set Wait Count
@wait_count = 8
end
# Original Update Phase 4 Step 2
seph_doom_scnbtl_up4s2
end
end
#------------------------------------------------------------------------------
# ** End SDK Enable Test
#------------------------------------------------------------------------------
end