ProjectIgnis / CardScripts

Project Ignis card script libraries and canonical card scripts for EDOPro. Send bug reports through Discord only!
86 stars 59 forks source link

Fix "Chain Destruction" #1132

Closed XGlitchy30 closed 2 months ago

XGlitchy30 commented 3 months ago

The Normal Trap "Chain Destruction", which reads...

When a monster(s) with 2000 or less ATK is Summoned: Target 1 of them; destroy all cards with that name in its controller's hand and Main Deck. ...currently has the following issues:

  • At the time of resolution, if the target left the Monster Zone between the activation and resolution of "Chain Destruction", or if it is currently in face-down Defense Position, the effect of "Chain Destruction" still destroys any available card in the hand and Main Deck of the controller, even though it shouldn't be able to. (Link to the FAQ on the Konami DB, refer to the last bulleted entry: https://www.db.yugioh-card.com/yugiohdb/faq_search.action?ope=4&cid=4813)
  • When a Fusion, Synchro, Xyz, or Link Monster is Summoned, "Chain Destruction" should not be able to be activated, unless that monster has a name of a card that can be placed in hand/Main Deck. (Link to the translated Q&A on the YGOrganization DB: https://db.ygorganization.com/qa#13158)

The following link redirects to the bug report in the official_card_rulings_bugs channel of the ProjectIgnis Discord server, where relevant replays reproducing the bugs can be found: https://discord.com/channels/170601678658076672/184324960842416129/1231661707332423761

The first problem was fixed by invoking the Card.IsRelateToEffect and Card.IsFaceup functions at the beginning of the Operation Function.

The second problem was more complex and prompted several changes regarding activation legality:

Additionally, missing Operation Info functions were added in the Target Function:

pyrQ commented 3 months ago

Should be able to use the Duel.GetCardTypeFromCode function instead of all that hidden Token stuff. See the documentation here: https://projectignis.github.io/scrapi-book/api/functions/Duel/GetCardTypeFromCode.html

XGlitchy30 commented 3 months ago

Fixed the following issues:

ClaireStanfield commented 3 months ago

I'm not sure if this is considered improper etiquette but, since the card is being worked on, I figured I'd bring to attention here another issue with this card I reported a while back that will persist even with these changes.

The card can still be activated and will properly resolve even if the Summoned monster leaves the field before the card's activation window. Here's a puzzle code to demonstrate what I mean by summoning Reptilianne Servant.


--Created using senpaizuri's Puzzle Maker (updated by Naim & Larry126)
--Partially rewritten by edo9300
Debug.ReloadFieldBegin(DUEL_ATTACK_FIRST_TURN+DUEL_SIMPLE_AI,5)
Debug.SetPlayerInfo(0,8000,0,0)
Debug.SetPlayerInfo(1,8000,0,0)

--Main Deck (yours)
Debug.AddCard(16008155,0,0,LOCATION_DECK,0,POS_FACEDOWN)

--Hand (yours)
Debug.AddCard(16008155,0,0,LOCATION_HAND,0,POS_FACEDOWN)

--Monster Zones (yours)
Debug.AddCard(79491903,0,0,LOCATION_MZONE,2,POS_FACEUP_ATTACK,true)

--Spell & Trap Zones (yours)
Debug.AddCard(1248895,0,0,LOCATION_SZONE,2,POS_FACEDOWN)

Debug.ReloadFieldEnd()
aux.BeginPuzzle()
XGlitchy30 commented 3 months ago

I'm not sure if this is considered improper etiquette but, since the card is being worked on, I figured I'd bring to attention here another issue with this card I reported a while back that will persist even with these changes.

The card can still be activated and will properly resolve even if the Summoned monster leaves the field before the card's activation window. Here's a puzzle code to demonstrate what I mean by summoning Reptilianne Servant.

--Created using senpaizuri's Puzzle Maker (updated by Naim & Larry126)
--Partially rewritten by edo9300
Debug.ReloadFieldBegin(DUEL_ATTACK_FIRST_TURN+DUEL_SIMPLE_AI,5)
Debug.SetPlayerInfo(0,8000,0,0)
Debug.SetPlayerInfo(1,8000,0,0)

--Main Deck (yours)
Debug.AddCard(16008155,0,0,LOCATION_DECK,0,POS_FACEDOWN)

--Hand (yours)
Debug.AddCard(16008155,0,0,LOCATION_HAND,0,POS_FACEDOWN)

--Monster Zones (yours)
Debug.AddCard(79491903,0,0,LOCATION_MZONE,2,POS_FACEUP_ATTACK,true)

--Spell & Trap Zones (yours)
Debug.AddCard(1248895,0,0,LOCATION_SZONE,2,POS_FACEDOWN)

Debug.ReloadFieldEnd()
aux.BeginPuzzle()

It's a bit late here so I pushed a quick fix to address this issue. I am fairly sure a simple check with Card.IsLocation in the filter should be enough for a "When" effect, but if that proves to be insufficient, I'll work out something else tomorrow once I can dedicate enough time to it.