Fluorohydride / ygopro-core

ygopro script engine.
MIT License
324 stars 134 forks source link

determining the summon type of a special summoned card in native code #282

Open melvinzhang opened 4 years ago

melvinzhang commented 4 years ago

A special summon can be one of the standard summon types such Ritual, XYZ etc. Currently, MSG_MOVE for the summon card gives reason as REASON_SPSUMMON which does not specify if it is one of the standard types. Knowing the specific type of summon is useful on the client to show different summoning animations.

The way this is done in Lua is with GetSummonType or IsSummonType. However, it doesn't seem possible to get this information via ocgapi's query_card as there is no corresponding QUERY_SUMMON_TYPE.

Would adding a QUERY_SUMMON_TYPE be something that the devs would consider accepting? It looks doable for me and I can create a PR for it.

DailyShana commented 4 years ago

There are reasons for being materials: https://github.com/Fluorohydride/ygopro-core/blob/b3401baab5ccdd49e3d1c5b9939594792320b3cd/common.h#L153-L156 If a MSG_MOVE with REASON_SPSUMMON after a series of MSG_MOVE with reason being materials, such a move should be a special summoning of the desired summon type.

melvinzhang commented 4 years ago

Thanks for the recommendation of using the msg_move of the materials.

What about the case of standard special summon without materials? For instance, Pendulum Summon, and some card effect which special summon without any materials and have "This Special Summon is treated as an Xyz/Link/Fusion/Pendulum/Ritual Summon". An example is "Number 53: Heart-eartH".

DailyShana commented 4 years ago

It seems no simple way to distinguish pendulum summon and general special summon

but I think we won't consider adding new query types just for this reason

melvinzhang commented 4 years ago

Alright, thanks for your consideration.

DailyShana commented 4 years ago

As for materials, for example, synchro summon, the reason is REASON_MATERIAL+REASON_SYNCHRO, maybe we can consider setting REASON_SPSUMMON+REASON_SYNCHRO for synchro summoning monster

melvinzhang commented 4 years ago

If we can have that as the reason for the msg_move of the summon that would be great! Similarly for the other standard special summon types.

melvinzhang commented 4 years ago

Going with the reason flag would require adding a REASON_PENDULUM as this is not present at the moment. It would also save a function call as we can get the info directly from the message, so this is a much nicer way of getting the same info.

Reopening as there is a way forward on this now.