mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 14:14:59 +00:00
Added affection effects
This commit is contained in:
@@ -128,9 +128,10 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
# Properties from Pokémon
|
||||
#=============================================================================
|
||||
def happiness; return @pokemon ? @pokemon.happiness : 0; end
|
||||
def nature; return @pokemon ? @pokemon.nature : 0; end
|
||||
def pokerusStage; return @pokemon ? @pokemon.pokerusStage : 0; end
|
||||
def happiness; return @pokemon ? @pokemon.happiness : 0; end
|
||||
def affection_level; return @pokemon ? @pokemon.affection_level : 2; end
|
||||
def nature; return @pokemon ? @pokemon.nature : 0; end
|
||||
def pokerusStage; return @pokemon ? @pokemon.pokerusStage : 0; end
|
||||
|
||||
#=============================================================================
|
||||
# Mega Evolution, Primal Reversion, Shadow Pokémon
|
||||
|
||||
@@ -571,7 +571,9 @@ class PokeBattle_Battler
|
||||
# Message shown when a move fails the per-hit success check above.
|
||||
#=============================================================================
|
||||
def pbMissMessage(move,user,target)
|
||||
if move.pbTarget(user).num_targets > 1
|
||||
if target.damageState.affection_missed
|
||||
@battle.pbDisplay(_INTL("{1} avoided the move in time with your shout!", target.pbThis))
|
||||
elsif move.pbTarget(user).num_targets > 1
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||
elsif target.effects[PBEffects::TwoTurnAttack]
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||
|
||||
@@ -208,6 +208,13 @@ class PokeBattle_Move
|
||||
elsif target.hasActiveItem?(:FOCUSBAND) && @battle.pbRandom(100)<10
|
||||
target.damageState.focusBand = true
|
||||
damage -= 1
|
||||
elsif Settings::AFFECTION_EFFECTS && @battle.internalBattle &&
|
||||
target.pbOwnedByPlayer? && !target.mega?
|
||||
chance = [0, 0, 0, 10, 15, 25][target.affection_level]
|
||||
if chance > 0 && @battle.pbRandom(100) < chance
|
||||
target.damageState.affection_endured = true
|
||||
damage -= 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -282,10 +289,19 @@ class PokeBattle_Move
|
||||
end
|
||||
if target.damageState.critical
|
||||
$game_temp.party_critical_hits_dealt[user.pokemonIndex] += 1 if user.pbOwnedByPlayer?
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("A critical hit on {1}!",target.pbThis(true)))
|
||||
if target.damageState.affection_critical
|
||||
if numTargets > 1
|
||||
@battle.pbDisplay(_INTL("{1} landed a critical hit on {2}, wishing to be praised!",
|
||||
user.pbThis, target.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} landed a critical hit, wishing to be praised!", user.pbThis))
|
||||
end
|
||||
else
|
||||
@battle.pbDisplay(_INTL("A critical hit!"))
|
||||
if numTargets > 1
|
||||
@battle.pbDisplay(_INTL("A critical hit on {1}!", target.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("A critical hit!"))
|
||||
end
|
||||
end
|
||||
end
|
||||
# Effectiveness message, for moves with 1 hit
|
||||
@@ -333,6 +349,8 @@ class PokeBattle_Move
|
||||
elsif target.damageState.focusBand
|
||||
@battle.pbCommonAnimation("UseItem",target)
|
||||
@battle.pbDisplay(_INTL("{1} hung on using its Focus Band!",target.pbThis))
|
||||
elsif target.damageState.affection_endured
|
||||
@battle.pbDisplay(_INTL("{1} toughed it out so you wouldn't feel sad!", target.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -115,8 +115,16 @@ class PokeBattle_Move
|
||||
accuracy = (accuracy * modifiers[:accuracy_multiplier]).round
|
||||
evasion = (evasion * modifiers[:evasion_multiplier]).round
|
||||
evasion = 1 if evasion < 1
|
||||
threshold = modifiers[:base_accuracy] * accuracy / evasion
|
||||
# Calculation
|
||||
return @battle.pbRandom(100) < modifiers[:base_accuracy] * accuracy / evasion
|
||||
r = @battle.pbRandom(100)
|
||||
if Settings::AFFECTION_EFFECTS && @battle.internalBattle &&
|
||||
target.pbOwnedByPlayer? && target.affection_level == 5 && !target.mega?
|
||||
return true if r < threshold - 10
|
||||
target.damageState.affection_missed = true if r < threshold
|
||||
return false
|
||||
end
|
||||
return r < threshold
|
||||
end
|
||||
|
||||
def pbCalcAccuracyModifiers(user,target,modifiers)
|
||||
@@ -199,7 +207,15 @@ class PokeBattle_Move
|
||||
c += 1 if user.inHyperMode? && @type == :SHADOW
|
||||
c = ratios.length-1 if c>=ratios.length
|
||||
# Calculation
|
||||
return @battle.pbRandom(ratios[c])==0
|
||||
return true if ratio[c] == 1
|
||||
r = @battle.pbRandom(ratios[c])
|
||||
return true if r == 0
|
||||
if r == 1 && Settings::AFFECTION_EFFECTS && @battle.internalBattle &&
|
||||
user.pbOwnedByPlayer? && user.affection_level == 5 && !target.mega?
|
||||
target.damageState.affection_critical = true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
@@ -152,6 +152,11 @@ class PokeBattle_Battle
|
||||
i = BattleHandlers.triggerExpGainModifierItem(@initialItems[0][idxParty],pkmn,exp)
|
||||
end
|
||||
exp = i if i>=0
|
||||
# Boost Exp gained with high affection
|
||||
if Settings::AFFECTION_EFFECTS && @internalBattle && pkmn.affection_level >= 4 && !pkmn.mega?
|
||||
exp = exp * 6 / 5
|
||||
isOutsider = true # To show the "boosted Exp" message
|
||||
end
|
||||
# Make sure Exp doesn't exceed the maximum
|
||||
expFinal = growth_rate.add_exp(pkmn.exp, exp)
|
||||
expGained = expFinal-pkmn.exp
|
||||
|
||||
@@ -283,6 +283,28 @@ class PokeBattle_Battle
|
||||
# Black Sludge, Leftovers
|
||||
BattleHandlers.triggerEORHealingItem(b.item,b,self) if b.itemActive?
|
||||
end
|
||||
# Self-curing of status due to affection
|
||||
if Settings::AFFECTION_EFFECTS && @internalBattle
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.status == :NONE
|
||||
next if !b.pbOwnedByPlayer? || b.affection_level < 4 || b.mega?
|
||||
next if pbRandom(100) < 80
|
||||
old_status = b.status
|
||||
b.pbCureStatus(false)
|
||||
case old_status
|
||||
when :SLEEP
|
||||
pbDisplay(_INTL("{1} shook itself awake so you wouldn't worry!", b.pbThis))
|
||||
when :POISON
|
||||
pbDisplay(_INTL("{1} managed to expel the poison so you wouldn't worry!", b.pbThis))
|
||||
when :BURN
|
||||
pbDisplay(_INTL("{1} healed its burn with its sheer determination so you wouldn't worry!", b.pbThis))
|
||||
when :PARALYSIS
|
||||
pbDisplay(_INTL("{1} gathered all its energy to break through its paralysis so you wouldn't worry!", b.pbThis))
|
||||
when :FROZEN
|
||||
pbDisplay(_INTL("{1} melted the ice with its fiery determination so you wouldn't worry!", b.pbThis))
|
||||
end
|
||||
end
|
||||
end
|
||||
# Aqua Ring
|
||||
priority.each do |b|
|
||||
next if !b.effects[PBEffects::AquaRing]
|
||||
|
||||
@@ -8,10 +8,12 @@ class PokeBattle_DamageState
|
||||
attr_accessor :fainted # Whether battler was knocked out by the move
|
||||
|
||||
attr_accessor :missed # Whether the move failed the accuracy check
|
||||
attr_accessor :affection_missed
|
||||
attr_accessor :invulnerable # If the move missed due to two turn move invulnerability
|
||||
attr_accessor :calcDamage # Calculated damage
|
||||
attr_accessor :hpLost # HP lost by opponent, inc. HP lost by a substitute
|
||||
attr_accessor :critical # Critical hit flag
|
||||
attr_accessor :affection_critical
|
||||
attr_accessor :substitute # Whether a substitute took the damage
|
||||
attr_accessor :focusBand # Focus Band used
|
||||
attr_accessor :focusSash # Focus Sash used
|
||||
@@ -19,34 +21,38 @@ class PokeBattle_DamageState
|
||||
attr_accessor :disguise # Disguise ability used
|
||||
attr_accessor :iceFace # Ice Face ability used
|
||||
attr_accessor :endured # Damage was endured
|
||||
attr_accessor :affection_endured
|
||||
attr_accessor :berryWeakened # Whether a type-resisting berry was used
|
||||
|
||||
def initialize; reset; end
|
||||
|
||||
def reset
|
||||
@typeMod = Effectiveness::INEFFECTIVE
|
||||
@unaffected = false
|
||||
@protected = false
|
||||
@missed = false
|
||||
@invulnerable = false
|
||||
@magicCoat = false
|
||||
@magicBounce = false
|
||||
@totalHPLost = 0
|
||||
@fainted = false
|
||||
@typeMod = Effectiveness::INEFFECTIVE
|
||||
@unaffected = false
|
||||
@protected = false
|
||||
@missed = false
|
||||
@affection_missed = false
|
||||
@invulnerable = false
|
||||
@magicCoat = false
|
||||
@magicBounce = false
|
||||
@totalHPLost = 0
|
||||
@fainted = false
|
||||
resetPerHit
|
||||
end
|
||||
|
||||
def resetPerHit
|
||||
@calcDamage = 0
|
||||
@hpLost = 0
|
||||
@critical = false
|
||||
@substitute = false
|
||||
@focusBand = false
|
||||
@focusSash = false
|
||||
@sturdy = false
|
||||
@disguise = false
|
||||
@iceFace = false
|
||||
@endured = false
|
||||
@berryWeakened = false
|
||||
@calcDamage = 0
|
||||
@hpLost = 0
|
||||
@critical = false
|
||||
@affection_critical = false
|
||||
@substitute = false
|
||||
@focusBand = false
|
||||
@focusSash = false
|
||||
@sturdy = false
|
||||
@disguise = false
|
||||
@iceFace = false
|
||||
@endured = false
|
||||
@affection_endured = false
|
||||
@berryWeakened = false
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user