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

Limit the kinds of terrain that are vulnerable to mattack::growplants #35778

Merged
merged 1 commit into from
Dec 9, 2019

Conversation

Kodiologist
Copy link
Contributor

@Kodiologist Kodiologist commented Nov 29, 2019

Summary

SUMMARY: Balance "Limit the kinds of terrain that are vulnerable to mattack::growplants"

Purpose of change

The TODO comment I replaced said "Make this sensible - it can destroy EVERYTHING". Triffid queens could destroy liquids, stairs, computers, etc.

Fixes #24995.

Describe the solution

Only DIGGABLE terrain or trees can be affected by triffid queens.

Testing

I watched a triffid queen tear up the area outside a shelter without affecting the inside.

"DIGGABLE", "ROAD", "RAIL", "TREE", "WALL"
} ) {
if( g->m.has_flag_ter( flag, p ) ) {
goto okay;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put this loop into a separate function and return from within the loop so you avoid using goto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@kevingranade
Copy link
Member

Avoid auto, never use goto.
I recomend you build your list as a static const map, and instead of the goto shuffle, capture a boolean indicating success or failure and use it to decide to bail out.

From a game logic point of view, I suspect the only flag we actually care about here is DIGGABLE, which makes things even simpler. I like the logic of simply needing to retreat to man made structures to avoid most of the danger.

@Kodiologist
Copy link
Contributor Author

I recomend you build your list as a static const map

Probably it's just because my C++ is rusty, but I'm not sure what that is or how I would solve the problem with it.

From a game logic point of view, I suspect the only flag we actually care about here is DIGGABLE, which makes things even simpler. I like the logic of simply needing to retreat to man made structures to avoid most of the danger.

Oh, I see. I thought it was intended that triffid queens could tear up buildings.

@I-am-Erk
Copy link
Member

Long term, not in this pr, it would be nice to make flammable flagged terrain become overgrown with vines rather than replaced fully with trees

@Kodiologist
Copy link
Contributor Author

This PR now takes a completely different approach, per Kevin's comment. Check it out.

// types we create (it's important that we can destroy our own
// trees, so we can't trap ourself).
if( !( g->m.has_flag_ter( "DIGGABLE", p ) ||
g->m.ter( p ) == t_tree_young || g->m.ter( p ) == t_tree ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend checking for the "TREE" flag instead of "t_tree". There are all kinds of trees in the game, and they all have different ids.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but I didn't think we would want to allow triffid queens to destroy fruit trees, etc.; the only reason to allow tree destruction at all is to keep them from getting trapped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outworld triffids won't differentiate between Earth plant genera.

Copy link
Contributor Author

@Kodiologist Kodiologist Dec 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, done. We still need an explicit check for t_tree_young because it's not a TREE.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Game: Balance Balancing of (existing) in-game features. Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies labels Dec 3, 2019
@Kodiologist
Copy link
Contributor Author

Regarding the "Mutations / Traits / Professions" tag, this function should only be available to triffid queens, not player plant-type mutants (yet?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Game: Balance Balancing of (existing) in-game features. Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Triffid queens can remove stairs to their nest.
5 participants