Added affection effects

This commit is contained in:
Maruno17
2021-10-31 20:43:16 +00:00
parent ee16c22388
commit 0ec67f78fa
11 changed files with 187 additions and 61 deletions

View File

@@ -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

View File

@@ -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
#=============================================================================