Permanent.cs 126 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. using System.Linq;
  6. public class Permanent
  7. {
  8. public Permanent(List<CardSource> cardSources)
  9. {
  10. SetCardSources(cardSources);
  11. }
  12. public void SetCardSources(List<CardSource> cardSources)
  13. {
  14. List<CardSource> newCardSources = cardSources.Clone();
  15. newCardSources.Reverse();
  16. foreach (CardSource cardSource in newCardSources)
  17. {
  18. AddCardSource(cardSource);
  19. }
  20. }
  21. public FieldCardFrame PermanentFrame
  22. {
  23. get
  24. {
  25. if (TopCard != null)
  26. {
  27. int index = Array.IndexOf(TopCard.Owner.FieldPermanents, this);
  28. if (0 <= index && index <= TopCard.Owner.fieldCardFrames.Count - 1)
  29. {
  30. return TopCard.Owner.fieldCardFrames[index];
  31. }
  32. }
  33. return null;
  34. }
  35. }
  36. public bool oldIsTapped_playCard { get; set; }
  37. #region Level
  38. public int Level
  39. {
  40. get
  41. {
  42. int Level = 0;
  43. if (TopCard != null)
  44. {
  45. Level = TopCard.Level;
  46. if (!TopCard.HasLevel)
  47. {
  48. Level = 1145140;
  49. }
  50. #region レベルを変更する効果
  51. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  52. {
  53. foreach (Permanent permanent in player.GetFieldPermanents())
  54. {
  55. #region 場のパーマネントの効果
  56. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  57. {
  58. if (cardEffect is IChangePermanentLevelEffect)
  59. {
  60. if (cardEffect.CanUse(null))
  61. {
  62. Level = ((IChangePermanentLevelEffect)cardEffect).GetPermanentLevel(Level, this);
  63. }
  64. }
  65. }
  66. #endregion
  67. }
  68. #region プレイヤーの効果
  69. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  70. {
  71. if (cardEffect is IChangePermanentLevelEffect)
  72. {
  73. if (cardEffect.CanUse(null))
  74. {
  75. Level = ((IChangePermanentLevelEffect)cardEffect).GetPermanentLevel(Level, this);
  76. }
  77. }
  78. }
  79. #endregion
  80. }
  81. #endregion
  82. }
  83. return Level;
  84. }
  85. }
  86. #endregion
  87. #region Place all evolution sources in the trash
  88. public IEnumerator DiscardEvoRoots(bool ignoreOverflow = false, bool putToTrash = true)
  89. {
  90. List<CardSource> evoRoots = DigivolutionCards.Clone();
  91. List<CardSource> linkRoots = LinkedCards.Clone();
  92. if (!ignoreOverflow)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(new AceOverflowClass(evoRoots).Overflow());
  95. yield return ContinuousController.instance.StartCoroutine(new AceOverflowClass(linkRoots).Overflow());
  96. }
  97. foreach (CardSource cardSource1 in evoRoots)
  98. {
  99. if (putToTrash)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource1));
  102. }
  103. else
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource1));
  106. }
  107. }
  108. foreach (CardSource cardSource2 in linkRoots)
  109. {
  110. if (putToTrash)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(cardSource2));
  113. }
  114. else
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource2));
  117. }
  118. }
  119. }
  120. #endregion
  121. #region Whether this permanent has DP
  122. public bool HasDP
  123. {
  124. get
  125. {
  126. if (TopCard == null)
  127. {
  128. return false;
  129. }
  130. if (!IsDigimon)
  131. {
  132. return false;
  133. }
  134. if (!TopCard.HasDP && TopCard.IsDigiEgg)
  135. {
  136. return false;
  137. }
  138. #region Effect of not having DP
  139. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  140. {
  141. foreach (Permanent permanent in player.GetFieldPermanents())
  142. {
  143. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  144. {
  145. if (cardEffect1 is IDontHaveDPEffect)
  146. {
  147. if (cardEffect1.CanUse(null))
  148. {
  149. if (((IDontHaveDPEffect)cardEffect1).DontHaveDP(this))
  150. {
  151. return false;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. }
  158. #endregion
  159. return true;
  160. }
  161. }
  162. #endregion
  163. #region Base DP
  164. public int BaseDP
  165. {
  166. get
  167. {
  168. int BaseDP = 0;
  169. if (HasDP)
  170. {
  171. BaseDP = TopCard.BaseCardDP;
  172. #region 基礎DPを変更する効果
  173. List<ICardEffect> cardEffects_ChangeDP = new List<ICardEffect>();
  174. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  175. {
  176. foreach (Permanent permanent in player.GetFieldPermanents())
  177. {
  178. #region 場のパーマネントの効果
  179. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  180. {
  181. if (cardEffect is IChangeBaseDPEffect)
  182. {
  183. if (cardEffect.CanUse(null))
  184. {
  185. if (((IChangeBaseDPEffect)cardEffect).PermanentCondition(this))
  186. {
  187. if (((IChangeBaseDPEffect)cardEffect).IsMinusDP())
  188. {
  189. if (this.ImmuneFromDPMinus(cardEffect))
  190. {
  191. continue;
  192. }
  193. }
  194. if (!TopCard.CanNotBeAffected(cardEffect))
  195. {
  196. cardEffects_ChangeDP.Add(cardEffect);
  197. }
  198. }
  199. }
  200. }
  201. }
  202. #endregion
  203. }
  204. #region プレイヤーの効果
  205. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  206. {
  207. if (cardEffect is IChangeBaseDPEffect)
  208. {
  209. if (cardEffect.CanUse(null))
  210. {
  211. if (((IChangeBaseDPEffect)cardEffect).PermanentCondition(this))
  212. {
  213. if (((IChangeBaseDPEffect)cardEffect).IsMinusDP())
  214. {
  215. if (this.ImmuneFromDPMinus(cardEffect))
  216. {
  217. continue;
  218. }
  219. }
  220. if (!TopCard.CanNotBeAffected(cardEffect))
  221. {
  222. cardEffects_ChangeDP.Add(cardEffect);
  223. }
  224. }
  225. }
  226. }
  227. }
  228. #endregion
  229. }
  230. List<ICardEffect> cardEffects_ChangeDP_isUpDown = new List<ICardEffect>();
  231. List<ICardEffect> cardEffects_ChangeDP_NotIsUpDown = new List<ICardEffect>();
  232. foreach (ICardEffect cardEffect in cardEffects_ChangeDP)
  233. {
  234. if (cardEffect is IChangeBaseDPEffect)
  235. {
  236. if (cardEffect.CanUse(null))
  237. {
  238. if (((IChangeBaseDPEffect)cardEffect).IsUpDown())
  239. {
  240. cardEffects_ChangeDP_isUpDown.Add(cardEffect);
  241. }
  242. else
  243. {
  244. cardEffects_ChangeDP_NotIsUpDown.Add(cardEffect);
  245. }
  246. }
  247. }
  248. }
  249. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_isUpDown)
  250. {
  251. if (cardEffect is IChangeBaseDPEffect)
  252. {
  253. if (cardEffect.CanUse(null))
  254. {
  255. BaseDP = ((IChangeBaseDPEffect)cardEffect).GetDP(BaseDP, this);
  256. }
  257. }
  258. }
  259. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_NotIsUpDown)
  260. {
  261. if (cardEffect is IChangeBaseDPEffect)
  262. {
  263. if (cardEffect.CanUse(null))
  264. {
  265. BaseDP = ((IChangeBaseDPEffect)cardEffect).GetDP(BaseDP, this);
  266. }
  267. }
  268. }
  269. #endregion
  270. if (BaseDP < 0)
  271. {
  272. BaseDP = 0;
  273. }
  274. }
  275. return BaseDP;
  276. }
  277. }
  278. #endregion
  279. #region DP
  280. public int DP
  281. {
  282. get
  283. {
  284. int DP = -1;
  285. if (HasDP)
  286. {
  287. DP = BaseDP;
  288. #region DP By Effect
  289. List<ICardEffect> cardEffects_ChangeDP = new List<ICardEffect>();
  290. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  291. {
  292. #region Effects of permanents in play
  293. foreach (Permanent permanent in player.GetFieldPermanents())
  294. {
  295. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  296. {
  297. if (cardEffect is IChangeDPEffect)
  298. {
  299. if (cardEffect.CanUse(null))
  300. {
  301. if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
  302. {
  303. if (((IChangeDPEffect)cardEffect).IsMinusDP())
  304. {
  305. if (this.ImmuneFromDPMinus(cardEffect))
  306. {
  307. continue;
  308. }
  309. }
  310. if (!TopCard.CanNotBeAffected(cardEffect))
  311. {
  312. cardEffects_ChangeDP.Add(cardEffect);
  313. }
  314. }
  315. }
  316. }
  317. }
  318. }
  319. #endregion
  320. #region Effects of face up security
  321. foreach (CardSource cardSource in player.SecurityCards)
  322. {
  323. if (cardSource.IsFlipped)
  324. continue;
  325. foreach (ICardEffect cardEffect in cardSource.EffectList(EffectTiming.None))
  326. {
  327. if (cardEffect is IChangeDPEffect)
  328. {
  329. if (cardEffect.CanUse(null))
  330. {
  331. if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
  332. {
  333. if (((IChangeDPEffect)cardEffect).IsMinusDP())
  334. {
  335. if (this.ImmuneFromDPMinus(cardEffect))
  336. {
  337. continue;
  338. }
  339. }
  340. if (!TopCard.CanNotBeAffected(cardEffect))
  341. {
  342. cardEffects_ChangeDP.Add(cardEffect);
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. #endregion
  350. #region Player effect
  351. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  352. {
  353. if (cardEffect is IChangeDPEffect)
  354. {
  355. if (cardEffect.CanUse(null))
  356. {
  357. if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
  358. {
  359. if (((IChangeDPEffect)cardEffect).IsMinusDP())
  360. {
  361. if (this.ImmuneFromDPMinus(cardEffect))
  362. {
  363. continue;
  364. }
  365. }
  366. if (!TopCard.CanNotBeAffected(cardEffect))
  367. {
  368. cardEffects_ChangeDP.Add(cardEffect);
  369. }
  370. }
  371. }
  372. }
  373. }
  374. #endregion
  375. }
  376. List<ICardEffect> cardEffects_ChangeDP_isUpDown = new List<ICardEffect>();
  377. List<ICardEffect> cardEffects_ChangeDP_NotIsUpDown = new List<ICardEffect>();
  378. foreach (ICardEffect cardEffect in cardEffects_ChangeDP)
  379. {
  380. if (cardEffect is IChangeDPEffect)
  381. {
  382. if (cardEffect.CanUse(null))
  383. {
  384. if (((IChangeDPEffect)cardEffect).IsUpDown())
  385. {
  386. cardEffects_ChangeDP_isUpDown.Add(cardEffect);
  387. }
  388. else
  389. {
  390. cardEffects_ChangeDP_NotIsUpDown.Add(cardEffect);
  391. }
  392. }
  393. }
  394. }
  395. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_isUpDown)
  396. {
  397. if (cardEffect is IChangeDPEffect)
  398. {
  399. if (cardEffect.CanUse(null))
  400. {
  401. DP = ((IChangeDPEffect)cardEffect).GetDP(DP, this);
  402. }
  403. }
  404. }
  405. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_NotIsUpDown)
  406. {
  407. if (cardEffect is IChangeDPEffect)
  408. {
  409. if (cardEffect.CanUse(null))
  410. {
  411. DP = ((IChangeDPEffect)cardEffect).GetDP(DP, this);
  412. }
  413. }
  414. }
  415. #endregion
  416. #region DP Boosts
  417. foreach(DPBoost boost in Boosts)
  418. {
  419. DP += boost.DP;
  420. }
  421. #endregion
  422. DP += LinkedDP;
  423. if (DP < 0)
  424. {
  425. DP = 0;
  426. }
  427. }
  428. return DP;
  429. }
  430. }
  431. public int LinkedDP { get; set; }
  432. public List<DPBoost> Boosts = new List<DPBoost>();
  433. public void AddBoost(DPBoost boost)
  434. {
  435. if (Boosts.Any(x => x.ID == boost.ID))
  436. Boosts.First(x => x.ID == boost.ID).DP = boost.DP;
  437. else
  438. Boosts.Add(boost);
  439. }
  440. public void RemoveBoost(string ID)
  441. {
  442. if (Boosts.Any(x => x.ID == ID))
  443. Boosts.Remove(Boosts.First(x => x.ID == ID));
  444. }
  445. public class DPBoost
  446. {
  447. public DPBoost(string id, int dp, Func<bool> cond)
  448. {
  449. ID = id;
  450. DP = dp;
  451. Condition = cond;
  452. }
  453. public string ID = "";
  454. public int DP = 0;
  455. public Func<bool> Condition = null;
  456. }
  457. #endregion
  458. #region Will it not receive negative DP effect?
  459. public bool ImmuneFromDPMinus(ICardEffect cardEffect)
  460. {
  461. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  462. {
  463. foreach (Permanent permanent in player.GetFieldPermanents())
  464. {
  465. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  466. {
  467. if (cardEffect1 is IImmuneFromDPMinusEffect)
  468. {
  469. if (cardEffect1.CanUse(null))
  470. {
  471. if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
  472. {
  473. return true;
  474. }
  475. }
  476. }
  477. }
  478. }
  479. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  480. {
  481. if (cardEffect1 is IImmuneFromDPMinusEffect)
  482. {
  483. if (cardEffect1.CanUse(null))
  484. {
  485. if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
  486. {
  487. return true;
  488. }
  489. }
  490. }
  491. }
  492. }
  493. return false;
  494. }
  495. #endregion
  496. #region Can be returned to your hand?
  497. public bool CannotReturnToHand(ICardEffect cardEffect)
  498. {
  499. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  500. {
  501. foreach (Permanent permanent in player.GetFieldPermanents())
  502. {
  503. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  504. {
  505. if (cardEffect1 is ICannotReturnToHandEffect)
  506. {
  507. if (cardEffect1.CanUse(null))
  508. {
  509. if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
  510. {
  511. return true;
  512. }
  513. }
  514. }
  515. }
  516. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  517. {
  518. if (cardEffect1 is ICannotReturnToHandEffect)
  519. {
  520. if (cardEffect1.CanUse(null))
  521. {
  522. if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
  523. {
  524. return true;
  525. }
  526. }
  527. }
  528. }
  529. }
  530. }
  531. return false;
  532. }
  533. #endregion
  534. #region Can be returned to deck?
  535. public bool CannotReturnToLibrary(ICardEffect cardEffect)
  536. {
  537. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  538. {
  539. foreach (Permanent permanent in player.GetFieldPermanents())
  540. {
  541. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  542. {
  543. if (cardEffect1 is ICannotReturnToLibraryEffect)
  544. {
  545. if (cardEffect1.CanUse(null))
  546. {
  547. if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
  548. {
  549. return true;
  550. }
  551. }
  552. }
  553. }
  554. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  555. {
  556. if (cardEffect1 is ICannotReturnToLibraryEffect)
  557. {
  558. if (cardEffect1.CanUse(null))
  559. {
  560. if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
  561. {
  562. return true;
  563. }
  564. }
  565. }
  566. }
  567. }
  568. }
  569. return false;
  570. }
  571. #endregion
  572. #region Immune From De-Digivolve
  573. public bool ImmuneFromDeDigivolve()
  574. {
  575. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  576. {
  577. foreach (Permanent permanent in player.GetFieldPermanents())
  578. {
  579. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  580. {
  581. if (cardEffect1 is IImmuneFromDeDigivolveEffect)
  582. {
  583. if (cardEffect1.CanUse(null))
  584. {
  585. if (((IImmuneFromDeDigivolveEffect)cardEffect1).ImmuneDeDigivolve(this))
  586. {
  587. return true;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. return false;
  595. }
  596. #endregion
  597. #region Immune From Trashing Stack
  598. public bool ImmuneFromStackTrashing(ICardEffect effect)
  599. {
  600. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  601. {
  602. foreach (Permanent permanent in player.GetFieldPermanents())
  603. {
  604. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  605. {
  606. if (cardEffect1 is IImmuneFromStackTrashingEffect)
  607. {
  608. if (cardEffect1.CanUse(null))
  609. {
  610. if (((IImmuneFromStackTrashingEffect)cardEffect1).ImmuneStackTrashing(this, effect))
  611. {
  612. return true;
  613. }
  614. }
  615. }
  616. }
  617. }
  618. }
  619. return false;
  620. }
  621. #endregion
  622. #region Card Sources
  623. public List<CardSource> cardSources = new List<CardSource>();
  624. #endregion
  625. #region Stacked Cards
  626. public List<CardSource> StackCards => cardSources.Filter(cardSource => !LinkedCards.Contains(cardSource));
  627. #endregion
  628. #region Digivolution Cards
  629. public List<CardSource> DigivolutionCards => cardSources.Filter(cardSource => cardSource != TopCard && !LinkedCards.Contains(cardSource));
  630. #endregion
  631. #region Linked Cards
  632. public int LinkedMax
  633. {
  634. get
  635. {
  636. int Max = 1;
  637. #region Effect of changing the number of sheets to undergo security check
  638. List<ICardEffect> cardEffects_ChangeLinkedMax = new List<ICardEffect>();
  639. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  640. {
  641. foreach (Permanent permanent in player.GetFieldPermanents())
  642. {
  643. #region Effects of permanents in play
  644. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  645. {
  646. if (cardEffect is IChangeLinkMaxEffect)
  647. {
  648. if (((IChangeLinkMaxEffect)cardEffect).PermanentCondition(this))
  649. {
  650. if (cardEffect.CanUse(null))
  651. {
  652. if (!TopCard.CanNotBeAffected(cardEffect))
  653. {
  654. cardEffects_ChangeLinkedMax.Add(cardEffect);
  655. }
  656. }
  657. }
  658. }
  659. }
  660. #endregion
  661. }
  662. #region player effect
  663. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  664. {
  665. if (cardEffect is IChangeLinkMaxEffect)
  666. {
  667. if (((IChangeLinkMaxEffect)cardEffect).PermanentCondition(this))
  668. {
  669. if (cardEffect.CanUse(null))
  670. {
  671. if (!TopCard.CanNotBeAffected(cardEffect))
  672. {
  673. cardEffects_ChangeLinkedMax.Add(cardEffect);
  674. }
  675. }
  676. }
  677. }
  678. }
  679. #endregion
  680. }
  681. List<ICardEffect> cardEffects_ChangeLinkedMax_UpToConstant = new List<ICardEffect>();
  682. List<ICardEffect> cardEffects_ChangeLinkedMax_UpDownValue = new List<ICardEffect>();
  683. List<ICardEffect> cardEffects_ChangeLinkedMax_DownToConstant = new List<ICardEffect>();
  684. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax)
  685. {
  686. if (cardEffect is IChangeLinkMaxEffect)
  687. {
  688. if (cardEffect.CanUse(null))
  689. {
  690. switch (((IChangeLinkMaxEffect)cardEffect).isUpDown())
  691. {
  692. case CalculateOrder.UpToConstant:
  693. cardEffects_ChangeLinkedMax_UpToConstant.Add(cardEffect);
  694. break;
  695. case CalculateOrder.UpDownValue:
  696. cardEffects_ChangeLinkedMax_UpDownValue.Add(cardEffect);
  697. break;
  698. case CalculateOrder.DownToConstant:
  699. cardEffects_ChangeLinkedMax_DownToConstant.Add(cardEffect);
  700. break;
  701. }
  702. }
  703. }
  704. }
  705. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_UpToConstant)
  706. {
  707. if (cardEffect is IChangeLinkMaxEffect)
  708. {
  709. if (cardEffect.CanUse(null))
  710. {
  711. Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
  712. }
  713. }
  714. }
  715. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_UpDownValue)
  716. {
  717. if (cardEffect is IChangeLinkMaxEffect)
  718. {
  719. if (cardEffect.CanUse(null))
  720. {
  721. Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
  722. }
  723. }
  724. }
  725. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_DownToConstant)
  726. {
  727. if (cardEffect is IChangeLinkMaxEffect)
  728. {
  729. if (cardEffect.CanUse(null))
  730. {
  731. Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
  732. }
  733. }
  734. }
  735. #endregion
  736. return Max;
  737. }
  738. }
  739. public List<CardSource> LinkedCards = new List<CardSource>();
  740. #endregion
  741. #region Add Card Source
  742. public void AddCardSource(CardSource cardSource)
  743. {
  744. cardSources.Insert(0, cardSource);
  745. cardSource.SetFace("Permanent.AddSourceCard");
  746. }
  747. #endregion
  748. #region Add digivolution cards to top of sources
  749. /// <summary>
  750. /// 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
  751. /// </summary>
  752. /// <param name="addedDigivolutionCards"></param>
  753. /// <param name="cardEffect"></param>
  754. /// <param name="skipEffectAndActivateSkill"></param>
  755. /// <returns></returns>
  756. public IEnumerator AddDigivolutionCardsTop(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect)
  757. {
  758. List<CardSource> addedCards = new List<CardSource>();
  759. bool isFromSameDigimon = false;
  760. bool isFromDigimon = false;
  761. foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
  762. {
  763. if (cardSources.Contains(addedDigivolutionCard))
  764. {
  765. isFromSameDigimon = true;
  766. }
  767. if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
  768. {
  769. if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  770. {
  771. isFromDigimon = true;
  772. }
  773. }
  774. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  775. if (!this.IsToken && !addedDigivolutionCard.IsToken)
  776. {
  777. this.cardSources.Insert(1, addedDigivolutionCard);
  778. addedDigivolutionCard.SetFace("Permanent.AddDigivolutionCardsTop");
  779. addedCards.Add(addedDigivolutionCard);
  780. }
  781. }
  782. if (addedCards.Count >= 1)
  783. {
  784. if (ShowingPermanentCard != null)
  785. {
  786. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  787. }
  788. #region "進化元が増えた時"の効果
  789. #region Hashtable Setting
  790. Hashtable hashtable = new Hashtable()
  791. {
  792. {"Permanent", this},
  793. {"CardEffect", cardEffect},
  794. {"CardSources", addedCards},
  795. {"isFromSameDigimon", isFromSameDigimon},
  796. {"isFromDigimon", isFromDigimon},
  797. };
  798. #endregion
  799. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
  800. #endregion
  801. }
  802. }
  803. #endregion
  804. #region Add digivolution cards to bottom of sources
  805. /// <summary>
  806. /// 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
  807. /// </summary>
  808. /// <param name="addedDigivolutionCards"></param>
  809. /// <param name="cardEffect"></param>
  810. /// <param name="skipEffectAndActivateSkill"></param>
  811. /// <returns></returns>
  812. public IEnumerator AddDigivolutionCardsBottom(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect, bool skipEffectAndActivateSkill = false, bool isFacedown = false)
  813. {
  814. List<CardSource> addedCards = new List<CardSource>();
  815. bool isFromSameDigimon = false;
  816. bool isFromDigimon = false;
  817. foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
  818. {
  819. if (addedDigivolutionCard.PermanentOfThisCard() != null)
  820. {
  821. if (addedDigivolutionCard.PermanentOfThisCard() != this)
  822. {
  823. if (addedDigivolutionCard.PermanentOfThisCard().TopCard == addedDigivolutionCard)
  824. {
  825. IPlacePermanentToDigivolutionCards placePermanent = new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { addedDigivolutionCard.PermanentOfThisCard(), this } }, false, cardEffect, skipEffectAndActivateSkill);
  826. yield return ContinuousController.instance.StartCoroutine(placePermanent.PlacePermanentToDigivolutionCards());
  827. if (!placePermanent.Placed)
  828. {
  829. continue;
  830. }
  831. }
  832. }
  833. }
  834. if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
  835. {
  836. if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  837. {
  838. isFromDigimon = true;
  839. }
  840. }
  841. if (cardSources.Contains(addedDigivolutionCard))
  842. {
  843. isFromSameDigimon = true;
  844. if (addedDigivolutionCard == TopCard)
  845. {
  846. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  847. ShowingPermanentCard.ShowPermanentData(true);
  848. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(
  849. addedDigivolutionCard,
  850. this));
  851. }
  852. }
  853. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  854. if (!IsToken && !addedDigivolutionCard.IsToken)
  855. {
  856. cardSources.Add(addedDigivolutionCard);
  857. if (isFacedown)
  858. addedDigivolutionCard.SetReverse();
  859. else
  860. addedDigivolutionCard.SetFace("Permanent.AddDigivolutionCardsBottom");
  861. addedCards.Add(addedDigivolutionCard);
  862. }
  863. }
  864. if (addedCards.Count >= 1 && !skipEffectAndActivateSkill)
  865. {
  866. if (ShowingPermanentCard != null)
  867. {
  868. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  869. }
  870. #region Effect of "when the number of evolution sources increases"
  871. #region Hashtable Setting
  872. Hashtable hashtable = new Hashtable()
  873. {
  874. {"Permanent", this},
  875. {"CardEffect", cardEffect},
  876. {"CardSources", addedCards},
  877. {"isFromSameDigimon", isFromSameDigimon},
  878. {"isFromDigimon", isFromDigimon},
  879. };
  880. #endregion
  881. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
  882. #endregion
  883. }
  884. }
  885. #endregion
  886. #region Add Link cards
  887. /// <summary>
  888. /// 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
  889. /// </summary>
  890. /// <param name="addedLinkCards"></param>
  891. /// <param name="cardEffect"></param>
  892. /// <param name="skipEffectAndActivateSkill"></param>
  893. /// <returns></returns>
  894. public IEnumerator AddLinkCard(CardSource addedLinkCard, ICardEffect cardEffect)
  895. {
  896. bool addedCard = false;
  897. bool isFromDigimon = false;
  898. if (CardEffectCommons.IsExistOnBattleArea(addedLinkCard))
  899. {
  900. if (addedLinkCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  901. {
  902. isFromDigimon = true;
  903. }
  904. }
  905. if (LinkedCards.Count >= LinkedMax)
  906. {
  907. if(LinkedMax > 1)
  908. yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(null,((LinkedCards.Count + 1) - LinkedMax)));
  909. else
  910. yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(LinkedCards[0]));
  911. }
  912. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedLinkCard));
  913. if (!this.IsToken && !addedLinkCard.IsToken)
  914. {
  915. LinkedCards.Insert(0, addedLinkCard);
  916. LinkedDP += addedLinkCard.LinkDP;
  917. this.cardSources.Insert(1, addedLinkCard);
  918. addedLinkCard.SetFace("Permanent.AddLinkCard");
  919. addedCard = true;
  920. }
  921. if (addedCard)
  922. {
  923. if (ShowingPermanentCard != null)
  924. {
  925. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  926. }
  927. #region Add Linked Card
  928. #region Hashtable Setting
  929. Hashtable hashtable = new Hashtable()
  930. {
  931. {"Permanent", this},
  932. {"CardEffect", cardEffect},
  933. {"Card", addedLinkCard},
  934. {"isFromDigimon", isFromDigimon},
  935. };
  936. #endregion
  937. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.WhenLinked));
  938. #endregion
  939. }
  940. }
  941. #endregion
  942. #region RemoveCardSource
  943. public IEnumerator RemoveCardSource(CardSource cardSource)
  944. {
  945. yield return null;
  946. cardSources.Remove(cardSource);
  947. }
  948. #endregion
  949. #region Remove Linked Card
  950. public IEnumerator RemoveLinkedCard(CardSource cardSource, int removeCount = 0)
  951. {
  952. if (LinkedCards.Contains(cardSource))
  953. {
  954. LinkedDP -= cardSource.LinkDP;
  955. yield return ContinuousController.instance.StartCoroutine(RemoveCardSource(cardSource));
  956. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  957. LinkedCards.Remove(cardSource);
  958. }
  959. if(removeCount > 0)
  960. {
  961. int maxCount = Mathf.Min(removeCount, LinkedCards.Count);
  962. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  963. selectCardEffect.SetUp(
  964. canTargetCondition: (CardSource) => true,
  965. canTargetCondition_ByPreSelecetedList: null,
  966. canEndSelectCondition: null,
  967. canNoSelect: () => false,
  968. selectCardCoroutine: null,
  969. afterSelectCardCoroutine: null,
  970. message: $"Select {maxCount} card to trash.",
  971. maxCount: removeCount,
  972. canEndNotMax: false,
  973. isShowOpponent: true,
  974. mode: SelectCardEffect.Mode.Discard,
  975. root: SelectCardEffect.Root.Custom,
  976. customRootCardList: LinkedCards,
  977. canLookReverseCard: true,
  978. selectPlayer: TopCard.Owner,
  979. cardEffect: null);
  980. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  981. }
  982. //TODO: Add event call if something was removed
  983. }
  984. #endregion
  985. #region Top Card
  986. public CardSource TopCard
  987. {
  988. get
  989. {
  990. if (cardSources.Count >= 1)
  991. {
  992. if (LinkedCards.Count > 0)
  993. return cardSources.First(source => !LinkedCards.Contains(source));
  994. else
  995. return cardSources[0];
  996. }
  997. return null;
  998. }
  999. }
  1000. #endregion
  1001. #region Permanent effect list
  1002. #region このパーマネントの効果リスト
  1003. public List<ICardEffect> EffectList(EffectTiming timing)
  1004. {
  1005. return EffectList_ForCard(timing, TopCard);
  1006. }
  1007. #endregion
  1008. #region このポケモンの追加効果リスト
  1009. public List<ICardEffect> EffectList_Added(EffectTiming timing)
  1010. {
  1011. List<ICardEffect> _EffectList = new List<ICardEffect>();
  1012. if (TopCard != null)
  1013. {
  1014. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerDrawPhaseEffects)
  1015. {
  1016. ICardEffect cardEffect = GetCardEffect(timing);
  1017. if (cardEffect != null)
  1018. {
  1019. _EffectList.Add(cardEffect);
  1020. }
  1021. }
  1022. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerTurnEndEffects)
  1023. {
  1024. ICardEffect cardEffect = GetCardEffect(timing);
  1025. if (cardEffect != null)
  1026. {
  1027. _EffectList.Add(cardEffect);
  1028. }
  1029. }
  1030. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEachTurnEndEffects)
  1031. {
  1032. ICardEffect cardEffect = GetCardEffect(timing);
  1033. if (cardEffect != null)
  1034. {
  1035. _EffectList.Add(cardEffect);
  1036. }
  1037. }
  1038. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOpponentTurnEndEffects)
  1039. {
  1040. ICardEffect cardEffect = GetCardEffect(timing);
  1041. if (cardEffect != null)
  1042. {
  1043. _EffectList.Add(cardEffect);
  1044. }
  1045. }
  1046. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEndBattleEffects)
  1047. {
  1048. ICardEffect cardEffect = GetCardEffect(timing);
  1049. if (cardEffect != null)
  1050. {
  1051. _EffectList.Add(cardEffect);
  1052. }
  1053. }
  1054. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerTurnStartEffects)
  1055. {
  1056. ICardEffect cardEffect = GetCardEffect(timing);
  1057. if (cardEffect != null)
  1058. {
  1059. _EffectList.Add(cardEffect);
  1060. }
  1061. }
  1062. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilNextUntapEffects)
  1063. {
  1064. ICardEffect cardEffect = GetCardEffect(timing);
  1065. if (cardEffect != null)
  1066. {
  1067. _EffectList.Add(cardEffect);
  1068. }
  1069. }
  1070. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in PermanentEffects)
  1071. {
  1072. ICardEffect cardEffect = GetCardEffect(timing);
  1073. if (cardEffect != null)
  1074. {
  1075. _EffectList.Add(cardEffect);
  1076. }
  1077. }
  1078. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEndAttackEffects)
  1079. {
  1080. ICardEffect cardEffect = GetCardEffect(timing);
  1081. if (cardEffect != null)
  1082. {
  1083. _EffectList.Add(cardEffect);
  1084. }
  1085. }
  1086. _EffectList = _EffectList.Filter(cardEffect => cardEffect != null);
  1087. foreach (ICardEffect cardEffect in _EffectList)
  1088. {
  1089. if (cardEffect != null)
  1090. {
  1091. if (cardEffect.EffectSourceCard == null)
  1092. {
  1093. cardEffect.SetEffectSourceCard(TopCard);
  1094. }
  1095. cardEffect.SetIsInheritedEffect(false);
  1096. }
  1097. }
  1098. }
  1099. return _EffectList;
  1100. }
  1101. #endregion
  1102. #region このパーマネントの効果リスト(引数:CardSource)
  1103. public List<ICardEffect> EffectList_ForCard(EffectTiming timing, CardSource _cardSource)
  1104. {
  1105. List<ICardEffect> _EffectList = new List<ICardEffect>();
  1106. if (TopCard != null && _cardSource != null)
  1107. {
  1108. foreach (CardSource cardSource in cardSources)
  1109. {
  1110. if (cardSource != null)
  1111. {
  1112. if (!cardSource.IsFlipped)
  1113. {
  1114. bool isTopCard = cardSource == TopCard;
  1115. if (!isTopCard)
  1116. {
  1117. if (!IsDigimon)
  1118. {
  1119. continue;
  1120. }
  1121. }
  1122. foreach (ICardEffect cardEffect in cardSource.cEntity_EffectController.GetCardEffects(timing, cardSource))
  1123. {
  1124. if (cardEffect != null)
  1125. {
  1126. if (cardEffect.IsInheritedEffect && !isTopCard)
  1127. {
  1128. _EffectList.Add(cardEffect);
  1129. continue;
  1130. }
  1131. if (cardEffect.IsLinkedEffect && cardSource.IsLinked)
  1132. {
  1133. _EffectList.Add(cardEffect);
  1134. continue;
  1135. }
  1136. if(isTopCard && !cardEffect.IsInheritedEffect && !cardEffect.IsLinkedEffect)
  1137. {
  1138. _EffectList.Add(cardEffect);
  1139. }
  1140. }
  1141. }
  1142. }
  1143. }
  1144. }
  1145. foreach (ICardEffect cardEffect in EffectList_Added(timing))
  1146. {
  1147. if (cardEffect != null)
  1148. {
  1149. _EffectList.Add(cardEffect);
  1150. }
  1151. }
  1152. foreach (ICardEffect cardEffect in _EffectList)
  1153. {
  1154. if (cardEffect != null)
  1155. {
  1156. if (cardEffect.EffectSourceCard == null)
  1157. {
  1158. cardEffect.SetEffectSourceCard(_cardSource);
  1159. }
  1160. }
  1161. }
  1162. }
  1163. return _EffectList;
  1164. }
  1165. #endregion
  1166. #region 自分のターン終了時に消える効果
  1167. public List<Func<EffectTiming, ICardEffect>> UntilOwnerTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
  1168. #endregion
  1169. #region 自分のドローフェイズ終了時に消える効果
  1170. public List<Func<EffectTiming, ICardEffect>> UntilOwnerDrawPhaseEffects = new List<Func<EffectTiming, ICardEffect>>();
  1171. #endregion
  1172. #region お互いのターン終了時に消える効果
  1173. public List<Func<EffectTiming, ICardEffect>> UntilEachTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
  1174. #endregion
  1175. #region 相手のターン終了時に消える効果
  1176. public List<Func<EffectTiming, ICardEffect>> UntilOpponentTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
  1177. #endregion
  1178. #region バトル終了時に消える効果
  1179. public List<Func<EffectTiming, ICardEffect>> UntilEndBattleEffects = new List<Func<EffectTiming, ICardEffect>>();
  1180. #endregion
  1181. #region 攻撃終了時に消える効果
  1182. public List<Func<EffectTiming, ICardEffect>> UntilEndAttackEffects = new List<Func<EffectTiming, ICardEffect>>();
  1183. #endregion
  1184. #region 自分のターン開始時に消える効果
  1185. public List<Func<EffectTiming, ICardEffect>> UntilOwnerTurnStartEffects = new List<Func<EffectTiming, ICardEffect>>();
  1186. #endregion
  1187. #region 次にアンタップする時に消える効果
  1188. public List<Func<EffectTiming, ICardEffect>> UntilNextUntapEffects = new List<Func<EffectTiming, ICardEffect>>();
  1189. #endregion
  1190. #region 場を離れるまで残る効果
  1191. public List<Func<EffectTiming, ICardEffect>> PermanentEffects = new List<Func<EffectTiming, ICardEffect>>();
  1192. #endregion
  1193. #endregion
  1194. #region 起動型効果を宣言できるか
  1195. public bool CanDeclareSkill() => CanDeclareSkillList().Count > 0;
  1196. #endregion
  1197. #region 宣言可能な起動型効果リスト
  1198. public List<ICardEffect> CanDeclareSkillList()
  1199. {
  1200. List<ICardEffect> CanDeclareSkillList = new List<ICardEffect>();
  1201. if (TopCard != null)
  1202. {
  1203. foreach (ICardEffect _cardEffect in EffectList(EffectTiming.OnDeclaration))
  1204. {
  1205. if (_cardEffect is ActivateICardEffect)
  1206. {
  1207. if (_cardEffect.CanUse(null))
  1208. {
  1209. CanDeclareSkillList.Add(_cardEffect);
  1210. }
  1211. }
  1212. }
  1213. }
  1214. return CanDeclareSkillList;
  1215. }
  1216. #endregion
  1217. #region このパーマネントが場に出たターン
  1218. public int EnterFieldTurnCount { get; set; } = -1;
  1219. #endregion
  1220. #region このパーマネントを表す場のオブジェクト
  1221. public FieldPermanentCard ShowingPermanentCard { get; set; }
  1222. #endregion
  1223. #region Whether this permanent can be selected by the effect
  1224. public bool CanSelectBySkill(ICardEffect skill)
  1225. {
  1226. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1227. {
  1228. #region Effects of field permanents
  1229. foreach (Permanent permanent in player.GetFieldPermanents())
  1230. {
  1231. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1232. {
  1233. if (cardEffect is ICanNotSelectBySkillEffect)
  1234. {
  1235. if (cardEffect.CanUse(null))
  1236. {
  1237. if (((ICanNotSelectBySkillEffect)cardEffect).CanNotSelectBySkill(this, skill))
  1238. {
  1239. return false;
  1240. }
  1241. }
  1242. }
  1243. }
  1244. }
  1245. #endregion
  1246. }
  1247. return true;
  1248. }
  1249. #endregion
  1250. #region Number of sheets to undergo security check
  1251. public int InvertSecutiryValue
  1252. {
  1253. get
  1254. {
  1255. int Invert = 0;
  1256. List<ICardEffect> cardEffects_InvertStrike = new List<ICardEffect>();
  1257. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1258. {
  1259. foreach (Permanent permanent in player.GetFieldPermanents())
  1260. {
  1261. #region Effects of permanents in play
  1262. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1263. {
  1264. if (cardEffect is IInvertSAttackEffect)
  1265. {
  1266. if (cardEffect.CanUse(null))
  1267. {
  1268. if (!TopCard.CanNotBeAffected(cardEffect))
  1269. {
  1270. cardEffects_InvertStrike.Add(cardEffect);
  1271. }
  1272. }
  1273. }
  1274. }
  1275. #endregion
  1276. }
  1277. #region player effect
  1278. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1279. {
  1280. if (cardEffect is IInvertSAttackEffect)
  1281. {
  1282. if (cardEffect.CanUse(null))
  1283. {
  1284. if (!TopCard.CanNotBeAffected(cardEffect))
  1285. {
  1286. cardEffects_InvertStrike.Add(cardEffect);
  1287. }
  1288. }
  1289. }
  1290. }
  1291. #endregion
  1292. }
  1293. foreach (ICardEffect cardEffect in cardEffects_InvertStrike)
  1294. {
  1295. Invert = ((IInvertSAttackEffect)cardEffect).InversionValue(this, Invert);
  1296. }
  1297. return Mathf.Clamp(Invert,-1,1);
  1298. }
  1299. }
  1300. public List<int> SecurityAttackChanges
  1301. {
  1302. get
  1303. {
  1304. List<int> SecurityAttackChanges = new List<int>();
  1305. int Strike = 1;
  1306. List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
  1307. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1308. {
  1309. foreach (Permanent permanent in player.GetFieldPermanents())
  1310. {
  1311. #region 場のパーマネントの効果
  1312. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1313. {
  1314. if (cardEffect is IChangeSAttackEffect)
  1315. {
  1316. if (cardEffect.CanUse(null))
  1317. {
  1318. if (!TopCard.CanNotBeAffected(cardEffect))
  1319. {
  1320. if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
  1321. {
  1322. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1323. }
  1324. }
  1325. }
  1326. }
  1327. }
  1328. #endregion
  1329. }
  1330. #region プレイヤーの効果
  1331. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1332. {
  1333. if (cardEffect is IChangeSAttackEffect)
  1334. {
  1335. if (cardEffect.CanUse(null))
  1336. {
  1337. if (!TopCard.CanNotBeAffected(cardEffect))
  1338. {
  1339. if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
  1340. {
  1341. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1342. }
  1343. }
  1344. }
  1345. }
  1346. }
  1347. #endregion
  1348. }
  1349. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
  1350. {
  1351. if (cardEffect is IChangeSAttackEffect)
  1352. {
  1353. if (cardEffect.CanUse(null))
  1354. {
  1355. int Strike1 = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, 0);
  1356. if (Strike1 != Strike)
  1357. {
  1358. SecurityAttackChanges.Add(Strike1 - Strike);
  1359. }
  1360. }
  1361. }
  1362. }
  1363. return SecurityAttackChanges;
  1364. }
  1365. }
  1366. public bool HasSecurityAttackChanges
  1367. {
  1368. get
  1369. {
  1370. if (!IsDigimon)
  1371. {
  1372. return false;
  1373. }
  1374. return SecurityAttackChanges.Count >= 1;
  1375. }
  1376. }
  1377. public int Strike_AllowMinus
  1378. {
  1379. get
  1380. {
  1381. int Strike = 1;
  1382. #region Effect of changing the number of sheets to undergo security check
  1383. List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
  1384. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1385. {
  1386. foreach (Permanent permanent in player.GetFieldPermanents())
  1387. {
  1388. #region Effects of permanents in play
  1389. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1390. {
  1391. if (cardEffect is IChangeSAttackEffect)
  1392. {
  1393. if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
  1394. {
  1395. if (cardEffect.CanUse(null))
  1396. {
  1397. if (!TopCard.CanNotBeAffected(cardEffect))
  1398. {
  1399. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1400. }
  1401. }
  1402. }
  1403. }
  1404. }
  1405. #endregion
  1406. }
  1407. #region player effect
  1408. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1409. {
  1410. if (cardEffect is IChangeSAttackEffect)
  1411. {
  1412. if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
  1413. {
  1414. if (cardEffect.CanUse(null))
  1415. {
  1416. if (!TopCard.CanNotBeAffected(cardEffect))
  1417. {
  1418. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1419. }
  1420. }
  1421. }
  1422. }
  1423. }
  1424. #endregion
  1425. }
  1426. List<ICardEffect> cardEffects_ChangeDirectStrike_UpToConstant = new List<ICardEffect>();
  1427. List<ICardEffect> cardEffects_ChangeDirectStrike_UpDownValue = new List<ICardEffect>();
  1428. List<ICardEffect> cardEffects_ChangeDirectStrike_DownToConstant = new List<ICardEffect>();
  1429. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
  1430. {
  1431. if (cardEffect is IChangeSAttackEffect)
  1432. {
  1433. if (cardEffect.CanUse(null))
  1434. {
  1435. switch (((IChangeSAttackEffect)cardEffect).isUpDown())
  1436. {
  1437. case CalculateOrder.UpToConstant:
  1438. cardEffects_ChangeDirectStrike_UpToConstant.Add(cardEffect);
  1439. break;
  1440. case CalculateOrder.UpDownValue:
  1441. cardEffects_ChangeDirectStrike_UpDownValue.Add(cardEffect);
  1442. break;
  1443. case CalculateOrder.DownToConstant:
  1444. cardEffects_ChangeDirectStrike_DownToConstant.Add(cardEffect);
  1445. break;
  1446. }
  1447. }
  1448. }
  1449. }
  1450. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpToConstant)
  1451. {
  1452. if (cardEffect is IChangeSAttackEffect)
  1453. {
  1454. if (cardEffect.CanUse(null))
  1455. {
  1456. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
  1457. }
  1458. }
  1459. }
  1460. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpDownValue)
  1461. {
  1462. if (cardEffect is IChangeSAttackEffect)
  1463. {
  1464. if (cardEffect.CanUse(null))
  1465. {
  1466. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
  1467. }
  1468. }
  1469. }
  1470. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_DownToConstant)
  1471. {
  1472. if (cardEffect is IChangeSAttackEffect)
  1473. {
  1474. if (cardEffect.CanUse(null))
  1475. {
  1476. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
  1477. }
  1478. }
  1479. }
  1480. #endregion
  1481. return Strike;
  1482. }
  1483. }
  1484. public int Strike
  1485. {
  1486. get
  1487. {
  1488. int Strike = Strike_AllowMinus;
  1489. if (Strike < 0)
  1490. {
  1491. Strike = 0;
  1492. }
  1493. return Strike;
  1494. }
  1495. }
  1496. #endregion
  1497. #region このパーマネントがタップされているかどうか
  1498. public bool OldIsSuspended = false;
  1499. public bool IsSuspended = false;
  1500. public int DPWhenSuspended = 114514;
  1501. #endregion
  1502. #region Whether this permanent can unsuspend
  1503. public bool CanUnsuspend
  1504. {
  1505. get
  1506. {
  1507. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1508. {
  1509. #region Effects of field permanents
  1510. foreach (Permanent permanent in player.GetFieldPermanents())
  1511. {
  1512. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1513. {
  1514. if (cardEffect is ICanNotUnsuspendEffect)
  1515. {
  1516. if (cardEffect.CanUse(null))
  1517. {
  1518. if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
  1519. {
  1520. return false;
  1521. }
  1522. }
  1523. }
  1524. }
  1525. }
  1526. #endregion
  1527. #region Effects of players
  1528. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1529. {
  1530. if (cardEffect is ICanNotUnsuspendEffect)
  1531. {
  1532. if (cardEffect.CanUse(null))
  1533. {
  1534. if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
  1535. {
  1536. return false;
  1537. }
  1538. }
  1539. }
  1540. }
  1541. #endregion
  1542. }
  1543. return true;
  1544. }
  1545. }
  1546. #endregion
  1547. #region このパーマネントが移動できるかどうか
  1548. public bool CanMove
  1549. {
  1550. get
  1551. {
  1552. if (TopCard != null)
  1553. {
  1554. #region the effects of permanents
  1555. if (GManager.instance.turnStateMachine.gameContext.Players
  1556. .Map(player => player.GetFieldPermanents())
  1557. .Flat()
  1558. .Map(permanent => permanent.EffectList(EffectTiming.None))
  1559. .Flat()
  1560. .Some(cardEffect => cardEffect is ICanNotMoveEffect
  1561. && cardEffect.CanUse(null)
  1562. && ((ICanNotMoveEffect)cardEffect).CanNotMove(TopCard, null)))
  1563. {
  1564. return false;
  1565. }
  1566. #endregion
  1567. #region the effects of players
  1568. if (GManager.instance.turnStateMachine.gameContext.Players
  1569. .Map(player => player.EffectList(EffectTiming.None))
  1570. .Flat()
  1571. .Some(cardEffect => cardEffect is ICanNotMoveEffect
  1572. && cardEffect.CanUse(null)
  1573. && ((ICanNotMoveEffect)cardEffect).CanNotMove(TopCard, null)))
  1574. {
  1575. return false;
  1576. }
  1577. #endregion
  1578. #region the effects of itself
  1579. if (this == null)
  1580. {
  1581. if (EffectList(EffectTiming.None)
  1582. .Some(cardEffect => cardEffect is ICanNotMoveEffect
  1583. && cardEffect.CanUse(null)
  1584. && ((ICanNotMoveEffect)cardEffect).CanNotMove(TopCard, null)))
  1585. {
  1586. return false;
  1587. }
  1588. }
  1589. #endregion
  1590. if (TopCard.PermanentOfThisCard().PermanentFrame.isBreedingAreaFrame())
  1591. {
  1592. if (!TopCard.Owner.GetBreedingAreaPermanents().Contains(this))
  1593. {
  1594. return false;
  1595. }
  1596. }
  1597. else
  1598. {
  1599. if (TopCard.Owner.GetBreedingAreaPermanents().Count > 0)
  1600. return false;
  1601. }
  1602. if (!IsDigimon)
  1603. return false;
  1604. if (TopCard.IsDigiEgg && DP <= 0)
  1605. return false;
  1606. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) == 0)
  1607. {
  1608. return false;
  1609. }
  1610. }
  1611. else
  1612. {
  1613. return false;
  1614. }
  1615. return true;
  1616. }
  1617. }
  1618. #endregion
  1619. #region このパーマネントが攻撃できるかどうか
  1620. public bool CanAttack(ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
  1621. {
  1622. // can not attack with empty cards
  1623. if (TopCard == null)
  1624. {
  1625. return false;
  1626. }
  1627. // can not attack during opponent's turn
  1628. if (TopCard.Owner != GManager.instance.turnStateMachine.gameContext.TurnPlayer)
  1629. {
  1630. return false;
  1631. }
  1632. //Can not attack during another attack
  1633. if (GManager.instance.attackProcess.IsAttacking)
  1634. return false;
  1635. // can not attack to player
  1636. if (!CanAttackTargetDigimon(null, cardEffect, withoutTap, isVortex))
  1637. {
  1638. // can not attack to opponent's Digimon
  1639. if (TopCard.Owner.Enemy.GetFieldPermanents().Count((permanent) => CanAttackTargetDigimon(permanent, cardEffect, withoutTap, isVortex)) == 0)
  1640. {
  1641. return false;
  1642. }
  1643. }
  1644. return true;
  1645. }
  1646. #endregion
  1647. #region このパーマネントが対象の攻撃パーマネントをブロックできるかどうか
  1648. public bool CanBlock(Permanent AttackingPermanent)
  1649. {
  1650. if (TopCard == null)
  1651. {
  1652. return false;
  1653. }
  1654. if (!IsDigimon)
  1655. {
  1656. return false;
  1657. }
  1658. if (IsSuspended)
  1659. {
  1660. return false;
  1661. }
  1662. if (!CanSuspend)
  1663. {
  1664. return false;
  1665. }
  1666. if (PermanentFrame != null)
  1667. {
  1668. if (!PermanentFrame.IsBattleAreaFrame())
  1669. {
  1670. return false;
  1671. }
  1672. }
  1673. if (!AttackingPermanent.IsDigimon)
  1674. return false;
  1675. if (!AttackingPermanent.CanSwitchAttackTarget)
  1676. return false;
  1677. #region "Unblockable" effect
  1678. #region Effects of permanents in play
  1679. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1680. {
  1681. foreach (Permanent permanent in player.GetFieldPermanents())
  1682. {
  1683. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1684. {
  1685. if (cardEffect is ICannotBlockEffect)
  1686. {
  1687. if (cardEffect.CanUse(null))
  1688. {
  1689. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1690. {
  1691. return false;
  1692. }
  1693. }
  1694. }
  1695. }
  1696. }
  1697. }
  1698. #endregion
  1699. #region player effect
  1700. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1701. {
  1702. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1703. {
  1704. if (cardEffect is ICannotBlockEffect)
  1705. {
  1706. if (cardEffect.CanUse(null))
  1707. {
  1708. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1709. {
  1710. if (!TopCard.CanNotBeAffected(cardEffect))
  1711. {
  1712. return false;
  1713. }
  1714. }
  1715. }
  1716. }
  1717. }
  1718. }
  1719. #endregion
  1720. #endregion
  1721. return true;
  1722. }
  1723. #endregion
  1724. #region 対象のパーマネントを攻撃できるか
  1725. public bool CanAttackTargetDigimon(Permanent Defender, ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
  1726. {
  1727. if (TopCard != null)
  1728. {
  1729. if (!IsDigimon)
  1730. {
  1731. return false;
  1732. }
  1733. if (!withoutTap)
  1734. {
  1735. if (IsSuspended)
  1736. {
  1737. return false;
  1738. }
  1739. if (!CanSuspend)
  1740. {
  1741. return false;
  1742. }
  1743. }
  1744. if (PermanentFrame != null)
  1745. {
  1746. if (!PermanentFrame.IsBattleAreaFrame())
  1747. {
  1748. return false;
  1749. }
  1750. }
  1751. if (EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  1752. {
  1753. if (!HasRush && !isVortex)
  1754. {
  1755. return false;
  1756. }
  1757. }
  1758. #region 「対象の防御パーマネントを攻撃できない」効果
  1759. #region 場のパーマネントの効果
  1760. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1761. {
  1762. foreach (Permanent permanent in player.GetFieldPermanents())
  1763. {
  1764. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1765. {
  1766. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1767. {
  1768. if (cardEffect1.CanUse(null))
  1769. {
  1770. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1771. {
  1772. if (!TopCard.CanNotBeAffected(cardEffect1))
  1773. {
  1774. return false;
  1775. }
  1776. }
  1777. }
  1778. }
  1779. }
  1780. }
  1781. }
  1782. #endregion
  1783. #region プレイヤーの効果
  1784. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1785. {
  1786. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1787. {
  1788. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1789. {
  1790. if (cardEffect1.CanUse(null))
  1791. {
  1792. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1793. {
  1794. if (!TopCard.CanNotBeAffected(cardEffect1))
  1795. {
  1796. return false;
  1797. }
  1798. }
  1799. }
  1800. }
  1801. }
  1802. }
  1803. #endregion
  1804. #endregion
  1805. if (Defender != null)
  1806. {
  1807. if (Defender.TopCard != null)
  1808. {
  1809. if (Defender.TopCard.Owner == TopCard.Owner.Enemy)
  1810. {
  1811. if (Defender.IsDigimon && Defender.TopCard.Owner.GetBattleAreaPermanents().Contains(Defender))
  1812. {
  1813. if (Defender.IsSuspended)
  1814. {
  1815. return true;
  1816. }
  1817. #region 「対象の防御パーマネントを攻撃できる」効果
  1818. #region 場のパーマネントの効果
  1819. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1820. {
  1821. foreach (Permanent permanent in player.GetFieldPermanents())
  1822. {
  1823. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1824. {
  1825. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1826. {
  1827. if (cardEffect1.CanUse(null))
  1828. {
  1829. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1830. {
  1831. return true;
  1832. }
  1833. }
  1834. }
  1835. }
  1836. }
  1837. }
  1838. #endregion
  1839. #region プレイヤーの効果
  1840. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1841. {
  1842. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1843. {
  1844. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1845. {
  1846. if (cardEffect1.CanUse(null))
  1847. {
  1848. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1849. {
  1850. return true;
  1851. }
  1852. }
  1853. }
  1854. }
  1855. }
  1856. #endregion
  1857. #endregion
  1858. }
  1859. }
  1860. }
  1861. }
  1862. else
  1863. {
  1864. return true;
  1865. }
  1866. }
  1867. return false;
  1868. }
  1869. #endregion
  1870. #region Is Unblockable
  1871. public bool IsUnblockable
  1872. {
  1873. get
  1874. {
  1875. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.None))
  1876. {
  1877. if (cardEffect is CannotBlockClass)
  1878. {
  1879. if (cardEffect.EffectName == "Unblockable")
  1880. {
  1881. return true;
  1882. }
  1883. }
  1884. }
  1885. return false;
  1886. }
  1887. }
  1888. #endregion
  1889. #region Has Blocker
  1890. public bool HasBlocker
  1891. {
  1892. get
  1893. {
  1894. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1895. {
  1896. #region Effects of permanents in play
  1897. foreach (Permanent permanent in player.GetFieldPermanents())
  1898. {
  1899. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1900. {
  1901. if (cardEffect is IBlockerEffect)
  1902. {
  1903. if (cardEffect.CanTrigger(null))
  1904. {
  1905. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1906. {
  1907. return true;
  1908. }
  1909. }
  1910. }
  1911. }
  1912. }
  1913. #endregion
  1914. #region Effects of faceup security
  1915. foreach (CardSource source in player.SecurityCards)
  1916. {
  1917. if (source.IsFlipped)
  1918. continue;
  1919. foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.None))
  1920. {
  1921. if (cardEffect is IBlockerEffect)
  1922. {
  1923. if (cardEffect.CanTrigger(null))
  1924. {
  1925. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1926. {
  1927. return true;
  1928. }
  1929. }
  1930. }
  1931. }
  1932. }
  1933. #endregion
  1934. #region プレイヤーの効果
  1935. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1936. {
  1937. if (cardEffect is IBlockerEffect)
  1938. {
  1939. if (cardEffect.CanTrigger(null))
  1940. {
  1941. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1942. {
  1943. return true;
  1944. }
  1945. }
  1946. }
  1947. }
  1948. #endregion
  1949. }
  1950. return false;
  1951. }
  1952. }
  1953. #endregion
  1954. #region Has Jamming
  1955. public bool HasJamming
  1956. {
  1957. get
  1958. {
  1959. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1960. {
  1961. foreach (Permanent permanent in player.GetFieldPermanents())
  1962. {
  1963. #region 場のパーマネントの効果
  1964. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1965. {
  1966. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1967. {
  1968. if (cardEffect.CanTrigger(null))
  1969. {
  1970. if (cardEffect.EffectName == "Jamming")
  1971. {
  1972. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1973. {
  1974. return true;
  1975. }
  1976. }
  1977. }
  1978. }
  1979. }
  1980. #endregion
  1981. }
  1982. #region プレイヤーの効果
  1983. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1984. {
  1985. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1986. {
  1987. if (cardEffect.CanTrigger(null))
  1988. {
  1989. if (cardEffect.EffectName == "Jamming")
  1990. {
  1991. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1992. {
  1993. return true;
  1994. }
  1995. }
  1996. }
  1997. }
  1998. }
  1999. #endregion
  2000. }
  2001. return false;
  2002. }
  2003. }
  2004. #endregion
  2005. #region Has Ice Clad
  2006. public bool HasIceclad
  2007. {
  2008. get
  2009. {
  2010. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2011. {
  2012. #region Ice clad permanent effects
  2013. foreach (ICardEffect cardEffect in EffectList(EffectTiming.None))
  2014. {
  2015. if (cardEffect is IIcecladEffect)
  2016. {
  2017. if (cardEffect.CanTrigger(null))
  2018. {
  2019. if (((IIcecladEffect)cardEffect).HasIceclad(this))
  2020. {
  2021. return true;
  2022. }
  2023. }
  2024. }
  2025. }
  2026. #endregion
  2027. #region Ice clad Player Effects
  2028. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2029. {
  2030. if (cardEffect is IIcecladEffect)
  2031. {
  2032. if (cardEffect.CanTrigger(null))
  2033. {
  2034. if (((IIcecladEffect)cardEffect).HasIceclad(this))
  2035. {
  2036. return true;
  2037. }
  2038. }
  2039. }
  2040. }
  2041. #endregion
  2042. }
  2043. return false;
  2044. }
  2045. }
  2046. #endregion
  2047. #region Whether this permanent has Pierce
  2048. public bool HasPierce
  2049. {
  2050. get
  2051. {
  2052. if (IsDigimon)
  2053. {
  2054. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDetermineDoSecurityCheck))
  2055. {
  2056. if (cardEffect is ActivateICardEffect)
  2057. {
  2058. if (cardEffect.CanTrigger(CardEffectCommons.PierceCheckHashtableOfPermanent(this)))
  2059. {
  2060. if (cardEffect.EffectName == "Pierce")
  2061. {
  2062. return true;
  2063. }
  2064. if (cardEffect.EffectName == "Piercing")
  2065. {
  2066. return true;
  2067. }
  2068. }
  2069. }
  2070. }
  2071. }
  2072. return false;
  2073. }
  2074. }
  2075. #endregion
  2076. #region Has Reboot
  2077. public bool HasReboot
  2078. {
  2079. get
  2080. {
  2081. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2082. {
  2083. foreach (Permanent permanent in player.GetFieldPermanents())
  2084. {
  2085. #region 場のパーマネントの効果
  2086. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2087. {
  2088. if (cardEffect is IRebootEffect)
  2089. {
  2090. if (cardEffect.CanTrigger(null))
  2091. {
  2092. if (((IRebootEffect)cardEffect).HasReboot(this))
  2093. {
  2094. return true;
  2095. }
  2096. }
  2097. }
  2098. }
  2099. #endregion
  2100. }
  2101. #region プレイヤーの効果
  2102. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2103. {
  2104. if (cardEffect is IRebootEffect)
  2105. {
  2106. if (cardEffect.CanTrigger(null))
  2107. {
  2108. if (((IRebootEffect)cardEffect).HasReboot(this))
  2109. {
  2110. return true;
  2111. }
  2112. }
  2113. }
  2114. }
  2115. #endregion
  2116. }
  2117. return false;
  2118. }
  2119. }
  2120. #endregion
  2121. #region Has Raid
  2122. public bool HasRaid
  2123. {
  2124. get
  2125. {
  2126. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  2127. {
  2128. if (cardEffect is ActivateICardEffect)
  2129. {
  2130. if (cardEffect.EffectName == "Raid")
  2131. {
  2132. return true;
  2133. }
  2134. }
  2135. }
  2136. return false;
  2137. }
  2138. }
  2139. #endregion
  2140. #region Has Rush
  2141. public bool HasRush
  2142. {
  2143. get
  2144. {
  2145. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2146. {
  2147. foreach (Permanent permanent in player.GetFieldPermanents())
  2148. {
  2149. #region 場のパーマネントの効果
  2150. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2151. {
  2152. if (cardEffect is IRushEffect)
  2153. {
  2154. if (cardEffect.CanTrigger(null))
  2155. {
  2156. if (((IRushEffect)cardEffect).HasRush(this))
  2157. {
  2158. return true;
  2159. }
  2160. }
  2161. }
  2162. }
  2163. #endregion
  2164. }
  2165. #region プレイヤーの効果
  2166. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2167. {
  2168. if (cardEffect is IRushEffect)
  2169. {
  2170. if (cardEffect.CanTrigger(null))
  2171. {
  2172. if (((IRushEffect)cardEffect).HasRush(this))
  2173. {
  2174. return true;
  2175. }
  2176. }
  2177. }
  2178. }
  2179. #endregion
  2180. }
  2181. return false;
  2182. }
  2183. }
  2184. #endregion
  2185. #region Has Retaliation
  2186. public bool HasRetaliation
  2187. {
  2188. get
  2189. {
  2190. if (RetaliationCount >= 1)
  2191. {
  2192. return true;
  2193. }
  2194. return false;
  2195. }
  2196. }
  2197. #endregion
  2198. #region Retaliation Count
  2199. public int RetaliationCount
  2200. {
  2201. get
  2202. {
  2203. int count = 0;
  2204. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2205. {
  2206. if (cardEffect is ActivateICardEffect)
  2207. {
  2208. if (cardEffect.EffectName == "Retaliation")
  2209. {
  2210. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2211. {
  2212. count++;
  2213. }
  2214. }
  2215. }
  2216. }
  2217. return count;
  2218. }
  2219. }
  2220. #endregion
  2221. #region Has Fortitude
  2222. public bool HasFortitude
  2223. {
  2224. get
  2225. {
  2226. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2227. {
  2228. if (cardEffect is ActivateICardEffect)
  2229. {
  2230. if (cardEffect.EffectName == "Fortitude")
  2231. {
  2232. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2233. {
  2234. return true;
  2235. }
  2236. }
  2237. }
  2238. }
  2239. return false;
  2240. }
  2241. }
  2242. #endregion
  2243. #region Has Blitz
  2244. public bool HasBlitz
  2245. {
  2246. get
  2247. {
  2248. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnEnterFieldAnyone))
  2249. {
  2250. if (cardEffect is ActivateICardEffect)
  2251. {
  2252. if (cardEffect.CanTrigger(CardEffectCommons.WhenDigivolutionCheckHashtableOfPermanent(this)) || cardEffect.CanTrigger(CardEffectCommons.OnPlayCheckHashtableOfPermanent(this)))
  2253. {
  2254. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  2255. {
  2256. if (cardEffect.EffectDiscription.Contains("Blitz"))
  2257. {
  2258. return true;
  2259. }
  2260. }
  2261. }
  2262. }
  2263. }
  2264. return false;
  2265. }
  2266. }
  2267. #endregion
  2268. #region Has Evade
  2269. public bool HasEvade
  2270. {
  2271. get
  2272. {
  2273. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2274. {
  2275. if (cardEffect is ActivateICardEffect)
  2276. {
  2277. Hashtable hashtable = new Hashtable()
  2278. {
  2279. {"Permanents", new List<Permanent>() { this }}
  2280. };
  2281. if (cardEffect.CanTrigger(hashtable))
  2282. {
  2283. if (cardEffect.EffectName == "Evade")
  2284. {
  2285. return true;
  2286. }
  2287. }
  2288. }
  2289. }
  2290. return false;
  2291. }
  2292. }
  2293. #endregion
  2294. #region Has Mind Link
  2295. public bool HasMindLink
  2296. {
  2297. get
  2298. {
  2299. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDeclaration))
  2300. {
  2301. if (cardEffect is ActivateICardEffect)
  2302. {
  2303. if (cardEffect.CanTrigger(null))
  2304. {
  2305. if (!String.IsNullOrEmpty(cardEffect.EffectDiscription))
  2306. {
  2307. if (cardEffect.EffectDiscription.Contains("Mind Link"))
  2308. {
  2309. return true;
  2310. }
  2311. }
  2312. }
  2313. }
  2314. }
  2315. return false;
  2316. }
  2317. }
  2318. #endregion
  2319. #region Has Barrier
  2320. public bool HasBarrier
  2321. {
  2322. get
  2323. {
  2324. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2325. {
  2326. if (cardEffect is ActivateICardEffect)
  2327. {
  2328. Hashtable hashtable = new Hashtable();
  2329. hashtable.Add("Permanents", new List<Permanent>() { this });
  2330. hashtable.Add("battle", new IBattle(null, null, null));
  2331. if (cardEffect.CanTrigger(hashtable))
  2332. {
  2333. if (cardEffect.EffectName == "Barrier")
  2334. {
  2335. return true;
  2336. }
  2337. }
  2338. }
  2339. }
  2340. return false;
  2341. }
  2342. }
  2343. #endregion
  2344. #region Has Alliance
  2345. public bool HasAlliance
  2346. {
  2347. get
  2348. {
  2349. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2350. {
  2351. foreach (Permanent permanent in player.GetFieldPermanents())
  2352. {
  2353. #region Permanent Effects
  2354. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.OnAllyAttack))
  2355. {
  2356. if (cardEffect is IAllianceEffect)
  2357. {
  2358. if (cardEffect.CanTrigger(null))
  2359. {
  2360. if (((IAllianceEffect)cardEffect).HasAlliance(this))
  2361. {
  2362. return true;
  2363. }
  2364. }
  2365. }
  2366. }
  2367. #endregion
  2368. }
  2369. #region Effects of faceup security
  2370. foreach (CardSource source in player.SecurityCards)
  2371. {
  2372. if (source.IsFlipped)
  2373. continue;
  2374. foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.OnAllyAttack))
  2375. {
  2376. if (cardEffect is IAllianceEffect)
  2377. {
  2378. if (cardEffect.CanTrigger(null))
  2379. {
  2380. if (((IAllianceEffect)cardEffect).HasAlliance(this))
  2381. {
  2382. return true;
  2383. }
  2384. }
  2385. }
  2386. }
  2387. }
  2388. #endregion
  2389. #region Player Effects
  2390. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.OnAllyAttack))
  2391. {
  2392. if (cardEffect is IAllianceEffect)
  2393. {
  2394. if (cardEffect.CanTrigger(null))
  2395. {
  2396. if (((IAllianceEffect)cardEffect).HasAlliance(this))
  2397. {
  2398. return true;
  2399. }
  2400. }
  2401. }
  2402. }
  2403. #endregion
  2404. }
  2405. return false;
  2406. }
  2407. }
  2408. #endregion
  2409. #region Has Collision
  2410. public bool HasCollision
  2411. {
  2412. get
  2413. {
  2414. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  2415. {
  2416. if (cardEffect is ActivateICardEffect)
  2417. {
  2418. if (cardEffect.EffectName == "Collision")
  2419. {
  2420. return true;
  2421. }
  2422. }
  2423. }
  2424. return false;
  2425. }
  2426. }
  2427. #endregion
  2428. #region Has Partition
  2429. public bool HasPartition
  2430. {
  2431. get
  2432. {
  2433. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2434. {
  2435. if (cardEffect is ActivateICardEffect)
  2436. {
  2437. if (cardEffect.EffectName == "Partition")
  2438. {
  2439. return true;
  2440. }
  2441. }
  2442. }
  2443. return false;
  2444. }
  2445. }
  2446. #endregion
  2447. #region 消滅時効化を持つか
  2448. public bool HasOnDeletionEffect
  2449. {
  2450. get
  2451. {
  2452. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2453. {
  2454. if (cardEffect is ActivateICardEffect)
  2455. {
  2456. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2457. {
  2458. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  2459. {
  2460. if (cardEffect.IsOnDeletion)
  2461. {
  2462. return true;
  2463. }
  2464. }
  2465. }
  2466. }
  2467. }
  2468. return false;
  2469. }
  2470. }
  2471. #endregion
  2472. #region バトルしているか
  2473. public IBattle battle { get; set; } = null;
  2474. #endregion
  2475. #region Can Be Destroyed
  2476. public bool CanBeDestroyed()
  2477. {
  2478. #region 消滅しない効果
  2479. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2480. {
  2481. foreach (Permanent permanent in player.GetFieldPermanents())
  2482. {
  2483. #region 場のパーマネントの効果
  2484. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2485. {
  2486. if (cardEffect is ICanNotBeDestroyedEffect)
  2487. {
  2488. if (cardEffect.CanUse(null))
  2489. {
  2490. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2491. {
  2492. return false;
  2493. }
  2494. }
  2495. }
  2496. }
  2497. #endregion
  2498. }
  2499. #region プレイヤーの効果
  2500. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2501. {
  2502. if (cardEffect is ICanNotBeDestroyedEffect)
  2503. {
  2504. if (cardEffect.CanUse(null))
  2505. {
  2506. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2507. {
  2508. return false;
  2509. }
  2510. }
  2511. }
  2512. }
  2513. #endregion
  2514. }
  2515. #endregion
  2516. return true;
  2517. }
  2518. #endregion
  2519. #region Can Be Destroyed By Battle
  2520. public bool CanBeDestroyedByBattle(Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  2521. {
  2522. if (!CanBeDestroyed())
  2523. {
  2524. return false;
  2525. }
  2526. #region Given Effects
  2527. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2528. {
  2529. foreach (Permanent permanent in player.GetFieldPermanents())
  2530. {
  2531. #region Permanents
  2532. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2533. {
  2534. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2535. {
  2536. if (cardEffect.CanUse(null))
  2537. {
  2538. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2539. {
  2540. return false;
  2541. }
  2542. }
  2543. }
  2544. }
  2545. #endregion
  2546. }
  2547. #region Effects of faceup security
  2548. foreach (CardSource source in player.SecurityCards)
  2549. {
  2550. if (source.IsFlipped)
  2551. continue;
  2552. foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.None))
  2553. {
  2554. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2555. {
  2556. if (cardEffect.CanUse(null))
  2557. {
  2558. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2559. {
  2560. return false;
  2561. }
  2562. }
  2563. }
  2564. }
  2565. }
  2566. #endregion
  2567. #region Player Effects
  2568. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2569. {
  2570. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2571. {
  2572. if (cardEffect.CanUse(null))
  2573. {
  2574. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2575. {
  2576. return false;
  2577. }
  2578. }
  2579. }
  2580. }
  2581. #endregion
  2582. }
  2583. #endregion
  2584. return true;
  2585. }
  2586. #endregion
  2587. #region このパーマネントが効果で消滅するか
  2588. public bool CanBeDestroyedBySkill(ICardEffect cardEffect)
  2589. {
  2590. if (this.TopCard != null)
  2591. {
  2592. if (this.TopCard.CanNotBeAffected(cardEffect))
  2593. {
  2594. return false;
  2595. }
  2596. if (!CanBeDestroyed())
  2597. {
  2598. return false;
  2599. }
  2600. #region 効果で消滅しない効果
  2601. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2602. {
  2603. foreach (Permanent permanent in player.GetFieldPermanents())
  2604. {
  2605. #region 場のパーマネントの効果
  2606. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  2607. {
  2608. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2609. {
  2610. if (cardEffect1.CanUse(null))
  2611. {
  2612. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2613. {
  2614. return false;
  2615. }
  2616. }
  2617. }
  2618. }
  2619. #endregion
  2620. }
  2621. #region プレイヤーの効果
  2622. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  2623. {
  2624. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2625. {
  2626. if (cardEffect1.CanUse(null))
  2627. {
  2628. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2629. {
  2630. return false;
  2631. }
  2632. }
  2633. }
  2634. }
  2635. #endregion
  2636. }
  2637. #endregion
  2638. }
  2639. return true;
  2640. }
  2641. #endregion
  2642. #region Can Leave Field
  2643. public bool CanBeRemoved()
  2644. {
  2645. #region Effect that never disappears
  2646. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2647. {
  2648. foreach (Permanent permanent in player.GetFieldPermanents())
  2649. {
  2650. #region Effects of permanents in play
  2651. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2652. {
  2653. if (cardEffect is ICanNotBeRemovedEffect)
  2654. {
  2655. if (cardEffect.CanUse(null))
  2656. {
  2657. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2658. {
  2659. return false;
  2660. }
  2661. }
  2662. }
  2663. }
  2664. #endregion
  2665. }
  2666. #region player effect
  2667. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2668. {
  2669. if (cardEffect is ICanNotBeRemovedEffect)
  2670. {
  2671. if (cardEffect.CanUse(null))
  2672. {
  2673. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2674. {
  2675. return false;
  2676. }
  2677. }
  2678. }
  2679. }
  2680. #endregion
  2681. }
  2682. #endregion
  2683. return true;
  2684. }
  2685. #endregion
  2686. #region トークンかどうか
  2687. public bool IsToken
  2688. {
  2689. get
  2690. {
  2691. if (TopCard != null)
  2692. {
  2693. if (TopCard.IsToken)
  2694. {
  2695. return true;
  2696. }
  2697. }
  2698. return false;
  2699. }
  2700. }
  2701. #endregion
  2702. #region そのパーマネントが消滅・バウンス待機状態か
  2703. public bool willBeRemoveField { get; set; } = false;
  2704. #endregion
  2705. #region Is a Digimon card
  2706. public bool IsDigimon
  2707. {
  2708. get
  2709. {
  2710. if (TopCard != null)
  2711. {
  2712. if (TopCard.IsDigimon || TopCard.IsDigiEgg)
  2713. {
  2714. return true;
  2715. }
  2716. #region Effect of treating it as a Digimon
  2717. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2718. {
  2719. foreach (Permanent permanent in player.GetFieldPermanents())
  2720. {
  2721. #region Effects of permanents in play
  2722. foreach (ICardEffect cardEffect in permanent.EffectList_Added(EffectTiming.None))
  2723. {
  2724. if (cardEffect is ITreatAsDigimonEffect)
  2725. {
  2726. if (cardEffect.CanTrigger(null))
  2727. {
  2728. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2729. {
  2730. return true;
  2731. }
  2732. }
  2733. }
  2734. }
  2735. #endregion
  2736. }
  2737. #region player effect
  2738. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2739. {
  2740. if (cardEffect is ITreatAsDigimonEffect)
  2741. {
  2742. if (cardEffect.CanTrigger(null))
  2743. {
  2744. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2745. {
  2746. return true;
  2747. }
  2748. }
  2749. }
  2750. }
  2751. #endregion
  2752. }
  2753. #endregion
  2754. }
  2755. return false;
  2756. }
  2757. }
  2758. #endregion
  2759. #region Is a Tamer card
  2760. public bool IsTamer
  2761. {
  2762. get
  2763. {
  2764. if (TopCard != null)
  2765. {
  2766. if (TopCard.IsTamer)
  2767. {
  2768. return true;
  2769. }
  2770. }
  2771. return false;
  2772. }
  2773. }
  2774. #endregion
  2775. #region Is an Option card
  2776. public bool IsOption
  2777. {
  2778. get
  2779. {
  2780. if (TopCard != null)
  2781. {
  2782. if (TopCard.IsOption)
  2783. {
  2784. return true;
  2785. }
  2786. }
  2787. return false;
  2788. }
  2789. }
  2790. #endregion
  2791. #region Levels handled by Jogress
  2792. public List<int> Levels_ForJogress(CardSource cardSource)
  2793. {
  2794. List<int> levels = new List<int>();
  2795. if (cardSource != null)
  2796. {
  2797. if (cardSource.HasLevel)
  2798. {
  2799. levels.Add(this.Level);
  2800. }
  2801. #region Effect of "adding levels handled by jogless evolution"
  2802. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2803. {
  2804. foreach (Permanent permanent in player.GetFieldPermanents())
  2805. {
  2806. #region Effects of permanents in play
  2807. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2808. {
  2809. if (cardEffect is IAddJogressLevelsEffect)
  2810. {
  2811. if (cardEffect.CanUse(null))
  2812. {
  2813. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2814. {
  2815. levels.Add(level);
  2816. }
  2817. }
  2818. }
  2819. }
  2820. #endregion
  2821. }
  2822. #region player effect
  2823. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2824. {
  2825. if (cardEffect is IAddJogressLevelsEffect)
  2826. {
  2827. if (cardEffect.CanUse(null))
  2828. {
  2829. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2830. {
  2831. levels.Add(level);
  2832. }
  2833. }
  2834. }
  2835. }
  2836. #endregion
  2837. }
  2838. #endregion
  2839. }
  2840. return levels;
  2841. }
  2842. #endregion
  2843. #region Names handled by Jogress
  2844. public List<string> Names_ForDNA(CardSource cardSource)
  2845. {
  2846. List<string> names = new List<string>();
  2847. if (cardSource != null)
  2848. {
  2849. foreach(string name in cardSource.CardNames)
  2850. names.Add(name);
  2851. #region Effect of "adding names handled by DNA evolution"
  2852. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2853. {
  2854. foreach (Permanent permanent in player.GetFieldPermanents())
  2855. {
  2856. #region Effects of permanents in play
  2857. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2858. {
  2859. if (cardEffect is IAddDNANamesEffect)
  2860. {
  2861. if (cardEffect.CanUse(null))
  2862. {
  2863. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2864. {
  2865. names.Add(name);
  2866. }
  2867. }
  2868. }
  2869. }
  2870. #endregion
  2871. }
  2872. #region player effect
  2873. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2874. {
  2875. if (cardEffect is IAddDNANamesEffect)
  2876. {
  2877. if (cardEffect.CanUse(null))
  2878. {
  2879. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2880. {
  2881. names.Add(name);
  2882. }
  2883. }
  2884. }
  2885. }
  2886. #endregion
  2887. }
  2888. #endregion
  2889. }
  2890. return names;
  2891. }
  2892. #endregion
  2893. #region バトルで消滅したか
  2894. public bool IsDestroyedByBattle { get; set; } = false;
  2895. #endregion
  2896. #region 消滅に使用された効果
  2897. public ICardEffect DestroyingEffect { get; set; } = null;
  2898. #endregion
  2899. #region 他のパーマネントの下に置くのに使用された効果
  2900. public ICardEffect PlaceOtherPermanentEffect { get; set; } = null;
  2901. #endregion
  2902. #region 手札バウンス に使用された効果
  2903. public ICardEffect HandBounceEffect { get; set; } = null;
  2904. #endregion
  2905. #region 山札バウンス に使用された効果
  2906. public ICardEffect LibraryBounceEffect { get; set; } = null;
  2907. #endregion
  2908. #region 登場に使用された効果
  2909. public ICardEffect PlayingEffect { get; set; } = null;
  2910. #endregion
  2911. #region 進化に使用された効果
  2912. public ICardEffect DigivolvingEffect { get; set; } = null;
  2913. #endregion
  2914. #region Whether this digimon is placed in the trash by not having a DP
  2915. public bool IsPlaceToTrashDueToNotHavingDP { get; set; } = true;
  2916. #endregion
  2917. #region Whether this permanent can suspend
  2918. public bool CanSuspend
  2919. {
  2920. get
  2921. {
  2922. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  2923. {
  2924. #region Effects of field permanents
  2925. foreach (Permanent permanent in player.GetFieldPermanents())
  2926. {
  2927. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2928. {
  2929. if (cardEffect is ICanNotSuspendEffect)
  2930. {
  2931. if (cardEffect.CanUse(null))
  2932. {
  2933. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2934. {
  2935. return false;
  2936. }
  2937. }
  2938. }
  2939. }
  2940. }
  2941. #endregion
  2942. #region Effects of players
  2943. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2944. {
  2945. if (cardEffect is ICanNotSuspendEffect)
  2946. {
  2947. if (cardEffect.CanUse(null))
  2948. {
  2949. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2950. {
  2951. return false;
  2952. }
  2953. }
  2954. }
  2955. }
  2956. #endregion
  2957. }
  2958. return true;
  2959. }
  2960. }
  2961. #endregion
  2962. #region このデジモンのアタックの対象が変更できるか
  2963. public bool CanSwitchAttackTarget
  2964. {
  2965. get
  2966. {
  2967. #region アタックの対象が変更できない効果
  2968. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2969. {
  2970. foreach (Permanent permanent in player.GetFieldPermanents())
  2971. {
  2972. #region 場のパーマネントの効果
  2973. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2974. {
  2975. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2976. {
  2977. if (cardEffect.CanUse(null))
  2978. {
  2979. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2980. {
  2981. return false;
  2982. }
  2983. }
  2984. }
  2985. }
  2986. #endregion
  2987. }
  2988. #region プレイヤーの効果
  2989. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2990. {
  2991. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2992. {
  2993. if (cardEffect.CanUse(null))
  2994. {
  2995. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2996. {
  2997. return false;
  2998. }
  2999. }
  3000. }
  3001. }
  3002. #endregion
  3003. }
  3004. #endregion
  3005. return true;
  3006. }
  3007. }
  3008. #endregion
  3009. #region このデジモンを場からデジクロス条件の代わりにできるか
  3010. public bool CanSubstituteForDigiXrosCondition(CardSource cardSource)
  3011. {
  3012. #region デジクロス条件の代わりにできる効果
  3013. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  3014. {
  3015. foreach (Permanent permanent in player.GetFieldPermanents())
  3016. {
  3017. #region 場のパーマネントの効果
  3018. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  3019. {
  3020. if (cardEffect is ICanSelectDigiXrosEffect)
  3021. {
  3022. if (cardEffect.CanUse(null))
  3023. {
  3024. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  3025. {
  3026. return true;
  3027. }
  3028. }
  3029. }
  3030. }
  3031. #endregion
  3032. }
  3033. #region プレイヤーの効果
  3034. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  3035. {
  3036. if (cardEffect is ICanSelectDigiXrosEffect)
  3037. {
  3038. if (cardEffect.CanUse(null))
  3039. {
  3040. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  3041. {
  3042. return true;
  3043. }
  3044. }
  3045. }
  3046. }
  3047. #endregion
  3048. }
  3049. #endregion
  3050. return false;
  3051. }
  3052. #endregion
  3053. #region Can Substitue for Assembly
  3054. public bool CanSubstituteForAssemblyCondition(CardSource cardSource)
  3055. {
  3056. #region Effects that can be used in place of Assembly conditions
  3057. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  3058. {
  3059. foreach (Permanent permanent in player.GetFieldPermanents())
  3060. {
  3061. #region Effects of permanents in play
  3062. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  3063. {
  3064. if (cardEffect is ICanSelectAssemblyEffect)
  3065. {
  3066. if (cardEffect.CanUse(null))
  3067. {
  3068. if (((ICanSelectAssemblyEffect)cardEffect).CanSelect(cardSource, this))
  3069. {
  3070. return true;
  3071. }
  3072. }
  3073. }
  3074. }
  3075. #endregion
  3076. }
  3077. #region player effect
  3078. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  3079. {
  3080. if (cardEffect is ICanSelectAssemblyEffect)
  3081. {
  3082. if (cardEffect.CanUse(null))
  3083. {
  3084. if (((ICanSelectAssemblyEffect)cardEffect).CanSelect(cardSource, this))
  3085. {
  3086. return true;
  3087. }
  3088. }
  3089. }
  3090. }
  3091. #endregion
  3092. }
  3093. #endregion
  3094. return false;
  3095. }
  3096. #endregion
  3097. #region 登場した直後のLevel
  3098. public int LevelJustAfterPlayed { get; set; } = -1;
  3099. #endregion
  3100. #region 登場した直後のPlay Cost
  3101. public int PlayCostJustAfterPlayed { get; set; } = -1;
  3102. #endregion
  3103. #region 登場した直後のCardNames
  3104. public List<string> CardNamesJustAfterPlayed { get; set; } = new List<string>();
  3105. #endregion
  3106. #region 進化した直後のCardNames
  3107. public List<string> CardNamesJustAfterDigivolved { get; set; } = new List<string>();
  3108. #endregion
  3109. #region 登場した直後のTraits
  3110. public List<string> TraitsJustAfterPlayed { get; set; } = new List<string>();
  3111. #endregion
  3112. #region 場を離れる直前のDP
  3113. public int DPJustBeforeRemoveField { get; set; } = -1;
  3114. #endregion
  3115. #region 場を離れる直前のLevel
  3116. public int LevelJustBeforeRemoveField { get; set; } = -1;
  3117. #endregion
  3118. #region 場を離れる直前のCost
  3119. public int CostJustBeforeRemoveField { get; set; } = -1;
  3120. #endregion
  3121. #region 場を離れる直前のカード名
  3122. public List<string> CardNamesJustBeforeRemoveField { get; set; } = new List<string>();
  3123. #endregion
  3124. #region Card Traits Just Before Removed Field
  3125. public List<string> CardTraitsJustBeforeRemoveField { get; set; } = new List<string>();
  3126. #endregion
  3127. #region バースト進化で手札に戻ったか
  3128. public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
  3129. #endregion
  3130. #region Is Linked Card Added as Source By App Fusion
  3131. public bool IsAddedAsSourceByAppFusion { get; set; } = false;
  3132. #endregion
  3133. #region バースト進化したか
  3134. public bool IsBurstDigivolved { get; set; } = false;
  3135. #endregion
  3136. #region Did it App Fusion?
  3137. public bool IsAppFusion { get; set; } = false;
  3138. #endregion
  3139. #region 効果で場に出たオプションか
  3140. public bool IsPlayedOptionPermanent { get; set; } = false;
  3141. #endregion
  3142. #region 進化元を持たないか
  3143. public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
  3144. #endregion
  3145. #region Has face down Digivolution Cards
  3146. public bool HasFaceDownDigivolutionCards => DigivolutionCards.Any(x => x.IsFlipped);
  3147. #endregion
  3148. #region Has No Link Cards
  3149. public bool HasNoLinkCards => LinkedCards.Count == 0;
  3150. #endregion
  3151. #region Digivolution cards' colors
  3152. public List<CardColor> DigivolutionCardsColors
  3153. {
  3154. get
  3155. {
  3156. List<CardColor> cardColors = new List<CardColor>();
  3157. foreach (CardSource cardSource in DigivolutionCards)
  3158. {
  3159. foreach (CardColor cardColor in cardSource.CardColors)
  3160. {
  3161. if (!cardColors.Contains(cardColor))
  3162. {
  3163. cardColors.Add(cardColor);
  3164. }
  3165. }
  3166. }
  3167. return cardColors.Distinct().ToList();
  3168. }
  3169. }
  3170. #endregion
  3171. #region Show "Unsuspend" effect object
  3172. public void ShowUnsuspendEffect()
  3173. {
  3174. if (TopCard != null)
  3175. {
  3176. if (ShowingPermanentCard != null)
  3177. {
  3178. if (ShowingPermanentCard.WillUntapObject != null)
  3179. {
  3180. ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
  3181. ShowingPermanentCard.WillUntapObject.SetActive(true);
  3182. }
  3183. }
  3184. }
  3185. }
  3186. #endregion
  3187. #region Show "Return to deck" effect object
  3188. public void ShowDeckBounceEffect()
  3189. {
  3190. if (TopCard != null)
  3191. {
  3192. if (willBeRemoveField)
  3193. {
  3194. if (ShowingPermanentCard != null)
  3195. {
  3196. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  3197. {
  3198. ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
  3199. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
  3200. }
  3201. }
  3202. }
  3203. }
  3204. }
  3205. #endregion
  3206. #region Hide "Return to deck" effect object
  3207. public void HideDeckBounceEffect()
  3208. {
  3209. if (TopCard != null)
  3210. {
  3211. if (ShowingPermanentCard != null)
  3212. {
  3213. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  3214. {
  3215. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
  3216. }
  3217. }
  3218. }
  3219. }
  3220. #endregion
  3221. #region Show "Return to hand" effect object
  3222. public void ShowHandBounceEffect()
  3223. {
  3224. if (TopCard != null)
  3225. {
  3226. if (willBeRemoveField)
  3227. {
  3228. if (ShowingPermanentCard != null)
  3229. {
  3230. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  3231. {
  3232. ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
  3233. ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
  3234. }
  3235. }
  3236. }
  3237. }
  3238. }
  3239. #endregion
  3240. #region Hide "Return to hand" effect object
  3241. public void HideHandBounceEffect()
  3242. {
  3243. if (TopCard != null)
  3244. {
  3245. if (ShowingPermanentCard != null)
  3246. {
  3247. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  3248. {
  3249. ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
  3250. }
  3251. }
  3252. }
  3253. }
  3254. #endregion
  3255. #region Show "Delete" effect object
  3256. public void ShowDeleteEffect()
  3257. {
  3258. if (TopCard != null)
  3259. {
  3260. if (willBeRemoveField)
  3261. {
  3262. if (ShowingPermanentCard != null)
  3263. {
  3264. if (ShowingPermanentCard.WillBeDeletedObject != null)
  3265. {
  3266. ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
  3267. ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
  3268. }
  3269. }
  3270. }
  3271. }
  3272. }
  3273. #endregion
  3274. #region Hide "Delete" effect object
  3275. public void HideDeleteEffect()
  3276. {
  3277. if (TopCard != null)
  3278. {
  3279. if (ShowingPermanentCard != null)
  3280. {
  3281. if (ShowingPermanentCard.WillBeDeletedObject != null)
  3282. {
  3283. ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  3284. }
  3285. }
  3286. }
  3287. }
  3288. #endregion
  3289. #region Show "Remove Field" effect object
  3290. public void ShowWillRemoveFieldEffect()
  3291. {
  3292. if (TopCard != null)
  3293. {
  3294. if (willBeRemoveField)
  3295. {
  3296. if (ShowingPermanentCard != null)
  3297. {
  3298. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  3299. {
  3300. ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
  3301. ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
  3302. }
  3303. }
  3304. }
  3305. }
  3306. }
  3307. #endregion
  3308. #region Hide "Remove Field" effect object
  3309. public void HideWillRemoveFieldEffect()
  3310. {
  3311. if (TopCard != null)
  3312. {
  3313. if (ShowingPermanentCard != null)
  3314. {
  3315. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  3316. {
  3317. ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
  3318. }
  3319. }
  3320. }
  3321. }
  3322. #endregion
  3323. #region Show "Digivolution" effect object
  3324. public void ShowWillEvolutionEffect()
  3325. {
  3326. if (TopCard != null)
  3327. {
  3328. if (ShowingPermanentCard != null)
  3329. {
  3330. if (ShowingPermanentCard.WillEvolutionObject != null)
  3331. {
  3332. ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
  3333. ShowingPermanentCard.WillEvolutionObject.SetActive(true);
  3334. }
  3335. }
  3336. }
  3337. }
  3338. #endregion
  3339. #region Hide "Digivolution" effect object
  3340. public void HideWillEvolutionEffect()
  3341. {
  3342. if (TopCard != null)
  3343. {
  3344. if (ShowingPermanentCard != null)
  3345. {
  3346. if (ShowingPermanentCard.WillEvolutionObject != null)
  3347. {
  3348. ShowingPermanentCard.WillEvolutionObject.SetActive(false);
  3349. }
  3350. }
  3351. }
  3352. }
  3353. #endregion
  3354. }