mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Fixed only one IV being inherited due to a held Power item if both
This commit is contained in:
@@ -174,13 +174,14 @@ class DayCare
|
|||||||
# Get all stats
|
# Get all stats
|
||||||
stats = []
|
stats = []
|
||||||
GameData::Stat.each_main { |s| stats.push(s.id) }
|
GameData::Stat.each_main { |s| stats.push(s.id) }
|
||||||
# Get the number of stats to inherit
|
# Get the number of stats to inherit (includes ones inherited via Power items)
|
||||||
inherit_count = 3
|
inherit_count = 3
|
||||||
if Settings::MECHANICS_GENERATION >= 6
|
if Settings::MECHANICS_GENERATION >= 6
|
||||||
inherit_count = 5 if mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT)
|
inherit_count = 5 if mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT)
|
||||||
end
|
end
|
||||||
# Inherit IV because of Power items (if both parents have a Power item,
|
# Inherit IV because of Power items (if both parents have the same Power
|
||||||
# then only a random one of them is inherited)
|
# item, then the parent that passes that Power item's stat down is chosen
|
||||||
|
# randomly)
|
||||||
power_items = [
|
power_items = [
|
||||||
[:POWERWEIGHT, :HP],
|
[:POWERWEIGHT, :HP],
|
||||||
[:POWERBRACER, :ATTACK],
|
[:POWERBRACER, :ATTACK],
|
||||||
@@ -189,18 +190,20 @@ class DayCare
|
|||||||
[:POWERBAND, :SPECIAL_DEFENSE],
|
[:POWERBAND, :SPECIAL_DEFENSE],
|
||||||
[:POWERANKLET, :SPEED]
|
[:POWERANKLET, :SPEED]
|
||||||
]
|
]
|
||||||
power_stats = []
|
power_stats = {}
|
||||||
[mother, father].each do |parent|
|
[mother, father].each do |parent|
|
||||||
power_items.each do |item|
|
power_items.each do |item|
|
||||||
next if !parent.hasItem?(item[0])
|
next if !parent.hasItem?(item[0])
|
||||||
power_stats.push(item[1], parent.iv[item[1]])
|
power_stats[item[1]] ||= []
|
||||||
|
power_stats[item[1]].push(parent.iv[item[1]])
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if power_stats.length > 0
|
power_stats.each_pair do |stat, new_stats|
|
||||||
power_stat = power_stats.sample
|
next if !new_stats || new_stats.length == 0
|
||||||
egg.iv[power_stat[0]] = power_stat[1]
|
new_stat = new_stats.sample
|
||||||
stats.delete(power_stat[0]) # Don't try to inherit this stat's IV again
|
egg.iv[stat] = new_stat
|
||||||
|
stats.delete(stat) # Don't try to inherit this stat's IV again
|
||||||
inherit_count -= 1
|
inherit_count -= 1
|
||||||
end
|
end
|
||||||
# Inherit the rest of the IVs
|
# Inherit the rest of the IVs
|
||||||
|
|||||||
Reference in New Issue
Block a user