Unlock card mechanics

If you have a suggestion for the site, create a topic here and telll us about it
eyal282
Posts: 101
Joined: Wed Sep 23, 2020 6:02 pm
Reputation: 1
Location: Dustshoot Phase

Unlock card mechanics

Post #1 by eyal282 » Fri Sep 09, 2022 9:27 am

Edit: I already made this topic, my bad. Regardless I'll keep it because this contains a LOT more data.

Either a one button do all or making All cards use their effect text to do it, I want to unlock all card mechanics.

I tried a custom extension, but it's janky at best, and broke my entire browser at worst.

List of things that are locked right now:

1. Defense position link monsters ( not complicated, cards will have an effect to make it so the links ALWAYS flip to face up attack position )

2. Banish random extra deck card ( allows extravegence & Cynet storm type of cards to exist )

3. Add to opponent's hand ( allows Exchange type of cards to exist, allows me to give my Kaiju to my opponent to let him know it's a wind attribute.

4. Set a spell or trap to monster zone.

5. Set an extra deck monster ( I will 100% make an I:P masquerina that sets the ED monster, and allows me to flip it up in response to destruction and chain whatever that link monster has / gain its protection.

Another thing I was trying is "Effect Token", which reads a card's effect and summons a token based on the first token that appears in it ( allows you to SS Taia's token and clearly see stats, type, attribute & Tuner or non-tuner status. This is basic programming and I can provide source code to my extension for easy replication.

Also, would be nice to be able to special summon kaijus to opponent's side of field.

Code: Select all

window.duelResponse = function(data) {
   
      //duelActions++;
      //saveGamestate(duelActions);


   console.log("abcdef");
   if (SOFT_PLAYS.indexOf(data.play) < 0) {
      $('.red_target').hide();
      $('.blue_target').hide();
      $('.green_target').hide();
   }
   var player;
   if (data.username == player1.username) {
      player = player1;
   }
   else if (data.username == player2.username) {
      player = player2;
   }
   else if (tag_duel && data.username == player3.username) {
      player = player3;
   }
   else if (tag_duel && data.username == player4.username) {
      player = player4;
   }
   if (actionsQueue.length > 0) {
      //console.log("actionsQueue.length = " + actionsQueue.length);
      for (var i = 0; i < actionsQueue.length; i++) {
         //console.log("actionsQueue[i] = " + actionsQueue[i]);
      }
   }
   
   if (data.owner && data.id) {
      actionsQueue.push(function(){
         //updateOwner(getPlayer(data.owner), getDuelCard(data.id));
         updateOwner(getCurrentOwner(data.owner), getDuelCard(data.id)); // the owner is always the active_player on a team
         endAction();
      });
   }
   
   switch (data.play) {
      case "Rejoin duel":
         rejoinDuel(player, data);
         break;
      case "Add watcher":
         addWatcher(data);
         break;
      case "Remove watcher":
         removeWatcher(data);
         enableAdminE();
         break;
      case "Watcher message":
         watchChatPrint(data);
         break;
      case "Siding":
         initSiding(data);
         addLine(escapeHTML(data.message));
         break;
      case "Siding with cards":
         initSiding(data);
         addLine(escapeHTML(data.message));
         createSidingHoles(data);
         initSideCardFromData(data);
         break;
      case "Begin next duel":
         beginNextDuel(data);
         break;
      case "Back to RPS":
         exitRPS();
         exitTP();
         exitDueling();
         exitSiding();
         duel_active = true;
         if (duelist) {
            updateActive(true);
         }
         else {
            $('#draw_btn').hide();
               $('#mulligan_btn').hide();
         }
         initRPSStart();
         gameLossSound = getGameLossSound();
         gameWinSound = getGameWinSound();
         if (switched) {
            if (tag_duel) {
               switchDuelists(data, "player1", "player2", "player3", "player4");
            }
            else {
               switchDuelists(data, "player1", "player2");
            }
         }
         else if (tag_duel && data.player3.username == username) {
            switchDuelists(data, "player1", "player3");
         }
         deckData = data;
         if (data.starting) {
            if (match_type == "m") {
               addLine("Starting new match");
            }
            else if (match_type == "n") {
               addLine("Starting new single");
            }
         }
         $('#draw_btn').val("Offer Draw");
         initSleeves();
         $('.all_good').hide();
         break;
      case "Admit defeat":
         hideDim();
         admittedDefeat(player, data);
         break;
      case "Left duel":
         leftDuel(player, data);
         break;
      case "Quit duel":
         quitDuel(player, data);
         break;
      case "Game loss":
      case "Match loss":
         gamelossed(player, data);
         break;
      case "Loss":
         loss(player, data);
         break;
      case "Cancel game":
         gameCanceled(data);
         break;
      case "Frozen":
         if (data.targeted_username) {
            addLine(data.targeted_username + " has been frozen");
         }
         else {
            addLine(data.username + " has been frozen");
         }
         break;
      case "Beginner":
         if (data.targeted_username) {
            addLine(data.targeted_username + " has been set as a beginner");
         }
         else {
            addLine(data.username + " has been set as a beginner");
         }
         break;
      case "RPS":
         determineWinner(data);
         break;
      case "Typing":
         typingE(player);
         break;
      case "Duel message":
         duelChatPrint(data);
         if (player) {
            player.stopTyping();
         }
         if (duelist && data.username == username) {
            duelChatTimerE();
         }
         break;
      case "Reset deck":
      case "Swap cards":
         hideDim();
         $('#reset_btn').disable(false);
         updateSideCards(data);
         checkSidingCards();
         break;
      case "Pause game":
         pauseGame(player, data);
         break;
      case "Resume game":
         resumeGame(data);
         break;
      case "Reset game":
         actionsQueue.push(function(){
            resetGame(player, data);
         });
         break;
      case "Call admin":
         addLine(escapeHTML(player.username) + " has called a judge");
         $('#call_admin_btn').disable(true);
         awaiting_admin = true;
         if (duelist && player.username == username) {
            $('#call_admin_btn').disable(false);
            $('#call_admin_btn').val("Cancel Call");
         }
         break;
      case "Cancel call":
         addLine(escapeHTML(player.username) + " cancelled the call");
         awaiting_admin = false;
         if (duelist) {
            $('#call_admin_btn').disable(false);
            $('#call_admin_btn').val("Call Judge");
         }
         break;
      case "Offer draw":
         addLine(escapeHTML(player.username) + " has made a draw offer");
         if (isPlayer2(player.username)) {
            $('#draw_btn').val("Accept Draw");
            return;
         }
         $('#draw_btn').val("Revoke Draw");
         break;
      case "Revoke draw":
         addLine(escapeHTML(player.username) + " has revoked the draw offer");
         $('#draw_btn').val("Offer Draw");
         break;
      case "Accept draw":
         acceptDraw(player, data);
         break;
      case "Offer rematch":
         addLine(escapeHTML(player.username) + " offered a rematch");
         if (isPlayer2(player.username)) {
            $('#rematch_btn').val("Accept Rematch");
            return;
         }
         $('#rematch_btn').val("Revoke Rematch");
         break;
      case "Revoke rematch":
         addLine(escapeHTML(player.username) + " has revoked the rematch offer");
         $('#rematch_btn').val("Offer Rematch");
         break;
      case "Accept rematch":
         used_allotted_rematch = 1;
         $('#rematch_btn').val("Offer Rematch");
         break;
      case "Done siding":
         if (!duelist && player == Player1()) {
            $('#done_siding1').show();
         }
         else if (duelist && player.username == username) {
            clearHoles();
            $('#done_siding_btn').hide();
            $('#done_siding1').show();
         }
         else if (player == Player2()) {
            $('#done_siding2').show();
         }
         break;
      case "Pick first":
         pickFirstResponse(data);
         break;
      case "Target card":
         actionsQueue.push(function(){
            targetCardResponse(player, data); // when not using actionsQueue, it messed up replays
         });
         break;
         break;
      case "Stop viewing":
         stopViewing(data);
         break;
      case "Shuffle deck":
         actionsQueue.push(function(){
            shuffleDeck(player, data);
         });
         break;
      case "Shuffle hand":
         actionsQueue.push(function(){
            shuffleHand2(player, data);
         });
         break;
      case "Permission event":
         permissionEvent(data);
         break;
      case "Permission granted":
         removePermission();
         break;
      case "Permission denied":
         addLine(escapeHTML(data.username) + " denied permission");
         if (isPlayer1(data.username)) {
            if ($('#status1 .status_txt').text() == "Waiting for permission") {
               $('#status1 .status_txt').text("");
            }
         }
         else if (isPlayer2(data.username)) {
            if ($('#status2 .status_txt').text() == "Waiting for permission") {
               $('#status2 .status_txt').text("");
            }
         }
         break;
      case "Start turn":
         actionsQueue.push(function(){
            turn_player = getPlayer(data.username);
            startTurn();
         });
         break;
      case "Enter DP":
         actionsQueue.push(function(){
            enterDP();
         });
         break;
      case "Enter SP":
         actionsQueue.push(function(){
            enterSP();
         });
         break;
      case "Enter M1":
         actionsQueue.push(function(){
            enterM1();
         });
         break;
      case "Enter BP":
         actionsQueue.push(function(){
            enterBP();
         });
         break;
      case "Enter M2":
         actionsQueue.push(function(){
            enterM2();
         });
         break;
      case "Enter EP":
         actionsQueue.push(function(){
            enterEP();
         });
         break;
      case "End turn":
         actionsQueue.push(function(){
            endTurn(data);
         });
         break;
      case "Add counter":
         actionsQueue.push(function(){
            addCounter(player, data);
         });
         break;
      case "Remove counter":
         actionsQueue.push(function(){
            removeCounter(player, data);
         });
         break;
      case "Die":
         actionsQueue.push(function(){
            dieRoll(player, data);
         });
         break;
      case "Coin":
         actionsQueue.push(function(){
            coinFlip(player, data);
         });
         break;
      case "Life points":
         actionsQueue.push(function(){
            updateLifePoints(player, data);
         });
         break;
      case "View deck":
         if (duelist && player.username == username) {
            if (seen_deck == false) {
               //seen_deck = true;
               viewingE(data.viewing, data);
            }
         }
         showViewing(data);
         break;
      case "View GY":
      case "View GY 2":
      case "View Banished":
      case "View Banished 2":
      case "View ED 2":
      case "View Graveyard":
      case "View Extra Deck":
      case "View Opponent's Banished":
      case "View Opponent's Graveyard":
      case "View Opponent's Public Extra Deck":
         showViewing(data);
         break;
      case "View ED":
         if (duelist && player.username == username) {
            if (seen_extra == false) {
               seen_extra = true;
               viewingE("Extra Deck", data);
            }
         }
         showViewing(data);
         break;
      case "Show deck":
      case "Show hand":
      case "Show ED":
      case "Show Extra Deck":
         actionsQueue.push(function(){
            showE(data.viewing, data);
         });
         break;
      case "Reveal":
      case "Reveal card from hand":
      case "Reveal card from deck":
      case "Reveal from Extra":
         actionsQueue.push(function(){
            reveal(player, data);
         });
         break;
      case "Move":
         actionsQueue.push(function(){
            move(player, data);
         });
         break;
      case "Overlay":
         actionsQueue.push(function(){
            overlay(player, data);
         });
         break;
      case "Detach":
         actionsQueue.push(function(){
            detach(player, data);
         });
         break;
      case "Attack":
         actionsQueue.push(function(){
            attack(player, data);
         });
         break;
      case "Attack directly":
         actionsQueue.push(function(){
            attackDirectly(player, data);
         });
         break;
      case "Draw card":
         actionsQueue.push(function(){
            drawCard(player, data);
         });
         break;
      case "To hand":
      case "To hand 2":
      case "To hand from deck":
      case "To hand from field":
      case "To hand from grave":
      case "To hand from Extra":
      case "To hand from banished":
         actionsQueue.push(function(){
            toHand(player, data);
         });
         break;
      case "To B Deck":
      case "To B Deck 2":
      case "To T Deck":
      case "To T Deck 2":
      case "To T Deck FU":
      case "To T Deck 2 FU": // Parasite Paracide
         actionsQueue.push(function(){
            toDeck(player, data);
         });
         break;
      case "To GY":
      case "To grave from deck":
      case "To grave from field":
      case "To grave from hand":
      case "To Grave from Extra":
      case "To grave from banished":
      case "To grave from opponent's banished":
         actionsQueue.push(function(){
            toGY(player, data);
         });
         break;
      case "Mill":
         actionsQueue.push(function(){
            mill(player, data);
         });
         break;
      case "Banish":
      case "Banish FD":
      case "Banish from deck":
      case "Banish top card of deck":
      case "Banish top card of deck FD":
      case "Banish FD from deck":
      case "Banish from field":
      case "Banish from field FD":
      case "Banish from hand":
      case "Banish from hand FD":
      case "Banish Xyz Material":
      case "Banish from Extra":
      case "Banish from Extra FD":
      case "Banish from grave":
      case "Banish from grave FD":
      case "Banish from opponent's grave":
         actionsQueue.push(function(){
            banish(player, data);
         });
         break;
      case "To ED":
      case "To ED FU":
      case "To Extra from field":
      case "To Extra FU from field":
      case "To Extra from grave":
      case "To Extra FU from grave":
      case "To Extra from banished":
      case "To Extra FU from banished":
         actionsQueue.push(function(){
            toED(player, data);
         });
         break;
      case "Normal Summon":
         actionsQueue.push(function(){
            normalSummon(player, data);
         });
         break;
      case "SS ATK":
      case "SS DEF":
      case "SS ATK from hand":
      case "SS ATK from deck":
      case "SS ATK from Extra":
      case "SS ATK from grave":
      case "SS ATK from banished":
      case "SS ATK from opponent's grave":
      case "SS ATK from opponent's banished":
      case "SS DEF from hand":
      case "SS DEF from deck":
      case "SS DEF from Extra":
      case "SS DEF from grave":
      case "SS DEF from banished":
      case "SS DEF from opponent's grave":
      case "SS DEF from opponent's banished":
         actionsQueue.push(function(){
            specialSummon(player, data);
         });
         break;
      case "OL ATK":
      case "OL DEF":
      case "OL ATK from Extra":
      case "OL DEF from Extra":
         actionsQueue.push(function(){
            olSummon(player, data);
         });
         break;
      case "Summon token":
      case "Summon Token":
         if(!summoning_card.data("cardfront").data("effect"))
         {
            actionsQueue.push(function(){
               summonToken(player, data);
            });
         }
         else
         {
            actionsQueue.push(function(){
               summonEffectToken(player, data);
            });
         }
         break;
      case "Remove Token":
         actionsQueue.push(function(){
            removeToken(player, data);
         });
         break;
      case "Flip":
      case "Flip monster":
         actionsQueue.push(function(){
            flip(player, data);
         });
         break;
      case "Flip Summon":
         actionsQueue.push(function(){
            flipSummon(player, data);
         });
         break;
      case "To ATK":
         actionsQueue.push(function(){
            toATK(player, data);
         });
         break;
      case "To DEF":
         actionsQueue.push(function(){
            toDEF(player, data);
         });
         break;
      case "Activate ST":
      case "Activate Spell":
      case "Activate Spell from hand":
         actionsQueue.push(function(){
            activateST(player, data);
         });
         break;
      case "To ST":
      case "To ST from deck":
      case "To ST from hand":
      case "To ST from grave":
         actionsQueue.push(function(){
            toST(player, data);
         });
         break;
      case "Set monster":
      case "Set monster from hand":
         actionsQueue.push(function(){
            setMonster(player, data);
         });
         break;
      case "Set ST":
      case "Set ST from deck":
      case "Set ST from hand":
      case "Set monster to ST from hand":
         actionsQueue.push(function(){
            setST(player, data);
         });
         break;
      case "Activate Field Spell":
      case "Activate Field Spell from hand":
         actionsQueue.push(function(){
            activateFieldSpell(player, data);
         });
         break;
      case "Activate Field Spell 2":
         actionsQueue.push(function(){
            activateFieldSpell2(player, data);
         });
         break;
      case "Set Field Spell":
      case "Set Field Spell from hand":
      case "Set Field Spell from deck":
         actionsQueue.push(function(){
            setFieldSpell(player, data);
         });
         break;
      case "Set Field Spell 2": // Set Rotation
      case "Set Field Spell from deck to opponent's field":
         actionsQueue.push(function(){
            setFieldSpell2(player, data);
         });
         break;
      case "Activate Pendulum Left":
      case "Activate Pendulum Left from field":
      case "Activate Pendulum Left from hand":
         actionsQueue.push(function(){
            activatePendulumLeft(player, data);
         });
         break;
      case "Activate Pendulum Right":
      case "Activate Pendulum Right from field":
      case "Activate Pendulum Right from hand":
         actionsQueue.push(function(){
            activatePendulumRight(player, data);
         });
         break;
      case "Activate Skill":
         actionsQueue.push(function(){
            activateSkill(player, data);
         });
         break;
      case "Set Skill":
         actionsQueue.push(function(){
            setSkill(player, data);
         });
         break;
      case "Change control":
         actionsQueue.push(function(){
            changeControl(player, data);
         });
         break;
      case "Add random card from deck to hand": // Crescent effect
         actionsQueue.push(function(){
            addRandomCardFromDeckToHand(player, data);
         });
         break;
      case "Turn top card face-up": // Grave Lure
      case "Turn top card of deck face-up":
         actionsQueue.push(function(){
            turnTopCardOfDeckFU(player, data);
         });
         break;
      case "Flip deck": // Convulsion of Nature
      case "Flip deck back":
         actionsQueue.push(function(){
            flipDeck(player, data);
         });
         break;
      case "Pick 2 cards": // Hi-Speedroid Rubber Band Shooter
      case "Pick 3 cards": // Spellbook Library of the Crescent, Power Tool Dragon, Lilith, Lady of Lament
         if (duelist && player.username == username) {
            viewingE(data.viewing, data);
            next_callback = data.callback; // moved here from below
         }
         showViewing(data);
         break;
      case "Cynet Storm": // Cynet Storm
         actionsQueue.push(function(){
            cynetStorm(player, data);
         });
         break;
      case "Exchange cards": // Exchange
         actionsQueue.push(function(){
            exchangeCards(player, data);
         });
         break;
      case "Attach top card from Deck 2": // Time Thief Redoer
         actionsQueue.push(function(){
            attachTopCardFromDeck2(player, data);
         });
         break;
      case "Swap":
         swap(player, data);
         return;
      case "New card":
         actionsQueue.push(function(){
            newCard(player, data);
         });
         break;
      case "Initialize cards":
         initalizeCards(player, data);
         break;
         
      // DEPRACATED PLAYS
      case "Flip decks":
         actionsQueue.push(function(){
            flipDecks(player, data);
         });
         break;
      case "Flip decks back":
         actionsQueue.push(function(){
            flipDecksBack(player, data);
         });
         break;
      case "Turn face-down":
         actionsQueue.push(function(){
            turnFaceDown(player, data);
         });
         break;
      case "Add proxy":
         actionsQueue.push(function(){
            addProxy(player, data);
         });
         break;
      case "Declare":
         actionsQueue.push(function(){
            declare(player, data);
         });
         break;
      case "Stay revealed":
         actionsQueue.push(function(){
            stayRevealed(player, data);
         });
         break;
      case "Stop revealing":
         actionsQueue.push(function(){
            stopRevealing(player, data);
         });
         break;
      case "Good":
         actionsQueue.push(function(){
            allGood(player, data);
         });
         break;
      case "Stop good":
         actionsQueue.push(function(){
            stopGood(player, data);
         });
         break;
      case "Thinking":
         //actionsQueue.push(function(){
            thinking(player, data);
            typingE(player);
         //});
         break;
      case "Countdown":
         //actionsQueue.push(function(){
            updateCountdown(player, data);
         //});
         break;
      case "Message":
         //addLine(data.line);
         break;
   }
   if (data.line) {
      addLine(escapeHTML(data.line));
   }
   //if (duelist) {
      if (data.log) {
         if (data.log instanceof Array) {
            for (i = 0; i < data.log.length; i++) {
               data.log[i].seconds = data.seconds;
            }
         }
         else {
            data.log.seconds = data.seconds;
         }
         duelLogPrint(data.log);
      }
   //}
   performNextAction();
}


window.summonEffectToken = function(player, data)
{
   console.log("token");
   awaiting_token = false;

   var card = summoning_card;
   var token = newDuelCard();
   loadSleeves(player1)
   loadSleeves(player2)
   token.data("id", data.id);
   token.data("inATK", false);
   token.data("inDEF", true);
   token.data("face_down", false);
   token.data("controller", player.opponent);
   token.data("owner", player.opponent);

   let pos = card.data("cardfront").data("effect").indexOf(`Token" (`) + 8
   
   let endPos = card.data("cardfront").data("effect").indexOf(`)`, pos)
   
   let tokenStr = card.data("cardfront").data("effect").slice(pos, endPos);
   
   let tuner = "";
   
   if(tokenStr.indexOf("Tuner/") >= 0)
      tuner = " / Tuner";
   
   tokenStr = tokenStr.replace("Tuner/", "");
   
   var exploded = tokenStr.split("/");
   
   var race = ""
   var attribute = ""
   var level = ""
   var atk = ""
   var def = ""
   
   race = exploded[0];
   attribute = exploded[1];
   level = exploded[2].replace("Level ", "");
   atk = exploded[3].replace("ATK ", "");
   def = exploded[4].replace("DEF ", "");
   
   token.data("cardfront").initializeFromData({
      "name":"Token",
      "treated_as":"Token",
      "effect":"This card can be used as any Token",
      "card_type":"Monster",
      "monster_color":"Token",
      "type":race + tuner,
      "attribute":attribute,
      "level":level,
      "atk":atk,
      "def":def,
      "pic":card.find('.pic').attr("src"),
   });
   card.data("cardfront").find('.image').attr("src", card.find('.pic').attr("src"));
   //token.data("cardfront").data("initialized", false); // Tokens DO cause problems otherwise, as seen at 644 in this replay 12889341
   
   
   //token.data("cardfront").setImage();
   player.all_cards_arr.push(token);
   
   var points = getNextMonsterZone(player, token, data);
   TweenMax.to(token, 0, {left:points[0], top:points[1], rotationY:ABOUT_ZERO, rotation:player.defRot, scale:0.1485});
   $('#field').append(token);
   token.onRotate(true);
   playSound(SpecialSummon);
   $('#ss_glow').show();
   $('#ss_spiral').show();
   TweenMax.to($('#ss_glow'), 0, {left:points[0], top:points[1]});
   TweenMax.to($('#ss_glow'), 0.7, {scale:6, rotation:-250});
   TweenMax.to($('#ss_glow'), 1, {alpha:0});
   TweenMax.to($('#ss_spiral'), 0, {left:points[0], top:points[1]});
   TweenMax.to($('#ss_spiral'), 0.7, {scale:6, rotation:250});
   TweenMax.to($('#ss_spiral'), 1, {alpha:0, onComplete:function(){
      resetSpecialSummon();
      if (duelist && player != Player1()) {
         token.css("cursor", "pointer");
         token.click(targetCard);
      }
      endAction();
   }});
   
}

Return to “Suggestions”

Who is online

Users browsing this forum: Bing [Bot] and 169 guests