Permanent.cs 124 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721
  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. if (boost.Condition())
  420. DP += boost.DP;
  421. }
  422. #endregion
  423. DP += LinkedDP;
  424. if (DP < 0)
  425. {
  426. DP = 0;
  427. }
  428. }
  429. return DP;
  430. }
  431. }
  432. public int LinkedDP { get; set; }
  433. public List<DPBoost> Boosts = new List<DPBoost>();
  434. public void AddBoost(DPBoost boost)
  435. {
  436. if (Boosts.Any(x => x.ID == boost.ID))
  437. Boosts.First(x => x.ID == boost.ID).DP = boost.DP;
  438. else
  439. Boosts.Add(boost);
  440. }
  441. public void RemoveBoost(string ID)
  442. {
  443. if (Boosts.Any(x => x.ID == ID))
  444. Boosts.Remove(Boosts.First(x => x.ID == ID));
  445. }
  446. public class DPBoost
  447. {
  448. public DPBoost(string id, int dp, Func<bool> cond)
  449. {
  450. ID = id;
  451. DP = dp;
  452. Condition = cond;
  453. }
  454. public string ID = "";
  455. public int DP = 0;
  456. public Func<bool> Condition = null;
  457. }
  458. #endregion
  459. #region Will it not receive negative DP effect?
  460. public bool ImmuneFromDPMinus(ICardEffect cardEffect)
  461. {
  462. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  463. {
  464. foreach (Permanent permanent in player.GetFieldPermanents())
  465. {
  466. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  467. {
  468. if (cardEffect1 is IImmuneFromDPMinusEffect)
  469. {
  470. if (cardEffect1.CanUse(null))
  471. {
  472. if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
  473. {
  474. return true;
  475. }
  476. }
  477. }
  478. }
  479. }
  480. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  481. {
  482. if (cardEffect1 is IImmuneFromDPMinusEffect)
  483. {
  484. if (cardEffect1.CanUse(null))
  485. {
  486. if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
  487. {
  488. return true;
  489. }
  490. }
  491. }
  492. }
  493. }
  494. return false;
  495. }
  496. #endregion
  497. #region Can be returned to your hand?
  498. public bool CannotReturnToHand(ICardEffect cardEffect)
  499. {
  500. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  501. {
  502. foreach (Permanent permanent in player.GetFieldPermanents())
  503. {
  504. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  505. {
  506. if (cardEffect1 is ICannotReturnToHandEffect)
  507. {
  508. if (cardEffect1.CanUse(null))
  509. {
  510. if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
  511. {
  512. return true;
  513. }
  514. }
  515. }
  516. }
  517. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  518. {
  519. if (cardEffect1 is ICannotReturnToHandEffect)
  520. {
  521. if (cardEffect1.CanUse(null))
  522. {
  523. if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
  524. {
  525. return true;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. }
  532. return false;
  533. }
  534. #endregion
  535. #region Can be returned to deck?
  536. public bool CannotReturnToLibrary(ICardEffect cardEffect)
  537. {
  538. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  539. {
  540. foreach (Permanent permanent in player.GetFieldPermanents())
  541. {
  542. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  543. {
  544. if (cardEffect1 is ICannotReturnToLibraryEffect)
  545. {
  546. if (cardEffect1.CanUse(null))
  547. {
  548. if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
  549. {
  550. return true;
  551. }
  552. }
  553. }
  554. }
  555. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  556. {
  557. if (cardEffect1 is ICannotReturnToLibraryEffect)
  558. {
  559. if (cardEffect1.CanUse(null))
  560. {
  561. if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
  562. {
  563. return true;
  564. }
  565. }
  566. }
  567. }
  568. }
  569. }
  570. return false;
  571. }
  572. #endregion
  573. #region Immune From De-Digivolve
  574. public bool ImmuneFromDeDigivolve()
  575. {
  576. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  577. {
  578. foreach (Permanent permanent in player.GetFieldPermanents())
  579. {
  580. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  581. {
  582. if (cardEffect1 is IImmuneFromDeDigivolveEffect)
  583. {
  584. if (cardEffect1.CanUse(null))
  585. {
  586. if (((IImmuneFromDeDigivolveEffect)cardEffect1).ImmuneDeDigivolve(this))
  587. {
  588. return true;
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }
  595. return false;
  596. }
  597. #endregion
  598. #region Immune From Trashing Stack
  599. public bool ImmuneFromStackTrashing(ICardEffect effect)
  600. {
  601. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  602. {
  603. foreach (Permanent permanent in player.GetFieldPermanents())
  604. {
  605. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  606. {
  607. if (cardEffect1 is IImmuneFromStackTrashingEffect)
  608. {
  609. if (cardEffect1.CanUse(null))
  610. {
  611. if (((IImmuneFromStackTrashingEffect)cardEffect1).ImmuneStackTrashing(this, effect))
  612. {
  613. return true;
  614. }
  615. }
  616. }
  617. }
  618. }
  619. }
  620. return false;
  621. }
  622. #endregion
  623. #region Card Sources
  624. public List<CardSource> cardSources = new List<CardSource>();
  625. #endregion
  626. #region Stacked Cards
  627. public List<CardSource> StackCards => cardSources.Filter(cardSource => !LinkedCards.Contains(cardSource));
  628. #endregion
  629. #region Digivolution Cards
  630. public List<CardSource> DigivolutionCards => cardSources.Filter(cardSource => cardSource != TopCard && !LinkedCards.Contains(cardSource));
  631. #endregion
  632. #region Linked Cards
  633. public int LinkedMax
  634. {
  635. get
  636. {
  637. int Max = 1;
  638. #region Effect of changing the number of sheets to undergo security check
  639. List<ICardEffect> cardEffects_ChangeLinkedMax = new List<ICardEffect>();
  640. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  641. {
  642. foreach (Permanent permanent in player.GetFieldPermanents())
  643. {
  644. #region Effects of permanents in play
  645. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  646. {
  647. if (cardEffect is IChangeLinkMaxEffect)
  648. {
  649. if (((IChangeLinkMaxEffect)cardEffect).PermanentCondition(this))
  650. {
  651. if (cardEffect.CanUse(null))
  652. {
  653. if (!TopCard.CanNotBeAffected(cardEffect))
  654. {
  655. cardEffects_ChangeLinkedMax.Add(cardEffect);
  656. }
  657. }
  658. }
  659. }
  660. }
  661. #endregion
  662. }
  663. #region player effect
  664. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  665. {
  666. if (cardEffect is IChangeLinkMaxEffect)
  667. {
  668. if (((IChangeLinkMaxEffect)cardEffect).PermanentCondition(this))
  669. {
  670. if (cardEffect.CanUse(null))
  671. {
  672. if (!TopCard.CanNotBeAffected(cardEffect))
  673. {
  674. cardEffects_ChangeLinkedMax.Add(cardEffect);
  675. }
  676. }
  677. }
  678. }
  679. }
  680. #endregion
  681. }
  682. List<ICardEffect> cardEffects_ChangeLinkedMax_UpToConstant = new List<ICardEffect>();
  683. List<ICardEffect> cardEffects_ChangeLinkedMax_UpDownValue = new List<ICardEffect>();
  684. List<ICardEffect> cardEffects_ChangeLinkedMax_DownToConstant = new List<ICardEffect>();
  685. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax)
  686. {
  687. if (cardEffect is IChangeLinkMaxEffect)
  688. {
  689. if (cardEffect.CanUse(null))
  690. {
  691. switch (((IChangeLinkMaxEffect)cardEffect).isUpDown())
  692. {
  693. case CalculateOrder.UpToConstant:
  694. cardEffects_ChangeLinkedMax_UpToConstant.Add(cardEffect);
  695. break;
  696. case CalculateOrder.UpDownValue:
  697. cardEffects_ChangeLinkedMax_UpDownValue.Add(cardEffect);
  698. break;
  699. case CalculateOrder.DownToConstant:
  700. cardEffects_ChangeLinkedMax_DownToConstant.Add(cardEffect);
  701. break;
  702. }
  703. }
  704. }
  705. }
  706. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_UpToConstant)
  707. {
  708. if (cardEffect is IChangeLinkMaxEffect)
  709. {
  710. if (cardEffect.CanUse(null))
  711. {
  712. Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
  713. }
  714. }
  715. }
  716. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_UpDownValue)
  717. {
  718. if (cardEffect is IChangeLinkMaxEffect)
  719. {
  720. if (cardEffect.CanUse(null))
  721. {
  722. Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
  723. }
  724. }
  725. }
  726. foreach (ICardEffect cardEffect in cardEffects_ChangeLinkedMax_DownToConstant)
  727. {
  728. if (cardEffect is IChangeLinkMaxEffect)
  729. {
  730. if (cardEffect.CanUse(null))
  731. {
  732. Max = ((IChangeLinkMaxEffect)cardEffect).GetLinkMax(Max, this, InvertSecutiryValue);
  733. }
  734. }
  735. }
  736. #endregion
  737. return Max;
  738. }
  739. }
  740. public List<CardSource> LinkedCards = new List<CardSource>();
  741. #endregion
  742. #region Add Card Source
  743. public void AddCardSource(CardSource cardSource)
  744. {
  745. cardSources.Insert(0, cardSource);
  746. cardSource.SetFace();
  747. }
  748. #endregion
  749. #region Add digivolution cards to top of sources
  750. /// <summary>
  751. /// 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
  752. /// </summary>
  753. /// <param name="addedDigivolutionCards"></param>
  754. /// <param name="cardEffect"></param>
  755. /// <param name="skipEffectAndActivateSkill"></param>
  756. /// <returns></returns>
  757. public IEnumerator AddDigivolutionCardsTop(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect)
  758. {
  759. List<CardSource> addedCards = new List<CardSource>();
  760. bool isFromSameDigimon = false;
  761. bool isFromDigimon = false;
  762. foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
  763. {
  764. if (cardSources.Contains(addedDigivolutionCard))
  765. {
  766. isFromSameDigimon = true;
  767. }
  768. if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
  769. {
  770. if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  771. {
  772. isFromDigimon = true;
  773. }
  774. }
  775. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  776. if (!this.IsToken && !addedDigivolutionCard.IsToken)
  777. {
  778. this.cardSources.Insert(1, addedDigivolutionCard);
  779. addedDigivolutionCard.SetFace();
  780. addedCards.Add(addedDigivolutionCard);
  781. }
  782. }
  783. if (addedCards.Count >= 1)
  784. {
  785. if (ShowingPermanentCard != null)
  786. {
  787. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  788. }
  789. #region "進化元が増えた時"の効果
  790. #region Hashtable Setting
  791. Hashtable hashtable = new Hashtable()
  792. {
  793. {"Permanent", this},
  794. {"CardEffect", cardEffect},
  795. {"CardSources", addedCards},
  796. {"isFromSameDigimon", isFromSameDigimon},
  797. {"isFromDigimon", isFromDigimon},
  798. };
  799. #endregion
  800. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
  801. #endregion
  802. }
  803. }
  804. #endregion
  805. #region Add digivolution cards to bottom of sources
  806. /// <summary>
  807. /// 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
  808. /// </summary>
  809. /// <param name="addedDigivolutionCards"></param>
  810. /// <param name="cardEffect"></param>
  811. /// <param name="skipEffectAndActivateSkill"></param>
  812. /// <returns></returns>
  813. public IEnumerator AddDigivolutionCardsBottom(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect, bool skipEffectAndActivateSkill = false)
  814. {
  815. List<CardSource> addedCards = new List<CardSource>();
  816. bool isFromSameDigimon = false;
  817. bool isFromDigimon = false;
  818. foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
  819. {
  820. if (addedDigivolutionCard.PermanentOfThisCard() != null)
  821. {
  822. if (addedDigivolutionCard.PermanentOfThisCard() != this)
  823. {
  824. if (addedDigivolutionCard.PermanentOfThisCard().TopCard == addedDigivolutionCard)
  825. {
  826. IPlacePermanentToDigivolutionCards placePermanent = new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { addedDigivolutionCard.PermanentOfThisCard(), this } }, false, cardEffect, skipEffectAndActivateSkill);
  827. yield return ContinuousController.instance.StartCoroutine(placePermanent.PlacePermanentToDigivolutionCards());
  828. if (!placePermanent.Placed)
  829. {
  830. continue;
  831. }
  832. }
  833. }
  834. }
  835. if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
  836. {
  837. if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  838. {
  839. isFromDigimon = true;
  840. }
  841. }
  842. if (cardSources.Contains(addedDigivolutionCard))
  843. {
  844. isFromSameDigimon = true;
  845. if (addedDigivolutionCard == TopCard)
  846. {
  847. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  848. ShowingPermanentCard.ShowPermanentData(true);
  849. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(
  850. addedDigivolutionCard,
  851. this));
  852. }
  853. }
  854. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  855. if (!IsToken && !addedDigivolutionCard.IsToken)
  856. {
  857. cardSources.Add(addedDigivolutionCard);
  858. addedDigivolutionCard.SetFace();
  859. addedCards.Add(addedDigivolutionCard);
  860. }
  861. }
  862. if (addedCards.Count >= 1 && !skipEffectAndActivateSkill)
  863. {
  864. if (ShowingPermanentCard != null)
  865. {
  866. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  867. }
  868. #region Effect of "when the number of evolution sources increases"
  869. #region Hashtable Setting
  870. Hashtable hashtable = new Hashtable()
  871. {
  872. {"Permanent", this},
  873. {"CardEffect", cardEffect},
  874. {"CardSources", addedCards},
  875. {"isFromSameDigimon", isFromSameDigimon},
  876. {"isFromDigimon", isFromDigimon},
  877. };
  878. #endregion
  879. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
  880. #endregion
  881. }
  882. }
  883. #endregion
  884. #region Add Link cards
  885. /// <summary>
  886. /// 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
  887. /// </summary>
  888. /// <param name="addedLinkCards"></param>
  889. /// <param name="cardEffect"></param>
  890. /// <param name="skipEffectAndActivateSkill"></param>
  891. /// <returns></returns>
  892. public IEnumerator AddLinkCard(CardSource addedLinkCard, ICardEffect cardEffect)
  893. {
  894. bool addedCard = false;
  895. bool isFromDigimon = false;
  896. if (CardEffectCommons.IsExistOnBattleArea(addedLinkCard))
  897. {
  898. if (addedLinkCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  899. {
  900. isFromDigimon = true;
  901. }
  902. }
  903. if (LinkedCards.Count >= LinkedMax)
  904. {
  905. if(LinkedMax > 1)
  906. yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(null,((LinkedCards.Count + 1) - LinkedMax)));
  907. else
  908. yield return ContinuousController.instance.StartCoroutine(RemoveLinkedCard(LinkedCards[0]));
  909. }
  910. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedLinkCard));
  911. if (!this.IsToken && !addedLinkCard.IsToken)
  912. {
  913. LinkedCards.Insert(0, addedLinkCard);
  914. LinkedDP += addedLinkCard.LinkDP;
  915. this.cardSources.Insert(1, addedLinkCard);
  916. addedLinkCard.SetFace();
  917. addedCard = true;
  918. }
  919. if (addedCard)
  920. {
  921. if (ShowingPermanentCard != null)
  922. {
  923. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  924. }
  925. #region Add Linked Card
  926. #region Hashtable Setting
  927. Hashtable hashtable = new Hashtable()
  928. {
  929. {"Permanent", this},
  930. {"CardEffect", cardEffect},
  931. {"Card", addedLinkCard},
  932. {"isFromDigimon", isFromDigimon},
  933. };
  934. #endregion
  935. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.WhenLinked));
  936. #endregion
  937. }
  938. }
  939. #endregion
  940. #region RemoveCardSource
  941. public IEnumerator RemoveCardSource(CardSource cardSource)
  942. {
  943. yield return null;
  944. cardSources.Remove(cardSource);
  945. }
  946. #endregion
  947. #region Remove Linked Card
  948. public IEnumerator RemoveLinkedCard(CardSource cardSource, int removeCount = 0)
  949. {
  950. Debug.Log($"REMOVE LINK CARD: {LinkedCards.Count} >= {LinkedCards.Contains(cardSource)}");
  951. if (LinkedCards.Contains(cardSource))
  952. {
  953. LinkedDP -= cardSource.LinkDP;
  954. yield return ContinuousController.instance.StartCoroutine(RemoveCardSource(cardSource));
  955. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  956. LinkedCards.Remove(cardSource);
  957. Debug.Log($"REMOVE LINK CARD: {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 ICanNotPutFieldEffect
  1561. && cardEffect.CanUse(null)
  1562. && ((ICanNotPutFieldEffect)cardEffect).CanNotPutField(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 ICanNotPutFieldEffect
  1572. && cardEffect.CanUse(null)
  1573. && ((ICanNotPutFieldEffect)cardEffect).CanNotPutField(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 ICanNotPutFieldEffect
  1583. && cardEffect.CanUse(null)
  1584. && ((ICanNotPutFieldEffect)cardEffect).CanNotPutField(TopCard, null)))
  1585. {
  1586. return false;
  1587. }
  1588. }
  1589. #endregion
  1590. if (!TopCard.Owner.GetBreedingAreaPermanents().Contains(this))
  1591. {
  1592. return false;
  1593. }
  1594. if (!IsDigimon)
  1595. return false;
  1596. if (TopCard.IsDigiEgg && DP <= 0)
  1597. return false;
  1598. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) == 0)
  1599. {
  1600. return false;
  1601. }
  1602. }
  1603. else
  1604. {
  1605. return false;
  1606. }
  1607. return true;
  1608. }
  1609. }
  1610. #endregion
  1611. #region このパーマネントが攻撃できるかどうか
  1612. public bool CanAttack(ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
  1613. {
  1614. // can not attack with empty cards
  1615. if (TopCard == null)
  1616. {
  1617. return false;
  1618. }
  1619. // can not attack during opponent's turn
  1620. if (TopCard.Owner != GManager.instance.turnStateMachine.gameContext.TurnPlayer)
  1621. {
  1622. return false;
  1623. }
  1624. //Can not attack during another attack
  1625. if (GManager.instance.attackProcess.IsAttacking)
  1626. return false;
  1627. // can not attack to player
  1628. if (!CanAttackTargetDigimon(null, cardEffect, withoutTap, isVortex))
  1629. {
  1630. // can not attack to opponent's Digimon
  1631. if (TopCard.Owner.Enemy.GetFieldPermanents().Count((permanent) => CanAttackTargetDigimon(permanent, cardEffect, withoutTap, isVortex)) == 0)
  1632. {
  1633. return false;
  1634. }
  1635. }
  1636. return true;
  1637. }
  1638. #endregion
  1639. #region このパーマネントが対象の攻撃パーマネントをブロックできるかどうか
  1640. public bool CanBlock(Permanent AttackingPermanent)
  1641. {
  1642. if (TopCard == null)
  1643. {
  1644. return false;
  1645. }
  1646. if (!IsDigimon)
  1647. {
  1648. return false;
  1649. }
  1650. if (IsSuspended)
  1651. {
  1652. return false;
  1653. }
  1654. if (!CanSuspend)
  1655. {
  1656. return false;
  1657. }
  1658. if (PermanentFrame != null)
  1659. {
  1660. if (!PermanentFrame.IsBattleAreaFrame())
  1661. {
  1662. return false;
  1663. }
  1664. }
  1665. if (!AttackingPermanent.IsDigimon)
  1666. return false;
  1667. if (!AttackingPermanent.CanSwitchAttackTarget)
  1668. return false;
  1669. #region "Unblockable" effect
  1670. #region Effects of permanents in play
  1671. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1672. {
  1673. foreach (Permanent permanent in player.GetFieldPermanents())
  1674. {
  1675. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1676. {
  1677. if (cardEffect is ICannotBlockEffect)
  1678. {
  1679. if (cardEffect.CanUse(null))
  1680. {
  1681. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1682. {
  1683. return false;
  1684. }
  1685. }
  1686. }
  1687. }
  1688. }
  1689. }
  1690. #endregion
  1691. #region player effect
  1692. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1693. {
  1694. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1695. {
  1696. if (cardEffect is ICannotBlockEffect)
  1697. {
  1698. if (cardEffect.CanUse(null))
  1699. {
  1700. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1701. {
  1702. if (!TopCard.CanNotBeAffected(cardEffect))
  1703. {
  1704. return false;
  1705. }
  1706. }
  1707. }
  1708. }
  1709. }
  1710. }
  1711. #endregion
  1712. #endregion
  1713. return true;
  1714. }
  1715. #endregion
  1716. #region 対象のパーマネントを攻撃できるか
  1717. public bool CanAttackTargetDigimon(Permanent Defender, ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
  1718. {
  1719. if (TopCard != null)
  1720. {
  1721. if (!IsDigimon)
  1722. {
  1723. return false;
  1724. }
  1725. if (!withoutTap)
  1726. {
  1727. if (IsSuspended)
  1728. {
  1729. return false;
  1730. }
  1731. if (!CanSuspend)
  1732. {
  1733. return false;
  1734. }
  1735. }
  1736. if (PermanentFrame != null)
  1737. {
  1738. if (!PermanentFrame.IsBattleAreaFrame())
  1739. {
  1740. return false;
  1741. }
  1742. }
  1743. if (EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  1744. {
  1745. if (!HasRush && !isVortex)
  1746. {
  1747. return false;
  1748. }
  1749. }
  1750. #region 「対象の防御パーマネントを攻撃できない」効果
  1751. #region 場のパーマネントの効果
  1752. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1753. {
  1754. foreach (Permanent permanent in player.GetFieldPermanents())
  1755. {
  1756. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1757. {
  1758. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1759. {
  1760. if (cardEffect1.CanUse(null))
  1761. {
  1762. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1763. {
  1764. if (!TopCard.CanNotBeAffected(cardEffect1))
  1765. {
  1766. return false;
  1767. }
  1768. }
  1769. }
  1770. }
  1771. }
  1772. }
  1773. }
  1774. #endregion
  1775. #region プレイヤーの効果
  1776. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1777. {
  1778. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1779. {
  1780. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1781. {
  1782. if (cardEffect1.CanUse(null))
  1783. {
  1784. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1785. {
  1786. if (!TopCard.CanNotBeAffected(cardEffect1))
  1787. {
  1788. return false;
  1789. }
  1790. }
  1791. }
  1792. }
  1793. }
  1794. }
  1795. #endregion
  1796. #endregion
  1797. if (Defender != null)
  1798. {
  1799. if (Defender.TopCard != null)
  1800. {
  1801. if (Defender.TopCard.Owner == TopCard.Owner.Enemy)
  1802. {
  1803. if (Defender.IsDigimon && Defender.TopCard.Owner.GetBattleAreaPermanents().Contains(Defender))
  1804. {
  1805. if (Defender.IsSuspended)
  1806. {
  1807. return true;
  1808. }
  1809. #region 「対象の防御パーマネントを攻撃できる」効果
  1810. #region 場のパーマネントの効果
  1811. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1812. {
  1813. foreach (Permanent permanent in player.GetFieldPermanents())
  1814. {
  1815. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1816. {
  1817. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1818. {
  1819. if (cardEffect1.CanUse(null))
  1820. {
  1821. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1822. {
  1823. return true;
  1824. }
  1825. }
  1826. }
  1827. }
  1828. }
  1829. }
  1830. #endregion
  1831. #region プレイヤーの効果
  1832. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1833. {
  1834. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1835. {
  1836. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1837. {
  1838. if (cardEffect1.CanUse(null))
  1839. {
  1840. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1841. {
  1842. return true;
  1843. }
  1844. }
  1845. }
  1846. }
  1847. }
  1848. #endregion
  1849. #endregion
  1850. }
  1851. }
  1852. }
  1853. }
  1854. else
  1855. {
  1856. return true;
  1857. }
  1858. }
  1859. return false;
  1860. }
  1861. #endregion
  1862. #region Is Unblockable
  1863. public bool IsUnblockable
  1864. {
  1865. get
  1866. {
  1867. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.None))
  1868. {
  1869. if (cardEffect is CannotBlockClass)
  1870. {
  1871. if (cardEffect.EffectName == "Can't Block")
  1872. {
  1873. return true;
  1874. }
  1875. }
  1876. }
  1877. return false;
  1878. }
  1879. }
  1880. #endregion
  1881. #region Has Blocker
  1882. public bool HasBlocker
  1883. {
  1884. get
  1885. {
  1886. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1887. {
  1888. #region Effects of permanents in play
  1889. foreach (Permanent permanent in player.GetFieldPermanents())
  1890. {
  1891. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1892. {
  1893. if (cardEffect is IBlockerEffect)
  1894. {
  1895. if (cardEffect.CanTrigger(null))
  1896. {
  1897. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1898. {
  1899. return true;
  1900. }
  1901. }
  1902. }
  1903. }
  1904. }
  1905. #endregion
  1906. #region Effects of faceup security
  1907. foreach (CardSource source in player.SecurityCards)
  1908. {
  1909. if (source.IsFlipped)
  1910. continue;
  1911. foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.None))
  1912. {
  1913. if (cardEffect is IBlockerEffect)
  1914. {
  1915. if (cardEffect.CanTrigger(null))
  1916. {
  1917. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1918. {
  1919. return true;
  1920. }
  1921. }
  1922. }
  1923. }
  1924. }
  1925. #endregion
  1926. #region プレイヤーの効果
  1927. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1928. {
  1929. if (cardEffect is IBlockerEffect)
  1930. {
  1931. if (cardEffect.CanTrigger(null))
  1932. {
  1933. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1934. {
  1935. return true;
  1936. }
  1937. }
  1938. }
  1939. }
  1940. #endregion
  1941. }
  1942. return false;
  1943. }
  1944. }
  1945. #endregion
  1946. #region Has Jamming
  1947. public bool HasJamming
  1948. {
  1949. get
  1950. {
  1951. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1952. {
  1953. foreach (Permanent permanent in player.GetFieldPermanents())
  1954. {
  1955. #region 場のパーマネントの効果
  1956. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1957. {
  1958. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1959. {
  1960. if (cardEffect.CanTrigger(null))
  1961. {
  1962. if (cardEffect.EffectName == "Jamming")
  1963. {
  1964. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1965. {
  1966. return true;
  1967. }
  1968. }
  1969. }
  1970. }
  1971. }
  1972. #endregion
  1973. }
  1974. #region プレイヤーの効果
  1975. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1976. {
  1977. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1978. {
  1979. if (cardEffect.CanTrigger(null))
  1980. {
  1981. if (cardEffect.EffectName == "Jamming")
  1982. {
  1983. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1984. {
  1985. return true;
  1986. }
  1987. }
  1988. }
  1989. }
  1990. }
  1991. #endregion
  1992. }
  1993. return false;
  1994. }
  1995. }
  1996. #endregion
  1997. #region Has Ice Clad
  1998. public bool HasIceclad
  1999. {
  2000. get
  2001. {
  2002. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2003. {
  2004. #region Ice clad permanent effects
  2005. foreach (ICardEffect cardEffect in EffectList(EffectTiming.None))
  2006. {
  2007. if (cardEffect is IIcecladEffect)
  2008. {
  2009. if (cardEffect.CanTrigger(null))
  2010. {
  2011. if (((IIcecladEffect)cardEffect).HasIceclad(this))
  2012. {
  2013. return true;
  2014. }
  2015. }
  2016. }
  2017. }
  2018. #endregion
  2019. #region Ice clad Player Effects
  2020. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2021. {
  2022. if (cardEffect is IIcecladEffect)
  2023. {
  2024. if (cardEffect.CanTrigger(null))
  2025. {
  2026. if (((IIcecladEffect)cardEffect).HasIceclad(this))
  2027. {
  2028. return true;
  2029. }
  2030. }
  2031. }
  2032. }
  2033. #endregion
  2034. }
  2035. return false;
  2036. }
  2037. }
  2038. #endregion
  2039. #region Whether this permanent has Pierce
  2040. public bool HasPierce
  2041. {
  2042. get
  2043. {
  2044. if (IsDigimon)
  2045. {
  2046. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDetermineDoSecurityCheck))
  2047. {
  2048. if (cardEffect is ActivateICardEffect)
  2049. {
  2050. if (cardEffect.CanTrigger(CardEffectCommons.PierceCheckHashtableOfPermanent(this)))
  2051. {
  2052. if (cardEffect.EffectName == "Pierce")
  2053. {
  2054. return true;
  2055. }
  2056. if (cardEffect.EffectName == "Piercing")
  2057. {
  2058. return true;
  2059. }
  2060. }
  2061. }
  2062. }
  2063. }
  2064. return false;
  2065. }
  2066. }
  2067. #endregion
  2068. #region Has Reboot
  2069. public bool HasReboot
  2070. {
  2071. get
  2072. {
  2073. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2074. {
  2075. foreach (Permanent permanent in player.GetFieldPermanents())
  2076. {
  2077. #region 場のパーマネントの効果
  2078. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2079. {
  2080. if (cardEffect is IRebootEffect)
  2081. {
  2082. if (cardEffect.CanTrigger(null))
  2083. {
  2084. if (((IRebootEffect)cardEffect).HasReboot(this))
  2085. {
  2086. return true;
  2087. }
  2088. }
  2089. }
  2090. }
  2091. #endregion
  2092. }
  2093. #region プレイヤーの効果
  2094. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2095. {
  2096. if (cardEffect is IRebootEffect)
  2097. {
  2098. if (cardEffect.CanTrigger(null))
  2099. {
  2100. if (((IRebootEffect)cardEffect).HasReboot(this))
  2101. {
  2102. return true;
  2103. }
  2104. }
  2105. }
  2106. }
  2107. #endregion
  2108. }
  2109. return false;
  2110. }
  2111. }
  2112. #endregion
  2113. #region Has Raid
  2114. public bool HasRaid
  2115. {
  2116. get
  2117. {
  2118. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  2119. {
  2120. if (cardEffect is ActivateICardEffect)
  2121. {
  2122. if (cardEffect.EffectName == "Raid")
  2123. {
  2124. return true;
  2125. }
  2126. }
  2127. }
  2128. return false;
  2129. }
  2130. }
  2131. #endregion
  2132. #region Has Rush
  2133. public bool HasRush
  2134. {
  2135. get
  2136. {
  2137. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2138. {
  2139. foreach (Permanent permanent in player.GetFieldPermanents())
  2140. {
  2141. #region 場のパーマネントの効果
  2142. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2143. {
  2144. if (cardEffect is IRushEffect)
  2145. {
  2146. if (cardEffect.CanTrigger(null))
  2147. {
  2148. if (((IRushEffect)cardEffect).HasRush(this))
  2149. {
  2150. return true;
  2151. }
  2152. }
  2153. }
  2154. }
  2155. #endregion
  2156. }
  2157. #region プレイヤーの効果
  2158. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2159. {
  2160. if (cardEffect is IRushEffect)
  2161. {
  2162. if (cardEffect.CanTrigger(null))
  2163. {
  2164. if (((IRushEffect)cardEffect).HasRush(this))
  2165. {
  2166. return true;
  2167. }
  2168. }
  2169. }
  2170. }
  2171. #endregion
  2172. }
  2173. return false;
  2174. }
  2175. }
  2176. #endregion
  2177. #region Has Retaliation
  2178. public bool HasRetaliation
  2179. {
  2180. get
  2181. {
  2182. if (RetaliationCount >= 1)
  2183. {
  2184. return true;
  2185. }
  2186. return false;
  2187. }
  2188. }
  2189. #endregion
  2190. #region Retaliation Count
  2191. public int RetaliationCount
  2192. {
  2193. get
  2194. {
  2195. int count = 0;
  2196. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2197. {
  2198. if (cardEffect is ActivateICardEffect)
  2199. {
  2200. if (cardEffect.EffectName == "Retaliation")
  2201. {
  2202. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2203. {
  2204. count++;
  2205. }
  2206. }
  2207. }
  2208. }
  2209. return count;
  2210. }
  2211. }
  2212. #endregion
  2213. #region Has Fortitude
  2214. public bool HasFortitude
  2215. {
  2216. get
  2217. {
  2218. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2219. {
  2220. if (cardEffect is ActivateICardEffect)
  2221. {
  2222. if (cardEffect.EffectName == "Fortitude")
  2223. {
  2224. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2225. {
  2226. return true;
  2227. }
  2228. }
  2229. }
  2230. }
  2231. return false;
  2232. }
  2233. }
  2234. #endregion
  2235. #region Has Blitz
  2236. public bool HasBlitz
  2237. {
  2238. get
  2239. {
  2240. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnEnterFieldAnyone))
  2241. {
  2242. if (cardEffect is ActivateICardEffect)
  2243. {
  2244. if (cardEffect.CanTrigger(CardEffectCommons.WhenDigivolutionCheckHashtableOfPermanent(this)) || cardEffect.CanTrigger(CardEffectCommons.OnPlayCheckHashtableOfPermanent(this)))
  2245. {
  2246. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  2247. {
  2248. if (cardEffect.EffectDiscription.Contains("Blitz"))
  2249. {
  2250. return true;
  2251. }
  2252. }
  2253. }
  2254. }
  2255. }
  2256. return false;
  2257. }
  2258. }
  2259. #endregion
  2260. #region Has Evade
  2261. public bool HasEvade
  2262. {
  2263. get
  2264. {
  2265. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2266. {
  2267. if (cardEffect is ActivateICardEffect)
  2268. {
  2269. Hashtable hashtable = new Hashtable()
  2270. {
  2271. {"Permanents", new List<Permanent>() { this }}
  2272. };
  2273. if (cardEffect.CanTrigger(hashtable))
  2274. {
  2275. if (cardEffect.EffectName == "Evade")
  2276. {
  2277. return true;
  2278. }
  2279. }
  2280. }
  2281. }
  2282. return false;
  2283. }
  2284. }
  2285. #endregion
  2286. #region Has Mind Link
  2287. public bool HasMindLink
  2288. {
  2289. get
  2290. {
  2291. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDeclaration))
  2292. {
  2293. if (cardEffect is ActivateICardEffect)
  2294. {
  2295. if (cardEffect.CanTrigger(null))
  2296. {
  2297. if (!String.IsNullOrEmpty(cardEffect.EffectDiscription))
  2298. {
  2299. if (cardEffect.EffectDiscription.Contains("Mind Link"))
  2300. {
  2301. return true;
  2302. }
  2303. }
  2304. }
  2305. }
  2306. }
  2307. return false;
  2308. }
  2309. }
  2310. #endregion
  2311. #region Has Barrier
  2312. public bool HasBarrier
  2313. {
  2314. get
  2315. {
  2316. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2317. {
  2318. if (cardEffect is ActivateICardEffect)
  2319. {
  2320. Hashtable hashtable = new Hashtable();
  2321. hashtable.Add("Permanents", new List<Permanent>() { this });
  2322. hashtable.Add("battle", new IBattle(null, null, null));
  2323. if (cardEffect.CanTrigger(hashtable))
  2324. {
  2325. if (cardEffect.EffectName == "Barrier")
  2326. {
  2327. return true;
  2328. }
  2329. }
  2330. }
  2331. }
  2332. return false;
  2333. }
  2334. }
  2335. #endregion
  2336. #region Has Alliance
  2337. public bool HasAlliance
  2338. {
  2339. get
  2340. {
  2341. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2342. {
  2343. foreach (Permanent permanent in player.GetFieldPermanents())
  2344. {
  2345. #region Permanent Effects
  2346. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.OnAllyAttack))
  2347. {
  2348. if (cardEffect is IAllianceEffect)
  2349. {
  2350. if (cardEffect.CanTrigger(null))
  2351. {
  2352. if (((IAllianceEffect)cardEffect).HasAlliance(this))
  2353. {
  2354. return true;
  2355. }
  2356. }
  2357. }
  2358. }
  2359. #endregion
  2360. }
  2361. #region Effects of faceup security
  2362. foreach (CardSource source in player.SecurityCards)
  2363. {
  2364. if (source.IsFlipped)
  2365. continue;
  2366. foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.OnAllyAttack))
  2367. {
  2368. if (cardEffect is IAllianceEffect)
  2369. {
  2370. if (cardEffect.CanTrigger(null))
  2371. {
  2372. if (((IAllianceEffect)cardEffect).HasAlliance(this))
  2373. {
  2374. return true;
  2375. }
  2376. }
  2377. }
  2378. }
  2379. }
  2380. #endregion
  2381. #region Player Effects
  2382. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.OnAllyAttack))
  2383. {
  2384. if (cardEffect is IAllianceEffect)
  2385. {
  2386. if (cardEffect.CanTrigger(null))
  2387. {
  2388. if (((IAllianceEffect)cardEffect).HasAlliance(this))
  2389. {
  2390. return true;
  2391. }
  2392. }
  2393. }
  2394. }
  2395. #endregion
  2396. }
  2397. return false;
  2398. }
  2399. }
  2400. #endregion
  2401. #region Has Collision
  2402. public bool HasCollision
  2403. {
  2404. get
  2405. {
  2406. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  2407. {
  2408. if (cardEffect is ActivateICardEffect)
  2409. {
  2410. if (cardEffect.EffectName == "Collision")
  2411. {
  2412. return true;
  2413. }
  2414. }
  2415. }
  2416. return false;
  2417. }
  2418. }
  2419. #endregion
  2420. #region Has Partition
  2421. public bool HasPartition
  2422. {
  2423. get
  2424. {
  2425. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2426. {
  2427. if (cardEffect is ActivateICardEffect)
  2428. {
  2429. if (cardEffect.EffectName == "Partition")
  2430. {
  2431. return true;
  2432. }
  2433. }
  2434. }
  2435. return false;
  2436. }
  2437. }
  2438. #endregion
  2439. #region 消滅時効化を持つか
  2440. public bool HasOnDeletionEffect
  2441. {
  2442. get
  2443. {
  2444. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2445. {
  2446. if (cardEffect is ActivateICardEffect)
  2447. {
  2448. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2449. {
  2450. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  2451. {
  2452. if (cardEffect.IsOnDeletion)
  2453. {
  2454. return true;
  2455. }
  2456. }
  2457. }
  2458. }
  2459. }
  2460. return false;
  2461. }
  2462. }
  2463. #endregion
  2464. #region バトルしているか
  2465. public IBattle battle { get; set; } = null;
  2466. #endregion
  2467. #region Can Be Destroyed
  2468. public bool CanBeDestroyed()
  2469. {
  2470. #region 消滅しない効果
  2471. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2472. {
  2473. foreach (Permanent permanent in player.GetFieldPermanents())
  2474. {
  2475. #region 場のパーマネントの効果
  2476. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2477. {
  2478. if (cardEffect is ICanNotBeDestroyedEffect)
  2479. {
  2480. if (cardEffect.CanUse(null))
  2481. {
  2482. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2483. {
  2484. return false;
  2485. }
  2486. }
  2487. }
  2488. }
  2489. #endregion
  2490. }
  2491. #region プレイヤーの効果
  2492. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2493. {
  2494. if (cardEffect is ICanNotBeDestroyedEffect)
  2495. {
  2496. if (cardEffect.CanUse(null))
  2497. {
  2498. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2499. {
  2500. return false;
  2501. }
  2502. }
  2503. }
  2504. }
  2505. #endregion
  2506. }
  2507. #endregion
  2508. return true;
  2509. }
  2510. #endregion
  2511. #region Can Be Destroyed By Battle
  2512. public bool CanBeDestroyedByBattle(Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  2513. {
  2514. if (!CanBeDestroyed())
  2515. {
  2516. return false;
  2517. }
  2518. #region Given Effects
  2519. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2520. {
  2521. foreach (Permanent permanent in player.GetFieldPermanents())
  2522. {
  2523. #region Permanents
  2524. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2525. {
  2526. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2527. {
  2528. if (cardEffect.CanUse(null))
  2529. {
  2530. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2531. {
  2532. return false;
  2533. }
  2534. }
  2535. }
  2536. }
  2537. #endregion
  2538. }
  2539. #region Effects of faceup security
  2540. foreach (CardSource source in player.SecurityCards)
  2541. {
  2542. if (source.IsFlipped)
  2543. continue;
  2544. foreach (ICardEffect cardEffect in source.EffectList(EffectTiming.None))
  2545. {
  2546. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2547. {
  2548. if (cardEffect.CanUse(null))
  2549. {
  2550. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2551. {
  2552. return false;
  2553. }
  2554. }
  2555. }
  2556. }
  2557. }
  2558. #endregion
  2559. #region Player Effects
  2560. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2561. {
  2562. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2563. {
  2564. if (cardEffect.CanUse(null))
  2565. {
  2566. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2567. {
  2568. return false;
  2569. }
  2570. }
  2571. }
  2572. }
  2573. #endregion
  2574. }
  2575. #endregion
  2576. return true;
  2577. }
  2578. #endregion
  2579. #region このパーマネントが効果で消滅するか
  2580. public bool CanBeDestroyedBySkill(ICardEffect cardEffect)
  2581. {
  2582. if (this.TopCard != null)
  2583. {
  2584. if (this.TopCard.CanNotBeAffected(cardEffect))
  2585. {
  2586. return false;
  2587. }
  2588. if (!CanBeDestroyed())
  2589. {
  2590. return false;
  2591. }
  2592. #region 効果で消滅しない効果
  2593. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2594. {
  2595. foreach (Permanent permanent in player.GetFieldPermanents())
  2596. {
  2597. #region 場のパーマネントの効果
  2598. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  2599. {
  2600. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2601. {
  2602. if (cardEffect1.CanUse(null))
  2603. {
  2604. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2605. {
  2606. return false;
  2607. }
  2608. }
  2609. }
  2610. }
  2611. #endregion
  2612. }
  2613. #region プレイヤーの効果
  2614. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  2615. {
  2616. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2617. {
  2618. if (cardEffect1.CanUse(null))
  2619. {
  2620. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2621. {
  2622. return false;
  2623. }
  2624. }
  2625. }
  2626. }
  2627. #endregion
  2628. }
  2629. #endregion
  2630. }
  2631. return true;
  2632. }
  2633. #endregion
  2634. #region Can Leave Field
  2635. public bool CanBeRemoved()
  2636. {
  2637. #region Effect that never disappears
  2638. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2639. {
  2640. foreach (Permanent permanent in player.GetFieldPermanents())
  2641. {
  2642. #region Effects of permanents in play
  2643. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2644. {
  2645. if (cardEffect is ICanNotBeRemovedEffect)
  2646. {
  2647. if (cardEffect.CanUse(null))
  2648. {
  2649. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2650. {
  2651. return false;
  2652. }
  2653. }
  2654. }
  2655. }
  2656. #endregion
  2657. }
  2658. #region player effect
  2659. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2660. {
  2661. if (cardEffect is ICanNotBeRemovedEffect)
  2662. {
  2663. if (cardEffect.CanUse(null))
  2664. {
  2665. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2666. {
  2667. return false;
  2668. }
  2669. }
  2670. }
  2671. }
  2672. #endregion
  2673. }
  2674. #endregion
  2675. return true;
  2676. }
  2677. #endregion
  2678. #region トークンかどうか
  2679. public bool IsToken
  2680. {
  2681. get
  2682. {
  2683. if (TopCard != null)
  2684. {
  2685. if (TopCard.IsToken)
  2686. {
  2687. return true;
  2688. }
  2689. }
  2690. return false;
  2691. }
  2692. }
  2693. #endregion
  2694. #region そのパーマネントが消滅・バウンス待機状態か
  2695. public bool willBeRemoveField { get; set; } = false;
  2696. #endregion
  2697. #region Is a Digimon card
  2698. public bool IsDigimon
  2699. {
  2700. get
  2701. {
  2702. if (TopCard != null)
  2703. {
  2704. if (TopCard.IsDigimon || TopCard.IsDigiEgg)
  2705. {
  2706. return true;
  2707. }
  2708. #region Effect of treating it as a Digimon
  2709. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2710. {
  2711. foreach (Permanent permanent in player.GetFieldPermanents())
  2712. {
  2713. #region Effects of permanents in play
  2714. foreach (ICardEffect cardEffect in permanent.EffectList_Added(EffectTiming.None))
  2715. {
  2716. if (cardEffect is ITreatAsDigimonEffect)
  2717. {
  2718. if (cardEffect.CanTrigger(null))
  2719. {
  2720. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2721. {
  2722. return true;
  2723. }
  2724. }
  2725. }
  2726. }
  2727. #endregion
  2728. }
  2729. #region player effect
  2730. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2731. {
  2732. if (cardEffect is ITreatAsDigimonEffect)
  2733. {
  2734. if (cardEffect.CanTrigger(null))
  2735. {
  2736. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2737. {
  2738. return true;
  2739. }
  2740. }
  2741. }
  2742. }
  2743. #endregion
  2744. }
  2745. #endregion
  2746. }
  2747. return false;
  2748. }
  2749. }
  2750. #endregion
  2751. #region Is a Tamer card
  2752. public bool IsTamer
  2753. {
  2754. get
  2755. {
  2756. if (TopCard != null)
  2757. {
  2758. if (TopCard.IsTamer)
  2759. {
  2760. return true;
  2761. }
  2762. }
  2763. return false;
  2764. }
  2765. }
  2766. #endregion
  2767. #region Is an Option card
  2768. public bool IsOption
  2769. {
  2770. get
  2771. {
  2772. if (TopCard != null)
  2773. {
  2774. if (TopCard.IsOption)
  2775. {
  2776. return true;
  2777. }
  2778. }
  2779. return false;
  2780. }
  2781. }
  2782. #endregion
  2783. #region Levels handled by Jogress
  2784. public List<int> Levels_ForJogress(CardSource cardSource)
  2785. {
  2786. List<int> levels = new List<int>();
  2787. if (cardSource != null)
  2788. {
  2789. if (cardSource.HasLevel)
  2790. {
  2791. levels.Add(this.Level);
  2792. }
  2793. #region Effect of "adding levels handled by jogless evolution"
  2794. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2795. {
  2796. foreach (Permanent permanent in player.GetFieldPermanents())
  2797. {
  2798. #region Effects of permanents in play
  2799. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2800. {
  2801. if (cardEffect is IAddJogressLevelsEffect)
  2802. {
  2803. if (cardEffect.CanUse(null))
  2804. {
  2805. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2806. {
  2807. levels.Add(level);
  2808. }
  2809. }
  2810. }
  2811. }
  2812. #endregion
  2813. }
  2814. #region player effect
  2815. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2816. {
  2817. if (cardEffect is IAddJogressLevelsEffect)
  2818. {
  2819. if (cardEffect.CanUse(null))
  2820. {
  2821. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2822. {
  2823. levels.Add(level);
  2824. }
  2825. }
  2826. }
  2827. }
  2828. #endregion
  2829. }
  2830. #endregion
  2831. }
  2832. return levels;
  2833. }
  2834. #endregion
  2835. #region Names handled by Jogress
  2836. public List<string> Names_ForDNA(CardSource cardSource)
  2837. {
  2838. List<string> names = new List<string>();
  2839. if (cardSource != null)
  2840. {
  2841. foreach(string name in cardSource.CardNames)
  2842. names.Add(name);
  2843. #region Effect of "adding names handled by DNA evolution"
  2844. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2845. {
  2846. foreach (Permanent permanent in player.GetFieldPermanents())
  2847. {
  2848. #region Effects of permanents in play
  2849. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2850. {
  2851. if (cardEffect is IAddDNANamesEffect)
  2852. {
  2853. if (cardEffect.CanUse(null))
  2854. {
  2855. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2856. {
  2857. names.Add(name);
  2858. }
  2859. }
  2860. }
  2861. }
  2862. #endregion
  2863. }
  2864. #region player effect
  2865. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2866. {
  2867. if (cardEffect is IAddDNANamesEffect)
  2868. {
  2869. if (cardEffect.CanUse(null))
  2870. {
  2871. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2872. {
  2873. names.Add(name);
  2874. }
  2875. }
  2876. }
  2877. }
  2878. #endregion
  2879. }
  2880. #endregion
  2881. }
  2882. return names;
  2883. }
  2884. #endregion
  2885. #region バトルで消滅したか
  2886. public bool IsDestroyedByBattle { get; set; } = false;
  2887. #endregion
  2888. #region 消滅に使用された効果
  2889. public ICardEffect DestroyingEffect { get; set; } = null;
  2890. #endregion
  2891. #region 他のパーマネントの下に置くのに使用された効果
  2892. public ICardEffect PlaceOtherPermanentEffect { get; set; } = null;
  2893. #endregion
  2894. #region 手札バウンス に使用された効果
  2895. public ICardEffect HandBounceEffect { get; set; } = null;
  2896. #endregion
  2897. #region 山札バウンス に使用された効果
  2898. public ICardEffect LibraryBounceEffect { get; set; } = null;
  2899. #endregion
  2900. #region 登場に使用された効果
  2901. public ICardEffect PlayingEffect { get; set; } = null;
  2902. #endregion
  2903. #region 進化に使用された効果
  2904. public ICardEffect DigivolvingEffect { get; set; } = null;
  2905. #endregion
  2906. #region Whether this digimon is placed in the trash by not having a DP
  2907. public bool IsPlaceToTrashDueToNotHavingDP { get; set; } = true;
  2908. #endregion
  2909. #region Whether this permanent can suspend
  2910. public bool CanSuspend
  2911. {
  2912. get
  2913. {
  2914. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  2915. {
  2916. #region Effects of field permanents
  2917. foreach (Permanent permanent in player.GetFieldPermanents())
  2918. {
  2919. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2920. {
  2921. if (cardEffect is ICanNotSuspendEffect)
  2922. {
  2923. if (cardEffect.CanUse(null))
  2924. {
  2925. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2926. {
  2927. return false;
  2928. }
  2929. }
  2930. }
  2931. }
  2932. }
  2933. #endregion
  2934. #region Effects of players
  2935. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2936. {
  2937. if (cardEffect is ICanNotSuspendEffect)
  2938. {
  2939. if (cardEffect.CanUse(null))
  2940. {
  2941. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2942. {
  2943. return false;
  2944. }
  2945. }
  2946. }
  2947. }
  2948. #endregion
  2949. }
  2950. return true;
  2951. }
  2952. }
  2953. #endregion
  2954. #region このデジモンのアタックの対象が変更できるか
  2955. public bool CanSwitchAttackTarget
  2956. {
  2957. get
  2958. {
  2959. #region アタックの対象が変更できない効果
  2960. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2961. {
  2962. foreach (Permanent permanent in player.GetFieldPermanents())
  2963. {
  2964. #region 場のパーマネントの効果
  2965. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2966. {
  2967. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2968. {
  2969. if (cardEffect.CanUse(null))
  2970. {
  2971. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2972. {
  2973. return false;
  2974. }
  2975. }
  2976. }
  2977. }
  2978. #endregion
  2979. }
  2980. #region プレイヤーの効果
  2981. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2982. {
  2983. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2984. {
  2985. if (cardEffect.CanUse(null))
  2986. {
  2987. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2988. {
  2989. return false;
  2990. }
  2991. }
  2992. }
  2993. }
  2994. #endregion
  2995. }
  2996. #endregion
  2997. return true;
  2998. }
  2999. }
  3000. #endregion
  3001. #region このデジモンを場からデジクロス条件の代わりにできるか
  3002. public bool CanSubstituteForDigiXrosCondition(CardSource cardSource)
  3003. {
  3004. #region デジクロス条件の代わりにできる効果
  3005. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  3006. {
  3007. foreach (Permanent permanent in player.GetFieldPermanents())
  3008. {
  3009. #region 場のパーマネントの効果
  3010. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  3011. {
  3012. if (cardEffect is ICanSelectDigiXrosEffect)
  3013. {
  3014. if (cardEffect.CanUse(null))
  3015. {
  3016. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  3017. {
  3018. return true;
  3019. }
  3020. }
  3021. }
  3022. }
  3023. #endregion
  3024. }
  3025. #region プレイヤーの効果
  3026. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  3027. {
  3028. if (cardEffect is ICanSelectDigiXrosEffect)
  3029. {
  3030. if (cardEffect.CanUse(null))
  3031. {
  3032. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  3033. {
  3034. return true;
  3035. }
  3036. }
  3037. }
  3038. }
  3039. #endregion
  3040. }
  3041. #endregion
  3042. return false;
  3043. }
  3044. #endregion
  3045. #region 登場した直後のLevel
  3046. public int LevelJustAfterPlayed { get; set; } = -1;
  3047. #endregion
  3048. #region 登場した直後のPlay Cost
  3049. public int PlayCostJustAfterPlayed { get; set; } = -1;
  3050. #endregion
  3051. #region 登場した直後のCardNames
  3052. public List<string> CardNamesJustAfterPlayed { get; set; } = new List<string>();
  3053. #endregion
  3054. #region 進化した直後のCardNames
  3055. public List<string> CardNamesJustAfterDigivolved { get; set; } = new List<string>();
  3056. #endregion
  3057. #region 登場した直後のTraits
  3058. public List<string> TraitsJustAfterPlayed { get; set; } = new List<string>();
  3059. #endregion
  3060. #region 場を離れる直前のDP
  3061. public int DPJustBeforeRemoveField { get; set; } = -1;
  3062. #endregion
  3063. #region 場を離れる直前のLevel
  3064. public int LevelJustBeforeRemoveField { get; set; } = -1;
  3065. #endregion
  3066. #region 場を離れる直前のCost
  3067. public int CostJustBeforeRemoveField { get; set; } = -1;
  3068. #endregion
  3069. #region 場を離れる直前のカード名
  3070. public List<string> CardNamesJustBeforeRemoveField { get; set; } = new List<string>();
  3071. #endregion
  3072. #region Card Traits Just Before Removed Field
  3073. public List<string> CardTraitsJustBeforeRemoveField { get; set; } = new List<string>();
  3074. #endregion
  3075. #region バースト進化で手札に戻ったか
  3076. public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
  3077. #endregion
  3078. #region Is Linked Card Added as Source By App Fusion
  3079. public bool IsAddedAsSourceByAppFusion { get; set; } = false;
  3080. #endregion
  3081. #region バースト進化したか
  3082. public bool IsBurstDigivolved { get; set; } = false;
  3083. #endregion
  3084. #region Did it App Fusion?
  3085. public bool IsAppFusion { get; set; } = false;
  3086. #endregion
  3087. #region 効果で場に出たオプションか
  3088. public bool IsPlayedOptionPermanent { get; set; } = false;
  3089. #endregion
  3090. #region 進化元を持たないか
  3091. public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
  3092. #endregion
  3093. #region Has No Link Cards
  3094. public bool HasNoLinkCards => LinkedCards.Count == 0;
  3095. #endregion
  3096. #region Digivolution cards' colors
  3097. public List<CardColor> DigivolutionCardsColors
  3098. {
  3099. get
  3100. {
  3101. List<CardColor> cardColors = new List<CardColor>();
  3102. foreach (CardSource cardSource in DigivolutionCards)
  3103. {
  3104. foreach (CardColor cardColor in cardSource.CardColors)
  3105. {
  3106. if (!cardColors.Contains(cardColor))
  3107. {
  3108. cardColors.Add(cardColor);
  3109. }
  3110. }
  3111. }
  3112. return cardColors.Distinct().ToList();
  3113. }
  3114. }
  3115. #endregion
  3116. #region Show "Unsuspend" effect object
  3117. public void ShowUnsuspendEffect()
  3118. {
  3119. if (TopCard != null)
  3120. {
  3121. if (ShowingPermanentCard != null)
  3122. {
  3123. if (ShowingPermanentCard.WillUntapObject != null)
  3124. {
  3125. ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
  3126. ShowingPermanentCard.WillUntapObject.SetActive(true);
  3127. }
  3128. }
  3129. }
  3130. }
  3131. #endregion
  3132. #region Show "Return to deck" effect object
  3133. public void ShowDeckBounceEffect()
  3134. {
  3135. if (TopCard != null)
  3136. {
  3137. if (willBeRemoveField)
  3138. {
  3139. if (ShowingPermanentCard != null)
  3140. {
  3141. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  3142. {
  3143. ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
  3144. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
  3145. }
  3146. }
  3147. }
  3148. }
  3149. }
  3150. #endregion
  3151. #region Hide "Return to deck" effect object
  3152. public void HideDeckBounceEffect()
  3153. {
  3154. if (TopCard != null)
  3155. {
  3156. if (ShowingPermanentCard != null)
  3157. {
  3158. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  3159. {
  3160. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
  3161. }
  3162. }
  3163. }
  3164. }
  3165. #endregion
  3166. #region Show "Return to hand" effect object
  3167. public void ShowHandBounceEffect()
  3168. {
  3169. if (TopCard != null)
  3170. {
  3171. if (willBeRemoveField)
  3172. {
  3173. if (ShowingPermanentCard != null)
  3174. {
  3175. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  3176. {
  3177. ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
  3178. ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
  3179. }
  3180. }
  3181. }
  3182. }
  3183. }
  3184. #endregion
  3185. #region Hide "Return to hand" effect object
  3186. public void HideHandBounceEffect()
  3187. {
  3188. if (TopCard != null)
  3189. {
  3190. if (ShowingPermanentCard != null)
  3191. {
  3192. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  3193. {
  3194. ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
  3195. }
  3196. }
  3197. }
  3198. }
  3199. #endregion
  3200. #region Show "Delete" effect object
  3201. public void ShowDeleteEffect()
  3202. {
  3203. if (TopCard != null)
  3204. {
  3205. if (willBeRemoveField)
  3206. {
  3207. if (ShowingPermanentCard != null)
  3208. {
  3209. if (ShowingPermanentCard.WillBeDeletedObject != null)
  3210. {
  3211. ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
  3212. ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
  3213. }
  3214. }
  3215. }
  3216. }
  3217. }
  3218. #endregion
  3219. #region Hide "Delete" effect object
  3220. public void HideDeleteEffect()
  3221. {
  3222. if (TopCard != null)
  3223. {
  3224. if (ShowingPermanentCard != null)
  3225. {
  3226. if (ShowingPermanentCard.WillBeDeletedObject != null)
  3227. {
  3228. ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  3229. }
  3230. }
  3231. }
  3232. }
  3233. #endregion
  3234. #region Show "Remove Field" effect object
  3235. public void ShowWillRemoveFieldEffect()
  3236. {
  3237. if (TopCard != null)
  3238. {
  3239. if (willBeRemoveField)
  3240. {
  3241. if (ShowingPermanentCard != null)
  3242. {
  3243. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  3244. {
  3245. ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
  3246. ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
  3247. }
  3248. }
  3249. }
  3250. }
  3251. }
  3252. #endregion
  3253. #region Hide "Remove Field" effect object
  3254. public void HideWillRemoveFieldEffect()
  3255. {
  3256. if (TopCard != null)
  3257. {
  3258. if (ShowingPermanentCard != null)
  3259. {
  3260. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  3261. {
  3262. ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
  3263. }
  3264. }
  3265. }
  3266. }
  3267. #endregion
  3268. #region Show "Digivolution" effect object
  3269. public void ShowWillEvolutionEffect()
  3270. {
  3271. if (TopCard != null)
  3272. {
  3273. if (ShowingPermanentCard != null)
  3274. {
  3275. if (ShowingPermanentCard.WillEvolutionObject != null)
  3276. {
  3277. ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
  3278. ShowingPermanentCard.WillEvolutionObject.SetActive(true);
  3279. }
  3280. }
  3281. }
  3282. }
  3283. #endregion
  3284. #region Hide "Digivolution" effect object
  3285. public void HideWillEvolutionEffect()
  3286. {
  3287. if (TopCard != null)
  3288. {
  3289. if (ShowingPermanentCard != null)
  3290. {
  3291. if (ShowingPermanentCard.WillEvolutionObject != null)
  3292. {
  3293. ShowingPermanentCard.WillEvolutionObject.SetActive(false);
  3294. }
  3295. }
  3296. }
  3297. }
  3298. #endregion
  3299. }