Jump to content
  • 0

s_random_opt_group::apply, logic of choosing an option in slots from item_randomopt_group


Question

Posted
	// Apply Must options
	for( size_t i = 0; i < this->slots.size(); i++ ){
		// Try to apply an entry
		for( size_t j = 0, max = this->slots[static_cast<uint16>(i)].size() * 3; j < max; j++ ){
			std::shared_ptr<s_random_opt_group_entry> option = util::vector_random( this->slots[static_cast<uint16>(i)] );

			if ( rnd_chance<uint16>(option->chance, 10000) ) {
				apply_sub( item.option[i], option );
				break;
			}
		}

		// If no entry was applied, assign one
		if( item.option[i].id == 0 ){
			std::shared_ptr<s_random_opt_group_entry> option = util::vector_random( this->slots[static_cast<uint16>(i)] );

			// Apply an entry without checking the chance
			apply_sub( item.option[i], option );
		}
	}

Here for must options.

The implementation choose to equally choose from options from slot, then do the chance check.

I think this might not be logical if the there is a big difference for the chance in each option

Another question is that what is the *3 for? Is it just for increasing the probability to pass chance check?

I wonder if this is to follow official logic.

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...