{"action":"opened","issue":{"url":"https://api.github.com/repos/Ygoproco/Ygopro-Anime/issues/64","labels_url":"https://api.github.com/repos/Ygoproco/Ygopro-Anime/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/Ygoproco/Ygopro-Anime/issues/64/comments","events_url":"https://api.github.com/repos/Ygoproco/Ygopro-Anime/issues/64/events","html_url":"https://github.com/Ygoproco/Ygopro-Anime/issues/64","id":123935349,"number":64,"title":"c95000055.lua - fixing the action field: Future Metropolis Heartland","user":{"login":"ClementLouis","id":11767515,"avatar_url":"https://avatars.githubusercontent.com/u/11767515?v=3","gravatar_id":"","url":"https://api.github.com/users/ClementLouis","html_url":"https://github.com/ClementLouis","followers_url":"https://api.github.com/users/ClementLouis/followers","following_url":"https://api.github.com/users/ClementLouis/following{/other_user}","gists_url":"https://api.github.com/users/ClementLouis/gists{/gist_id}","starred_url":"https://api.github.com/users/ClementLouis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClementLouis/subscriptions","organizations_url":"https://api.github.com/users/ClementLouis/orgs","repos_url":"https://api.github.com/users/ClementLouis/repos","events_url":"https://api.github.com/users/ClementLouis/events{/privacy}","received_events_url":"https://api.github.com/users/ClementLouis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-26T15:35:22Z","updated_at":"2015-12-26T15:35:22Z","closed_at":null,"body":"--Action Field - Future Metropolis Heartland\r\nfunction c95000055.initial_effect(c)\r\n\t--Activate\t\r\n\tlocal e1=Effect.CreateEffect(c)\t\r\n\te1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)\r\n\te1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)\r\n\te1:SetCode(EVENT_PREDRAW)\r\n\te1:SetCountLimit(1)\r\n\te1:SetRange(0xff)\r\n\te1:SetOperation(c95000055.op)\r\n\tc:RegisterEffect(e1)\r\n\t--unaffectable\r\n\tlocal e2=Effect.CreateEffect(c)\r\n\te2:SetType(EFFECT_TYPE_SINGLE)\r\n\te2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)\r\n\te2:SetRange(LOCATION_SZONE)\r\n\te2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)\r\n\te2:SetValue(1)\r\n\tc:RegisterEffect(e2)\r\n\tlocal e3=e2:Clone()\r\n\te3:SetCode(EFFECT_IMMUNE_EFFECT)\r\n\te3:SetValue(c95000055.ctcon2)\r\n\tc:RegisterEffect(e3)\r\n\t--cannot set\r\n\tlocal e4=Effect.CreateEffect(c)\r\n\te4:SetType(EFFECT_TYPE_FIELD)\r\n\te4:SetCode(EFFECT_CANNOT_SSET)\r\n\te4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)\r\n\te4:SetRange(LOCATION_SZONE)\r\n\te4:SetTargetRange(1,1)\r\n\te4:SetTarget(c95000055.aclimit2)\r\n\tc:RegisterEffect(e4)\r\n\t--~ Add Action Card\r\n\tlocal e5=Effect.CreateEffect(c)\r\n\te5:SetDescription(aux.Stringid(95000055,0))\r\n\te5:SetType(EFFECT_TYPE_QUICK_O)\r\n\te5:SetRange(LOCATION_SZONE)\r\n\te5:SetCode(EVENT_FREE_CHAIN)\r\n\te5:SetCondition(c95000055.condition)\r\n\te5:SetTarget(c95000055.Acttarget)\r\n\te5:SetOperation(c95000055.operation)\r\n\tc:RegisterEffect(e5)\r\n\t--cannot change zone\r\n\tlocal eb=Effect.CreateEffect(c)\r\n\teb:SetType(EFFECT_TYPE_SINGLE)\r\n\teb:SetCode(EFFECT_CANNOT_TO_DECK)\r\n\teb:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)\r\n\teb:SetRange(LOCATION_SZONE)\r\n\tc:RegisterEffect(eb)\r\n\tlocal ec=eb:Clone()\r\n\tec:SetCode(EFFECT_CANNOT_TO_HAND)\r\n\tc:RegisterEffect(ec)\r\n\tlocal ed=eb:Clone()\r\n\ted:SetCode(EFFECT_CANNOT_TO_GRAVE)\r\n\tc:RegisterEffect(ed)\r\n\tlocal ee=eb:Clone()\r\n\tee:SetCode(EFFECT_CANNOT_REMOVE)\r\n\tc:RegisterEffect(ee)\r\n\t--cheater check\r\n\tlocal ef=Effect.CreateEffect(c)\t\r\n\tef:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)\r\n\tef:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)\r\n\tef:SetCode(EVENT_PREDRAW)\r\n\tef:SetCountLimit(1)\r\n\tef:SetRange(0xff)\r\n\tef:SetOperation(c95000055.Cheatercheck1)\r\n\tc:RegisterEffect(ef)\r\n\t-- Draw when removed\r\n\tlocal ef3=Effect.CreateEffect(c)\r\n\tef3:SetDescription(aux.Stringid(44792253,0))\r\n\tef3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)\r\n\tef3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)\r\n\tef3:SetCode(EVENT_REMOVE)\r\n\tef3:SetCondition(c95000055.descon)\r\n\tef3:SetTarget(c95000055.drtarget)\r\n\tef3:SetOperation(c95000055.drop)\r\n\tc:RegisterEffect(ef3)\r\nend\r\nfunction c95000055.Cheatercheck1(e,c)\r\n\tif Duel.GetMatchingGroupCount(c95000055.Fieldfilter,tp,0,LOCATION_DECK+LOCATION_HAND,nil)>1\r\n\tthen\r\n\tlocal WIN_REASON_ACTION_FIELD=0x55\r\n\tDuel.Win(tp,WIN_REASON_ACTION_FIELD)\r\n\tend\r\n\t\r\n\tlocal sg=Duel.GetMatchingGroup(c95000055.Fieldfilter,tp,LOCATION_DECK+LOCATION_HAND,LOCATION_DECK+LOCATION_HAND,nil)\r\n\tDuel.Remove(sg,POS_FACEUP,REASON_EFFECT)\r\nend\r\n\r\nfunction c95000055.descon(e,tp,eg,ep,ev,re,r,rp)\r\n\treturn e:GetHandler():IsFaceup() and e:GetHandler():IsPreviousLocation(LOCATION_HAND)\r\nend\r\nfunction c95000055.drtarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc)\r\n\tif chk==0 then return true end\r\n\tDuel.SetTargetPlayer(tp)\r\n\tDuel.SetTargetParam(1)\r\n\tDuel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)\r\nend\r\nfunction c95000055.drop(e,tp,eg,ep,ev,re,r,rp)\r\n\tlocal p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)\r\n\tDuel.Draw(p,d,REASON_RULE)\r\nend\r\nfunction c95000055.Fieldfilter(c)\r\n\treturn c:IsSetCard(0xac2)\r\nend\r\nfunction c95000055.ctcon2(e,re)\r\n\treturn re:GetHandler()~=e:GetHandler()\r\nend\r\nfunction c95000055.aclimit2(e,c)\r\n\treturn c:IsType(TYPE_FIELD)\r\nend\r\nfunction c95000055.tgn(e,c)\r\n\treturn c==e:GetHandler()\r\nend\r\nfunction c95000055.op(e,tp,eg,ep,ev,re,r,rp,chk)\r\nlocal tc=Duel.GetFieldCard(tp,LOCATION_SZONE,5)\r\n\tlocal tc2=Duel.GetFieldCard(1-tp,LOCATION_SZONE,5)\t\r\n\tif tc==nil then\r\n\t\tDuel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)\r\n\t\tif tc2==nil then\r\n\t\t\tlocal token=Duel.CreateToken(tp,95000043,nil,nil,nil,nil,nil,nil)\t\t\r\n\t\t\tDuel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)\r\n\t\t\tlocal e1=Effect.CreateEffect(e:GetHandler())\r\n\t\t\te1:SetCode(EFFECT_CHANGE_TYPE)\r\n\t\t\te1:SetType(EFFECT_TYPE_SINGLE)\r\n\t\t\te1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)\r\n\t\t\te1:SetReset(RESET_EVENT+0x1fc0000)\r\n\t\t\te1:SetValue(TYPE_SPELL+TYPE_FIELD)\r\n\t\t\ttoken:RegisterEffect(e1)\r\n\t\t\tDuel.MoveToField(token,tp,1-tp,LOCATION_SZONE,POS_FACEUP,true)\r\n\t\t\tDuel.SpecialSummonComplete()\r\n\t\tend\r\n\tend\r\n\t-- if e:GetHandler():GetPreviousLocation()==LOCATION_HAND then\r\n\t\t-- Duel.Draw(tp,1,REASON_RULE)\r\n\t-- end\r\nend\r\n-- Add Action Card\r\nfunction c95000055.Acttarget(e,tp,eg,ep,ev,re,r,rp,chk)\r\nif chk==0 then return true end\r\nDuel.Hint(HINT_SELECTMSG,tp,564)\r\nif Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then\r\nlocal g=Duel.GetDecktopGroup(tp,1)\r\nlocal tc=g:GetFirst()\r\nmath.randomseed( tc:getcode() )\r\nend\r\ni = math.random(20)\r\nac=math.random(1,tableAction_size)\r\ne:SetLabel(tableAction[ac])\r\nend\r\nfunction c95000055.operation(e,tp,eg,ep,ev,re,r,rp)\r\nif Duel.SelectYesNo(1-tp,aux.Stringid(95000055,0)) then\r\nlocal dc=Duel.TossDice(tp,1)\r\nif dc==2 or dc==3 or dc==4 or dc==6 then\r\ne:GetHandler():RegisterFlagEffect(95000055,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)\r\nend\r\nif dc==1 or dc==2 then\r\nif not Duel.IsExistingMatchingCard(c95000055.cfilter,tp,LOCATION_SZONE+LOCATION_HAND,0,1,nil) then\r\n\t\tlocal token=Duel.CreateToken(tp,e:GetLabel(),nil,nil,nil,nil,nil,nil)\t\t\r\n\t\tDuel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)\r\n\t\tlocal e1=Effect.CreateEffect(e:GetHandler())\r\n\t\te1:SetCode(EFFECT_CHANGE_TYPE)\r\n\t\te1:SetType(EFFECT_TYPE_SINGLE)\r\n\t\te1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)\r\n\t\te1:SetReset(RESET_EVENT+0x1fc0000)\r\n\t\te1:SetValue(TYPE_SPELL+TYPE_QUICKPLAY)\r\n\t\ttoken:RegisterEffect(e1)\r\n\t\tDuel.SendtoHand(token,nil,REASON_EFFECT)\r\n\t\tDuel.SpecialSummonComplete()\t\r\nend\r\nend\r\n\r\nif dc==5 or dc==6 then\r\n if not Duel.IsExistingMatchingCard(c95000055.cfilter,1-tp,LOCATION_SZONE+LOCATION_HAND,0,1,nil) then\r\n\t\tlocal token=Duel.CreateToken(1-tp,e:GetLabel(),nil,nil,nil,nil,nil,nil)\t\t\r\n\t\tDuel.SpecialSummonStep(token,0,1-tp,1-tp,false,false,POS_FACEUP)\r\n\t\tlocal e1=Effect.CreateEffect(e:GetHandler())\r\n\t\te1:SetCode(EFFECT_CHANGE_TYPE)\r\n\t\te1:SetType(EFFECT_TYPE_SINGLE)\r\n\t\te1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)\r\n\t\te1:SetReset(RESET_EVENT+0x1fc0000)\r\n\t\te1:SetValue(TYPE_SPELL+TYPE_QUICKPLAY)\r\n\t\ttoken:RegisterEffect(e1)\r\n\t\tDuel.SendtoHand(token,1-tp,REASON_EFFECT)\r\n\t\tDuel.SpecialSummonComplete()\r\n\t\tend\r\n\r\nend\r\n\r\nelse \r\nif not Duel.IsExistingMatchingCard(c95000055.cfilter,tp,LOCATION_SZONE+LOCATION_HAND,0,1,nil) then\r\n\t\tlocal token=Duel.CreateToken(tp,e:GetLabel(),nil,nil,nil,nil,nil,nil)\t\t\r\n\t\tDuel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)\r\n\t\tlocal e1=Effect.CreateEffect(e:GetHandler())\r\n\t\te1:SetCode(EFFECT_CHANGE_TYPE)\r\n\t\te1:SetType(EFFECT_TYPE_SINGLE)\r\n\t\te1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)\r\n\t\te1:SetReset(RESET_EVENT+0x1fc0000)\r\n\t\te1:SetValue(TYPE_SPELL+TYPE_QUICKPLAY)\r\n\t\ttoken:RegisterEffect(e1)\r\n\t\tDuel.SendtoHand(token,nil,REASON_EFFECT)\r\n\t\tDuel.SpecialSummonComplete()\t\r\nend\r\nend\r\nend\r\n\r\nfunction c95000055.aclimit2(e,c)\r\n\treturn c:IsType(TYPE_FIELD)\r\nend\r\nfunction c95000055.condition(e,tp,eg,ep,ev,re,r,rp)\r\n\treturn not Duel.IsExistingMatchingCard(c95000055.cfilter,tp,LOCATION_SZONE+LOCATION_HAND,0,1,nil) and e:GetHandler():GetFlagEffect(95000055)==0\r\n\tand not e:GetHandler():IsStatus(STATUS_CHAINING)\r\nend\r\nfunction c95000055.cfilter(c)\r\n\treturn c:IsSetCard(0xac1)\r\nend\r\ntableAction = {\r\n95000044,\r\n95000045,\r\n95000046,\r\n95000046,\r\n95000143\r\n} \r\ntableAction_size=5"}}