Last active
February 2, 2024 23:28
-
-
Save DRayX/064244eae8c2e7ca1d234be725a75bd4 to your computer and use it in GitHub Desktop.
Palword Breeding Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import collections | |
COMBI_RANKS = collections.OrderedDict([ | |
('Anubis', 570), | |
('Baphomet', 590), | |
('Baphomet_Dark', 580), | |
('Bastet', 1480), | |
('Bastet_Ice', 1440), | |
('Boar', 1130), | |
('Carbunclo', 1430), | |
('ColorfulBird', 1340), | |
('Deer', 920), | |
('Deer_Ground', 900), | |
('DrillGame', 850), | |
('Eagle', 1030), | |
('ElecPanda', 200), | |
('Ganesha', 1490), | |
('Garm', 1060), | |
('Gorilla', 1040), | |
('Hedgehog', 1370), | |
('Hedgehog_Ice', 1360), | |
('Kirin', 680), | |
('Kitsunebi', 1400), | |
('LittleBriarRose', 1320), | |
('Mutant', 1110), | |
('Penguin', 1350), | |
('RaijinDaughter', 1210), | |
('SharkKid', 1090), | |
('SharkKid_Fire', 1100), | |
('SheepBall', 1470), | |
('Umihebi', 310), | |
('Umihebi_Fire', 315), | |
('Werewolf', 950), | |
('WindChimes', 1420), | |
('WindChimes_Ice', 1422), | |
('Suzaku', 50), | |
('Suzaku_Water', 30), | |
('FireKirin', 360), | |
('FireKirin_Dark', 240), | |
('FairyDragon', 540), | |
('FairyDragon_Water', 530), | |
('SweetsSheep', 1190), | |
('WhiteTiger', 130), | |
('Alpaca', 890), | |
('Serpent', 560), | |
('Serpent_Ground', 550), | |
('DarkCrow', 1080), | |
('BlueDragon', 500), | |
('PinkCat', 1460), | |
('NegativeKoala', 1380), | |
('FengyunDeeper', 980), | |
('VolcanicMonster', 320), | |
('VolcanicMonster_Ice', 230), | |
('GhostBeast', 1150), | |
('RobinHood', 1020), | |
('RobinHood_Ground', 1000), | |
('LazyDragon', 280), | |
('LazyDragon_Electric', 270), | |
('AmaterasuWolf', 830), | |
('LizardMan', 1120), | |
('LizardMan_Fire', 1140), | |
('Blueplatypus', 1330), | |
('BirdDragon', 660), | |
('BirdDragon_Ice', 620), | |
('ChickenPal', 1500), | |
('FlowerDinosaur', 820), | |
('FlowerDinosaur_Electric', 810), | |
('ElecCat', 1410), | |
('IceHorse', 120), | |
('IceHorse_Dark', 100), | |
('GrassMammoth', 300), | |
('GrassMammoth_Ice', 290), | |
('CatVampire', 1010), | |
('SakuraSaurus', 860), | |
('SakuraSaurus_Water', 840), | |
('Horus', 370), | |
('KingBahamut', 10), | |
('BerryGoat', 930), | |
('IceDeer', 880), | |
('BlackGriffon', 60), | |
('WhiteMoth', 450), | |
('CuteFox', 1450), | |
('FoxMage', 1160), | |
('PinkLizard', 940), | |
('WizardOwl', 1390), | |
('Kelpie', 1260), | |
('Kelpie_Fire', 1270), | |
('NegativeOctopus', 1290), | |
('CowPal', 910), | |
('Yeti', 460), | |
('Yeti_Grass', 480), | |
('VioletFairy', 1050), | |
('HawkBird', 420), | |
('FlowerRabbit', 1280), | |
('LilyQueen', 250), | |
('LilyQueen_Dark', 210), | |
('QueenBee', 330), | |
('SoldierBee', 1070), | |
('CatBat', 750), | |
('GrassPanda', 430), | |
('GrassPanda_Electric', 390), | |
('FlameBuffalo', 790), | |
('ThunderDog', 740), | |
('CuteMole', 1220), | |
('BlackMetalDragon', 150), | |
('GrassRabbitMan', 990), | |
('IceFox', 760), | |
('JetDragon', 90), | |
('DreamDemon', 1230), | |
('Monkey', 1250), | |
('Manticore', 710), | |
('Manticore_Dark', 670), | |
('KingAlpaca', 470), | |
('KingAlpaca_Ice', 440), | |
('PlantSlime', 1240), | |
('MopBaby', 1300), | |
('MopKing', 410), | |
('CatMage', 700), | |
('PinkRabbit', 1310), | |
('ThunderBird', 220), | |
('HerculesBeetle', 340), | |
('SaintCentaur', 80), | |
('NightFox', 1180), | |
('CaptainPenguin', 520), | |
('WeaselDragon', 800), | |
('SkyDragon', 350), | |
('HadesBird', 190), | |
('RedArmorBird', 380), | |
('Ronin', 640), | |
('FlyingManta', 870), | |
('BlackCentaur', 70), | |
('FlowerDoll', 780), | |
('NaughtyCat', 510), | |
('CuteButterfly', 490), | |
('DarkScorpion', 260), | |
('ThunderDragonMan', 140), | |
('WoolFox', 1455), | |
('LazyCatfish', 895), | |
('LavaGirl', 1405), | |
('FlameBambi', 1155), | |
]) | |
UNIQUE_COMBI = { | |
('LazyDragon', 'ElecCat'): 'LazyDragon_Electric', | |
('Baphomet', 'GhostBeast'): 'Baphomet_Dark', | |
('Bastet', 'Penguin'): 'Bastet_Ice', | |
('BirdDragon', 'IceFox'): 'BirdDragon_Ice', | |
('Deer', 'WindChimes'): 'Deer_Ground', | |
('FairyDragon', 'Serpent'): 'FairyDragon_Water', | |
('FireKirin', 'CatMage'): 'FireKirin_Dark', | |
('GrassMammoth', 'Yeti'): 'GrassMammoth_Ice', | |
('GrassPanda', 'ElecPanda'): 'GrassPanda_Electric', | |
('FlowerDinosaur', 'ThunderDog'): 'FlowerDinosaur_Electric', | |
('Hedgehog', 'Penguin'): 'Hedgehog_Ice', | |
('IceHorse', 'HadesBird'): 'IceHorse_Dark', | |
('KingAlpaca', 'IceDeer'): 'KingAlpaca_Ice', | |
('LilyQueen', 'DarkScorpion'): 'LilyQueen_Dark', | |
('LizardMan', 'LavaGirl'): 'LizardMan_Fire', | |
('Manticore', 'CatVampire'): 'Manticore_Dark', | |
('RobinHood', 'CuteMole'): 'RobinHood_Ground', | |
('SakuraSaurus', 'Blueplatypus'): 'SakuraSaurus_Water', | |
('Serpent', 'LazyCatfish'): 'Serpent_Ground', | |
('SharkKid', 'FlameBambi'): 'SharkKid_Fire', | |
('Suzaku', 'Umihebi'): 'Suzaku_Water', | |
('VolcanicMonster', 'IceFox'): 'VolcanicMonster_Ice', | |
('WindChimes', 'MopBaby'): 'WindChimes_Ice', | |
('IceHorse', 'IceHorse'): 'IceHorse', | |
('JetDragon', 'JetDragon'): 'JetDragon', | |
('SaintCentaur', 'SaintCentaur'): 'SaintCentaur', | |
('BlackCentaur', 'BlackCentaur'): 'BlackCentaur', | |
('GrassPanda', 'FlowerDoll'): 'LilyQueen', | |
('BirdDragon', 'Anubis'): 'Horus', | |
('GrassPanda', 'ThunderDog'): 'ElecPanda', | |
('ElecPanda', 'LazyDragon'): 'ThunderDragonMan', | |
('AmaterasuWolf', 'BlackMetalDragon'): 'BlackGriffon', | |
('LilyQueen', 'LilyQueen'): 'LilyQueen', | |
('Horus', 'Horus'): 'Horus', | |
('ElecPanda', 'ElecPanda'): 'ElecPanda', | |
('ThunderDragonMan', 'ThunderDragonMan'): 'ThunderDragonMan', | |
('BlackGriffon', 'BlackGriffon'): 'BlackGriffon', | |
('Umihebi_Fire', 'Umihebi_Fire'): 'Umihebi_Fire', | |
('LazyDragon_Electric', 'LazyDragon_Electric'): 'LazyDragon_Electric', | |
('Baphomet_Dark', 'Baphomet_Dark'): 'Baphomet_Dark', | |
('Bastet_Ice', 'Bastet_Ice'): 'Bastet_Ice', | |
('BirdDragon_Ice', 'BirdDragon_Ice'): 'BirdDragon_Ice', | |
('Deer_Ground', 'Deer_Ground'): 'Deer_Ground', | |
('FairyDragon_Water', 'FairyDragon_Water'): 'FairyDragon_Water', | |
('FireKirin_Dark', 'FireKirin_Dark'): 'FireKirin_Dark', | |
('GrassMammoth_Ice', 'GrassMammoth_Ice'): 'GrassMammoth_Ice', | |
('GrassPanda_Electric', 'GrassPanda_Electric'): 'GrassPanda_Electric', | |
('FlowerDinosaur_Electric', 'FlowerDinosaur_Electric'): 'FlowerDinosaur_Electric', | |
('Hedgehog_Ice', 'Hedgehog_Ice'): 'Hedgehog_Ice', | |
('IceHorse_Dark', 'IceHorse_Dark'): 'IceHorse_Dark', | |
('KingAlpaca_Ice', 'KingAlpaca_Ice'): 'KingAlpaca_Ice', | |
('LilyQueen_Dark', 'LilyQueen_Dark'): 'LilyQueen_Dark', | |
('LizardMan_Fire', 'LizardMan_Fire'): 'LizardMan_Fire', | |
('Manticore_Dark', 'Manticore_Dark'): 'Manticore_Dark', | |
('RobinHood_Ground', 'RobinHood_Ground'): 'RobinHood_Ground', | |
('SakuraSaurus_Water', 'SakuraSaurus_Water'): 'SakuraSaurus_Water', | |
('Serpent_Ground', 'Serpent_Ground'): 'Serpent_Ground', | |
('SharkKid_Fire', 'SharkKid_Fire'): 'SharkKid_Fire', | |
('Suzaku_Water', 'Suzaku_Water'): 'Suzaku_Water', | |
('VolcanicMonster_Ice', 'VolcanicMonster_Ice'): 'VolcanicMonster_Ice', | |
('WindChimes_Ice', 'WindChimes_Ice'): 'WindChimes_Ice', | |
('PinkKangaroo', 'PinkKangaroo'): 'PinkKangaroo', | |
('BeardedDragon', 'BeardedDragon'): 'BeardedDragon', | |
('BlackFurDragon', 'BlackFurDragon'): 'BlackFurDragon', | |
('WaterLizard', 'WaterLizard'): 'WaterLizard', | |
('ElecLion', 'ElecLion'): 'ElecLion', | |
('GuardianDog', 'GuardianDog'): 'GuardianDog', | |
('GrassDragon', 'GrassDragon'): 'GrassDragon', | |
('DarkMutant', 'DarkMutant'): 'DarkMutant', | |
('SifuDog', 'SifuDog'): 'SifuDog', | |
('TentacleTurtle', 'TentacleTurtle'): 'TentacleTurtle', | |
('GoldenHorse', 'GoldenHorse'): 'GoldenHorse', | |
('BadCatgirl', 'BadCatgirl'): 'BadCatgirl', | |
('BrownRabbit', 'BrownRabbit'): 'BrownRabbit', | |
('FeatherOstrich', 'FeatherOstrich'): 'FeatherOstrich', | |
('WingGolem', 'WingGolem'): 'WingGolem', | |
('ScorpionMan', 'ScorpionMan'): 'ScorpionMan', | |
('BlueberryFairy', 'BlueberryFairy'): 'BlueberryFairy', | |
} | |
UNIQUE_CHILDREN = set(UNIQUE_COMBI.values()) | |
def FindChildCharacterId(parent_a: str, parent_b: str) -> str: | |
if (parent_a, parent_b) in UNIQUE_COMBI: | |
return UNIQUE_COMBI[(parent_a, parent_b)] | |
elif (parent_b, parent_a) in UNIQUE_COMBI: | |
return UNIQUE_COMBI[(parent_b, parent_a)] | |
else: | |
return FindNearestCombiRank( | |
(COMBI_RANKS[parent_a] + COMBI_RANKS[parent_b] + 1) // 2) | |
def FindNearestCombiRank(combi_rank: int) -> str: | |
return min( | |
(x for x in COMBI_RANKS.items() if x[0] not in UNIQUE_CHILDREN), | |
key=lambda x: abs(x[1] - combi_rank))[0] | |
if __name__ == '__main__': | |
import sys | |
if len(sys.argv) == 2: | |
print('\n'.join( | |
f'{a} + {b}' for a in COMBI_RANKS for b in COMBI_RANKS | |
if FindChildCharacterId(a, b) == sys.argv[1])) | |
elif len(sys.argv) == 3: | |
print(FindChildCharacterId(sys.argv[1], sys.argv[2])) | |
else: | |
raise RuntimeError('Expected 1 or 2 arguments') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment