Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded quick instances #3504

Merged

Conversation

Shinthoras0815
Copy link
Contributor

This replaces the hardcoded selection of "QUICK" instances in the going_postal job (mad sorcerers in library) with a dynamic instance selection mechanism. This change allows modders to set their own custom "QUICK" instances.

@PieterVdc
Copy link
Member

If I'm reading correctly now warlocks would start shooting navigating missiles at imps, doesn't sound like something we'd want

@walt253
Copy link
Contributor

walt253 commented Oct 6, 2024

If I'm reading correctly now warlocks would start shooting navigating missiles at imps, doesn't sound like something we'd want

For reference this is what I did on a discontinued PR.

CrInstance get_best_quick_range_instance_to_use(const struct Thing *thing)
{
    struct InstanceInfo* inst_inf;
    for (int p = PRIORITY_MAX; p >= 0; p--)
    {
        for (int i = 0; i < game.conf.crtr_conf.instances_count; i++)
        {
            inst_inf = creature_instance_info_get(i);
            if (inst_inf->priority < p) // Instances with low priority are used last.
                continue;
            if (flag_is_set(inst_inf->instance_property_flags, InstPF_Quick))
            {
                INSTANCE_RET_IF_AVAIL(thing, i);
            }
        }
    }
    return CrInst_NULL;
}

It used a priority parameter and in case of ties it's the first instance on the list the creature uses first.

Shinthoras version is better in my opinion, it checks the range min/max (something I intentionnaly neglected since my reasoning was the vanilla experience don't check the range) and it adds some randomness to the mix.

src/creature_states_combt.c Outdated Show resolved Hide resolved
@PieterVdc
Copy link
Member

I'm not fond of the randomness part of choosing an instance, they're supposed to use something weak to scare them off so they'd leave, not intentionally murder them

@walt253
Copy link
Contributor

walt253 commented Oct 6, 2024

I'm not fond of the randomness part of choosing an instance, they're supposed to use something weak to scare them off so they'd leave, not intentionally murder them

It still pick only those with the QUICK attribute, right?

They are not going to use Meteor unless mapmaker give it QUICK, I think?

Edit: maybe I'm missing your point entirely, that's possible too. 🤔

@PieterVdc
Copy link
Member

navigating missile is in the current list, but not something I'd want warlocks to use if fireball is available

- retain original sorcerer behavior by removing the 'Quick' property from the navigation_missile instance in the default config

- Cleaned up redundant code
@Shinthoras0815 Shinthoras0815 marked this pull request as ready for review October 6, 2024 21:41
src/config_creature.c Outdated Show resolved Hide resolved
config/fxdata/creature.cfg Outdated Show resolved Hide resolved
0 to disable,
add comments
@Loobinex Loobinex force-pushed the remove-hardcoded-quick-instances branch from 7d16520 to 0542916 Compare November 10, 2024 23:13
In the original order, with space in between to make it easy for modders to put their ability in between others
@Loobinex Loobinex merged commit d0e95d0 into dkfans:master Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants