Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- item [string] slot_to_best;
- string [string, string] all_modifiers;
- file_to_map("data/modifiers.txt", all_modifiers);
- int [item] item_to_plus_hot;
- boolean [item] single_equip_item;
- string extra_damage_re = "(Hot|Cold|Spooky|Sleaze|Stench)( Spell)? Damage: \\+([0-9]+)";
- string class_specific_re = 'Class: "([^"]+)"';
- foreach this_item_str, enchantments in all_modifiers["Item"] {
- matcher class_matcher = create_matcher(class_specific_re, enchantments);
- if ( class_matcher.find() ) {
- string class_locked = class_matcher.group(1).to_lower_case();
- if ( class_locked != my_class().to_lower_case() )
- continue;
- }
- item this_item = to_item(this_item_str);
- if ( this_item == $item[none] )
- continue;
- matcher enchantment_matcher = create_matcher(extra_damage_re, enchantments);
- while ( enchantment_matcher.find() ) {
- string plus_damage = enchantment_matcher.group(3);
- int plus_damage_int = plus_damage.to_int();
- item_to_plus_hot[this_item] += plus_damage_int;
- }
- if ( this_item != $item[none] ) {
- single_equip_item[this_item] = enchantments.contains_text("Single Equip");
- }
- }
- void handle_item(item this_item) {
- slot this_slot = this_item.to_slot();
- if ( this_slot == $slot[none] )
- return;
- if ( !this_item.can_equip() )
- return;
- int hot_damage = item_to_plus_hot[this_item];
- if ( hot_damage <= 0 )
- return;
- if ( this_slot == $slot[weapon] && this_item.weapon_hands() != 1 )
- return; // no 2h
- int [string] slottery;
- if ( this_slot == $slot[acc1] ) {
- slottery["acc1"] = 1;
- slottery["acc2"] = 1;
- }
- else {
- slottery[this_slot.to_string()] = 1;
- }
- foreach this_slot_again in slottery {
- item current_best = slot_to_best[this_slot_again];
- if ( current_best == $item[none] ) {
- slot_to_best[this_slot_again] = this_item;
- continue;
- }
- int current_best_dmg = item_to_plus_hot[current_best];
- if ( current_best_dmg > hot_damage )
- continue;
- if ( single_equip_item[this_item] && this_slot_again == "acc2" ) {
- item current_acc1 = slot_to_best["acc1"];
- if ( current_acc1 == this_item )
- continue;
- }
- slot_to_best[this_slot_again] = this_item;
- }
- }
- foreach this_item in $items[] {
- if ( this_item.available_amount() < 1 )
- continue;
- handle_item(this_item);
- }
- foreach this_slot, best_in_slot in slot_to_best {
- print(this_slot + " " + best_in_slot);
- }
Advertisement
Add Comment
Please, Sign In to add comment