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

Implement monster evolutions #585

Merged
merged 8 commits into from
Jan 6, 2020
Merged

Conversation

MirceaKitsune
Copy link
Contributor

@MirceaKitsune MirceaKitsune commented Jan 5, 2020

I'm happy to announce the implementation of monster evolutions in Tuxemon! This initial code doesn't contain animations or notifications, but fully implements the ability to define an evolution for a tuxemon which replaces that monster when triggered. Branching evolutionary paths are supported using keywords... for standard evolutions just define and call the tag "default". This should fix #540

Evolutions are called by an event action and don't occur automatically, offering flexibility for game designers while allowing existing dialog choices to select a path. This model allows the following scenario: The player must interact with a device located in the healing center, upon doing so a dialog will ask if they wish to evolve their tuxemon on the "fire" "water" "air" or "ground" path... picking any option will cause all tuxemon in your party that have a path for the given keyword defined to morph into the replacement tuxemon, granted they've reached the level required for that evolution.

This only contains the feature implementation. Once it's merged I can do a separate MR implementing the default tuxemon evolutions as documented on the wiki.

Example of defining this in tuxemon/resources/db/monster/my_monster.json:

{
    "slug": "fruitera",
    ...
    "evolutions": [
        {
            "path": "default",
            "slug": "bursa",
            "at_level": 10
        }
}

To actually carry out the evolution, use the following act on an event in your map:

act1: evolve_monsters default

If you had a Fruitera in your party which reached at least level 10, you should now see a Bursa in its place. It will have inherited the same monster slot, name, level, and HP.

@MirceaKitsune
Copy link
Contributor Author

As a bonus, I just adjusted the code to also allow a negative rather than positive level requirement: If you specify a negative number in the level field of the evolution definition, it means the tuxemon must be under rather than above that level for the evolution to work.

@MirceaKitsune
Copy link
Contributor Author

A conditional has now been implemented, following the same format as the action. This allows you to check if you have monsters that can be evolved on the given path, so for instance, the game can show a "you have no tuxemon to evolve" dialog instead of needlessly presenting you with the choice.

@kerizane
Copy link
Collaborator

kerizane commented Jan 5, 2020

"picking any option will cause all tuxemon in your party that have a path for the given keyword defined to morph"

I'd rather do it per individual.

@MirceaKitsune
Copy link
Contributor Author

Doing it like that would be a nightmare: The player could have any of 100's of monster definitions, the action chains would be colossal. I could add a monster slot filter, but what would be the benefit?

Note that if you want to trigger the evolution of a specific tuxemon, you can already do this with the current implementation: Instead of calling the path "wind" you can use "fruitera:wind" which is specific. In this case the code will only only select the wind path for the fruitera if you have one.

@MirceaKitsune
Copy link
Contributor Author

I made a little change based on what @kerizane mentioned still: Only one evolution will be handled per call... so instead of evolving every tuxemon at once, only the first monster in your party that can evolve will evolve. This will give the user much more control. Thanks for the suggestion!

@bitcraft
Copy link
Collaborator

bitcraft commented Jan 6, 2020

@MirceaKitsune looks pretty good. please take a look at my comments.

@MirceaKitsune
Copy link
Contributor Author

@bitcraft Not seeing any comments anywhere. If it's another part of Github that doesn't work let me know here please.

tuxemon/core/components/event/actions/evolve_monsters.py Outdated Show resolved Hide resolved
tuxemon/core/components/event/actions/evolve_monsters.py Outdated Show resolved Hide resolved
from tuxemon.core.components.event.eventcondition import EventCondition


class EvolveMonstersCondition(EventCondition):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this condition checked anywhere? Also, please document the argument for the path in the docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confused by which check you meant, couldn't find where the docstring is located.

tuxemon/core/components/event/actions/evolve_monsters.py Outdated Show resolved Hide resolved
@bitcraft
Copy link
Collaborator

bitcraft commented Jan 6, 2020

@MirceaKitsune please check again

@bitcraft
Copy link
Collaborator

bitcraft commented Jan 6, 2020

Also, echoing Kerizane's comment, I would also like to see a way to evolve a single monster. But given that we don't have a consistent interface into selecting monsters, we can implement that in the future by refactoring this.

Maybe from the monster menu, we could have an additional option called "evolve".

@bitcraft bitcraft closed this Jan 6, 2020
@bitcraft bitcraft reopened this Jan 6, 2020
@MirceaKitsune
Copy link
Contributor Author

Very good suggestions! Fixed all of them except the 3rd one: I'm not familiar with the docstring and couldn't find it anywhere. Also confused what you meant by whether the condition is used anywhere... it's a conditional for events actions, it can be used by maps as cond1: evolve_monsters default to first check if the given evolution is possible before taking a decision.

@bitcraft
Copy link
Collaborator

bitcraft commented Jan 6, 2020

ok cool. it looks pretty good as is, ill get this merged. thanks again!

@bitcraft bitcraft merged commit 4b04605 into Tuxemon:development Jan 6, 2020
@MirceaKitsune
Copy link
Contributor Author

Glad to have been part of implementing such an essential feature, and thank you too! Attending to another PR for the night, tomorrow I can hopefully look at making a new one to now implement the default evolutions as documented on the wiki.

@Sanglorian
Copy link
Collaborator

Thanks heaps, MirceaKitsune!

Do you need the default evolutions tweaked at all in terms of how they're displayed on the wiki?

For example, at the moment it just has either the level that it levels up at, the item it needs to level up with, or a description of some other condition. Ignoring the other conditions for now, is that all you need? Or would you prefer that I create, e.g., an extra field for "morphs by" (above X level, below X level, item, other).

@MirceaKitsune
Copy link
Contributor Author

@Sanglorian I just need a page that displays all intended evolutions if possible. There is one for each monster on the wiki, but going through that for +100 entries is a bit more tedious.

I'm happy with the technical implementation for now: It uses event actions so it's flexible and up to the map designer. Only important thing still missing in my book is a song and animation for evolutions.

@Sanglorian
Copy link
Collaborator

No worries - I hope this helps:

https://wiki.tuxemon.org/index.php?title=Morphing#All_morphs

I couldn't figure out how to only show completed monsters, but you should get a pretty close list if you exclude any monster without an "Evolution Level" specified and exclude any monster with an invalid evolution method.

@bitcraft
Copy link
Collaborator

bitcraft commented Jan 6, 2020

@MirceaKitsune @Sanglorian please note we already have a monster generator script which uses the wiki. Please "@" AndyMender if you want to discuss it with him. If we already have the evolutions, lets just work smart and improve the script.

@MirceaKitsune
Copy link
Contributor Author

Thanks. That is quite the list... doing it manually would be a painful experience, the wiki already has them as well. @AndyMender think it would be possible to help with this task please?

@bitcraft
Copy link
Collaborator

bitcraft commented Jan 6, 2020

Let's move this convo to a new issue so that its not lost.

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.

Implement evolution ("morphing") for monsters
4 participants