Heyho,
kurz vor Weihnachten nochmal ein Script von mir. :)
Was macht das Script?
Was macht das Script?
#
# Waffen und Rüstungen können mehr als 1Mio. Kosten.
# Waffen mit Eigenschaften einer Rüstung?
# Waffen die gezielt deine CRIT oder HIT Werte anheben lassen,
# oder Rüstungen deine Ausweichchance?
# Items können die Attribute des Actors auch senken.
# Außerdem ist es möglich ATK, DEF, AGI und SPI prozentual anheben zu lassen.
Und wie funktioniert das Script?
# Benutzung:
# Einfach als neues Script über Main einfügen.
#
# Im Script ab Zeile 73 könnt ihr die Eigenschaften einzelner Items anpassen.
# Ihr geht dabei so vor:
#
# @weapon_atkp = {
# ID1 => WERT1,
# ID2 => WERT2,
# }
#
# Hier nochmal deutlicher:
# @weapon_atkp = {
# 1 => 5, # Weapon oder Armor mit der ID 1 erhöht die ATK um 5 %
# 3 => 9, # " "" "" "" "" ID 3 "" "" "" um 9 %
# 4 => 12, # usw.
# }
#
#
# Für Eigenschaften wie Halbierte MP-Kosten, doppelte EXP, Auto HP usw.
# müsst ihr als Wert 1 angeben.
#
# WENN NICHTS EINGETRAGEN WIRD, WERDEN DIE WERTE DER DATABASE ENTNOMMEN!
Das Script
Aktuell
v.0.4
Was ist Neu?
~ Was ist Neu?
#~ v0.4
#~
#~ ? Übersicht und Konfiguration leichter gestaltet, MP 0 hinzugefügt?
Das Script
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~ Equipment Anpassung
#~ 25.12.08
#~ Credits: Shinji aka Spike
#
# Version 0.4
#
# Was macht das Script?
#
# Waffen und Rüstungen können mehr als 1Mio. Kosten.
# Waffen mit Eigenschaften einer Rüstung?
# Waffen die gezielt deine CRIT oder HIT Werte anheben lassen,
# oder Rüstungen deine Ausweichchance?
# Items können die Attribute des Actors auch senken.
# Außerdem ist es möglich ATK, DEF, AGI und SPI prozentual anheben zu lassen.
#
#
# Benutzung:
# Einfach als neues Script über Main einfügen.
#
# Im Script ab Zeile 73 könnt ihr die Eigenschaften einzelner Items anpassen.
# Ihr geht dabei so vor:
#
# @weapon_atkp = {
# ID1 => WERT1,
# ID2 => WERT2,
# }
#
# Hier nochmal deutlicher:
# @weapon_atkp = {
# 1 => 5, # Weapon oder Armor mit der ID 1 erhöht die ATK um 5 %
# 3 => 9, # " "" "" "" "" ID 3 "" "" "" um 9 %
# 4 => 12, # usw.
# }
#
#
# Für Eigenschaften wie Halbierte MP-Kosten, doppelte EXP, Auto HP usw.
# müsst ihr als Wert 1 angeben.
#
# WENN NICHTS EINGETRAGEN WIRD, WERDEN DIE WERTE DER DATABASE ENTNOMMEN!
#
#
#
#~ Was ist Neu?
#~
#~ v0.2
#~
#~ ? Folgende Eigenschaften nun auf Waffen und Rüstungen festgelegt werden ?
#~
#~ ? Doppelte Erfahrung
#~ ? Auto HP Recovery
#~ ? Auto MP Recovery
#~ ? Kritische Treffer verhindern
#~ ? Mana-Kosten halbieren
#~ ? Preise unbegrenzt
#~
#~
#~ v0.3
#~
#~ ? ATK, DEF, SPI und AGI werden jetzt prozentual gesteigert angegeben ?
#~
#~
#~ v0.4
#~
#~ ? Übersicht und Konfiguration leichter gestaltet, MP 0 hinzugefügt?
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Equipment_Anpassung
def initialize
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ¦ Hier werden die Attribute angepasst
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@weapon_atkp = {} # Prozentualer ATK Bonus
@weapon_defp = {} # Prozentualer DEF Bonus
@weapon_agip = {} # Prozentualer AGI Bonus
@weapon_spip = {} # Prozentualer SPI Bonus
@weapon_hit = {} # HIT Wert der Waffen
@weapon_cri = {} # CRIT Wert der Waffen
@weapon_price = {} # Wie teuer darfs denn sein?
@weapon_half_mp_cost = {} # Halbierte MP Kosten?
@weapon_prevent_critical = {} # kritische Treffer verhindern?
@weapon_double_exp_gain = {} # doppelte Erfahrung erhalten?
@weapon_auto_hp_recover = {} # automatische HP-Regeneration?
@weapon_auto_mp_recover = {} # automatische MP-Regeneration?
@weapon_mp_cost_null = {} # MP 0?
@armor_atkp = {} # prozentualer ATK Bonus
@armor_defp = {} # prozentualer DEF Bonus
@armor_agip = {} # prozentualer AGI Bonus
@armor_spip = {} # prozentualer SPI Bonus
@armor_eva = {} # EVA Wert der Rüstungen
@armor_price = {} # Wie teuer darfs denn sein?
@armor_half_mp_cost = {} # Halbierte MP Kosten?
@armor_prevent_critical = {} # kritische Treffer verhindern?
@armor_double_exp_gain = {} # doppelte Erfahrung erhalten?
@armor_auto_hp_recover = {} # automatische HP-Regeneration?
@armor_auto_mp_recover = {} # automatische MP-Regeneration?
@armor_mp_cost_null = {} # MP 0?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# IGNORIEREN, AUßER DU WEIßT WAS DU TUST
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ATK% Wert den Waffen zuweisen
@weapon_atkp.values.each do |weapon|
$data_weapons[@weapon_atkp.index(weapon)].atkp = weapon
end
# DEF% Wert den Waffen zuweisen
@weapon_defp.values.each do |weapon|
$data_weapons[@weapon_defp.index(weapon)].defp = weapon
end
# AGI% Wert den Waffen zuweisen
@weapon_agip.values.each do |weapon|
$data_weapons[@weapon_agip.index(weapon)].agip = weapon
end
# SPI% Wert den Waffen zuweisen
@weapon_spip.values.each do |weapon|
$data_weapons[@weapon_spip.index(weapon)].spip = weapon
end
# HIT Wert den Waffen zuweisen
@weapon_hit.values.each do |weapon|
$data_weapons[@weapon_hit.index(weapon)].hit = weapon
end
# CRI Wert den Waffen zuweisen
@weapon_cri.values.each do |weapon|
$data_weapons[@weapon_cri.index(weapon)].cri = weapon
end
# PREIS der Waffen zuweisen
@weapon_price.values.each do |weapon|
$data_weapons[@weapon_price.index(weapon)].price = weapon
end
# HALF-MP den Waffen zuweisen
@weapon_half_mp_cost.values.each do |weapon|
$data_weapons[@weapon_half_mp_cost.index(weapon)].half_mp_cost = weapon
end
# CRIT-IMMUNITÄT den Waffen zuweisen
@weapon_prevent_critical.values.each do |weapon|
$data_weapons[@weapon_prevent_critical.index(weapon)].prevent_critical = weapon
end
# EXP x 2 den Waffen zuweisen
@weapon_double_exp_gain.values.each do |weapon|
$data_weapons[@weapon_double_exp_gain.index(weapon)].double_exp_gain = weapon
end
# AUTO-HP den Waffen zuweisen
@weapon_auto_hp_recover.values.each do |weapon|
$data_weapons[@weapon_auto_hp_recover.index(weapon)].auto_hp_recover = weapon
end
# AUTO-MP den Waffen zuweisen
@weapon_auto_mp_recover.values.each do |weapon|
$data_weapons[@weapon_auto_mp_recover.index(weapon)].auto_mp_recover = weapon
end
# MP 0 den Waffen zuweisen
@weapon_mp_cost_null.values.each do |weapon|
$data_weapons[@weapon_mp_cost_null.index(weapon)].mp_cost_null = weapon
end
# ATK Wert den Rüstungen zuweisen
@armor_atkp.values.each do |armor|
$data_armors[@armor_atkp.index(armor)].atkp = armor
end
# DEF Wert den Rüstugnen zuweisen
@armor_defp.values.each do |armor|
$data_armors[@armor_defp.index(armor)].defp = armor
end
# AGI Wert den Rüstungen zuweisen
@armor_agip.values.each do |armor|
$data_armors[@armor_agip.index(armor)].agip = armor
end
# SPI Wert den Rüstungen zuweisen
@armor_spip.values.each do |armor|
$data_armors[@armor_spip.index(armor)].spip = armor
end
# EVA Wert den Rüstungen zuweisen
@armor_eva.values.each do |armor|
$data_armors[@armor_eva.index(armor)].eva = armor
end
# PREIS der Rüstungen zuweisen
@armor_price.values.each do |armor|
$data_armors[@armor_price.index(armor)].price = armor
end
# HALF-MP den Rüstungen zuweisen
@armor_half_mp_cost.values.each do |armor|
$data_armors[@armor_half_mp_cost.index(armor)].half_mp_cost = armor
end
# CRIT-IMMUNITÄT den Rüstungen zuweisen
@armor_prevent_critical.values.each do |armor|
$data_armors[@armor_prevent_critical.index(armor)].prevent_critical = armor
end
# EXP x 2 den Rüstungen zuweisen
@armor_double_exp_gain.values.each do |armor|
$data_armors[@armor_double_exp_gain.index(armor)].double_exp_gain = armor
end
# AUTO-HP den Rüstungen zuweisen
@armor_auto_hp_recover.values.each do |armor|
$data_armors[@armor_auto_hp_recover.index(armor)].auto_hp_recover = armor
end
# AUTO-MP den Rüstungen zuweisen
@armor_auto_mp_recover.values.each do |armor|
$data_armors[@armor_auto_mp_recover.index(armor)].auto_mp_recover = armor
end
# MP 0 den Rüstungen zuweisen
@armor_mp_cost_null.values.each do |armor|
$data_armors[@armor_mp_cost_null.index(armor)].mp_cost_null = armor
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Battler
# prozentualer atk bonus
def atk
n = [[base_atk + @atk_plus, 1].max, 999].min
if actor?
for item in equips.compact
n += ((n * item.atkp)/ 100.0) if item.atkp != nil
end
end
for state in states do n *= state.atk_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
# prozentualer def bonus
def def
n = [[base_def + @def_plus, 1].max, 999].min
if actor?
for item in equips.compact
n += ((n * item.defp)/ 100.0) if item.defp != nil
end
end
for state in states do n *= state.def_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
# prozentualer spi bonus
def spi
n = [[base_spi + @spi_plus, 1].max, 999].min
if actor?
for item in equips.compact
n += ((n * item.spip)/ 100.0) if item.spip != nil
end
end
for state in states do n *= state.spi_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
# prozentualer agi bonus
def agi
n = [[base_agi + @agi_plus, 1].max, 999].min
if actor?
for item in equips.compact
n += ((n * item.agip)/ 100.0) if item.agip != nil
end
end
for state in states do n *= state.agi_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
# crit bonus
def cri
n = 4
n += 4 if actor.critical_bonus
for weapon in weapons.compact
n += 4 if weapon.critical_bonus
end
for weapon in weapons.compact
n += weapon.cri if weapon.cri != nil
end
return n
end
# MP null
def calc_mp_cost(skill)
if mp_cost_null
return 0
elsif half_mp_cost
return skill.mp_cost / 2
else
return skill.mp_cost
end
end
# mp-kosten null?
def mp_cost_null
if actor?
for item in equips.compact
return true if item.mp_cost_null
end
end
return false
end
# halbierte MP Kosten
def half_mp_cost
if actor?
for item in equips.compact
return true if item.half_mp_cost
end
end
return false
end
# kritische Treffer verhindern
def prevent_critical
if actor?
for item in equips.compact
return true if item.prevent_critical
end
end
return false
end
# doppelte EXP
def double_exp_gain
if actor?
for item in equips.compact
return true if item.double_exp_gain
end
end
return false
end
# HP Regeneration
def auto_hp_recover
if actor?
for item in equips.compact
return true if item.auto_hp_recover
end
end
return false
end
# MP Regeneration
def auto_mp_recover
if actor?
for item in equips.compact
return true if item.auto_mp_recover
end
end
return false
end
# Do MP & HP Regeneration
def do_auto_recover
if auto_mp_recover and not dead?
then self.mp += maxmp / 20
end
if auto_hp_recover and not dead?
then self.hp += maxhp / 20
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Party < Game_Unit
def on_player_walk
for actor in members
if actor.slip_damage?
actor.hp -= 1 if actor.hp > 1 # Poison damage
$game_map.screen.start_flash(Color.new(255,0,0,64), 4)
end
if actor.auto_hp_recover and actor.hp > 0
actor.hp += 1 # HP auto recovery
end
if actor.auto_mp_recover
actor.mp += 1 # MP auto recovery
end
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# module WeApon
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module RPG
class Weapon < BaseItem
def initialize
super
@atkp = 0
@defp = 0
@agip = 0
@spip = 0
@cri = 0
@prevent_critical = false
@half_mp_cost = false
@double_exp_gain = false
@auto_hp_recover = false
@auto_mp_recover = false
@mp_cost_null = false
end
attr_accessor :defp
attr_accessor :spip
attr_accessor :agip
attr_accessor :atkp
attr_accessor :cri
attr_accessor :half_mp_cost
attr_accessor :prevent_critical
attr_accessor :double_exp_gain
attr_accessor :auto_hp_recover
attr_accessor :auto_mp_recover
attr_accessor :mp_cost_null
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# module Arm0r
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module RPG
class Armor < BaseItem
def initialize
super
@atkp = 0
@defp = 0
@agip = 0
@spip = 0
@element_rate = []
@auto_mp_recover = false
@mp_cost_null = false
end
attr_accessor :defp
attr_accessor :spip
attr_accessor :agip
attr_accessor :atkp
attr_accessor :element_rate
attr_accessor :auto_mp_recover
attr_accessor :mp_cost_null
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Klasse aufrufen
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Scene_Title
alias spk_new_game command_new_game
def command_new_game
Equipment_Anpassung.new
spk_new_game
end
end
EDIT3: Version 0.4 steht euch jetzt zur Verfügung!
EDIT2: Version 0.3 steht euch jetzt zur Verfügung!
EDIT1: Version 0.2 steht euch jetzt zur Verfügung!
Ich bin für Kritik, Vorschläge oder Fragen jeglicher Art offen!
Und bitte meldet Bugs.
Selbst wenn ihr es nicht braucht, schreibt wenigstens was dazu!
Danke.
mfg Shinji
Sehr guter skript da muss ich recht geben.
Aber mal ne dumme frage, auch wenn ich mich täusche aber gibts das nicht alles schon???
In der KGC skriptsammlung ist sowas dabei. Waffen haben Rüssi eigenschaften, zocken leben beim Angriff
satt MP verbrauchen sie HP, erhöhte crit + ausweichchance. Is alles dabei, nur das mit dem 1mille Kosten ist mir neu.
Trotzdem vielen dank für deine Bemühungen, schöner skript.
PS: Hier ein Beispiel
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ? Equipment Effects - KGC_AddEquipmentOptions ? VX ?
#_/ ? Last Update: 2008/04/01 ?
#_/ ? Translation by Mr. Anonymous ?
#_/-----------------------------------------------------------------------------
#_/ This script allows the designer to add additional effects to items, weapons
#_/ and armor. You add effects through tags, such as <Auto HP Recover 10%>
#_/=============================================================================
#_/ ? 2008/03/29 UPDATE [KCG] ?
#_/ Added "MP Conversion" and "MP Absorbtion"
#_/=============================================================================
#_/ ? Instructions For Usage ?
#_/ To make use of these functions, you must insert the desired tag into the
#_/ "Notes" box located in the appropriate section of the database. For
#_/ example, you want a magic Robe to restore a small amount of MP before
#_/ each combat round combat, you would locate the robe in the armor tab of
#_/ the database and insert "<auto MP recover 10%>" (without quotations)
#_/ in the note box. Simple, no? Note: Tags are case-sensitive.
#_/
#_/ Key:
#_/ * Rate = Numerical value of desired outcome.
#_/ * Modifier = Subtraction, Addition, Mulpication, etc
#_/ * ElementalID = The number of the desired "Element Name" (See Database)
#_/ * StateID = The number of the desired "State" (See Database)
#_/
#_/ ? Restored Combat Functions ?
#_/
#_/ ? Shields - Headgear - Accessories Related ?
#_/ <auto HP recover Rate %>
#_/ Automatically regenerate a specified percentage of HP at the beginning of
#_/ each combat round. It can also be written without the rate and percentile.
#_/
#_/ <auto MP recover Rate %>
#_/ Automatically regenerate a specified percentage of MP at the beginning of
#_/ each combat round. It can also be written without the rate and percentile.
#_/
#_/ <MP absorb Rate %>
#_/ Absorb a specified amount of MP based on a percentile of damage the actor
#_/ recieved.
#_/
#_/ <MP convert Rate %>
#_/ Converts a specified amount of MP that depends on the amount of MP the
#_/ attacking foe uses for an attack.
#_/
#_/ <element resist ElementID: Modifier Rate %>
#_/ Resist a specified amount of damage from a specified element.
#_/ Modifier is optional.
#_/
#_/ <element weakness ElementID: Modifier Rate>
#_/ Damage from specified element is increased by 1.5 times to the character
#_/ equipped with the tagged weapon.
#_/
#_/ <element half ElementID>
#_/ Damage from specified element is divided in half.
#_/
#_/ <element null ElementID>
#_/ Damaged from specified element is completely nullified (cancelled).
#_/
#_/ <element absorb ElementID: Modifier Rate>
#_/ Damage from specified element is completely absorbed.
#_/
#_/ <state resist stateID: Modifier Rate %>
#_/ Resist a specified state.
#_/
#_/ ? Weapons Related ?
#_/
#_/ <prevent critical>
#_/ Prevent critical attacks done by equipped character.
#_/
#_/ <half MP cost>
#_/ Decreases MP spent on skills by 50%.
#_/
#_/ <double exp>
#_/ Increases experience points gained from defeated foes in battle by 50%.
#_/
#_/
#_/ ? Body Gear Related ?
#_/ <fast attack>
#_/ Adds "Preemptive Strike" aka "Fast Attack" to the character.
#_/
#_/ <dual attack>
#_/ Adds the "Dual Attack" style to the character, allowing the character to
#_/ equip attack twice in a row on every attack.
#_/
#_/ <critical bonus>
#_/ Same as the Critical Bonus in the Actors Database.
#_/
#_/ <attack element ElementID>
#_/ Adds additional elements to the character's default attack.
#_/
#_/ <plus state StateID>
#_/ Adds additional status effects to the character's default attack.
#_/=============================================================================
#_/ Installation: Insert above Main.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#==============================================================================#
# ? Customization ? #
#==============================================================================#
module KGC
module AddEquipmentOptions
# ? <auto HP recover> Default HP Recovery Rate (Percentile)
# (When not manually assigned)
# Allows you to change the default amount of HP recovered per-round.
DEFAULT_RECOVER_HP_RATE = 5
# ? <auto MP recover> Default MP Recovery Rate (Percentile)
# (When not manually assigned)
# Allows you to change the default amount of HP recovered per-round.
DEFAULT_RECOVER_MP_RATE = 5
# ? <MP convert> Default MP Conversion Rate (Percentile)
# (When not manually assigned)
# Allows you to change the default amount of MP converted on damage.
DEFAULT_CONVERT_MP_RATE = 1
# ? <MP absorb> Default MP Absorbtion Rate (Percentile)
# (When not manually assigned)
# Allows you to change the default amount of MP absorbed on damage.
DEFAULT_ABSORB_MP_RATE = 5
end
end
## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Unless you know what you're doing, it's best not to alter anything beyond #
# this point, as this only affects the tags used for "Notes" in database. #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Whatever word(s) are after the separator ( | ) in the following lines are
# what are used to determine what is searched for in the "Notes" section.
$imported = {} if $imported == nil
$imported["AddEquipmentOptions"] = true
module KGC::AddEquipmentOptions
# Regular Expressions Defined
module Regexp
# Base Item Module
module BaseItem
# Multi Attack Tag String
MULTI_ATTACK = /<(\d+)\s*(?:TIMES_ATTACK|multiatk)>/i
# HP Automatic Recovery Tag String
AUTO_HP_RECOVER = /<(?:AUTO_HP_RECOVER|auto HP recover)(\s*(\d+)([%%])?)?>/i
# MP Automatic Recovery Tag String
AUTO_MP_RECOVER = /<(?:AUTO_MP_RECOVER|auto MP recover)(\s*(\d+)([%%])?)?>/i
# MP conversion Tag String
CONVERT_MP = /<(?:CONVERT_MP|MP convert)\s*(\d+)?[%%]?>/i
# MP Absorbtion Tag String
ABSORB_MP = /<(?:ABSORB_MP|MP absorb)\s*(\d+)?[%%]?>/i
# Attribute Resistance Tag String
ELEMENT_RESISTANCE =
/<(?:ELEMENT_RESISTANCE|element resist)\s*(\d+):(\-?\d+)[%%]?>/i
# Attribute Weakness Tag String
WEAK_ELEMENT =
/<(?:WEAK_ELEMENT|element weakness)\s*(\d+(?:\s*,\s*\d+)*)>/i
# Attribute Half Damage Tag String
GUARD_ELEMENT =
/<(?:GUARD_ELEMENT|element half)\s*(\d+(?:\s*,\s*\d+)*)>/i
# Attribute Nullification Tag String
INVALID_ELEMENT =
/<(?:INVALID_ELEMENT|element null)\s*(\d+(?:\s*,\s*\d+)*)>/i
# Attribute Absorbtion Tag String
ABSORB_ELEMENT =
/<(?:ABSORB_ELEMENT|element absorb)\s*(\d+(?:\s*,\s*\d+)*)>/i
# State Resistance Tag String
STATE_RESISTANCE =
/<(?:STATE_RESISTANCE|state resist)\s*(\d+):(\d+)[%%]?>/i
end
# Base Weapon Module
module Weapon
# Critical Prevention Tag String
PREVENT_CRITICAL = /<(?:PREVENT_CRITICAL|prevent critical)>/i
# Half MP Consumption Tag String
HALF_MP_COST = /<(?:HALF_MP_COST|half MP cost)>/i
# Experience Gain x2 Tag String
DOUBLE_EXP_GAIN = /<(?:DOUBLE_EXP_GAIN|double exp)>/i
end
# Base Armor Module
module Armor
# Premptive Attack Tag String
FAST_ATTACK = /<(?:FAST_ATTACK|fast attack)>/i
# Dual Attack Tag String
DUAL_ATTACK = /<(?:DUAL_ATTACK|dual attack)>/i
# Critial Bonus Tag String
CRITICAL_BONUS = /<(?:CRITICAL_BONUS|critical bonus)>/i
# Attack Element Tag String
ATTACK_ELEMENT =
/<(?:ATTACK_ELEMENT|attack element)\s*(\d+(?:\s*,\s*\d+)*)>/i
# Status Addition Tag String
PLUS_STATE = /<(?:PLUS_STATE|plus state)\s*(\d+(?:\s*,\s*\d+)*)>/i
end
end
end
#==============================================================================
# ¦ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ? Additional Equipment Augmentation Compilation
#--------------------------------------------------------------------------
def create_add_equipment_options_cache
@__multi_attack_count = 1
@__auto_hp_recover = false
@__auto_hp_recover_value = 0
@__auto_hp_recover_rate = 0
@__auto_mp_recover = false
@__auto_mp_recover_value = 0
@__auto_mp_recover_rate = 0
@__convert_mp_rate = 0
@__absorb_mp_rate = 0
@note.split(/[\r\n]+/).each { |line|
case line
when KGC::AddEquipmentOptions::Regexp::BaseItem::MULTI_ATTACK
# n???
@__multi_attack_count = [$1.to_i, 1].max
when KGC::AddEquipmentOptions::Regexp::BaseItem::AUTO_HP_RECOVER
# HP????
@__auto_hp_recover = true
next if $1 == nil
if $3 != nil
@__auto_hp_recover_rate += $2.to_i
else
@__auto_hp_recover_value += $2.to_i
end
when KGC::AddEquipmentOptions::Regexp::BaseItem::AUTO_MP_RECOVER
# MP????
@__auto_mp_recover = true
next if $1 == nil
if $3 != nil
@__auto_mp_recover_rate += $2.to_i
else
@__auto_mp_recover_value += $2.to_i
end
when KGC::AddEquipmentOptions::Regexp::BaseItem::CONVERT_MP
# MP??
@__convert_mp_rate = ($1 != nil ?
$1.to_i : KGC::AddEquipmentOptions::DEFAULT_CONVERT_MP_RATE)
when KGC::AddEquipmentOptions::Regexp::BaseItem::ABSORB_MP
# MP??
@__absorb_mp_rate = ($1 != nil ?
$1.to_i : KGC::AddEquipmentOptions::DEFAULT_ABSORB_MP_RATE)
end
}
create_resistance_cache
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def create_resistance_cache
@__element_resistance = []
@__weak_element_set = []
@__guard_element_set = []
@__invalid_element_set = []
@__absorb_element_set = []
@__state_resistance = []
@note.split(/[\r\n]+/).each { |line|
case line
when KGC::AddEquipmentOptions::Regexp::BaseItem::ELEMENT_RESISTANCE
# ????
element_id = $1.to_i
value = $2.to_i
if @__element_resistance[element_id] == nil
@__element_resistance[element_id] = 100
end
@__element_resistance[element_id] -= (100 - value)
when KGC::AddEquipmentOptions::Regexp::BaseItem::WEAK_ELEMENT
# ????
$1.scan(/\d+/).each { |num|
@__weak_element_set << num.to_i
}
when KGC::AddEquipmentOptions::Regexp::BaseItem::GUARD_ELEMENT
# ????
$1.scan(/\d+/).each { |num|
@__guard_element_set << num.to_i
}
when KGC::AddEquipmentOptions::Regexp::BaseItem::INVALID_ELEMENT
# ????
$1.scan(/\d+/).each { |num|
@__invalid_element_set << num.to_i
}
when KGC::AddEquipmentOptions::Regexp::BaseItem::ABSORB_ELEMENT
# ????
$1.scan(/\d+/).each { |num|
@__absorb_element_set << num.to_i
}
when KGC::AddEquipmentOptions::Regexp::BaseItem::STATE_RESISTANCE
# ??????
state_id = $1.to_i
value = $2.to_i
if @__state_resistance[state_id] == nil
@__state_resistance[state_id] = 100
end
@__state_resistance[state_id] -= (100 - value)
end
}
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def multi_attack_count
create_add_equipment_options_cache if @__multi_attack_count == nil
return @__multi_attack_count
end
#--------------------------------------------------------------------------
# ? ??????? [HP????]
#--------------------------------------------------------------------------
def auto_hp_recover
create_add_equipment_options_cache if @__auto_hp_recover == nil
return @__auto_hp_recover
end
#--------------------------------------------------------------------------
# ? ??????? [MP????]
#--------------------------------------------------------------------------
def auto_mp_recover
create_add_equipment_options_cache if @__auto_mp_recover == nil
return @__auto_mp_recover
end
#--------------------------------------------------------------------------
# ? HP ????? (??)
#--------------------------------------------------------------------------
def auto_hp_recover_value
create_add_equipment_options_cache if @__auto_hp_recover_value == nil
return @__auto_hp_recover_value
end
#--------------------------------------------------------------------------
# ? HP ????? (??)
#--------------------------------------------------------------------------
def auto_hp_recover_rate
create_add_equipment_options_cache if @__auto_hp_recover_rate == nil
return @__auto_hp_recover_rate
end
#--------------------------------------------------------------------------
# ? MP ????? (??)
#--------------------------------------------------------------------------
def auto_mp_recover_value
create_add_equipment_options_cache if @__auto_mp_recover_value == nil
return @__auto_mp_recover_value
end
#--------------------------------------------------------------------------
# ? MP ????? (??)
#--------------------------------------------------------------------------
def auto_mp_recover_rate
create_add_equipment_options_cache if @__auto_mp_recover_rate == nil
return @__auto_mp_recover_rate
end
#--------------------------------------------------------------------------
# ? MP ???
#--------------------------------------------------------------------------
def convert_mp_rate
create_add_equipment_options_cache if @__convert_mp_rate == nil
return @__convert_mp_rate
end
#--------------------------------------------------------------------------
# ? MP ???
#--------------------------------------------------------------------------
def absorb_mp_rate
create_add_equipment_options_cache if @__absorb_mp_rate == nil
return @__absorb_mp_rate
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def element_resistance
create_add_equipment_options_cache if @__element_resistance == nil
return @__element_resistance
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def weak_element_set
create_add_equipment_options_cache if @__weak_element_set == nil
return @__weak_element_set
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def guard_element_set
create_add_equipment_options_cache if @__guard_element_set == nil
return @__guard_element_set
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def invalid_element_set
create_add_equipment_options_cache if @__invalid_element_set == nil
return @__invalid_element_set
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def absorb_element_set
create_add_equipment_options_cache if @__absorb_element_set == nil
return @__absorb_element_set
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def state_resistance
create_add_equipment_options_cache if @__state_resistance == nil
return @__state_resistance
end
end
#==================================End Class===================================#
#==============================================================================
# ¦ RPG::Weapon
#==============================================================================
class RPG::Weapon < RPG::BaseItem
#--------------------------------------------------------------------------
# ? ????????????????
#--------------------------------------------------------------------------
def create_add_equipment_options_cache
super
@__prevent_critical = false
@__half_mp_cost = false
@__double_exp_gain = false
@note.split(/[\r\n]+/).each { |line|
case line
when KGC::AddEquipmentOptions::Regexp::Weapon::PREVENT_CRITICAL
# ????????
@__prevent_critical = true
when KGC::AddEquipmentOptions::Regexp::Weapon::HALF_MP_COST
# ??MP??
@__half_mp_cost = true
when KGC::AddEquipmentOptions::Regexp::Weapon::DOUBLE_EXP_GAIN
# ?????2?
@__double_exp_gain = true
end
}
end
#--------------------------------------------------------------------------
# ? ??????? [????????]
#--------------------------------------------------------------------------
def prevent_critical
create_add_equipment_options_cache if @__prevent_critical == nil
return @__prevent_critical
end
#--------------------------------------------------------------------------
# ? ??????? [??MP??]
#--------------------------------------------------------------------------
def half_mp_cost
create_add_equipment_options_cache if @__half_mp_cost == nil
return @__half_mp_cost
end
#--------------------------------------------------------------------------
# ? ??????? [?????2?]
#--------------------------------------------------------------------------
def double_exp_gain
create_add_equipment_options_cache if @__double_exp_gain == nil
return @__double_exp_gain
end
end
#==================================End Class===================================#
#==============================================================================
# ¦ RPG::Armor
#==============================================================================
class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ? ????????????????
#--------------------------------------------------------------------------
def create_add_equipment_options_cache
super
@__fast_attack = false
@__dual_attack = false
@__critical_bonus = false
@__attack_element_set = []
@__plus_state_set = []
@note.split(/[\r\n]+/).each { |line|
case line
when KGC::AddEquipmentOptions::Regexp::Armor::FAST_ATTACK
# ??????
@__fast_attack = true
when KGC::AddEquipmentOptions::Regexp::Armor::DUAL_ATTACK
# ????
@__dual_attack = true
when KGC::AddEquipmentOptions::Regexp::Armor::CRITICAL_BONUS
# ????????
@__critical_bonus = true
when KGC::AddEquipmentOptions::Regexp::Armor::ATTACK_ELEMENT
# ????
$1.scan(/\d+/).each { |num|
@__attack_element_set << num.to_i
}
when KGC::AddEquipmentOptions::Regexp::Armor::PLUS_STATE
# ??????
$1.scan(/\d+/).each { |num|
@__plus_state_set << num.to_i
}
end
}
end
#--------------------------------------------------------------------------
# ? ??????? [??????]
#--------------------------------------------------------------------------
def fast_attack
create_add_equipment_options_cache if @__fast_attack == nil
return @__fast_attack
end
#--------------------------------------------------------------------------
# ? ??????? [????]
#--------------------------------------------------------------------------
def dual_attack
create_add_equipment_options_cache if @__dual_attack == nil
return @__dual_attack
end
#--------------------------------------------------------------------------
# ? ??????? [????????]
#--------------------------------------------------------------------------
def critical_bonus
create_add_equipment_options_cache if @__critical_bonus == nil
return @__critical_bonus
end
#--------------------------------------------------------------------------
# ? ??????? [HP????]
#--------------------------------------------------------------------------
def auto_hp_recover
return (@auto_hp_recover || super)
end
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
def attack_element_set
create_add_equipment_options_cache if @__attack_element_set == nil
return @__attack_element_set
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def plus_state_set
create_add_equipment_options_cache if @__plus_state_set == nil
return @__plus_state_set
end
end
#==================================End Class===================================#
#==============================================================================
# ¦ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def multi_attack_count
return 1
end
#--------------------------------------------------------------------------
# ? ?????????????
# attacker : ???
# ??? @hp_damage ??????
#--------------------------------------------------------------------------
alias make_attack_damage_value_KGC_AddEquipmentOptions make_attack_damage_value
def make_attack_damage_value(attacker)
make_attack_damage_value_KGC_AddEquipmentOptions(attacker)
make_convert_mp_value(attacker)
make_absorb_mp_value(attacker)
end
#--------------------------------------------------------------------------
# ? ???????????????????
# user : ??????????????
# obj : ??????????
# ??? @hp_damage ??? @mp_damage ??????
#--------------------------------------------------------------------------
alias make_obj_damage_value_KGC_AddEquipmentOptions make_obj_damage_value
def make_obj_damage_value(user, obj)
make_obj_damage_value_KGC_AddEquipmentOptions(user, obj)
make_convert_mp_value(user, obj)
make_absorb_mp_value(user, obj)
end
#--------------------------------------------------------------------------
# ? MP ??????
#--------------------------------------------------------------------------
def calc_convert_mp_rate
return 0
end
#--------------------------------------------------------------------------
# ? MP ??????
#--------------------------------------------------------------------------
def calc_absorb_mp_rate
return 0
end
#--------------------------------------------------------------------------
# ? MP ???????
# user : ???
# obj : ?????????? (nil ??????)
# ??? @hp_damage ??? @mp_damage ??????
#--------------------------------------------------------------------------
def make_convert_mp_value(user, obj = nil)
return if @hp_damage <= 0 # ????????????
rate = calc_convert_mp_rate
return if rate == 0 # ???? 0 ???????
@mp_damage -= [@hp_damage * rate / 100, 1].max
end
#--------------------------------------------------------------------------
# ? MP ???????
# user : ???
# obj : ?????????? (nil ??????)
# ??? @hp_damage ??? @mp_damage ??????
#--------------------------------------------------------------------------
def make_absorb_mp_value(user, obj = nil)
return unless mp_absorb?(user, obj)
# HP ????? MP ??????
rate = elements_max_rate( (obj == nil ? user : obj).element_set )
rate = rate.abs * calc_absorb_mp_rate / 100
@mp_damage -= [@hp_damage.abs * rate / 100, 1].max
@hp_damage = 0
end
#--------------------------------------------------------------------------
# ? MP ????
# user : ???
# obj : ?????????? (nil ??????)
#--------------------------------------------------------------------------
def mp_absorb?(user, obj = nil)
if obj.is_a?(RPG::UsableItem)
return false if obj.base_damage < 0 # ?????????
if obj.is_a?(RPG::Item)
# ?????????????
return false if obj.hp_recovery_rate > 0 || obj.hp_recovery > 0
end
end
return false if calc_absorb_mp_rate == 0 # ???? 0 ???????
rate = elements_max_rate( (obj == nil ? user : obj).element_set )
return false if rate >= 0 # ????????????
return true
end
end
#==================================End Class===================================#
#==============================================================================
# ¦ Game_BattleAction
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
alias make_attack_targets_KGC_AddEquipmentOptions make_attack_targets
def make_attack_targets
buf = make_attack_targets_KGC_AddEquipmentOptions
targets = buf.clone
# n ???
(battler.multi_attack_count - 1).times { targets += buf }
return targets
end
end
#==================================End Class===================================#
#==============================================================================
# ¦ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ????????
# element_id : ?? ID
#--------------------------------------------------------------------------
alias element_rate_KGC_AddEquipmentOptions element_rate
def element_rate(element_id)
result = element_rate_KGC_AddEquipmentOptions(element_id)
# ?????
result = result * element_resistance(element_id) / 100
absorb_flag = (result < 0)
result = result.abs
equips.compact.each { |item|
if item.invalid_element_set.include?(element_id) # ??
result = 0
break
end
if item.guard_element_set.include?(element_id) # ??
result /= 2
end
if item.weak_element_set.include?(element_id) # ??
result = result * 3 / 2
end
absorb_flag |= item.absorb_element_set.include?(element_id) # ?????
}
result = -result if absorb_flag
return result
end
#--------------------------------------------------------------------------
# ? ???????
# element_id : ?? ID
#--------------------------------------------------------------------------
def element_resistance(element_id)
n = 100
equips.compact.each { |item|
if item.element_resistance[element_id] != nil
n += item.element_resistance[element_id] - 100
end
}
return n
end
#--------------------------------------------------------------------------
# ? ?????????????
# state_id : ???? ID
#--------------------------------------------------------------------------
alias state_probability_KGC_AddEquipmentOptions state_probability
def state_probability(state_id)
result = state_probability_KGC_AddEquipmentOptions(state_id)
return result * state_resistance(state_id) / 100
end
#--------------------------------------------------------------------------
# ? ?????????
# state_id : ???? ID
#--------------------------------------------------------------------------
def state_resistance(state_id)
n = 100
equips.compact.each { |item|
if item.state_resistance[state_id] != nil
n += item.state_resistance[state_id] - 100
end
}
return [n, 0].max
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias element_set_KGC_AddEquipmentOptions element_set
def element_set
result = element_set_KGC_AddEquipmentOptions
armors.compact.each { |armor|
result |= armor.attack_element_set
}
return result
end
#--------------------------------------------------------------------------
# ? ????????? (??????) ??
#--------------------------------------------------------------------------
alias plus_state_set_KGC_AddEquipmentOptions plus_state_set
def plus_state_set
result = plus_state_set_KGC_AddEquipmentOptions
armors.compact.each { |armor|
result |= armor.plus_state_set
}
return result
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
alias cri_KGC_AddEquipmentOptions cri
def cri
n = cri_KGC_AddEquipmentOptions
armors.compact.each { |armor|
n += 4 if armor.critical_bonus
}
return n
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def multi_attack_count
result = [1]
equips.compact.each { |item|
result << item.multi_attack_count
}
return result.max
end
#--------------------------------------------------------------------------
# ? ??????? [??????] ???
#--------------------------------------------------------------------------
alias fast_attack_KGC_AddEquipmentOptions fast_attack
def fast_attack
return true if fast_attack_KGC_AddEquipmentOptions
armors.compact.each { |armor|
return true if armor.fast_attack
}
return false
end
#--------------------------------------------------------------------------
# ? ??????? [????] ???
#--------------------------------------------------------------------------
alias dual_attack_KGC_AddEquipmentOptions dual_attack
def dual_attack
# 2?????????
return false if multi_attack_count >= 2
return true if dual_attack_KGC_AddEquipmentOptions
armors.compact.each { |armor|
return true if armor.dual_attack
}
return false
end
#--------------------------------------------------------------------------
# ? ??????? [????????] ???
#--------------------------------------------------------------------------
alias prevent_critical_KGC_AddEquipmentOptions prevent_critical
def prevent_critical
return true if prevent_critical_KGC_AddEquipmentOptions
weapons.compact.each { |weapon|
return true if weapon.prevent_critical
}
return false
end
#--------------------------------------------------------------------------
# ? ??????? [?? MP ??] ???
#--------------------------------------------------------------------------
alias half_mp_cost_KGC_AddEquipmentOptions half_mp_cost
def half_mp_cost
return true if half_mp_cost_KGC_AddEquipmentOptions
weapons.compact.each { |weapon|
return true if weapon.half_mp_cost
}
return false
end
#--------------------------------------------------------------------------
# ? ??????? [????? 2 ?] ???
#--------------------------------------------------------------------------
alias double_exp_gain_KGC_AddEquipmentOptions double_exp_gain
def double_exp_gain
return true if double_exp_gain_KGC_AddEquipmentOptions
weapons.compact.each { |weapon|
return true if weapon.double_exp_gain
}
return false
end
#--------------------------------------------------------------------------
# ? ??????? [HP ????] ???
#--------------------------------------------------------------------------
alias auto_hp_recover_KGC_AddEquipmentOptions auto_hp_recover
def auto_hp_recover
return true if auto_hp_recover_KGC_AddEquipmentOptions
weapons.compact.each { |weapon|
return true if weapon.auto_hp_recover
}
return false
end
#--------------------------------------------------------------------------
# ? ??????? [MP ????] ???
#--------------------------------------------------------------------------
def auto_mp_recover
equips.compact.each { |item|
return true if item.auto_mp_recover
}
return false
end
#--------------------------------------------------------------------------
# ? HP ????????
#--------------------------------------------------------------------------
def auto_hp_recover_value
value = 0
rate = 0
equips.compact.each { |item|
value += item.auto_hp_recover_value
rate += item.auto_hp_recover_rate
}
# ??????
if value == 0 && rate == 0
n = maxhp * KGC::AddEquipmentOptions::DEFAULT_RECOVER_HP_RATE / 100
else
n = value + (maxhp * rate / 100)
end
return [n, 1].max
end
#--------------------------------------------------------------------------
# ? MP ????????
#--------------------------------------------------------------------------
def auto_mp_recover_value
value = 0
rate = 0
equips.compact.each { |item|
value += item.auto_mp_recover_value
rate += item.auto_mp_recover_rate
}
# ??????
if value == 0 && rate == 0
n = maxmp * KGC::AddEquipmentOptions::DEFAULT_RECOVER_MP_RATE / 100
else
n = value + (maxmp * rate / 100)
end
return [n, 1].max
end
#--------------------------------------------------------------------------
# ? ??????? (???????????)
#--------------------------------------------------------------------------
def do_auto_recovery
return if dead?
self.hp += auto_hp_recover_value if auto_hp_recover
self.mp += auto_mp_recover_value if auto_mp_recover
end
#--------------------------------------------------------------------------
# ? MP ??????
#--------------------------------------------------------------------------
def calc_convert_mp_rate
n = 0
equips.compact.each { |item| n += item.convert_mp_rate }
return n
end
#--------------------------------------------------------------------------
# ? MP ??????
#--------------------------------------------------------------------------
def calc_absorb_mp_rate
n = 0
equips.compact.each { |item| n += item.absorb_mp_rate }
return n
end
end
#==================================End Class===================================#
#==============================================================================
# ¦ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ? HP ??????
# target : ???
# obj : ??????????
#--------------------------------------------------------------------------
alias display_hp_damage_KGC_AddEquipmentOptions display_hp_damage
def display_hp_damage(target, obj = nil)
if target.hp_damage == 0 && target.mp_damage < 0
return if target.mp_absorb?(@active_battler, obj) # MP ??
end
display_hp_damage_KGC_AddEquipmentOptions(target, obj)
end
end
#==================================End Class===================================#
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ The original untranslated version of this script can be found here:
# http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/equip&tech=add_equipment_options
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
Grüß Klex