| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System;
- using System.Linq;
- public class Permanent
- {
- public Permanent(List<CardSource> cardSources)
- {
- SetCardSources(cardSources);
- }
- public void SetCardSources(List<CardSource> cardSources)
- {
- List<CardSource> newCardSources = cardSources.Clone();
- newCardSources.Reverse();
- foreach (CardSource cardSource in newCardSources)
- {
- AddCardSource(cardSource);
- }
- }
- public FieldCardFrame PermanentFrame
- {
- get
- {
- if (TopCard != null)
- {
- int index = Array.IndexOf(TopCard.Owner.FieldPermanents, this);
- if (0 <= index && index <= TopCard.Owner.fieldCardFrames.Count - 1)
- {
- return TopCard.Owner.fieldCardFrames[index];
- }
- }
- return null;
- }
- }
- public bool oldIsTapped_playCard { get; set; }
- #region Level
- public int Level
- {
- get
- {
- int Level = 0;
- if (TopCard != null)
- {
- Level = TopCard.Level;
- if (!TopCard.HasLevel)
- {
- Level = 1145140;
- }
- #region レベルを変更する効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangePermanentLevelEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Level = ((IChangePermanentLevelEffect)cardEffect).GetPermanentLevel(Level, this);
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangePermanentLevelEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Level = ((IChangePermanentLevelEffect)cardEffect).GetPermanentLevel(Level, this);
- }
- }
- }
- #endregion
- }
- #endregion
- }
- return Level;
- }
- }
- #endregion
- #region Place all evolution sources in the trash
- public IEnumerator DiscardEvoRoots(bool ignoreOverflow = false, bool putToTrash = true)
- {
- List<CardSource> evoRoots = DigivolutionCards.Clone();
- List<CardSource> linkRoots = LinkedCards.Clone();
- if (!ignoreOverflow)
- {
- yield return ContinuousController.instance.StartCoroutine(new AceOverflowClass(evoRoots).Overflow());
- yield return ContinuousController.instance.StartCoroutine(new AceOverflowClass(linkRoots).Overflow());
- }
- foreach (CardSource cardSource1 in evoRoots)
- {
- if (putToTrash)
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource1));
- }
- else
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource1));
- }
- }
- foreach (CardSource cardSource2 in linkRoots)
- {
- if (putToTrash)
- {
- yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(cardSource2));
- }
- else
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource2));
- }
- }
- }
- #endregion
- #region Whether this permanent has DP
- public bool HasDP
- {
- get
- {
- if (TopCard == null)
- {
- return false;
- }
- if (!IsDigimon)
- {
- return false;
- }
- if (!TopCard.HasDP && TopCard.IsDigiEgg)
- {
- return false;
- }
- #region Effect of not having DP
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is IDontHaveDPEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((IDontHaveDPEffect)cardEffect1).DontHaveDP(this))
- {
- return false;
- }
- }
- }
- }
- }
- }
- #endregion
- return true;
- }
- }
- #endregion
- #region Base DP
- public int BaseDP
- {
- get
- {
- int BaseDP = 0;
- if (HasDP)
- {
- BaseDP = TopCard.BaseCardDP;
- #region 基礎DPを変更する効果
- List<ICardEffect> cardEffects_ChangeDP = new List<ICardEffect>();
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeBaseDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeBaseDPEffect)cardEffect).PermanentCondition(this))
- {
- if (((IChangeBaseDPEffect)cardEffect).IsMinusDP())
- {
- if (this.ImmuneFromDPMinus(cardEffect))
- {
- continue;
- }
- }
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDP.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeBaseDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeBaseDPEffect)cardEffect).PermanentCondition(this))
- {
- if (((IChangeBaseDPEffect)cardEffect).IsMinusDP())
- {
- if (this.ImmuneFromDPMinus(cardEffect))
- {
- continue;
- }
- }
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDP.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- List<ICardEffect> cardEffects_ChangeDP_isUpDown = new List<ICardEffect>();
- List<ICardEffect> cardEffects_ChangeDP_NotIsUpDown = new List<ICardEffect>();
- foreach (ICardEffect cardEffect in cardEffects_ChangeDP)
- {
- if (cardEffect is IChangeBaseDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeBaseDPEffect)cardEffect).IsUpDown())
- {
- cardEffects_ChangeDP_isUpDown.Add(cardEffect);
- }
- else
- {
- cardEffects_ChangeDP_NotIsUpDown.Add(cardEffect);
- }
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDP_isUpDown)
- {
- if (cardEffect is IChangeBaseDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- BaseDP = ((IChangeBaseDPEffect)cardEffect).GetDP(BaseDP, this);
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDP_NotIsUpDown)
- {
- if (cardEffect is IChangeBaseDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- BaseDP = ((IChangeBaseDPEffect)cardEffect).GetDP(BaseDP, this);
- }
- }
- }
- #endregion
- if (BaseDP < 0)
- {
- BaseDP = 0;
- }
- }
- return BaseDP;
- }
- }
- #endregion
- #region DP
- public int DP
- {
- get
- {
- int DP = -1;
- if (HasDP)
- {
- DP = BaseDP;
- #region DP By Effect
- List<ICardEffect> cardEffects_ChangeDP = new List<ICardEffect>();
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- #region Effects of permanents in play
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
- {
- if (((IChangeDPEffect)cardEffect).IsMinusDP())
- {
- if (this.ImmuneFromDPMinus(cardEffect))
- {
- continue;
- }
- }
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDP.Add(cardEffect);
- }
- }
- }
- }
- }
- }
- #endregion
- #region Effects of face up security
- foreach (CardSource cardSource in player.SecurityCards)
- {
- if (cardSource.IsFlipped)
- continue;
- foreach (ICardEffect cardEffect in cardSource.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
- {
- if (((IChangeDPEffect)cardEffect).IsMinusDP())
- {
- if (this.ImmuneFromDPMinus(cardEffect))
- {
- continue;
- }
- }
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDP.Add(cardEffect);
- }
- }
- }
- }
- }
- }
- #endregion
- #region Player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
- {
- if (((IChangeDPEffect)cardEffect).IsMinusDP())
- {
- if (this.ImmuneFromDPMinus(cardEffect))
- {
- continue;
- }
- }
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDP.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- List<ICardEffect> cardEffects_ChangeDP_isUpDown = new List<ICardEffect>();
- List<ICardEffect> cardEffects_ChangeDP_NotIsUpDown = new List<ICardEffect>();
- foreach (ICardEffect cardEffect in cardEffects_ChangeDP)
- {
- if (cardEffect is IChangeDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((IChangeDPEffect)cardEffect).IsUpDown())
- {
- cardEffects_ChangeDP_isUpDown.Add(cardEffect);
- }
- else
- {
- cardEffects_ChangeDP_NotIsUpDown.Add(cardEffect);
- }
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDP_isUpDown)
- {
- if (cardEffect is IChangeDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- DP = ((IChangeDPEffect)cardEffect).GetDP(DP, this);
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDP_NotIsUpDown)
- {
- if (cardEffect is IChangeDPEffect)
- {
- if (cardEffect.CanUse(null))
- {
- DP = ((IChangeDPEffect)cardEffect).GetDP(DP, this);
- }
- }
- }
- #endregion
- #region DP Boosts
- foreach(DPBoost boost in Boosts)
- {
- DP += boost.DP;
- }
- #endregion
- DP += LinkedDP;
- if (DP < 0)
- {
- DP = 0;
- }
- }
- return DP;
- }
- }
- public int LinkedDP { get; set; }
- public List<DPBoost> Boosts = new List<DPBoost>();
- public void AddBoost(DPBoost boost)
- {
- if (Boosts.Any(x => x.ID == boost.ID))
- Boosts.First(x => x.ID == boost.ID).DP = boost.DP;
- else
- Boosts.Add(boost);
- }
- public void RemoveBoost(string ID)
- {
- if (Boosts.Any(x => x.ID == ID))
- Boosts.Remove(Boosts.First(x => x.ID == ID));
- }
- public class DPBoost
- {
- public DPBoost(string id, int dp, Func<bool> cond)
- {
- ID = id;
- DP = dp;
- Condition = cond;
- }
- public string ID = "";
- public int DP = 0;
- public Func<bool> Condition = null;
- }
- #endregion
- #region Will it not receive negative DP effect?
- public bool ImmuneFromDPMinus(ICardEffect cardEffect)
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is IImmuneFromDPMinusEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
- {
- return true;
- }
- }
- }
- }
- }
- foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is IImmuneFromDPMinusEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Can be returned to your hand?
- public bool CannotReturnToHand(ICardEffect cardEffect)
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICannotReturnToHandEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
- {
- return true;
- }
- }
- }
- }
- foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICannotReturnToHandEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Can be returned to deck?
- public bool CannotReturnToLibrary(ICardEffect cardEffect)
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICannotReturnToLibraryEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
- {
- return true;
- }
- }
- }
- }
- foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICannotReturnToLibraryEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Immune From De-Digivolve
- public bool ImmuneFromDeDigivolve()
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is IImmuneFromDeDigivolveEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((IImmuneFromDeDigivolveEffect)cardEffect1).ImmuneDeDigivolve(this))
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Immune From Trashing Stack
- public bool ImmuneFromStackTrashing(ICardEffect effect)
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is IImmuneFromStackTrashingEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((IImmuneFromStackTrashingEffect)cardEffect1).ImmuneStackTrashing(this, effect))
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Card Sources
- public List<CardSource> cardSources = new List<CardSource>();
- #endregion
- #region Stacked Cards
- public List<CardSource> StackCards => cardSources.Filter(cardSource => !LinkedCards.Contains(cardSource));
- #endregion
- #region Digivolution Cards
- public List<CardSource> DigivolutionCards => cardSources.Filter(cardSource => cardSource != TopCard && !LinkedCards.Contains(cardSource));
- #endregion
- #region Linked Cards
- public int LinkedMax
- {
- get
- {
- int Max = 1;
- #region Effect of changing the number of sheets to undergo security check
- List<ICardEffect> cardEffects_ChangeLinkedMax = new List<ICardEffect>();
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeLinkMaxEffect)
- {
- if (((IChangeLinkMaxEffect)cardEffect).PermanentCondition(this))
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeLinkedMax.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeLinkMaxEffect)
- {
- if (((IChangeLinkMaxEffect)cardEffect).PermanentCondition(this))
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeLinkedMax.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- List<ICardEffect> cardEffects_ChangeLinkedMax_UpToConstant = new List<ICardEffect>();
- List<ICardEffect> cardEffects_ChangeLinkedMax_UpDownValue = new List<ICardEffect>();
- List<ICardEffect> cardEffects_ChangeLinkedMax_DownToConstant = new List<ICardEffect>();
- foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax)
- {
- if (cardEffect is IChangeLinkMaxEffect)
- {
- if (cardEffect.CanUse(null))
- {
- switch (((IChangeLinkMaxEffect)cardEffect).isUpDown())
- {
- case CalculateOrder.UpToConstant:
- cardEffects_ChangeLinkedMax_UpToConstant.Add(cardEffect);
- break;
- case CalculateOrder.UpDownValue:
- cardEffects_ChangeLinkedMax_UpDownValue.Add(cardEffect);
- break;
- case CalculateOrder.DownToConstant:
- cardEffects_ChangeLinkedMax_DownToConstant.Add(cardEffect);
- break;
- }
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_UpToConstant)
- {
- if (cardEffect is IChangeLinkMaxEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_UpDownValue)
- {
- if (cardEffect is IChangeLinkMaxEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_DownToConstant)
- {
- if (cardEffect is IChangeLinkMaxEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
- }
- }
- }
- #endregion
- return Max;
- }
- }
- public List<CardSource> LinkedCards = new List<CardSource>();
- #endregion
- #region Add Card Source
- public void AddCardSource(CardSource cardSource)
- {
- cardSources.Insert(0, cardSource);
- cardSource.SetFace("Permanent.AddSourceCard");
- }
- #endregion
- #region Add digivolution cards to top of sources
- /// <summary>
- /// IEnumerator to add a list of CardSource to a permanents top sources, CAN NOT be used to put a field permanent under must use IPlacePermanentToDigivolutionCards
- /// </summary>
- /// <param name="addedDigivolutionCards"></param>
- /// <param name="cardEffect"></param>
- /// <param name="skipEffectAndActivateSkill"></param>
- /// <returns></returns>
- public IEnumerator AddDigivolutionCardsTop(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect)
- {
- List<CardSource> addedCards = new List<CardSource>();
- bool isFromSameDigimon = false;
- bool isFromDigimon = false;
- foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
- {
- if (cardSources.Contains(addedDigivolutionCard))
- {
- isFromSameDigimon = true;
- }
- if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
- {
- if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
- {
- isFromDigimon = true;
- }
- }
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
- if (!this.IsToken && !addedDigivolutionCard.IsToken)
- {
- this.cardSources.Insert(1, addedDigivolutionCard);
- addedDigivolutionCard.SetFace("Permanent.AddDigivolutionCardsTop");
- addedCards.Add(addedDigivolutionCard);
- }
- }
- if (addedCards.Count >= 1)
- {
- if (ShowingPermanentCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
- }
- #region "進化元が増えた時"の効果
- #region Hashtable Setting
- Hashtable hashtable = new Hashtable()
- {
- {"Permanent", this},
- {"CardEffect", cardEffect},
- {"CardSources", addedCards},
- {"isFromSameDigimon", isFromSameDigimon},
- {"isFromDigimon", isFromDigimon},
- };
- #endregion
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
- #endregion
- }
- }
- #endregion
- #region Add digivolution cards to bottom of sources
- /// <summary>
- /// IEnumerator to add a list of CardSource to a permanents bottom sources, CAN NOT be used to put a field permanent under must use IPlacePermanentToDigivolutionCards
- /// </summary>
- /// <param name="addedDigivolutionCards"></param>
- /// <param name="cardEffect"></param>
- /// <param name="skipEffectAndActivateSkill"></param>
- /// <returns></returns>
- public IEnumerator AddDigivolutionCardsBottom(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect, bool skipEffectAndActivateSkill = false, bool isFacedown = false)
- {
- List<CardSource> addedCards = new List<CardSource>();
- bool isFromSameDigimon = false;
- bool isFromDigimon = false;
- foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
- {
- if (addedDigivolutionCard.PermanentOfThisCard() != null)
- {
- if (addedDigivolutionCard.PermanentOfThisCard() != this)
- {
- if (addedDigivolutionCard.PermanentOfThisCard().TopCard == addedDigivolutionCard)
- {
- IPlacePermanentToDigivolutionCards placePermanent = new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { addedDigivolutionCard.PermanentOfThisCard(), this } }, false, cardEffect, skipEffectAndActivateSkill);
- yield return ContinuousController.instance.StartCoroutine(placePermanent.PlacePermanentToDigivolutionCards());
- if (!placePermanent.Placed)
- {
- continue;
- }
- }
- }
- }
- if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
- {
- if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
- {
- isFromDigimon = true;
- }
- }
- if (cardSources.Contains(addedDigivolutionCard))
- {
- isFromSameDigimon = true;
- if (addedDigivolutionCard == TopCard)
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
- ShowingPermanentCard.ShowPermanentData(true);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(
- addedDigivolutionCard,
- this));
- }
- }
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
- if (!IsToken && !addedDigivolutionCard.IsToken)
- {
- cardSources.Add(addedDigivolutionCard);
- if (isFacedown)
- addedDigivolutionCard.SetReverse();
- else
- addedDigivolutionCard.SetFace("Permanent.AddDigivolutionCardsBottom");
- addedCards.Add(addedDigivolutionCard);
- }
- }
- if (addedCards.Count >= 1 && !skipEffectAndActivateSkill)
- {
- if (ShowingPermanentCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
- }
- #region Effect of "when the number of evolution sources increases"
- #region Hashtable Setting
- Hashtable hashtable = new Hashtable()
- {
- {"Permanent", this},
- {"CardEffect", cardEffect},
- {"CardSources", addedCards},
- {"isFromSameDigimon", isFromSameDigimon},
- {"isFromDigimon", isFromDigimon},
- };
- #endregion
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
- #endregion
- }
- }
- #endregion
- #region Add Link cards
- /// <summary>
- /// IEnumerator to add a list of CardSource to a permanents top sources, CAN NOT be used to put a field permanent under must use IPlacePermanentToLinkCards
- /// </summary>
- /// <param name="addedLinkCards"></param>
- /// <param name="cardEffect"></param>
- /// <param name="skipEffectAndActivateSkill"></param>
- /// <returns></returns>
- public IEnumerator AddLinkCard(CardSource addedLinkCard, ICardEffect cardEffect)
- {
- bool addedCard = false;
- bool isFromDigimon = false;
- if (CardEffectCommons.IsExistOnBattleArea(addedLinkCard))
- {
- if (addedLinkCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
- {
- isFromDigimon = true;
- }
- }
- if (LinkedCards.Count >= LinkedMax)
- {
- if(LinkedMax > 1)
- yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(null,((LinkedCards.Count + 1) - LinkedMax)));
- else
- yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(LinkedCards[0]));
- }
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedLinkCard));
- if (!this.IsToken && !addedLinkCard.IsToken)
- {
- LinkedCards.Insert(0, addedLinkCard);
- LinkedDP += addedLinkCard.LinkDP;
- this.cardSources.Insert(1, addedLinkCard);
- addedLinkCard.SetFace("Permanent.AddLinkCard");
- addedCard = true;
- }
- if (addedCard)
- {
- if (ShowingPermanentCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
- }
- #region Add Linked Card
- #region Hashtable Setting
- Hashtable hashtable = new Hashtable()
- {
- {"Permanent", this},
- {"CardEffect", cardEffect},
- {"Card", addedLinkCard},
- {"isFromDigimon", isFromDigimon},
- };
- #endregion
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.WhenLinked));
- #endregion
- }
- }
- #endregion
- #region RemoveCardSource
- public IEnumerator RemoveCardSource(CardSource cardSource)
- {
- yield return null;
- cardSources.Remove(cardSource);
- }
- #endregion
- #region Remove Linked Card
- public IEnumerator RemoveLinkedCard(CardSource cardSource, int removeCount = 0)
- {
- if (LinkedCards.Contains(cardSource))
- {
- LinkedDP -= cardSource.LinkDP;
- yield return ContinuousController.instance.StartCoroutine(RemoveCardSource(cardSource));
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
- LinkedCards.Remove(cardSource);
- }
- if(removeCount > 0)
- {
- int maxCount = Mathf.Min(removeCount, LinkedCards.Count);
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: (CardSource) => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: $"Select {maxCount} card to trash.",
- maxCount: removeCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Discard,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: LinkedCards,
- canLookReverseCard: true,
- selectPlayer: TopCard.Owner,
- cardEffect: null);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- //TODO: Add event call if something was removed
- }
- #endregion
- #region Top Card
- public CardSource TopCard
- {
- get
- {
- if (cardSources.Count >= 1)
- {
- if (LinkedCards.Count > 0)
- return cardSources.First(source => !LinkedCards.Contains(source));
- else
- return cardSources[0];
- }
- return null;
- }
- }
- #endregion
- #region Permanent effect list
- #region このパーマネントの効果リスト
- public List<ICardEffect> EffectList(EffectTiming timing)
- {
- return EffectList_ForCard(timing, TopCard);
- }
- #endregion
- #region このポケモンの追加効果リスト
- public List<ICardEffect> EffectList_Added(EffectTiming timing)
- {
- List<ICardEffect> _EffectList = new List<ICardEffect>();
- if (TopCard != null)
- {
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerDrawPhaseEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerTurnEndEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEachTurnEndEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOpponentTurnEndEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEndBattleEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerTurnStartEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilNextUntapEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in PermanentEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEndAttackEffects)
- {
- ICardEffect cardEffect = GetCardEffect(timing);
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- _EffectList = _EffectList.Filter(cardEffect => cardEffect != null);
- foreach (ICardEffect cardEffect in _EffectList)
- {
- if (cardEffect != null)
- {
- if (cardEffect.EffectSourceCard == null)
- {
- cardEffect.SetEffectSourceCard(TopCard);
- }
- cardEffect.SetIsInheritedEffect(false);
- }
- }
- }
- return _EffectList;
- }
- #endregion
- #region このパーマネントの効果リスト(引数:CardSource)
- public List<ICardEffect> EffectList_ForCard(EffectTiming timing, CardSource _cardSource)
- {
- List<ICardEffect> _EffectList = new List<ICardEffect>();
- if (TopCard != null && _cardSource != null)
- {
- foreach (CardSource cardSource in cardSources)
- {
-
- if (cardSource != null)
- {
- if (!cardSource.IsFlipped)
- {
- bool isTopCard = cardSource == TopCard;
- if (!isTopCard)
- {
- if (!IsDigimon)
- {
- continue;
- }
- }
- foreach (ICardEffect cardEffect in cardSource.cEntity_EffectController.GetCardEffects(timing, cardSource))
- {
- if (cardEffect != null)
- {
- if (cardEffect.IsInheritedEffect && !isTopCard)
- {
- _EffectList.Add(cardEffect);
- continue;
- }
- if (cardEffect.IsLinkedEffect && cardSource.IsLinked)
- {
- _EffectList.Add(cardEffect);
- continue;
- }
- if(isTopCard && !cardEffect.IsInheritedEffect && !cardEffect.IsLinkedEffect)
- {
- _EffectList.Add(cardEffect);
- }
- }
- }
- }
- }
- }
- foreach (ICardEffect cardEffect in EffectList_Added(timing))
- {
- if (cardEffect != null)
- {
- _EffectList.Add(cardEffect);
- }
- }
- foreach (ICardEffect cardEffect in _EffectList)
- {
- if (cardEffect != null)
- {
- if (cardEffect.EffectSourceCard == null)
- {
- cardEffect.SetEffectSourceCard(_cardSource);
- }
- }
- }
- }
- return _EffectList;
- }
- #endregion
- #region 自分のターン終了時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilOwnerTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region 自分のドローフェイズ終了時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilOwnerDrawPhaseEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region お互いのターン終了時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilEachTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region 相手のターン終了時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilOpponentTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region バトル終了時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilEndBattleEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region 攻撃終了時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilEndAttackEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region 自分のターン開始時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilOwnerTurnStartEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region 次にアンタップする時に消える効果
- public List<Func<EffectTiming, ICardEffect>> UntilNextUntapEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #region 場を離れるまで残る効果
- public List<Func<EffectTiming, ICardEffect>> PermanentEffects = new List<Func<EffectTiming, ICardEffect>>();
- #endregion
- #endregion
- #region 起動型効果を宣言できるか
- public bool CanDeclareSkill() => CanDeclareSkillList().Count > 0;
- #endregion
- #region 宣言可能な起動型効果リスト
- public List<ICardEffect> CanDeclareSkillList()
- {
- List<ICardEffect> CanDeclareSkillList = new List<ICardEffect>();
- if (TopCard != null)
- {
- foreach (ICardEffect _cardEffect in EffectList(EffectTiming.OnDeclaration))
- {
- if (_cardEffect is ActivateICardEffect)
- {
- if (_cardEffect.CanUse(null))
- {
- CanDeclareSkillList.Add(_cardEffect);
- }
- }
- }
- }
- return CanDeclareSkillList;
- }
- #endregion
- #region このパーマネントが場に出たターン
- public int EnterFieldTurnCount { get; set; } = -1;
- #endregion
- #region このパーマネントを表す場のオブジェクト
- public FieldPermanentCard ShowingPermanentCard { get; set; }
- #endregion
- #region Whether this permanent can be selected by the effect
- public bool CanSelectBySkill(ICardEffect skill)
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- #region Effects of field permanents
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotSelectBySkillEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotSelectBySkillEffect)cardEffect).CanNotSelectBySkill(this, skill))
- {
- return false;
- }
- }
- }
- }
- }
- #endregion
- }
- return true;
- }
- #endregion
- #region Number of sheets to undergo security check
- public int InvertSecutiryValue
- {
- get
- {
- int Invert = 0;
- List<ICardEffect> cardEffects_InvertStrike = new List<ICardEffect>();
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IInvertSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_InvertStrike.Add(cardEffect);
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IInvertSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_InvertStrike.Add(cardEffect);
- }
- }
- }
- }
- #endregion
- }
- foreach (ICardEffect cardEffect in cardEffects_InvertStrike)
- {
- Invert = ((IInvertSAttackEffect)cardEffect).InversionValue(this, Invert);
- }
- return Mathf.Clamp(Invert,-1,1);
- }
- }
- public List<int> SecurityAttackChanges
- {
- get
- {
- List<int> SecurityAttackChanges = new List<int>();
- int Strike = 1;
- List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
- {
- cardEffects_ChangeDirectStrike.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
- {
- cardEffects_ChangeDirectStrike.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- int Strike1 = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, 0);
- if (Strike1 != Strike)
- {
- SecurityAttackChanges.Add(Strike1 - Strike);
- }
- }
- }
- }
- return SecurityAttackChanges;
- }
- }
- public bool HasSecurityAttackChanges
- {
- get
- {
- if (!IsDigimon)
- {
- return false;
- }
- return SecurityAttackChanges.Count >= 1;
- }
- }
- public int Strike_AllowMinus
- {
- get
- {
- int Strike = 1;
- #region Effect of changing the number of sheets to undergo security check
- List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDirectStrike.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
- {
- if (cardEffect.CanUse(null))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- cardEffects_ChangeDirectStrike.Add(cardEffect);
- }
- }
- }
- }
- }
- #endregion
- }
- List<ICardEffect> cardEffects_ChangeDirectStrike_UpToConstant = new List<ICardEffect>();
- List<ICardEffect> cardEffects_ChangeDirectStrike_UpDownValue = new List<ICardEffect>();
- List<ICardEffect> cardEffects_ChangeDirectStrike_DownToConstant = new List<ICardEffect>();
- foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- switch (((IChangeSAttackEffect)cardEffect).isUpDown())
- {
- case CalculateOrder.UpToConstant:
- cardEffects_ChangeDirectStrike_UpToConstant.Add(cardEffect);
- break;
- case CalculateOrder.UpDownValue:
- cardEffects_ChangeDirectStrike_UpDownValue.Add(cardEffect);
- break;
- case CalculateOrder.DownToConstant:
- cardEffects_ChangeDirectStrike_DownToConstant.Add(cardEffect);
- break;
- }
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpToConstant)
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpDownValue)
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
- }
- }
- }
- foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_DownToConstant)
- {
- if (cardEffect is IChangeSAttackEffect)
- {
- if (cardEffect.CanUse(null))
- {
- Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
- }
- }
- }
- #endregion
- return Strike;
- }
- }
- public int Strike
- {
- get
- {
- int Strike = Strike_AllowMinus;
- if (Strike < 0)
- {
- Strike = 0;
- }
- return Strike;
- }
- }
- #endregion
- #region このパーマネントがタップされているかどうか
- public bool OldIsSuspended = false;
- public bool IsSuspended = false;
- public int DPWhenSuspended = 114514;
- #endregion
- #region Whether this permanent can unsuspend
- public bool CanUnsuspend
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- #region Effects of field permanents
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotUnsuspendEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
- {
- return false;
- }
- }
- }
- }
- }
- #endregion
- #region Effects of players
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotUnsuspendEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- return true;
- }
- }
- #endregion
- #region このパーマネントが移動できるかどうか
- public bool CanMove
- {
- get
- {
- if (TopCard != null)
- {
- #region the effects of permanents
- if (GManager.instance.turnStateMachine.gameContext.Players
- .Map(player => player.GetFieldPermanents())
- .Flat()
- .Map(permanent => permanent.EffectList(EffectTiming.None))
- .Flat()
- .Some(cardEffect => cardEffect is ICanNotMoveEffect
- && cardEffect.CanUse(null)
- && ((ICanNotMoveEffect)cardEffect).CanNotMove(TopCard, null)))
- {
- return false;
- }
- #endregion
- #region the effects of players
- if (GManager.instance.turnStateMachine.gameContext.Players
- .Map(player => player.EffectList(EffectTiming.None))
- .Flat()
- .Some(cardEffect => cardEffect is ICanNotMoveEffect
- && cardEffect.CanUse(null)
- && ((ICanNotMoveEffect)cardEffect).CanNotMove(TopCard, null)))
- {
- return false;
- }
- #endregion
- #region the effects of itself
- if (this == null)
- {
- if (EffectList(EffectTiming.None)
- .Some(cardEffect => cardEffect is ICanNotMoveEffect
- && cardEffect.CanUse(null)
- && ((ICanNotMoveEffect)cardEffect).CanNotMove(TopCard, null)))
- {
- return false;
- }
- }
- #endregion
- if (TopCard.PermanentOfThisCard().PermanentFrame.isBreedingAreaFrame())
- {
- if (!TopCard.Owner.GetBreedingAreaPermanents().Contains(this))
- {
- return false;
- }
- }
- else
- {
- if (TopCard.Owner.GetBreedingAreaPermanents().Count > 0)
- return false;
- }
- if (!IsDigimon)
- return false;
- if (TopCard.IsDigiEgg && DP <= 0)
- return false;
- if (GManager.instance.turnStateMachine.gameContext.TurnPlayer.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) == 0)
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- return true;
- }
- }
- #endregion
- #region このパーマネントが攻撃できるかどうか
- public bool CanAttack(ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
- {
- // can not attack with empty cards
- if (TopCard == null)
- {
- return false;
- }
- // can not attack during opponent's turn
- if (TopCard.Owner != GManager.instance.turnStateMachine.gameContext.TurnPlayer)
- {
- return false;
- }
- //Can not attack during another attack
- if (GManager.instance.attackProcess.IsAttacking)
- return false;
- // can not attack to player
- if (!CanAttackTargetDigimon(null, cardEffect, withoutTap, isVortex))
- {
- // can not attack to opponent's Digimon
- if (TopCard.Owner.Enemy.GetFieldPermanents().Count((permanent) => CanAttackTargetDigimon(permanent, cardEffect, withoutTap, isVortex)) == 0)
- {
- return false;
- }
- }
- return true;
- }
- #endregion
- #region このパーマネントが対象の攻撃パーマネントをブロックできるかどうか
- public bool CanBlock(Permanent AttackingPermanent)
- {
- if (TopCard == null)
- {
- return false;
- }
- if (!IsDigimon)
- {
- return false;
- }
- if (IsSuspended)
- {
- return false;
- }
- if (!CanSuspend)
- {
- return false;
- }
- if (PermanentFrame != null)
- {
- if (!PermanentFrame.IsBattleAreaFrame())
- {
- return false;
- }
- }
- if (!AttackingPermanent.IsDigimon)
- return false;
- if (!AttackingPermanent.CanSwitchAttackTarget)
- return false;
- #region "Unblockable" effect
- #region Effects of permanents in play
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICannotBlockEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
- {
- return false;
- }
- }
- }
- }
- }
- }
- #endregion
- #region player effect
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICannotBlockEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
- {
- if (!TopCard.CanNotBeAffected(cardEffect))
- {
- return false;
- }
- }
- }
- }
- }
- }
- #endregion
- #endregion
- return true;
- }
- #endregion
- #region 対象のパーマネントを攻撃できるか
- public bool CanAttackTargetDigimon(Permanent Defender, ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
- {
- if (TopCard != null)
- {
- if (!IsDigimon)
- {
- return false;
- }
- if (!withoutTap)
- {
- if (IsSuspended)
- {
- return false;
- }
- if (!CanSuspend)
- {
- return false;
- }
- }
- if (PermanentFrame != null)
- {
- if (!PermanentFrame.IsBattleAreaFrame())
- {
- return false;
- }
- }
- if (EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
- {
- if (!HasRush && !isVortex)
- {
- return false;
- }
- }
- #region 「対象の防御パーマネントを攻撃できない」効果
- #region 場のパーマネントの効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
- {
- if (!TopCard.CanNotBeAffected(cardEffect1))
- {
- return false;
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region プレイヤーの効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
- {
- if (!TopCard.CanNotBeAffected(cardEffect1))
- {
- return false;
- }
- }
- }
- }
- }
- }
- #endregion
- #endregion
- if (Defender != null)
- {
- if (Defender.TopCard != null)
- {
- if (Defender.TopCard.Owner == TopCard.Owner.Enemy)
- {
- if (Defender.IsDigimon && Defender.TopCard.Owner.GetBattleAreaPermanents().Contains(Defender))
- {
- if (Defender.IsSuspended)
- {
- return true;
- }
- #region 「対象の防御パーマネントを攻撃できる」効果
- #region 場のパーマネントの効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
- {
- return true;
- }
- }
- }
- }
- }
- }
- #endregion
- #region プレイヤーの効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- #endregion
- }
- }
- }
- }
- else
- {
- return true;
- }
- }
- return false;
- }
- #endregion
- #region Is Unblockable
- public bool IsUnblockable
- {
- get
- {
- foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.None))
- {
- if (cardEffect is CannotBlockClass)
- {
- if (cardEffect.EffectName == "Unblockable")
- {
- return true;
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Blocker
- public bool HasBlocker
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- #region Effects of permanents in play
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IBlockerEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IBlockerEffect)cardEffect).IsBlocker(this))
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- #region Effects of faceup security
- foreach (CardSource source in player.SecurityCards)
- {
- if (source.IsFlipped)
- continue;
- foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.None))
- {
- if (cardEffect is IBlockerEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IBlockerEffect)cardEffect).IsBlocker(this))
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IBlockerEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IBlockerEffect)cardEffect).IsBlocker(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Has Jamming
- public bool HasJamming
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedByBattleEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (cardEffect.EffectName == "Jamming")
- {
- if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedByBattleEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (cardEffect.EffectName == "Jamming")
- {
- if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Has Ice Clad
- public bool HasIceclad
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- #region Ice clad permanent effects
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.None))
- {
- if (cardEffect is IIcecladEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IIcecladEffect)cardEffect).HasIceclad(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- #region Ice clad Player Effects
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IIcecladEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IIcecladEffect)cardEffect).HasIceclad(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Whether this permanent has Pierce
- public bool HasPierce
- {
- get
- {
- if (IsDigimon)
- {
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDetermineDoSecurityCheck))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.CanTrigger(CardEffectCommons.PierceCheckHashtableOfPermanent(this)))
- {
- if (cardEffect.EffectName == "Pierce")
- {
- return true;
- }
- if (cardEffect.EffectName == "Piercing")
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Reboot
- public bool HasReboot
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IRebootEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IRebootEffect)cardEffect).HasReboot(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IRebootEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IRebootEffect)cardEffect).HasReboot(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Has Raid
- public bool HasRaid
- {
- get
- {
- foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.EffectName == "Raid")
- {
- return true;
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Rush
- public bool HasRush
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IRushEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IRushEffect)cardEffect).HasRush(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IRushEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IRushEffect)cardEffect).HasRush(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Has Retaliation
- public bool HasRetaliation
- {
- get
- {
- if (RetaliationCount >= 1)
- {
- return true;
- }
- return false;
- }
- }
- #endregion
- #region Retaliation Count
- public int RetaliationCount
- {
- get
- {
- int count = 0;
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.EffectName == "Retaliation")
- {
- if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
- {
- count++;
- }
- }
- }
- }
- return count;
- }
- }
- #endregion
- #region Has Fortitude
- public bool HasFortitude
- {
- get
- {
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.EffectName == "Fortitude")
- {
- if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Blitz
- public bool HasBlitz
- {
- get
- {
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnEnterFieldAnyone))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.CanTrigger(CardEffectCommons.WhenDigivolutionCheckHashtableOfPermanent(this)) || cardEffect.CanTrigger(CardEffectCommons.OnPlayCheckHashtableOfPermanent(this)))
- {
- if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
- {
- if (cardEffect.EffectDiscription.Contains("Blitz"))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Evade
- public bool HasEvade
- {
- get
- {
- foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
- {
- if (cardEffect is ActivateICardEffect)
- {
- Hashtable hashtable = new Hashtable()
- {
- {"Permanents", new List<Permanent>() { this }}
- };
- if (cardEffect.CanTrigger(hashtable))
- {
- if (cardEffect.EffectName == "Evade")
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Mind Link
- public bool HasMindLink
- {
- get
- {
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDeclaration))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (!String.IsNullOrEmpty(cardEffect.EffectDiscription))
- {
- if (cardEffect.EffectDiscription.Contains("Mind Link"))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Barrier
- public bool HasBarrier
- {
- get
- {
- foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
- {
- if (cardEffect is ActivateICardEffect)
- {
- Hashtable hashtable = new Hashtable();
- hashtable.Add("Permanents", new List<Permanent>() { this });
- hashtable.Add("battle", new IBattle(null, null, null));
- if (cardEffect.CanTrigger(hashtable))
- {
- if (cardEffect.EffectName == "Barrier")
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Alliance
- public bool HasAlliance
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Permanent Effects
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.OnAllyAttack))
- {
- if (cardEffect is IAllianceEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IAllianceEffect)cardEffect).HasAlliance(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #region Effects of faceup security
- foreach (CardSource source in player.SecurityCards)
- {
- if (source.IsFlipped)
- continue;
- foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.OnAllyAttack))
- {
- if (cardEffect is IAllianceEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IAllianceEffect)cardEffect).HasAlliance(this))
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- #region Player Effects
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.OnAllyAttack))
- {
- if (cardEffect is IAllianceEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((IAllianceEffect)cardEffect).HasAlliance(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Has Collision
- public bool HasCollision
- {
- get
- {
- foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.EffectName == "Collision")
- {
- return true;
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region Has Partition
- public bool HasPartition
- {
- get
- {
- foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.EffectName == "Partition")
- {
- return true;
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region 消滅時効化を持つか
- public bool HasOnDeletionEffect
- {
- get
- {
- foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
- {
- if (cardEffect is ActivateICardEffect)
- {
- if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
- {
- if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
- {
- if (cardEffect.IsOnDeletion)
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- }
- #endregion
- #region バトルしているか
- public IBattle battle { get; set; } = null;
- #endregion
- #region Can Be Destroyed
- public bool CanBeDestroyed()
- {
- #region 消滅しない効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- return true;
- }
- #endregion
- #region Can Be Destroyed By Battle
- public bool CanBeDestroyedByBattle(Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
- {
- if (!CanBeDestroyed())
- {
- return false;
- }
- #region Given Effects
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Permanents
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedByBattleEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #region Effects of faceup security
- foreach (CardSource source in player.SecurityCards)
- {
- if (source.IsFlipped)
- continue;
- foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedByBattleEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
- {
- return false;
- }
- }
- }
- }
- }
- #endregion
- #region Player Effects
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeDestroyedByBattleEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- return true;
- }
- #endregion
- #region このパーマネントが効果で消滅するか
- public bool CanBeDestroyedBySkill(ICardEffect cardEffect)
- {
- if (this.TopCard != null)
- {
- if (this.TopCard.CanNotBeAffected(cardEffect))
- {
- return false;
- }
- if (!CanBeDestroyed())
- {
- return false;
- }
- #region 効果で消滅しない効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
- {
- if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
- {
- if (cardEffect1.CanUse(null))
- {
- if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- }
- return true;
- }
- #endregion
- #region Can Leave Field
- public bool CanBeRemoved()
- {
- #region Effect that never disappears
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeRemovedEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotBeRemovedEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- return true;
- }
- #endregion
- #region トークンかどうか
- public bool IsToken
- {
- get
- {
- if (TopCard != null)
- {
- if (TopCard.IsToken)
- {
- return true;
- }
- }
- return false;
- }
- }
- #endregion
- #region そのパーマネントが消滅・バウンス待機状態か
- public bool willBeRemoveField { get; set; } = false;
- #endregion
- #region Is a Digimon card
- public bool IsDigimon
- {
- get
- {
- if (TopCard != null)
- {
- if (TopCard.IsDigimon || TopCard.IsDigiEgg)
- {
- return true;
- }
- #region Effect of treating it as a Digimon
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList_Added(EffectTiming.None))
- {
- if (cardEffect is ITreatAsDigimonEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ITreatAsDigimonEffect)
- {
- if (cardEffect.CanTrigger(null))
- {
- if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- }
- return false;
- }
- }
- #endregion
- #region Is a Tamer card
- public bool IsTamer
- {
- get
- {
- if (TopCard != null)
- {
- if (TopCard.IsTamer)
- {
- return true;
- }
- }
- return false;
- }
- }
- #endregion
-
- #region Is an Option card
- public bool IsOption
- {
- get
- {
- if (TopCard != null)
- {
- if (TopCard.IsOption)
- {
- return true;
- }
- }
- return false;
- }
- }
- #endregion
- #region Levels handled by Jogress
- public List<int> Levels_ForJogress(CardSource cardSource)
- {
- List<int> levels = new List<int>();
- if (cardSource != null)
- {
- if (cardSource.HasLevel)
- {
- levels.Add(this.Level);
- }
- #region Effect of "adding levels handled by jogless evolution"
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IAddJogressLevelsEffect)
- {
- if (cardEffect.CanUse(null))
- {
- foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
- {
- levels.Add(level);
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IAddJogressLevelsEffect)
- {
- if (cardEffect.CanUse(null))
- {
- foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
- {
- levels.Add(level);
- }
- }
- }
- }
- #endregion
- }
- #endregion
- }
- return levels;
- }
- #endregion
- #region Names handled by Jogress
- public List<string> Names_ForDNA(CardSource cardSource)
- {
- List<string> names = new List<string>();
- if (cardSource != null)
- {
- foreach(string name in cardSource.CardNames)
- names.Add(name);
- #region Effect of "adding names handled by DNA evolution"
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is IAddDNANamesEffect)
- {
- if (cardEffect.CanUse(null))
- {
- foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
- {
- names.Add(name);
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is IAddDNANamesEffect)
- {
- if (cardEffect.CanUse(null))
- {
- foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
- {
- names.Add(name);
- }
- }
- }
- }
- #endregion
- }
- #endregion
- }
- return names;
- }
- #endregion
- #region バトルで消滅したか
- public bool IsDestroyedByBattle { get; set; } = false;
- #endregion
- #region 消滅に使用された効果
- public ICardEffect DestroyingEffect { get; set; } = null;
- #endregion
- #region 他のパーマネントの下に置くのに使用された効果
- public ICardEffect PlaceOtherPermanentEffect { get; set; } = null;
- #endregion
- #region 手札バウンス に使用された効果
- public ICardEffect HandBounceEffect { get; set; } = null;
- #endregion
- #region 山札バウンス に使用された効果
- public ICardEffect LibraryBounceEffect { get; set; } = null;
- #endregion
- #region 登場に使用された効果
- public ICardEffect PlayingEffect { get; set; } = null;
- #endregion
- #region 進化に使用された効果
- public ICardEffect DigivolvingEffect { get; set; } = null;
- #endregion
- #region Whether this digimon is placed in the trash by not having a DP
- public bool IsPlaceToTrashDueToNotHavingDP { get; set; } = true;
- #endregion
- #region Whether this permanent can suspend
- public bool CanSuspend
- {
- get
- {
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
- {
- #region Effects of field permanents
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotSuspendEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
- {
- return false;
- }
- }
- }
- }
- }
- #endregion
- #region Effects of players
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotSuspendEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- return true;
- }
- }
- #endregion
- #region このデジモンのアタックの対象が変更できるか
- public bool CanSwitchAttackTarget
- {
- get
- {
- #region アタックの対象が変更できない効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotSwitchAttackTargetEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanNotSwitchAttackTargetEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
- {
- return false;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- return true;
- }
- }
- #endregion
- #region このデジモンを場からデジクロス条件の代わりにできるか
- public bool CanSubstituteForDigiXrosCondition(CardSource cardSource)
- {
- #region デジクロス条件の代わりにできる効果
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region 場のパーマネントの効果
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanSelectDigiXrosEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #region プレイヤーの効果
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanSelectDigiXrosEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- return false;
- }
- #endregion
- #region Can Substitue for Assembly
- public bool CanSubstituteForAssemblyCondition(CardSource cardSource)
- {
- #region Effects that can be used in place of Assembly conditions
- foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
- {
- foreach (Permanent permanent in player.GetFieldPermanents())
- {
- #region Effects of permanents in play
- foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanSelectAssemblyEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanSelectAssemblyEffect)cardEffect).CanSelect(cardSource, this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #region player effect
- foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
- {
- if (cardEffect is ICanSelectAssemblyEffect)
- {
- if (cardEffect.CanUse(null))
- {
- if (((ICanSelectAssemblyEffect)cardEffect).CanSelect(cardSource, this))
- {
- return true;
- }
- }
- }
- }
- #endregion
- }
- #endregion
- return false;
- }
- #endregion
- #region 登場した直後のLevel
- public int LevelJustAfterPlayed { get; set; } = -1;
- #endregion
- #region 登場した直後のPlay Cost
- public int PlayCostJustAfterPlayed { get; set; } = -1;
- #endregion
- #region 登場した直後のCardNames
- public List<string> CardNamesJustAfterPlayed { get; set; } = new List<string>();
- #endregion
- #region 進化した直後のCardNames
- public List<string> CardNamesJustAfterDigivolved { get; set; } = new List<string>();
- #endregion
- #region 登場した直後のTraits
- public List<string> TraitsJustAfterPlayed { get; set; } = new List<string>();
- #endregion
- #region 場を離れる直前のDP
- public int DPJustBeforeRemoveField { get; set; } = -1;
- #endregion
- #region 場を離れる直前のLevel
- public int LevelJustBeforeRemoveField { get; set; } = -1;
- #endregion
- #region 場を離れる直前のCost
- public int CostJustBeforeRemoveField { get; set; } = -1;
- #endregion
- #region 場を離れる直前のカード名
- public List<string> CardNamesJustBeforeRemoveField { get; set; } = new List<string>();
- #endregion
- #region Card Traits Just Before Removed Field
- public List<string> CardTraitsJustBeforeRemoveField { get; set; } = new List<string>();
- #endregion
- #region バースト進化で手札に戻ったか
- public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
- #endregion
- #region Is Linked Card Added as Source By App Fusion
- public bool IsAddedAsSourceByAppFusion { get; set; } = false;
- #endregion
- #region バースト進化したか
- public bool IsBurstDigivolved { get; set; } = false;
- #endregion
- #region Did it App Fusion?
- public bool IsAppFusion { get; set; } = false;
- #endregion
- #region 効果で場に出たオプションか
- public bool IsPlayedOptionPermanent { get; set; } = false;
- #endregion
- #region 進化元を持たないか
- public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
- #endregion
- #region Has face down Digivolution Cards
- public bool HasFaceDownDigivolutionCards => DigivolutionCards.Any(x => x.IsFlipped);
- #endregion
- #region Has No Link Cards
- public bool HasNoLinkCards => LinkedCards.Count == 0;
- #endregion
- #region Digivolution cards' colors
- public List<CardColor> DigivolutionCardsColors
- {
- get
- {
- List<CardColor> cardColors = new List<CardColor>();
- foreach (CardSource cardSource in DigivolutionCards)
- {
- foreach (CardColor cardColor in cardSource.CardColors)
- {
- if (!cardColors.Contains(cardColor))
- {
- cardColors.Add(cardColor);
- }
- }
- }
- return cardColors.Distinct().ToList();
- }
- }
- #endregion
- #region Show "Unsuspend" effect object
- public void ShowUnsuspendEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillUntapObject != null)
- {
- ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
- ShowingPermanentCard.WillUntapObject.SetActive(true);
- }
- }
- }
- }
- #endregion
- #region Show "Return to deck" effect object
- public void ShowDeckBounceEffect()
- {
- if (TopCard != null)
- {
- if (willBeRemoveField)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillBeDeckBounceObject != null)
- {
- ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
- ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
- }
- }
- }
- }
- }
- #endregion
- #region Hide "Return to deck" effect object
- public void HideDeckBounceEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillBeDeckBounceObject != null)
- {
- ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
- }
- }
- }
- }
- #endregion
- #region Show "Return to hand" effect object
- public void ShowHandBounceEffect()
- {
- if (TopCard != null)
- {
- if (willBeRemoveField)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillBeHandBounceObject != null)
- {
- ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
- ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
- }
- }
- }
- }
- }
- #endregion
- #region Hide "Return to hand" effect object
- public void HideHandBounceEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillBeHandBounceObject != null)
- {
- ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
- }
- }
- }
- }
- #endregion
- #region Show "Delete" effect object
- public void ShowDeleteEffect()
- {
- if (TopCard != null)
- {
- if (willBeRemoveField)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillBeDeletedObject != null)
- {
- ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
- ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
- }
- }
- }
- }
- }
- #endregion
- #region Hide "Delete" effect object
- public void HideDeleteEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillBeDeletedObject != null)
- {
- ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
- }
- }
- }
- }
- #endregion
- #region Show "Remove Field" effect object
- public void ShowWillRemoveFieldEffect()
- {
- if (TopCard != null)
- {
- if (willBeRemoveField)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillRemoveFieldObject != null)
- {
- ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
- ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
- }
- }
- }
- }
- }
- #endregion
- #region Hide "Remove Field" effect object
- public void HideWillRemoveFieldEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillRemoveFieldObject != null)
- {
- ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
- }
- }
- }
- }
- #endregion
- #region Show "Digivolution" effect object
- public void ShowWillEvolutionEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillEvolutionObject != null)
- {
- ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
- ShowingPermanentCard.WillEvolutionObject.SetActive(true);
- }
- }
- }
- }
- #endregion
- #region Hide "Digivolution" effect object
- public void HideWillEvolutionEffect()
- {
- if (TopCard != null)
- {
- if (ShowingPermanentCard != null)
- {
- if (ShowingPermanentCard.WillEvolutionObject != null)
- {
- ShowingPermanentCard.WillEvolutionObject.SetActive(false);
- }
- }
- }
- }
- #endregion
- }
|