CREDITS
ANLEITUNG
In den Notes eines Eintrags in Weapons, Armors, States und Enemies dient <Konter:Wahrscheinlichkeit%> zum Einstellen von der Konterwahrscheinlichkeit. Das Konter kann man im Skript ändern und Wahrscheinlichkeit muss durch eine Zahl ersetzt werden. Die Konterwahrscheinlichkeit wird addiert, falls z.B. ein Held eine Waffe mit Konterwahrscheinlichkeit und eine Rüstung mit Konterwahrscheinlichkeit besitzt.
Ebenfalls kann man einstellen, dass bei einem Actor bzw. Enemy kein Konter auf dessen Attacken möglich ist durch <Konter nicht möglich>, dass man in den Notes eines Eintrags in Weapon, Armors, Skills oder Enemies schreibt. Dies ist ebenfalls im Skript austauschbar.
Wenn man ausstellen will, ob Skills auch gekontert werden, ändert man das true in dieser ZeileSKILL_COUNTER = true
ab in false.
SKRIPT
#==============================================================================
# ** Konter v1.00 (von Space not far)
#-----------------------------------------------------------------------------
# Ermöglicht einen Actor oder einen Enemy eine Attacke kontern.
#==============================================================================
#==============================================================================
# ** SNF
#==============================================================================
module SNF
# ????????????????????(true/false)
COUNTER_VOID = false
# Sollen Skills auch gekontert werden?
SKILL_COUNTER = true
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
# Teil des Eintrags in den Notes der Ausrüstung, Enemies und/Oder Skills
# um die Konterrate festzulegen; muss normalerweise nicht geändert werden
SNF_COUNTER = "Konter"
# durch diesen Eintrag in den Notes eines Actors bzw. Gegners
# ist ein Konter auf eine Attacke von ihn nicht möglich
SNF_VOID_COUNTER = "<Konter nicht möglich>"
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :countered
#--------------------------------------------------------------------------
# * Calculate counter rate
#--------------------------------------------------------------------------
def snf_counter_calc(attacker)
counter_prob = 0
if self.is_a?(Game_Actor)
# Equipment
for equip in self.equips.compact
memo = equip.note.scan(/<#{SNF_COUNTER}[::](\S+)[%%]>/)
memo = memo.flatten
if memo != nil and not memo.empty?
counter_prob += memo[0].to_i
end
end
else
# Enemy
memo = self.enemy.note.scan(/<#{SNF_COUNTER}[::](\S+)[%%]>/)
memo = memo.flatten
if memo != nil and not memo.empty?
counter_prob += memo[0].to_i
end
end
# State
for state in self.states
memo = state.note.scan(/<#{SNF_COUNTER}[::](\S+)[%%]>/)
memo = memo.flatten
if memo != nil and not memo.empty?
counter_prob += memo[0].to_i
end
end
# Skill
if attacker.action.kind == 1
counter_prob = 0 unless attacker.action.skill.physical_attack
if attacker.action.skill.note.include?(SNF_VOID_COUNTER)
# Wenn ein Konter nicht möglich ist: Konterwahrscheinlichkeit = 0
counter_prob = 0
end
end
if attacker.is_a?(Game_Actor)
# Equipment
for equip in attacker.equips.compact
if equip.note.include?(SNF_VOID_COUNTER) and attacker.action.kind == 0
# Wenn ein Konter nicht möglich ist: Konterwahrscheinlichkeit = 0
counter_prob = 0
break
end
end
else
# Enemy
if attacker.enemy.note.include?(SNF_VOID_COUNTER) and attacker.action.kind == 0
# Wenn ein Konter nicht möglich ist: Konterwahrscheinlichkeit = 0
counter_prob = 0
end
end
unless attacker.action.void_counter
if rand(100) <= counter_prob
@countered = true
snf_counter(attacker, self)
return if SNF::COUNTER_VOID
end
end
end
#--------------------------------------------------------------------------
# * Apply Normal Attack Effects
# attacker : Attacker
#--------------------------------------------------------------------------
alias snf_conuter_attack_effect attack_effect
def attack_effect(attacker)
clear_action_results
@countered = false
snf_counter_calc(attacker)
snf_conuter_attack_effect(attacker)
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : Skill user
# skill : skill
#--------------------------------------------------------------------------
alias snf_conuter_skill_effect skill_effect
def skill_effect(user, skill)
clear_action_results
@countered = false
snf_counter_calc(user) if SNF::SKILL_COUNTER
snf_conuter_skill_effect(user, skill)
end
#--------------------------------------------------------------------------
# * ??????????
#--------------------------------------------------------------------------
def snf_counter(attacker, battler)
battler.action.void_counter = true
battler.action.kind = 0
if battler.action.kind == 0
battler.action.basic = 0
else
battler.action.skill_id = 1
end
battler.action.target_index = attacker.index
battler.action.forcing = true
$game_troop.forcing_battler = battler
return true
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Show Damage
# target : Target
# obj : Skill or item
#--------------------------------------------------------------------------
alias snf_conuter_display_damage display_damage
def display_damage(target, obj = nil)
return if target.countered and SNF::COUNTER_VOID
snf_conuter_display_damage(target, obj)
end
#--------------------------------------------------------------------------
# * Show Failure
# target : Target (actor)
# obj : Skill or item
#--------------------------------------------------------------------------
alias snf_conuter_display_failure display_failure
def display_failure(target, obj)
return if target.countered and SNF::COUNTER_VOID
snf_conuter_display_failure(target, obj)
end
end
#==============================================================================
# ** Game_BattleAction
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :void_counter
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
alias snf_conuter_clear clear
def clear
@void_counter = false
snf_conuter_clear
end
end
LINKS
- als Textdatei downloaden oder öffnen (http://rpgvx.bplaced.net/scripts/Konter.txt)
- Space not far (Quelle) (http://muspell.raindrop.jp/file/material.htm)