SalvationDevelopment / ygopro-tcg-scripts

0 stars 0 forks source link

TCG ruling for trigger locations #2

Open StormWulf opened 8 years ago

StormWulf commented 8 years ago

In the TCG, a trigger effect must be where it needs to be by the time it would start a chain link. For example, for Ether the Heavenly Monarch when Tribute Summoned on the opponents turn, it must remain there on an opened game state. This means that if Ether is chained to a card like Raigeki, it will be destroyed before the open game state, and the opponent wouldn't be allowed to activate Ehther's Trigger effect to summon a Monarch.

This is a complicated fix to consider, so we would need suggestions for how to do this. @salix5 @VanillaSalt @nekrozar @destdev @mercury233

mercury233 commented 8 years ago

I don't know much about the core either. @DailyShana

destdev commented 8 years ago

Me neither... I think you should find something about triggers in processor.cpp? Somewhere there you could check for current location and trigger location perhaps ... if that doesn't work you can always add that check to all the trigger effects in the scripts. That would be a lot of work, but would definitly do the job.

salix5 commented 8 years ago

I think that whether the trigger effects can be activated when the card is not on the field is controlled by the scripts, since the system only checks basic conditions in effect::is_activateable(). Maybe you can modify the script to implement these features?

StormWulf commented 8 years ago

@OneShot119 was able to figure out the script change for Satellerknight Deneb to follow the TCG location ruling as shown at https://github.com/SalvationDevelopment/ygopro-tcg-scripts/blob/2397e3d31e3b1f0ffd78ed5b2bdc02f950409bf2/c75878039.lua#L27

However, there is an overwhelmingly amount of other cards that will need this line of code. We will need an optimal method of searching through all scripts that mention EFFECT_TYPE_TRIGGER_F or EFFECT_TYPE_TRIGGER_O in its code and to post that line for all cards with a variation of EVENT_SUMMON_SUCCESS. Cards with EVENT_TO_GRAVE and EVENT_REMOVE will need a slightly different line of code.

destdev commented 8 years ago

tools like notepad++ and I'm sure also other editors have a search engine that allows you to search through the entire script folder for the code EFFECT_TYPE_TRIGGER_F or EFFECT_TYPE_TRIGGER_O (maybe include EFFECT_FLAG_DELAY for the latter since you shouldn't need the check for cards that can miss the timing)

beyond that I don't think there is a way to avoid to manually check through all the files, however you can break that part into blocks for specific conditions for example if you search for every card that is a forced trigger and says "if this card is summoned" or "if this card is special summoned" (both use the event_spsummon_success), you just need to replace every "if chk==0 then return true end" with "local c=e:getHander() if chk==0 then return c:IsLocation(LOCATION_MZONE) and c:IsPosition(POS_FACEUP) end" ... this should do the job for the majority of those there is a very limited number of forced trigger that don't have a "true" in their target chk part of the function ... however there also may be other special things used in those, thus you need to manually check for those things ... this is also an easy example, all in all editing most of the forced triggers should be easier since most of those have that "if chk==0 then return true end" line, the optional triggers don't have that much in common most of the time and have (mostly very small) differences and make something like search and replace quite difficult... all in all I don't have an idea to easy that part up atm :/

btw, why did you use tc for Deneb btw, usually you just use c for e:getHandler()

ChibiChanNya commented 8 years ago

You can easily search the entire scripts folder for both with any sort of GREP functionality and a bit of Regex. If you're on windows and have this repo, just hit the console and try something like this:

git grep -li -e EVENT TO_REMOVE --and -e EFFECT_TYPE_TRIGGER -- *.lua

If you're on Mac or Linux, can use your regular console grep for an even faster search.

Here's the full documentation: https://git-scm.com/docs/git-grep nya. Can make it as specific as needed. Only the actual modification of the code should require grunty work.