mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
RoR2: code cleanup and styling consistency (#833)
* build locations dict dynamically from the TotalLocations option. Minor styling cleanup * Minor items styling cleanup. remove unused event items * minor options cleanup. clarify preset toggle slightly better * make items.py more readable. add chaos weights dict to use as reference point for generation * small rules styling and consistency cleanup * create less regions and other init cleanup * move region creation to less function calls and move revivals calculation * typing * use enum instead of hardcoded ints. fix bug i introduced * better typing
This commit is contained in:
@@ -1,143 +1,154 @@
|
||||
from typing import Dict
|
||||
from BaseClasses import Item
|
||||
import typing
|
||||
from .Options import ItemWeights
|
||||
|
||||
|
||||
class RiskOfRainItem(Item):
|
||||
game: str = "Risk of Rain 2"
|
||||
|
||||
|
||||
# 37000 - 38000
|
||||
item_table = {
|
||||
"Dio's Best Friend": 37001,
|
||||
"Common Item": 37002,
|
||||
"Uncommon Item": 37003,
|
||||
"Legendary Item": 37004,
|
||||
"Boss Item": 37005,
|
||||
"Lunar Item": 37006,
|
||||
"Equipment": 37007,
|
||||
"Item Scrap, White": 37008,
|
||||
"Item Scrap, Green": 37009,
|
||||
"Item Scrap, Red": 37010,
|
||||
"Item Scrap, Yellow": 37011,
|
||||
"Victory": None,
|
||||
"Beat Level One": None,
|
||||
"Beat Level Two": None,
|
||||
"Beat Level Three": None,
|
||||
"Beat Level Four": None,
|
||||
"Beat Level Five": None,
|
||||
item_table: Dict[str, int] = {
|
||||
"Dio's Best Friend": 37001,
|
||||
"Common Item": 37002,
|
||||
"Uncommon Item": 37003,
|
||||
"Legendary Item": 37004,
|
||||
"Boss Item": 37005,
|
||||
"Lunar Item": 37006,
|
||||
"Equipment": 37007,
|
||||
"Item Scrap, White": 37008,
|
||||
"Item Scrap, Green": 37009,
|
||||
"Item Scrap, Red": 37010,
|
||||
"Item Scrap, Yellow": 37011
|
||||
}
|
||||
|
||||
default_weights = {
|
||||
"Item Scrap, Green": 16,
|
||||
"Item Scrap, Red": 4,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 32,
|
||||
"Common Item": 64,
|
||||
"Uncommon Item": 32,
|
||||
"Legendary Item": 8,
|
||||
"Boss Item": 4,
|
||||
"Lunar Item": 16,
|
||||
"Equipment": 32
|
||||
default_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 16,
|
||||
"Item Scrap, Red": 4,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 32,
|
||||
"Common Item": 64,
|
||||
"Uncommon Item": 32,
|
||||
"Legendary Item": 8,
|
||||
"Boss Item": 4,
|
||||
"Lunar Item": 16,
|
||||
"Equipment": 32
|
||||
}
|
||||
|
||||
new_weights = {
|
||||
"Item Scrap, Green": 15,
|
||||
"Item Scrap, Red": 5,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 30,
|
||||
"Common Item": 75,
|
||||
"Uncommon Item": 40,
|
||||
"Legendary Item": 10,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 10,
|
||||
"Equipment": 20
|
||||
new_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 15,
|
||||
"Item Scrap, Red": 5,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 30,
|
||||
"Common Item": 75,
|
||||
"Uncommon Item": 40,
|
||||
"Legendary Item": 10,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 10,
|
||||
"Equipment": 20
|
||||
}
|
||||
|
||||
uncommon_weights = {
|
||||
"Item Scrap, Green": 45,
|
||||
"Item Scrap, Red": 5,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 30,
|
||||
"Common Item": 45,
|
||||
"Uncommon Item": 100,
|
||||
"Legendary Item": 10,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 15,
|
||||
"Equipment": 20
|
||||
uncommon_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 45,
|
||||
"Item Scrap, Red": 5,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 30,
|
||||
"Common Item": 45,
|
||||
"Uncommon Item": 100,
|
||||
"Legendary Item": 10,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 15,
|
||||
"Equipment": 20
|
||||
}
|
||||
|
||||
legendary_weights = {
|
||||
"Item Scrap, Green": 15,
|
||||
"Item Scrap, Red": 5,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 30,
|
||||
"Common Item": 50,
|
||||
"Uncommon Item": 25,
|
||||
"Legendary Item": 100,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 15,
|
||||
"Equipment": 20
|
||||
legendary_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 15,
|
||||
"Item Scrap, Red": 5,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 30,
|
||||
"Common Item": 50,
|
||||
"Uncommon Item": 25,
|
||||
"Legendary Item": 100,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 15,
|
||||
"Equipment": 20
|
||||
}
|
||||
|
||||
lunartic_weights = {
|
||||
"Item Scrap, Green": 0,
|
||||
"Item Scrap, Red": 0,
|
||||
"Item Scrap, Yellow": 0,
|
||||
"Item Scrap, White": 0,
|
||||
"Common Item": 0,
|
||||
"Uncommon Item": 0,
|
||||
"Legendary Item": 0,
|
||||
"Boss Item": 0,
|
||||
"Lunar Item": 100,
|
||||
"Equipment": 0
|
||||
lunartic_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 0,
|
||||
"Item Scrap, Red": 0,
|
||||
"Item Scrap, Yellow": 0,
|
||||
"Item Scrap, White": 0,
|
||||
"Common Item": 0,
|
||||
"Uncommon Item": 0,
|
||||
"Legendary Item": 0,
|
||||
"Boss Item": 0,
|
||||
"Lunar Item": 100,
|
||||
"Equipment": 0
|
||||
}
|
||||
|
||||
no_scraps_weights = {
|
||||
"Item Scrap, Green": 0,
|
||||
"Item Scrap, Red": 0,
|
||||
"Item Scrap, Yellow": 0,
|
||||
"Item Scrap, White": 0,
|
||||
"Common Item": 100,
|
||||
"Uncommon Item": 40,
|
||||
"Legendary Item": 15,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 10,
|
||||
"Equipment": 25
|
||||
chaos_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 80,
|
||||
"Item Scrap, Red": 45,
|
||||
"Item Scrap, Yellow": 30,
|
||||
"Item Scrap, White": 100,
|
||||
"Common Item": 100,
|
||||
"Uncommon Item": 70,
|
||||
"Legendary Item": 30,
|
||||
"Boss Item": 20,
|
||||
"Lunar Item": 60,
|
||||
"Equipment": 40
|
||||
}
|
||||
|
||||
even_weights = {
|
||||
"Item Scrap, Green": 1,
|
||||
"Item Scrap, Red": 1,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 1,
|
||||
"Common Item": 1,
|
||||
"Uncommon Item": 1,
|
||||
"Legendary Item": 1,
|
||||
"Boss Item": 1,
|
||||
"Lunar Item": 1,
|
||||
"Equipment": 1
|
||||
no_scraps_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 0,
|
||||
"Item Scrap, Red": 0,
|
||||
"Item Scrap, Yellow": 0,
|
||||
"Item Scrap, White": 0,
|
||||
"Common Item": 100,
|
||||
"Uncommon Item": 40,
|
||||
"Legendary Item": 15,
|
||||
"Boss Item": 5,
|
||||
"Lunar Item": 10,
|
||||
"Equipment": 25
|
||||
}
|
||||
|
||||
scraps_only = {
|
||||
"Item Scrap, Green": 70,
|
||||
"Item Scrap, White": 100,
|
||||
"Item Scrap, Red": 30,
|
||||
"Item Scrap, Yellow": 5,
|
||||
"Common Item": 0,
|
||||
"Uncommon Item": 0,
|
||||
"Legendary Item": 0,
|
||||
"Boss Item": 0,
|
||||
"Lunar Item": 0,
|
||||
"Equipment": 0
|
||||
even_weights: Dict[str, int] = {
|
||||
"Item Scrap, Green": 1,
|
||||
"Item Scrap, Red": 1,
|
||||
"Item Scrap, Yellow": 1,
|
||||
"Item Scrap, White": 1,
|
||||
"Common Item": 1,
|
||||
"Uncommon Item": 1,
|
||||
"Legendary Item": 1,
|
||||
"Boss Item": 1,
|
||||
"Lunar Item": 1,
|
||||
"Equipment": 1
|
||||
}
|
||||
|
||||
item_pool_weights: typing.Dict[int, typing.Dict[str, int]] = {
|
||||
0: default_weights,
|
||||
1: new_weights,
|
||||
2: uncommon_weights,
|
||||
3: legendary_weights,
|
||||
4: lunartic_weights,
|
||||
6: no_scraps_weights,
|
||||
7: even_weights,
|
||||
8: scraps_only
|
||||
scraps_only: Dict[str, int] = {
|
||||
"Item Scrap, Green": 70,
|
||||
"Item Scrap, White": 100,
|
||||
"Item Scrap, Red": 30,
|
||||
"Item Scrap, Yellow": 5,
|
||||
"Common Item": 0,
|
||||
"Uncommon Item": 0,
|
||||
"Legendary Item": 0,
|
||||
"Boss Item": 0,
|
||||
"Lunar Item": 0,
|
||||
"Equipment": 0
|
||||
}
|
||||
|
||||
lookup_id_to_name: typing.Dict[int, str] = {id: name for name, id in item_table.items() if id}
|
||||
item_pool_weights: Dict[int, Dict[str, int]] = {
|
||||
ItemWeights.option_default: default_weights,
|
||||
ItemWeights.option_new: new_weights,
|
||||
ItemWeights.option_uncommon: uncommon_weights,
|
||||
ItemWeights.option_legendary: legendary_weights,
|
||||
ItemWeights.option_lunartic: lunartic_weights,
|
||||
ItemWeights.option_chaos: chaos_weights,
|
||||
ItemWeights.option_no_scraps: no_scraps_weights,
|
||||
ItemWeights.option_even: even_weights,
|
||||
ItemWeights.option_scraps_only: scraps_only
|
||||
}
|
||||
|
||||
lookup_id_to_name: Dict[int, str] = {id: name for name, id in item_table.items()}
|
||||
|
||||
Reference in New Issue
Block a user