Permanent.cs 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013
  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. if (!ignoreOverflow)
  92. {
  93. yield return ContinuousController.instance.StartCoroutine(new AceOverflowClass(evoRoots).Overflow());
  94. }
  95. foreach (CardSource cardSource1 in evoRoots)
  96. {
  97. if (putToTrash)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource1));
  100. }
  101. else
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource1));
  104. }
  105. }
  106. }
  107. #endregion
  108. #region Whether this permanent has DP
  109. public bool HasDP
  110. {
  111. get
  112. {
  113. if (TopCard == null)
  114. {
  115. return false;
  116. }
  117. if (!IsDigimon)
  118. {
  119. return false;
  120. }
  121. if (!TopCard.HasDP && TopCard.IsDigiEgg)
  122. {
  123. return false;
  124. }
  125. #region Effect of not having DP
  126. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  127. {
  128. foreach (Permanent permanent in player.GetFieldPermanents())
  129. {
  130. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  131. {
  132. if (cardEffect1 is IDontHaveDPEffect)
  133. {
  134. if (cardEffect1.CanUse(null))
  135. {
  136. if (((IDontHaveDPEffect)cardEffect1).DontHaveDP(this))
  137. {
  138. return false;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. return true;
  147. }
  148. }
  149. #endregion
  150. #region Base DP
  151. public int BaseDP
  152. {
  153. get
  154. {
  155. int BaseDP = 0;
  156. if (HasDP)
  157. {
  158. BaseDP = TopCard.BaseCardDP;
  159. #region 基礎DPを変更する効果
  160. List<ICardEffect> cardEffects_ChangeDP = new List<ICardEffect>();
  161. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  162. {
  163. foreach (Permanent permanent in player.GetFieldPermanents())
  164. {
  165. #region 場のパーマネントの効果
  166. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  167. {
  168. if (cardEffect is IChangeBaseDPEffect)
  169. {
  170. if (cardEffect.CanUse(null))
  171. {
  172. if (((IChangeBaseDPEffect)cardEffect).PermanentCondition(this))
  173. {
  174. if (((IChangeBaseDPEffect)cardEffect).IsMinusDP())
  175. {
  176. if (this.ImmuneFromDPMinus(cardEffect))
  177. {
  178. continue;
  179. }
  180. }
  181. if (!TopCard.CanNotBeAffected(cardEffect))
  182. {
  183. cardEffects_ChangeDP.Add(cardEffect);
  184. }
  185. }
  186. }
  187. }
  188. }
  189. #endregion
  190. }
  191. #region プレイヤーの効果
  192. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  193. {
  194. if (cardEffect is IChangeBaseDPEffect)
  195. {
  196. if (cardEffect.CanUse(null))
  197. {
  198. if (((IChangeBaseDPEffect)cardEffect).PermanentCondition(this))
  199. {
  200. if (((IChangeBaseDPEffect)cardEffect).IsMinusDP())
  201. {
  202. if (this.ImmuneFromDPMinus(cardEffect))
  203. {
  204. continue;
  205. }
  206. }
  207. if (!TopCard.CanNotBeAffected(cardEffect))
  208. {
  209. cardEffects_ChangeDP.Add(cardEffect);
  210. }
  211. }
  212. }
  213. }
  214. }
  215. #endregion
  216. }
  217. List<ICardEffect> cardEffects_ChangeDP_isUpDown = new List<ICardEffect>();
  218. List<ICardEffect> cardEffects_ChangeDP_NotIsUpDown = new List<ICardEffect>();
  219. foreach (ICardEffect cardEffect in cardEffects_ChangeDP)
  220. {
  221. if (cardEffect is IChangeBaseDPEffect)
  222. {
  223. if (cardEffect.CanUse(null))
  224. {
  225. if (((IChangeBaseDPEffect)cardEffect).IsUpDown())
  226. {
  227. cardEffects_ChangeDP_isUpDown.Add(cardEffect);
  228. }
  229. else
  230. {
  231. cardEffects_ChangeDP_NotIsUpDown.Add(cardEffect);
  232. }
  233. }
  234. }
  235. }
  236. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_isUpDown)
  237. {
  238. if (cardEffect is IChangeBaseDPEffect)
  239. {
  240. if (cardEffect.CanUse(null))
  241. {
  242. BaseDP = ((IChangeBaseDPEffect)cardEffect).GetDP(BaseDP, this);
  243. }
  244. }
  245. }
  246. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_NotIsUpDown)
  247. {
  248. if (cardEffect is IChangeBaseDPEffect)
  249. {
  250. if (cardEffect.CanUse(null))
  251. {
  252. BaseDP = ((IChangeBaseDPEffect)cardEffect).GetDP(BaseDP, this);
  253. }
  254. }
  255. }
  256. #endregion
  257. if (BaseDP < 0)
  258. {
  259. BaseDP = 0;
  260. }
  261. }
  262. return BaseDP;
  263. }
  264. }
  265. #endregion
  266. #region DP
  267. public int DP
  268. {
  269. get
  270. {
  271. int DP = -1;
  272. if (HasDP)
  273. {
  274. DP = BaseDP;
  275. #region DPを変更する効果
  276. List<ICardEffect> cardEffects_ChangeDP = new List<ICardEffect>();
  277. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  278. {
  279. foreach (Permanent permanent in player.GetFieldPermanents())
  280. {
  281. #region 場のパーマネントの効果
  282. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  283. {
  284. if (cardEffect is IChangeDPEffect)
  285. {
  286. if (cardEffect.CanUse(null))
  287. {
  288. if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
  289. {
  290. if (((IChangeDPEffect)cardEffect).IsMinusDP())
  291. {
  292. if (this.ImmuneFromDPMinus(cardEffect))
  293. {
  294. continue;
  295. }
  296. }
  297. if (!TopCard.CanNotBeAffected(cardEffect))
  298. {
  299. cardEffects_ChangeDP.Add(cardEffect);
  300. }
  301. }
  302. }
  303. }
  304. }
  305. #endregion
  306. }
  307. #region プレイヤーの効果
  308. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  309. {
  310. if (cardEffect is IChangeDPEffect)
  311. {
  312. if (cardEffect.CanUse(null))
  313. {
  314. if (((IChangeDPEffect)cardEffect).PermanentCondition(this))
  315. {
  316. if (((IChangeDPEffect)cardEffect).IsMinusDP())
  317. {
  318. if (this.ImmuneFromDPMinus(cardEffect))
  319. {
  320. continue;
  321. }
  322. }
  323. if (!TopCard.CanNotBeAffected(cardEffect))
  324. {
  325. cardEffects_ChangeDP.Add(cardEffect);
  326. }
  327. }
  328. }
  329. }
  330. }
  331. #endregion
  332. }
  333. List<ICardEffect> cardEffects_ChangeDP_isUpDown = new List<ICardEffect>();
  334. List<ICardEffect> cardEffects_ChangeDP_NotIsUpDown = new List<ICardEffect>();
  335. foreach (ICardEffect cardEffect in cardEffects_ChangeDP)
  336. {
  337. if (cardEffect is IChangeDPEffect)
  338. {
  339. if (cardEffect.CanUse(null))
  340. {
  341. if (((IChangeDPEffect)cardEffect).IsUpDown())
  342. {
  343. cardEffects_ChangeDP_isUpDown.Add(cardEffect);
  344. }
  345. else
  346. {
  347. cardEffects_ChangeDP_NotIsUpDown.Add(cardEffect);
  348. }
  349. }
  350. }
  351. }
  352. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_isUpDown)
  353. {
  354. if (cardEffect is IChangeDPEffect)
  355. {
  356. if (cardEffect.CanUse(null))
  357. {
  358. DP = ((IChangeDPEffect)cardEffect).GetDP(DP, this);
  359. }
  360. }
  361. }
  362. foreach (ICardEffect cardEffect in cardEffects_ChangeDP_NotIsUpDown)
  363. {
  364. if (cardEffect is IChangeDPEffect)
  365. {
  366. if (cardEffect.CanUse(null))
  367. {
  368. DP = ((IChangeDPEffect)cardEffect).GetDP(DP, this);
  369. }
  370. }
  371. }
  372. #endregion
  373. if (DP < 0)
  374. {
  375. DP = 0;
  376. }
  377. }
  378. return DP;
  379. }
  380. }
  381. #endregion
  382. #region Will it not receive negative DP effect?
  383. public bool ImmuneFromDPMinus(ICardEffect cardEffect)
  384. {
  385. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  386. {
  387. foreach (Permanent permanent in player.GetFieldPermanents())
  388. {
  389. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  390. {
  391. if (cardEffect1 is IImmuneFromDPMinusEffect)
  392. {
  393. if (cardEffect1.CanUse(null))
  394. {
  395. if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
  396. {
  397. return true;
  398. }
  399. }
  400. }
  401. }
  402. }
  403. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  404. {
  405. if (cardEffect1 is IImmuneFromDPMinusEffect)
  406. {
  407. if (cardEffect1.CanUse(null))
  408. {
  409. if (((IImmuneFromDPMinusEffect)cardEffect1).ImmuneFromDPMinus(this, cardEffect))
  410. {
  411. return true;
  412. }
  413. }
  414. }
  415. }
  416. }
  417. return false;
  418. }
  419. #endregion
  420. #region Can be returned to your hand?
  421. public bool CannotReturnToHand(ICardEffect cardEffect)
  422. {
  423. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  424. {
  425. foreach (Permanent permanent in player.GetFieldPermanents())
  426. {
  427. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  428. {
  429. if (cardEffect1 is ICannotReturnToHandEffect)
  430. {
  431. if (cardEffect1.CanUse(null))
  432. {
  433. if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
  434. {
  435. return true;
  436. }
  437. }
  438. }
  439. }
  440. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  441. {
  442. if (cardEffect1 is ICannotReturnToHandEffect)
  443. {
  444. if (cardEffect1.CanUse(null))
  445. {
  446. if (((ICannotReturnToHandEffect)cardEffect1).CannotReturnToHand(this, cardEffect))
  447. {
  448. return true;
  449. }
  450. }
  451. }
  452. }
  453. }
  454. }
  455. return false;
  456. }
  457. #endregion
  458. #region Can be returned to deck?
  459. public bool CannotReturnToLibrary(ICardEffect cardEffect)
  460. {
  461. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  462. {
  463. foreach (Permanent permanent in player.GetFieldPermanents())
  464. {
  465. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  466. {
  467. if (cardEffect1 is ICannotReturnToLibraryEffect)
  468. {
  469. if (cardEffect1.CanUse(null))
  470. {
  471. if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
  472. {
  473. return true;
  474. }
  475. }
  476. }
  477. }
  478. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  479. {
  480. if (cardEffect1 is ICannotReturnToLibraryEffect)
  481. {
  482. if (cardEffect1.CanUse(null))
  483. {
  484. if (((ICannotReturnToLibraryEffect)cardEffect1).CannotReturnToLibrary(this, cardEffect))
  485. {
  486. return true;
  487. }
  488. }
  489. }
  490. }
  491. }
  492. }
  493. return false;
  494. }
  495. #endregion
  496. #region 退化を受けないか
  497. public bool ImmuneFromDeDigivolve()
  498. {
  499. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  500. {
  501. foreach (Permanent permanent in player.GetFieldPermanents())
  502. {
  503. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  504. {
  505. if (cardEffect1 is IImmuneFromDeDigivolveEffect)
  506. {
  507. if (cardEffect1.CanUse(null))
  508. {
  509. if (((IImmuneFromDeDigivolveEffect)cardEffect1).ImmuneDeDigivolve(this))
  510. {
  511. return true;
  512. }
  513. }
  514. }
  515. }
  516. }
  517. }
  518. return false;
  519. }
  520. #endregion
  521. #region このパーマネントの持つカードリスト
  522. public List<CardSource> cardSources = new List<CardSource>();
  523. #endregion
  524. #region 一番上以外のカード
  525. public List<CardSource> DigivolutionCards => cardSources.Filter(cardSource => cardSource != TopCard);
  526. #endregion
  527. #region パーマネントのカードリストにカードを追加
  528. public void AddCardSource(CardSource cardSource)
  529. {
  530. cardSources.Insert(0, cardSource);
  531. cardSource.SetFace();
  532. }
  533. #endregion
  534. #region 進化元の一番上に置く
  535. public IEnumerator AddDigivolutionCardsTop(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect)
  536. {
  537. List<CardSource> addedCards = new List<CardSource>();
  538. bool isFromSameDigimon = false;
  539. bool isFromDigimon = false;
  540. foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
  541. {
  542. if (cardSources.Contains(addedDigivolutionCard))
  543. {
  544. isFromSameDigimon = true;
  545. }
  546. if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
  547. {
  548. if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  549. {
  550. isFromDigimon = true;
  551. }
  552. }
  553. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  554. if (!this.IsToken && !addedDigivolutionCard.IsToken)
  555. {
  556. this.cardSources.Insert(1, addedDigivolutionCard);
  557. addedDigivolutionCard.SetFace();
  558. addedCards.Add(addedDigivolutionCard);
  559. }
  560. }
  561. if (addedCards.Count >= 1)
  562. {
  563. if (ShowingPermanentCard != null)
  564. {
  565. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  566. }
  567. #region "進化元が増えた時"の効果
  568. #region Hashtable Setting
  569. Hashtable hashtable = new Hashtable()
  570. {
  571. {"Permanent", this},
  572. {"CardEffect", cardEffect},
  573. {"CardSources", addedCards},
  574. {"isFromSameDigimon", isFromSameDigimon},
  575. {"isFromDigimon", isFromDigimon},
  576. };
  577. #endregion
  578. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
  579. #endregion
  580. }
  581. }
  582. #endregion
  583. #region 進化元の一番下に置く
  584. public IEnumerator AddDigivolutionCardsBottom(List<CardSource> addedDigivolutionCards, ICardEffect cardEffect, bool skipEffectAndActivateSkill = false)
  585. {
  586. List<CardSource> addedCards = new List<CardSource>();
  587. bool isFromSameDigimon = false;
  588. bool isFromDigimon = false;
  589. foreach (CardSource addedDigivolutionCard in addedDigivolutionCards)
  590. {
  591. if (addedDigivolutionCard.PermanentOfThisCard() != null)
  592. {
  593. if (addedDigivolutionCard.PermanentOfThisCard() != this)
  594. {
  595. if (addedDigivolutionCard.PermanentOfThisCard().TopCard == addedDigivolutionCard)
  596. {
  597. IPlacePermanentToDigivolutionCards placePermanent = new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { addedDigivolutionCard.PermanentOfThisCard(), this } }, false, cardEffect, skipEffectAndActivateSkill = true);
  598. yield return ContinuousController.instance.StartCoroutine(placePermanent.PlacePermanentToDigivolutionCards());
  599. if (!placePermanent.Placed)
  600. {
  601. continue;
  602. }
  603. }
  604. }
  605. }
  606. if (CardEffectCommons.IsExistOnBattleArea(addedDigivolutionCard))
  607. {
  608. if (addedDigivolutionCard.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  609. {
  610. isFromDigimon = true;
  611. }
  612. }
  613. if (cardSources.Contains(addedDigivolutionCard))
  614. {
  615. isFromSameDigimon = true;
  616. if (addedDigivolutionCard == TopCard)
  617. {
  618. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  619. ShowingPermanentCard.ShowPermanentData(true);
  620. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(
  621. addedDigivolutionCard,
  622. this));
  623. }
  624. }
  625. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(addedDigivolutionCard));
  626. if (!IsToken && !addedDigivolutionCard.IsToken)
  627. {
  628. cardSources.Add(addedDigivolutionCard);
  629. addedDigivolutionCard.SetFace();
  630. addedCards.Add(addedDigivolutionCard);
  631. }
  632. }
  633. if (addedCards.Count >= 1 && !skipEffectAndActivateSkill)
  634. {
  635. if (ShowingPermanentCard != null)
  636. {
  637. yield return ContinuousController.instance.StartCoroutine(ShowingPermanentCard.ShowAddDigivolutionCardEffect());
  638. }
  639. #region Effect of "when the number of evolution sources increases"
  640. #region Hashtable Setting
  641. Hashtable hashtable = new Hashtable()
  642. {
  643. {"Permanent", this},
  644. {"CardEffect", cardEffect},
  645. {"CardSources", addedCards},
  646. {"isFromSameDigimon", isFromSameDigimon},
  647. {"isFromDigimon", isFromDigimon},
  648. };
  649. #endregion
  650. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(hashtable, EffectTiming.OnAddDigivolutionCards));
  651. #endregion
  652. }
  653. }
  654. #endregion
  655. #region パーマネントのカードリストからカードを除く
  656. public IEnumerator RemoveCardSource(CardSource cardSource)
  657. {
  658. yield return null;
  659. cardSources.Remove(cardSource);
  660. }
  661. #endregion
  662. #region このパーマネントの一番上のカード
  663. public CardSource TopCard
  664. {
  665. get
  666. {
  667. if (cardSources.Count >= 1)
  668. {
  669. return cardSources[0];
  670. }
  671. return null;
  672. }
  673. }
  674. #endregion
  675. #region Permanent effect list
  676. #region このパーマネントの効果リスト
  677. public List<ICardEffect> EffectList(EffectTiming timing)
  678. {
  679. return EffectList_ForCard(timing, TopCard);
  680. }
  681. #endregion
  682. #region このポケモンの追加効果リスト
  683. public List<ICardEffect> EffectList_Added(EffectTiming timing)
  684. {
  685. List<ICardEffect> _EffectList = new List<ICardEffect>();
  686. if (TopCard != null)
  687. {
  688. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerDrawPhaseEffects)
  689. {
  690. ICardEffect cardEffect = GetCardEffect(timing);
  691. if (cardEffect != null)
  692. {
  693. _EffectList.Add(cardEffect);
  694. }
  695. }
  696. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerTurnEndEffects)
  697. {
  698. ICardEffect cardEffect = GetCardEffect(timing);
  699. if (cardEffect != null)
  700. {
  701. _EffectList.Add(cardEffect);
  702. }
  703. }
  704. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEachTurnEndEffects)
  705. {
  706. ICardEffect cardEffect = GetCardEffect(timing);
  707. if (cardEffect != null)
  708. {
  709. _EffectList.Add(cardEffect);
  710. }
  711. }
  712. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOpponentTurnEndEffects)
  713. {
  714. ICardEffect cardEffect = GetCardEffect(timing);
  715. if (cardEffect != null)
  716. {
  717. _EffectList.Add(cardEffect);
  718. }
  719. }
  720. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEndBattleEffects)
  721. {
  722. ICardEffect cardEffect = GetCardEffect(timing);
  723. if (cardEffect != null)
  724. {
  725. _EffectList.Add(cardEffect);
  726. }
  727. }
  728. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilOwnerTurnStartEffects)
  729. {
  730. ICardEffect cardEffect = GetCardEffect(timing);
  731. if (cardEffect != null)
  732. {
  733. _EffectList.Add(cardEffect);
  734. }
  735. }
  736. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilNextUntapEffects)
  737. {
  738. ICardEffect cardEffect = GetCardEffect(timing);
  739. if (cardEffect != null)
  740. {
  741. _EffectList.Add(cardEffect);
  742. }
  743. }
  744. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in PermanentEffects)
  745. {
  746. ICardEffect cardEffect = GetCardEffect(timing);
  747. if (cardEffect != null)
  748. {
  749. _EffectList.Add(cardEffect);
  750. }
  751. }
  752. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in UntilEndAttackEffects)
  753. {
  754. ICardEffect cardEffect = GetCardEffect(timing);
  755. if (cardEffect != null)
  756. {
  757. _EffectList.Add(cardEffect);
  758. }
  759. }
  760. _EffectList = _EffectList.Filter(cardEffect => cardEffect != null);
  761. foreach (ICardEffect cardEffect in _EffectList)
  762. {
  763. if (cardEffect != null)
  764. {
  765. if (cardEffect.EffectSourceCard == null)
  766. {
  767. cardEffect.SetEffectSourceCard(TopCard);
  768. }
  769. cardEffect.SetIsInheritedEffect(false);
  770. }
  771. }
  772. }
  773. return _EffectList;
  774. }
  775. #endregion
  776. #region このパーマネントの効果リスト(引数:CardSource)
  777. public List<ICardEffect> EffectList_ForCard(EffectTiming timing, CardSource _cardSource)
  778. {
  779. List<ICardEffect> _EffectList = new List<ICardEffect>();
  780. if (TopCard != null && _cardSource != null)
  781. {
  782. foreach (CardSource cardSource in cardSources)
  783. {
  784. if (cardSource != null)
  785. {
  786. if (!cardSource.IsFlipped)
  787. {
  788. bool isTopCard = cardSource == TopCard;
  789. if (!isTopCard)
  790. {
  791. if (!IsDigimon)
  792. {
  793. continue;
  794. }
  795. }
  796. foreach (ICardEffect cardEffect in cardSource.cEntity_EffectController.GetCardEffects(timing, cardSource))
  797. {
  798. if (cardEffect != null)
  799. {
  800. if (isTopCard == cardEffect.IsInheritedEffect)
  801. {
  802. continue;
  803. }
  804. _EffectList.Add(cardEffect);
  805. }
  806. }
  807. }
  808. }
  809. }
  810. foreach (ICardEffect cardEffect in EffectList_Added(timing))
  811. {
  812. if (cardEffect != null)
  813. {
  814. _EffectList.Add(cardEffect);
  815. }
  816. }
  817. foreach (ICardEffect cardEffect in _EffectList)
  818. {
  819. if (cardEffect != null)
  820. {
  821. if (cardEffect.EffectSourceCard == null)
  822. {
  823. cardEffect.SetEffectSourceCard(_cardSource);
  824. }
  825. }
  826. }
  827. }
  828. return _EffectList;
  829. }
  830. #endregion
  831. #region 自分のターン終了時に消える効果
  832. public List<Func<EffectTiming, ICardEffect>> UntilOwnerTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
  833. #endregion
  834. #region 自分のドローフェイズ終了時に消える効果
  835. public List<Func<EffectTiming, ICardEffect>> UntilOwnerDrawPhaseEffects = new List<Func<EffectTiming, ICardEffect>>();
  836. #endregion
  837. #region お互いのターン終了時に消える効果
  838. public List<Func<EffectTiming, ICardEffect>> UntilEachTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
  839. #endregion
  840. #region 相手のターン終了時に消える効果
  841. public List<Func<EffectTiming, ICardEffect>> UntilOpponentTurnEndEffects = new List<Func<EffectTiming, ICardEffect>>();
  842. #endregion
  843. #region バトル終了時に消える効果
  844. public List<Func<EffectTiming, ICardEffect>> UntilEndBattleEffects = new List<Func<EffectTiming, ICardEffect>>();
  845. #endregion
  846. #region 攻撃終了時に消える効果
  847. public List<Func<EffectTiming, ICardEffect>> UntilEndAttackEffects = new List<Func<EffectTiming, ICardEffect>>();
  848. #endregion
  849. #region 自分のターン開始時に消える効果
  850. public List<Func<EffectTiming, ICardEffect>> UntilOwnerTurnStartEffects = new List<Func<EffectTiming, ICardEffect>>();
  851. #endregion
  852. #region 次にアンタップする時に消える効果
  853. public List<Func<EffectTiming, ICardEffect>> UntilNextUntapEffects = new List<Func<EffectTiming, ICardEffect>>();
  854. #endregion
  855. #region 場を離れるまで残る効果
  856. public List<Func<EffectTiming, ICardEffect>> PermanentEffects = new List<Func<EffectTiming, ICardEffect>>();
  857. #endregion
  858. #endregion
  859. #region 起動型効果を宣言できるか
  860. public bool CanDeclareSkill() => CanDeclareSkillList().Count > 0;
  861. #endregion
  862. #region 宣言可能な起動型効果リスト
  863. public List<ICardEffect> CanDeclareSkillList()
  864. {
  865. List<ICardEffect> CanDeclareSkillList = new List<ICardEffect>();
  866. if (TopCard != null)
  867. {
  868. foreach (ICardEffect _cardEffect in EffectList(EffectTiming.OnDeclaration))
  869. {
  870. if (_cardEffect is ActivateICardEffect)
  871. {
  872. if (_cardEffect.CanUse(null))
  873. {
  874. CanDeclareSkillList.Add(_cardEffect);
  875. }
  876. }
  877. }
  878. }
  879. return CanDeclareSkillList;
  880. }
  881. #endregion
  882. #region このパーマネントが場に出たターン
  883. public int EnterFieldTurnCount { get; set; } = -1;
  884. #endregion
  885. #region このパーマネントを表す場のオブジェクト
  886. public FieldPermanentCard ShowingPermanentCard { get; set; }
  887. #endregion
  888. #region Whether this permanent can be selected by the effect
  889. public bool CanSelectBySkill(ICardEffect skill)
  890. {
  891. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  892. {
  893. #region Effects of field permanents
  894. foreach (Permanent permanent in player.GetFieldPermanents())
  895. {
  896. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  897. {
  898. if (cardEffect is ICanNotSelectBySkillEffect)
  899. {
  900. if (cardEffect.CanUse(null))
  901. {
  902. if (((ICanNotSelectBySkillEffect)cardEffect).CanNotSelectBySkill(this, skill))
  903. {
  904. return false;
  905. }
  906. }
  907. }
  908. }
  909. }
  910. #endregion
  911. }
  912. return true;
  913. }
  914. #endregion
  915. #region セキュリティチェックを行う枚数
  916. public List<int> SecurityAttackChanges
  917. {
  918. get
  919. {
  920. List<int> SecurityAttackChanges = new List<int>();
  921. int Strike = 1;
  922. List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
  923. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  924. {
  925. foreach (Permanent permanent in player.GetFieldPermanents())
  926. {
  927. #region 場のパーマネントの効果
  928. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  929. {
  930. if (cardEffect is IChangeSAttackEffect)
  931. {
  932. if (cardEffect.CanUse(null))
  933. {
  934. if (!TopCard.CanNotBeAffected(cardEffect))
  935. {
  936. if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
  937. {
  938. cardEffects_ChangeDirectStrike.Add(cardEffect);
  939. }
  940. }
  941. }
  942. }
  943. }
  944. #endregion
  945. }
  946. #region プレイヤーの効果
  947. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  948. {
  949. if (cardEffect is IChangeSAttackEffect)
  950. {
  951. if (cardEffect.CanUse(null))
  952. {
  953. if (!TopCard.CanNotBeAffected(cardEffect))
  954. {
  955. if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
  956. {
  957. cardEffects_ChangeDirectStrike.Add(cardEffect);
  958. }
  959. }
  960. }
  961. }
  962. }
  963. #endregion
  964. }
  965. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
  966. {
  967. if (cardEffect is IChangeSAttackEffect)
  968. {
  969. if (cardEffect.CanUse(null))
  970. {
  971. int Strike1 = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this);
  972. if (Strike1 != Strike)
  973. {
  974. SecurityAttackChanges.Add(Strike1 - Strike);
  975. }
  976. }
  977. }
  978. }
  979. return SecurityAttackChanges;
  980. }
  981. }
  982. public bool HasSecurityAttackChanges
  983. {
  984. get
  985. {
  986. if (!IsDigimon)
  987. {
  988. return false;
  989. }
  990. return SecurityAttackChanges.Count >= 1;
  991. }
  992. }
  993. public int Strike_AllowMinus
  994. {
  995. get
  996. {
  997. int Strike = 1;
  998. #region セキュリティチェックを行う枚数を変更する効果
  999. List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
  1000. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1001. {
  1002. foreach (Permanent permanent in player.GetFieldPermanents())
  1003. {
  1004. #region 場のパーマネントの効果
  1005. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1006. {
  1007. if (cardEffect is IChangeSAttackEffect)
  1008. {
  1009. if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
  1010. {
  1011. if (cardEffect.CanUse(null))
  1012. {
  1013. if (!TopCard.CanNotBeAffected(cardEffect))
  1014. {
  1015. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1016. }
  1017. }
  1018. }
  1019. }
  1020. }
  1021. #endregion
  1022. }
  1023. #region プレイヤーの効果
  1024. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1025. {
  1026. if (cardEffect is IChangeSAttackEffect)
  1027. {
  1028. if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
  1029. {
  1030. if (cardEffect.CanUse(null))
  1031. {
  1032. if (!TopCard.CanNotBeAffected(cardEffect))
  1033. {
  1034. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1035. }
  1036. }
  1037. }
  1038. }
  1039. }
  1040. #endregion
  1041. }
  1042. List<ICardEffect> cardEffects_ChangeDirectStrike_UpToConstant = new List<ICardEffect>();
  1043. List<ICardEffect> cardEffects_ChangeDirectStrike_UpDownValue = new List<ICardEffect>();
  1044. List<ICardEffect> cardEffects_ChangeDirectStrike_DownToConstant = new List<ICardEffect>();
  1045. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
  1046. {
  1047. if (cardEffect is IChangeSAttackEffect)
  1048. {
  1049. if (cardEffect.CanUse(null))
  1050. {
  1051. switch (((IChangeSAttackEffect)cardEffect).isUpDown())
  1052. {
  1053. case CalculateOrder.UpToConstant:
  1054. cardEffects_ChangeDirectStrike_UpToConstant.Add(cardEffect);
  1055. break;
  1056. case CalculateOrder.UpDownValue:
  1057. cardEffects_ChangeDirectStrike_UpDownValue.Add(cardEffect);
  1058. break;
  1059. case CalculateOrder.DownToConstant:
  1060. cardEffects_ChangeDirectStrike_DownToConstant.Add(cardEffect);
  1061. break;
  1062. }
  1063. }
  1064. }
  1065. }
  1066. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpToConstant)
  1067. {
  1068. if (cardEffect is IChangeSAttackEffect)
  1069. {
  1070. if (cardEffect.CanUse(null))
  1071. {
  1072. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this);
  1073. }
  1074. }
  1075. }
  1076. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpDownValue)
  1077. {
  1078. if (cardEffect is IChangeSAttackEffect)
  1079. {
  1080. if (cardEffect.CanUse(null))
  1081. {
  1082. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this);
  1083. }
  1084. }
  1085. }
  1086. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_DownToConstant)
  1087. {
  1088. if (cardEffect is IChangeSAttackEffect)
  1089. {
  1090. if (cardEffect.CanUse(null))
  1091. {
  1092. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this);
  1093. }
  1094. }
  1095. }
  1096. #endregion
  1097. return Strike;
  1098. }
  1099. }
  1100. public int Strike
  1101. {
  1102. get
  1103. {
  1104. int Strike = Strike_AllowMinus;
  1105. if (Strike < 0)
  1106. {
  1107. Strike = 0;
  1108. }
  1109. return Strike;
  1110. }
  1111. }
  1112. #endregion
  1113. #region このパーマネントがタップされているかどうか
  1114. public bool OldIsSuspended = false;
  1115. public bool IsSuspended = false;
  1116. public int DPWhenSuspended = 114514;
  1117. #endregion
  1118. #region Whether this permanent can unsuspend
  1119. public bool CanUnsuspend
  1120. {
  1121. get
  1122. {
  1123. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1124. {
  1125. #region Effects of field permanents
  1126. foreach (Permanent permanent in player.GetFieldPermanents())
  1127. {
  1128. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1129. {
  1130. if (cardEffect is ICanNotUnsuspendEffect)
  1131. {
  1132. if (cardEffect.CanUse(null))
  1133. {
  1134. if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
  1135. {
  1136. return false;
  1137. }
  1138. }
  1139. }
  1140. }
  1141. }
  1142. #endregion
  1143. #region Effects of players
  1144. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1145. {
  1146. if (cardEffect is ICanNotUnsuspendEffect)
  1147. {
  1148. if (cardEffect.CanUse(null))
  1149. {
  1150. if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
  1151. {
  1152. return false;
  1153. }
  1154. }
  1155. }
  1156. }
  1157. #endregion
  1158. }
  1159. return true;
  1160. }
  1161. }
  1162. #endregion
  1163. #region このパーマネントが移動できるかどうか
  1164. public bool CanMove
  1165. {
  1166. get
  1167. {
  1168. if (TopCard != null)
  1169. {
  1170. if (!TopCard.Owner.GetBreedingAreaPermanents().Contains(this))
  1171. {
  1172. return false;
  1173. }
  1174. if (!IsDigimon)
  1175. {
  1176. return false;
  1177. }
  1178. if (DP <= 0)
  1179. {
  1180. return false;
  1181. }
  1182. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) == 0)
  1183. {
  1184. return false;
  1185. }
  1186. }
  1187. else
  1188. {
  1189. return false;
  1190. }
  1191. return true;
  1192. }
  1193. }
  1194. #endregion
  1195. #region このパーマネントが攻撃できるかどうか
  1196. public bool CanAttack(ICardEffect cardEffect, bool withoutTap = false)
  1197. {
  1198. // can not attack with empty cards
  1199. if (TopCard == null)
  1200. {
  1201. return false;
  1202. }
  1203. // can not attack during opponent's turn
  1204. if (TopCard.Owner != GManager.instance.turnStateMachine.gameContext.TurnPlayer)
  1205. {
  1206. return false;
  1207. }
  1208. // can not attack to player
  1209. if (!CanAttackTargetDigimon(null, cardEffect, withoutTap))
  1210. {
  1211. // can not attack to opponent's Digimon
  1212. if (TopCard.Owner.Enemy.GetFieldPermanents().Count((permanent) => CanAttackTargetDigimon(permanent, cardEffect, withoutTap)) == 0)
  1213. {
  1214. return false;
  1215. }
  1216. }
  1217. return true;
  1218. }
  1219. #endregion
  1220. #region このパーマネントが対象の攻撃パーマネントをブロックできるかどうか
  1221. public bool CanBlock(Permanent AttackingPermanent)
  1222. {
  1223. if (TopCard == null)
  1224. {
  1225. return false;
  1226. }
  1227. if (!IsDigimon)
  1228. {
  1229. return false;
  1230. }
  1231. if (IsSuspended)
  1232. {
  1233. return false;
  1234. }
  1235. if (!CanSuspend)
  1236. {
  1237. return false;
  1238. }
  1239. if (PermanentFrame != null)
  1240. {
  1241. if (!PermanentFrame.IsBattleAreaFrame())
  1242. {
  1243. return false;
  1244. }
  1245. }
  1246. #region "Unblockable" effect
  1247. #region Effects of permanents in play
  1248. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1249. {
  1250. foreach (Permanent permanent in player.GetFieldPermanents())
  1251. {
  1252. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1253. {
  1254. if (cardEffect is ICannotBlockEffect)
  1255. {
  1256. if (cardEffect.CanUse(null))
  1257. {
  1258. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1259. {
  1260. return false;
  1261. }
  1262. }
  1263. }
  1264. }
  1265. }
  1266. }
  1267. #endregion
  1268. #region player effect
  1269. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1270. {
  1271. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1272. {
  1273. if (cardEffect is ICannotBlockEffect)
  1274. {
  1275. if (cardEffect.CanUse(null))
  1276. {
  1277. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1278. {
  1279. if (!TopCard.CanNotBeAffected(cardEffect))
  1280. {
  1281. return false;
  1282. }
  1283. }
  1284. }
  1285. }
  1286. }
  1287. }
  1288. #endregion
  1289. #endregion
  1290. return true;
  1291. }
  1292. #endregion
  1293. #region 対象のパーマネントを攻撃できるか
  1294. public bool CanAttackTargetDigimon(Permanent Defender, ICardEffect cardEffect, bool withoutTap = false)
  1295. {
  1296. if (TopCard != null)
  1297. {
  1298. if (!IsDigimon)
  1299. {
  1300. return false;
  1301. }
  1302. if (!withoutTap)
  1303. {
  1304. if (IsSuspended)
  1305. {
  1306. return false;
  1307. }
  1308. if (!CanSuspend)
  1309. {
  1310. return false;
  1311. }
  1312. }
  1313. if (PermanentFrame != null)
  1314. {
  1315. if (!PermanentFrame.IsBattleAreaFrame())
  1316. {
  1317. return false;
  1318. }
  1319. }
  1320. if (EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  1321. {
  1322. if (!HasRush)
  1323. {
  1324. return false;
  1325. }
  1326. }
  1327. #region 「対象の防御パーマネントを攻撃できない」効果
  1328. #region 場のパーマネントの効果
  1329. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1330. {
  1331. foreach (Permanent permanent in player.GetFieldPermanents())
  1332. {
  1333. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1334. {
  1335. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1336. {
  1337. if (cardEffect1.CanUse(null))
  1338. {
  1339. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1340. {
  1341. if (!TopCard.CanNotBeAffected(cardEffect1))
  1342. {
  1343. return false;
  1344. }
  1345. }
  1346. }
  1347. }
  1348. }
  1349. }
  1350. }
  1351. #endregion
  1352. #region プレイヤーの効果
  1353. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1354. {
  1355. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1356. {
  1357. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1358. {
  1359. if (cardEffect1.CanUse(null))
  1360. {
  1361. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1362. {
  1363. if (!TopCard.CanNotBeAffected(cardEffect1))
  1364. {
  1365. return false;
  1366. }
  1367. }
  1368. }
  1369. }
  1370. }
  1371. }
  1372. #endregion
  1373. #endregion
  1374. if (Defender != null)
  1375. {
  1376. if (Defender.TopCard != null)
  1377. {
  1378. if (Defender.TopCard.Owner == TopCard.Owner.Enemy)
  1379. {
  1380. if (Defender.IsDigimon && Defender.TopCard.Owner.GetBattleAreaPermanents().Contains(Defender))
  1381. {
  1382. if (Defender.IsSuspended)
  1383. {
  1384. return true;
  1385. }
  1386. #region 「対象の防御パーマネントを攻撃できる」効果
  1387. #region 場のパーマネントの効果
  1388. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1389. {
  1390. foreach (Permanent permanent in player.GetFieldPermanents())
  1391. {
  1392. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1393. {
  1394. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1395. {
  1396. if (cardEffect1.CanUse(null))
  1397. {
  1398. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1399. {
  1400. return true;
  1401. }
  1402. }
  1403. }
  1404. }
  1405. }
  1406. }
  1407. #endregion
  1408. #region プレイヤーの効果
  1409. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1410. {
  1411. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1412. {
  1413. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1414. {
  1415. if (cardEffect1.CanUse(null))
  1416. {
  1417. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1418. {
  1419. return true;
  1420. }
  1421. }
  1422. }
  1423. }
  1424. }
  1425. #endregion
  1426. #endregion
  1427. }
  1428. }
  1429. }
  1430. }
  1431. else
  1432. {
  1433. return true;
  1434. }
  1435. }
  1436. return false;
  1437. }
  1438. #endregion
  1439. #region Is Unblockable
  1440. public bool IsUnblockable
  1441. {
  1442. get
  1443. {
  1444. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.None))
  1445. {
  1446. if (cardEffect is CannotBlockClass)
  1447. {
  1448. if (cardEffect.EffectName == "Can't Block")
  1449. {
  1450. return true;
  1451. }
  1452. }
  1453. }
  1454. return false;
  1455. }
  1456. }
  1457. #endregion
  1458. #region Has Blocker
  1459. public bool HasBlocker
  1460. {
  1461. get
  1462. {
  1463. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1464. {
  1465. foreach (Permanent permanent in player.GetFieldPermanents())
  1466. {
  1467. #region 場のパーマネントの効果
  1468. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1469. {
  1470. if (cardEffect is IBlockerEffect)
  1471. {
  1472. if (cardEffect.CanTrigger(null))
  1473. {
  1474. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1475. {
  1476. return true;
  1477. }
  1478. }
  1479. }
  1480. }
  1481. #endregion
  1482. }
  1483. #region プレイヤーの効果
  1484. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1485. {
  1486. if (cardEffect is IBlockerEffect)
  1487. {
  1488. if (cardEffect.CanTrigger(null))
  1489. {
  1490. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1491. {
  1492. return true;
  1493. }
  1494. }
  1495. }
  1496. }
  1497. #endregion
  1498. }
  1499. return false;
  1500. }
  1501. }
  1502. #endregion
  1503. #region Has Jamming
  1504. public bool HasJamming
  1505. {
  1506. get
  1507. {
  1508. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1509. {
  1510. foreach (Permanent permanent in player.GetFieldPermanents())
  1511. {
  1512. #region 場のパーマネントの効果
  1513. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1514. {
  1515. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1516. {
  1517. if (cardEffect.CanTrigger(null))
  1518. {
  1519. if (cardEffect.EffectName == "Jamming")
  1520. {
  1521. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1522. {
  1523. return true;
  1524. }
  1525. }
  1526. }
  1527. }
  1528. }
  1529. #endregion
  1530. }
  1531. #region プレイヤーの効果
  1532. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1533. {
  1534. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1535. {
  1536. if (cardEffect.CanTrigger(null))
  1537. {
  1538. if (cardEffect.EffectName == "Jamming")
  1539. {
  1540. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1541. {
  1542. return true;
  1543. }
  1544. }
  1545. }
  1546. }
  1547. }
  1548. #endregion
  1549. }
  1550. return false;
  1551. }
  1552. }
  1553. #endregion
  1554. #region Whether this permanent has Pierce
  1555. public bool HasPierce
  1556. {
  1557. get
  1558. {
  1559. if (IsDigimon)
  1560. {
  1561. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDetermineDoSecurityCheck))
  1562. {
  1563. if (cardEffect is ActivateICardEffect)
  1564. {
  1565. if (cardEffect.CanTrigger(CardEffectCommons.PierceCheckHashtableOfPermanent(this)))
  1566. {
  1567. if (cardEffect.EffectName == "Pierce")
  1568. {
  1569. return true;
  1570. }
  1571. if (cardEffect.EffectName == "Piercing")
  1572. {
  1573. return true;
  1574. }
  1575. }
  1576. }
  1577. }
  1578. }
  1579. return false;
  1580. }
  1581. }
  1582. #endregion
  1583. #region 再起動を持つか
  1584. public bool HasReboot
  1585. {
  1586. get
  1587. {
  1588. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1589. {
  1590. foreach (Permanent permanent in player.GetFieldPermanents())
  1591. {
  1592. #region 場のパーマネントの効果
  1593. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1594. {
  1595. if (cardEffect is IRebootEffect)
  1596. {
  1597. if (cardEffect.CanTrigger(null))
  1598. {
  1599. if (((IRebootEffect)cardEffect).HasReboot(this))
  1600. {
  1601. return true;
  1602. }
  1603. }
  1604. }
  1605. }
  1606. #endregion
  1607. }
  1608. #region プレイヤーの効果
  1609. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1610. {
  1611. if (cardEffect is IRebootEffect)
  1612. {
  1613. if (cardEffect.CanTrigger(null))
  1614. {
  1615. if (((IRebootEffect)cardEffect).HasReboot(this))
  1616. {
  1617. return true;
  1618. }
  1619. }
  1620. }
  1621. }
  1622. #endregion
  1623. }
  1624. return false;
  1625. }
  1626. }
  1627. #endregion
  1628. #region 突進を持つか
  1629. public bool HasRaid
  1630. {
  1631. get
  1632. {
  1633. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1634. {
  1635. if (cardEffect is ActivateICardEffect)
  1636. {
  1637. if (cardEffect.EffectName == "Raid")
  1638. {
  1639. return true;
  1640. }
  1641. }
  1642. }
  1643. return false;
  1644. }
  1645. }
  1646. #endregion
  1647. #region 速攻を持つか
  1648. public bool HasRush
  1649. {
  1650. get
  1651. {
  1652. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1653. {
  1654. foreach (Permanent permanent in player.GetFieldPermanents())
  1655. {
  1656. #region 場のパーマネントの効果
  1657. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1658. {
  1659. if (cardEffect is IRushEffect)
  1660. {
  1661. if (cardEffect.CanTrigger(null))
  1662. {
  1663. if (((IRushEffect)cardEffect).HasRush(this))
  1664. {
  1665. return true;
  1666. }
  1667. }
  1668. }
  1669. }
  1670. #endregion
  1671. }
  1672. #region プレイヤーの効果
  1673. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1674. {
  1675. if (cardEffect is IRushEffect)
  1676. {
  1677. if (cardEffect.CanTrigger(null))
  1678. {
  1679. if (((IRushEffect)cardEffect).HasRush(this))
  1680. {
  1681. return true;
  1682. }
  1683. }
  1684. }
  1685. }
  1686. #endregion
  1687. }
  1688. return false;
  1689. }
  1690. }
  1691. #endregion
  1692. #region 道連れを持つか
  1693. public bool HasRetaliation
  1694. {
  1695. get
  1696. {
  1697. if (RetaliationCount >= 1)
  1698. {
  1699. return true;
  1700. }
  1701. return false;
  1702. }
  1703. }
  1704. #endregion
  1705. #region 道連れを持つ個数
  1706. public int RetaliationCount
  1707. {
  1708. get
  1709. {
  1710. int count = 0;
  1711. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1712. {
  1713. if (cardEffect is ActivateICardEffect)
  1714. {
  1715. if (cardEffect.EffectName == "Retaliation")
  1716. {
  1717. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1718. {
  1719. count++;
  1720. }
  1721. }
  1722. }
  1723. }
  1724. return count;
  1725. }
  1726. }
  1727. #endregion
  1728. #region 不屈を持つか
  1729. public bool HasFortitude
  1730. {
  1731. get
  1732. {
  1733. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1734. {
  1735. if (cardEffect is ActivateICardEffect)
  1736. {
  1737. if (cardEffect.EffectName == "Fortitude")
  1738. {
  1739. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1740. {
  1741. return true;
  1742. }
  1743. }
  1744. }
  1745. }
  1746. return false;
  1747. }
  1748. }
  1749. #endregion
  1750. #region Has Blitz
  1751. public bool HasBlitz
  1752. {
  1753. get
  1754. {
  1755. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnEnterFieldAnyone))
  1756. {
  1757. if (cardEffect is ActivateICardEffect)
  1758. {
  1759. if (cardEffect.CanTrigger(CardEffectCommons.WhenDigivolutionCheckHashtableOfPermanent(this)) || cardEffect.CanTrigger(CardEffectCommons.OnPlayCheckHashtableOfPermanent(this)))
  1760. {
  1761. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  1762. {
  1763. if (cardEffect.EffectDiscription.Contains("Blitz"))
  1764. {
  1765. return true;
  1766. }
  1767. }
  1768. }
  1769. }
  1770. }
  1771. return false;
  1772. }
  1773. }
  1774. #endregion
  1775. #region 回避を持つか
  1776. public bool HasEvade
  1777. {
  1778. get
  1779. {
  1780. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1781. {
  1782. if (cardEffect is ActivateICardEffect)
  1783. {
  1784. Hashtable hashtable = new Hashtable()
  1785. {
  1786. {"Permanents", new List<Permanent>() { this }}
  1787. };
  1788. if (cardEffect.CanTrigger(hashtable))
  1789. {
  1790. if (cardEffect.EffectName == "Evade")
  1791. {
  1792. return true;
  1793. }
  1794. }
  1795. }
  1796. }
  1797. return false;
  1798. }
  1799. }
  1800. #endregion
  1801. #region マインドリンクを持つか
  1802. public bool HasMindLink
  1803. {
  1804. get
  1805. {
  1806. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDeclaration))
  1807. {
  1808. if (cardEffect is ActivateICardEffect)
  1809. {
  1810. if (cardEffect.CanTrigger(null))
  1811. {
  1812. if (!String.IsNullOrEmpty(cardEffect.EffectDiscription))
  1813. {
  1814. if (cardEffect.EffectDiscription.Contains("Mind Link"))
  1815. {
  1816. return true;
  1817. }
  1818. }
  1819. }
  1820. }
  1821. }
  1822. return false;
  1823. }
  1824. }
  1825. #endregion
  1826. #region 防壁を持つか
  1827. public bool HasBarrier
  1828. {
  1829. get
  1830. {
  1831. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1832. {
  1833. if (cardEffect is ActivateICardEffect)
  1834. {
  1835. Hashtable hashtable = new Hashtable();
  1836. hashtable.Add("Permanents", new List<Permanent>() { this });
  1837. hashtable.Add("battle", new IBattle(null, null, null));
  1838. if (cardEffect.CanTrigger(hashtable))
  1839. {
  1840. if (cardEffect.EffectName == "Barrier")
  1841. {
  1842. return true;
  1843. }
  1844. }
  1845. }
  1846. }
  1847. return false;
  1848. }
  1849. }
  1850. #endregion
  1851. #region 連携を持つか
  1852. public bool HasAlliance
  1853. {
  1854. get
  1855. {
  1856. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1857. {
  1858. if (cardEffect is ActivateICardEffect)
  1859. {
  1860. if (cardEffect.EffectName == "Alliance")
  1861. {
  1862. return true;
  1863. }
  1864. }
  1865. }
  1866. return false;
  1867. }
  1868. }
  1869. #endregion
  1870. #region Has Collision
  1871. public bool HasCollision
  1872. {
  1873. get
  1874. {
  1875. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1876. {
  1877. if (cardEffect is ActivateICardEffect)
  1878. {
  1879. if (cardEffect.EffectName == "Collision")
  1880. {
  1881. return true;
  1882. }
  1883. }
  1884. }
  1885. return false;
  1886. }
  1887. }
  1888. #endregion
  1889. #region Has Partition
  1890. public bool HasPartition
  1891. {
  1892. get
  1893. {
  1894. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1895. {
  1896. if (cardEffect is ActivateICardEffect)
  1897. {
  1898. if (cardEffect.EffectName == "Partition")
  1899. {
  1900. return true;
  1901. }
  1902. }
  1903. }
  1904. return false;
  1905. }
  1906. }
  1907. #endregion
  1908. #region 消滅時効化を持つか
  1909. public bool HasOnDeletionEffect
  1910. {
  1911. get
  1912. {
  1913. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1914. {
  1915. if (cardEffect is ActivateICardEffect)
  1916. {
  1917. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1918. {
  1919. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  1920. {
  1921. if (cardEffect.IsOnDeletion)
  1922. {
  1923. return true;
  1924. }
  1925. }
  1926. }
  1927. }
  1928. }
  1929. return false;
  1930. }
  1931. }
  1932. #endregion
  1933. #region バトルしているか
  1934. public IBattle battle { get; set; } = null;
  1935. #endregion
  1936. #region Can Be Destroyed
  1937. public bool CanBeDestroyed()
  1938. {
  1939. #region 消滅しない効果
  1940. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1941. {
  1942. foreach (Permanent permanent in player.GetFieldPermanents())
  1943. {
  1944. #region 場のパーマネントの効果
  1945. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1946. {
  1947. if (cardEffect is ICanNotBeDestroyedEffect)
  1948. {
  1949. if (cardEffect.CanUse(null))
  1950. {
  1951. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  1952. {
  1953. return false;
  1954. }
  1955. }
  1956. }
  1957. }
  1958. #endregion
  1959. }
  1960. #region プレイヤーの効果
  1961. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1962. {
  1963. if (cardEffect is ICanNotBeDestroyedEffect)
  1964. {
  1965. if (cardEffect.CanUse(null))
  1966. {
  1967. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  1968. {
  1969. return false;
  1970. }
  1971. }
  1972. }
  1973. }
  1974. #endregion
  1975. }
  1976. #endregion
  1977. return true;
  1978. }
  1979. #endregion
  1980. #region このデジモンが戦闘によって消滅するか
  1981. public bool CanBeDestroyedByBattle(Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  1982. {
  1983. if (!CanBeDestroyed())
  1984. {
  1985. return false;
  1986. }
  1987. if (!CanBeRemoved())
  1988. return false;
  1989. #region 戦闘で消滅しない効果
  1990. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1991. {
  1992. foreach (Permanent permanent in player.GetFieldPermanents())
  1993. {
  1994. #region 場のパーマネントの効果
  1995. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1996. {
  1997. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1998. {
  1999. if (cardEffect.CanUse(null))
  2000. {
  2001. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2002. {
  2003. return false;
  2004. }
  2005. }
  2006. }
  2007. }
  2008. #endregion
  2009. }
  2010. #region プレイヤーの効果
  2011. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2012. {
  2013. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2014. {
  2015. if (cardEffect.CanUse(null))
  2016. {
  2017. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2018. {
  2019. return false;
  2020. }
  2021. }
  2022. }
  2023. }
  2024. #endregion
  2025. }
  2026. #endregion
  2027. return true;
  2028. }
  2029. #endregion
  2030. #region このパーマネントが効果で消滅するか
  2031. public bool CanBeDestroyedBySkill(ICardEffect cardEffect)
  2032. {
  2033. if (this.TopCard != null)
  2034. {
  2035. if (this.TopCard.CanNotBeAffected(cardEffect))
  2036. {
  2037. return false;
  2038. }
  2039. if (!CanBeDestroyed())
  2040. {
  2041. return false;
  2042. }
  2043. if (!CanBeRemoved())
  2044. return false;
  2045. #region 効果で消滅しない効果
  2046. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2047. {
  2048. foreach (Permanent permanent in player.GetFieldPermanents())
  2049. {
  2050. #region 場のパーマネントの効果
  2051. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  2052. {
  2053. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2054. {
  2055. if (cardEffect1.CanUse(null))
  2056. {
  2057. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2058. {
  2059. return false;
  2060. }
  2061. }
  2062. }
  2063. }
  2064. #endregion
  2065. }
  2066. #region プレイヤーの効果
  2067. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  2068. {
  2069. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2070. {
  2071. if (cardEffect1.CanUse(null))
  2072. {
  2073. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2074. {
  2075. return false;
  2076. }
  2077. }
  2078. }
  2079. }
  2080. #endregion
  2081. }
  2082. #endregion
  2083. }
  2084. return true;
  2085. }
  2086. #endregion
  2087. #region Can Leave Field
  2088. public bool CanBeRemoved()
  2089. {
  2090. #region Effect that never disappears
  2091. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2092. {
  2093. foreach (Permanent permanent in player.GetFieldPermanents())
  2094. {
  2095. #region Effects of permanents in play
  2096. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2097. {
  2098. if (cardEffect is ICanNotBeRemovedEffect)
  2099. {
  2100. if (cardEffect.CanUse(null))
  2101. {
  2102. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2103. {
  2104. return false;
  2105. }
  2106. }
  2107. }
  2108. }
  2109. #endregion
  2110. }
  2111. #region player effect
  2112. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2113. {
  2114. if (cardEffect is ICanNotBeRemovedEffect)
  2115. {
  2116. if (cardEffect.CanUse(null))
  2117. {
  2118. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2119. {
  2120. return false;
  2121. }
  2122. }
  2123. }
  2124. }
  2125. #endregion
  2126. }
  2127. #endregion
  2128. return true;
  2129. }
  2130. #endregion
  2131. #region トークンかどうか
  2132. public bool IsToken
  2133. {
  2134. get
  2135. {
  2136. if (TopCard != null)
  2137. {
  2138. if (TopCard.IsToken)
  2139. {
  2140. return true;
  2141. }
  2142. }
  2143. return false;
  2144. }
  2145. }
  2146. #endregion
  2147. #region そのパーマネントが消滅・バウンス待機状態か
  2148. public bool willBeRemoveField { get; set; } = false;
  2149. #endregion
  2150. #region このパーマネントがデジモンか
  2151. public bool IsDigimon
  2152. {
  2153. get
  2154. {
  2155. if (TopCard != null)
  2156. {
  2157. if (TopCard.IsDigimon || TopCard.IsDigiEgg)
  2158. {
  2159. return true;
  2160. }
  2161. #region Effect of treating it as a Digimon
  2162. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2163. {
  2164. foreach (Permanent permanent in player.GetFieldPermanents())
  2165. {
  2166. #region Effects of permanents in play
  2167. foreach (ICardEffect cardEffect in permanent.EffectList_Added(EffectTiming.None))
  2168. {
  2169. if (cardEffect is ITreatAsDigimonEffect)
  2170. {
  2171. if (cardEffect.CanTrigger(null))
  2172. {
  2173. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2174. {
  2175. return true;
  2176. }
  2177. }
  2178. }
  2179. }
  2180. #endregion
  2181. }
  2182. #region player effect
  2183. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2184. {
  2185. if (cardEffect is ITreatAsDigimonEffect)
  2186. {
  2187. if (cardEffect.CanTrigger(null))
  2188. {
  2189. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2190. {
  2191. return true;
  2192. }
  2193. }
  2194. }
  2195. }
  2196. #endregion
  2197. }
  2198. #endregion
  2199. }
  2200. return false;
  2201. }
  2202. }
  2203. #endregion
  2204. #region このパーマネントがテイマーか
  2205. public bool IsTamer
  2206. {
  2207. get
  2208. {
  2209. if (TopCard != null)
  2210. {
  2211. if (TopCard.IsTamer)
  2212. {
  2213. return true;
  2214. }
  2215. }
  2216. return false;
  2217. }
  2218. }
  2219. #endregion
  2220. #region ジョグレスで扱うレベル
  2221. public List<int> Levels_ForJogress(CardSource cardSource)
  2222. {
  2223. List<int> levels = new List<int>();
  2224. if (cardSource != null)
  2225. {
  2226. if (cardSource.HasLevel)
  2227. {
  2228. levels.Add(this.Level);
  2229. }
  2230. #region "ジョグレス進化で扱うレベルを追加する"効果
  2231. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2232. {
  2233. foreach (Permanent permanent in player.GetFieldPermanents())
  2234. {
  2235. #region 場のパーマネントの効果
  2236. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2237. {
  2238. if (cardEffect is IAddJogressLevelsEffect)
  2239. {
  2240. if (cardEffect.CanUse(null))
  2241. {
  2242. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2243. {
  2244. levels.Add(level);
  2245. }
  2246. }
  2247. }
  2248. }
  2249. #endregion
  2250. }
  2251. #region プレイヤーの効果
  2252. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2253. {
  2254. if (cardEffect is IAddJogressLevelsEffect)
  2255. {
  2256. if (cardEffect.CanUse(null))
  2257. {
  2258. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2259. {
  2260. levels.Add(level);
  2261. }
  2262. }
  2263. }
  2264. }
  2265. #endregion
  2266. }
  2267. #endregion
  2268. }
  2269. return levels;
  2270. }
  2271. #endregion
  2272. #region バトルで消滅したか
  2273. public bool IsDestroyedByBattle { get; set; } = false;
  2274. #endregion
  2275. #region 消滅に使用された効果
  2276. public ICardEffect DestroyingEffect { get; set; } = null;
  2277. #endregion
  2278. #region 他のパーマネントの下に置くのに使用された効果
  2279. public ICardEffect PlaceOtherPermanentEffect { get; set; } = null;
  2280. #endregion
  2281. #region 手札バウンス に使用された効果
  2282. public ICardEffect HandBounceEffect { get; set; } = null;
  2283. #endregion
  2284. #region 山札バウンス に使用された効果
  2285. public ICardEffect LibraryBounceEffect { get; set; } = null;
  2286. #endregion
  2287. #region 登場に使用された効果
  2288. public ICardEffect PlayingEffect { get; set; } = null;
  2289. #endregion
  2290. #region 進化に使用された効果
  2291. public ICardEffect DigivolvingEffect { get; set; } = null;
  2292. #endregion
  2293. #region Whether this digimon is placed in the trash by not having a DP
  2294. public bool IsPlaceToTrashDueToNotHavingDP { get; set; } = true;
  2295. #endregion
  2296. #region Whether this permanent can suspend
  2297. public bool CanSuspend
  2298. {
  2299. get
  2300. {
  2301. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  2302. {
  2303. #region Effects of field permanents
  2304. foreach (Permanent permanent in player.GetFieldPermanents())
  2305. {
  2306. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2307. {
  2308. if (cardEffect is ICanNotSuspendEffect)
  2309. {
  2310. if (cardEffect.CanUse(null))
  2311. {
  2312. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2313. {
  2314. return false;
  2315. }
  2316. }
  2317. }
  2318. }
  2319. }
  2320. #endregion
  2321. #region Effects of players
  2322. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2323. {
  2324. if (cardEffect is ICanNotSuspendEffect)
  2325. {
  2326. if (cardEffect.CanUse(null))
  2327. {
  2328. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2329. {
  2330. return false;
  2331. }
  2332. }
  2333. }
  2334. }
  2335. #endregion
  2336. }
  2337. return true;
  2338. }
  2339. }
  2340. #endregion
  2341. #region このデジモンのアタックの対象が変更できるか
  2342. public bool CanSwitchAttackTarget
  2343. {
  2344. get
  2345. {
  2346. #region アタックの対象が変更できない効果
  2347. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2348. {
  2349. foreach (Permanent permanent in player.GetFieldPermanents())
  2350. {
  2351. #region 場のパーマネントの効果
  2352. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2353. {
  2354. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2355. {
  2356. if (cardEffect.CanUse(null))
  2357. {
  2358. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2359. {
  2360. return false;
  2361. }
  2362. }
  2363. }
  2364. }
  2365. #endregion
  2366. }
  2367. #region プレイヤーの効果
  2368. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2369. {
  2370. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2371. {
  2372. if (cardEffect.CanUse(null))
  2373. {
  2374. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2375. {
  2376. return false;
  2377. }
  2378. }
  2379. }
  2380. }
  2381. #endregion
  2382. }
  2383. #endregion
  2384. return true;
  2385. }
  2386. }
  2387. #endregion
  2388. #region このデジモンを場からデジクロス条件の代わりにできるか
  2389. public bool CanSubstituteForDigiXrosCondition(CardSource cardSource)
  2390. {
  2391. #region デジクロス条件の代わりにできる効果
  2392. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2393. {
  2394. foreach (Permanent permanent in player.GetFieldPermanents())
  2395. {
  2396. #region 場のパーマネントの効果
  2397. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2398. {
  2399. if (cardEffect is ICanSelectDigiXrosEffect)
  2400. {
  2401. if (cardEffect.CanUse(null))
  2402. {
  2403. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  2404. {
  2405. return true;
  2406. }
  2407. }
  2408. }
  2409. }
  2410. #endregion
  2411. }
  2412. #region プレイヤーの効果
  2413. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2414. {
  2415. if (cardEffect is ICanSelectDigiXrosEffect)
  2416. {
  2417. if (cardEffect.CanUse(null))
  2418. {
  2419. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  2420. {
  2421. return true;
  2422. }
  2423. }
  2424. }
  2425. }
  2426. #endregion
  2427. }
  2428. #endregion
  2429. return false;
  2430. }
  2431. #endregion
  2432. #region 登場した直後のLevel
  2433. public int LevelJustAfterPlayed { get; set; } = -1;
  2434. #endregion
  2435. #region 登場した直後のPlay Cost
  2436. public int PlayCostJustAfterPlayed { get; set; } = -1;
  2437. #endregion
  2438. #region 登場した直後のCardNames
  2439. public List<string> CardNamesJustAfterPlayed { get; set; } = new List<string>();
  2440. #endregion
  2441. #region 進化した直後のCardNames
  2442. public List<string> CardNamesJustAfterDigivolved { get; set; } = new List<string>();
  2443. #endregion
  2444. #region 登場した直後のTraits
  2445. public List<string> TraitsJustAfterPlayed { get; set; } = new List<string>();
  2446. #endregion
  2447. #region 場を離れる直前のDP
  2448. public int DPJustBeforeRemoveField { get; set; } = -1;
  2449. #endregion
  2450. #region 場を離れる直前のLevel
  2451. public int LevelJustBeforeRemoveField { get; set; } = -1;
  2452. #endregion
  2453. #region 場を離れる直前のCost
  2454. public int CostJustBeforeRemoveField { get; set; } = -1;
  2455. #endregion
  2456. #region 場を離れる直前のカード名
  2457. public List<string> CardNamesJustBeforeRemoveField { get; set; } = new List<string>();
  2458. #endregion
  2459. #region バースト進化で手札に戻ったか
  2460. public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
  2461. #endregion
  2462. #region バースト進化したか
  2463. public bool IsBurstDigivolved { get; set; } = false;
  2464. #endregion
  2465. #region 効果で場に出たオプションか
  2466. public bool IsPlayedOptionPermanent { get; set; } = false;
  2467. #endregion
  2468. #region 進化元を持たないか
  2469. public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
  2470. #endregion
  2471. #region Digivolution cards' colors
  2472. public List<CardColor> DigivolutionCardsColors
  2473. {
  2474. get
  2475. {
  2476. List<CardColor> cardColors = new List<CardColor>();
  2477. foreach (CardSource cardSource in DigivolutionCards)
  2478. {
  2479. foreach (CardColor cardColor in cardSource.CardColors)
  2480. {
  2481. if (!cardColors.Contains(cardColor))
  2482. {
  2483. cardColors.Add(cardColor);
  2484. }
  2485. }
  2486. }
  2487. return cardColors.Distinct().ToList();
  2488. }
  2489. }
  2490. #endregion
  2491. #region Show "Unsuspend" effect object
  2492. public void ShowUnsuspendEffect()
  2493. {
  2494. if (TopCard != null)
  2495. {
  2496. if (ShowingPermanentCard != null)
  2497. {
  2498. if (ShowingPermanentCard.WillUntapObject != null)
  2499. {
  2500. ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
  2501. ShowingPermanentCard.WillUntapObject.SetActive(true);
  2502. }
  2503. }
  2504. }
  2505. }
  2506. #endregion
  2507. #region Show "Return to deck" effect object
  2508. public void ShowDeckBounceEffect()
  2509. {
  2510. if (TopCard != null)
  2511. {
  2512. if (willBeRemoveField)
  2513. {
  2514. if (ShowingPermanentCard != null)
  2515. {
  2516. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2517. {
  2518. ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
  2519. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
  2520. }
  2521. }
  2522. }
  2523. }
  2524. }
  2525. #endregion
  2526. #region Hide "Return to deck" effect object
  2527. public void HideDeckBounceEffect()
  2528. {
  2529. if (TopCard != null)
  2530. {
  2531. if (ShowingPermanentCard != null)
  2532. {
  2533. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2534. {
  2535. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
  2536. }
  2537. }
  2538. }
  2539. }
  2540. #endregion
  2541. #region Show "Return to hand" effect object
  2542. public void ShowHandBounceEffect()
  2543. {
  2544. if (TopCard != null)
  2545. {
  2546. if (willBeRemoveField)
  2547. {
  2548. if (ShowingPermanentCard != null)
  2549. {
  2550. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2551. {
  2552. ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
  2553. ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
  2554. }
  2555. }
  2556. }
  2557. }
  2558. }
  2559. #endregion
  2560. #region Hide "Return to hand" effect object
  2561. public void HideHandBounceEffect()
  2562. {
  2563. if (TopCard != null)
  2564. {
  2565. if (ShowingPermanentCard != null)
  2566. {
  2567. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2568. {
  2569. ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
  2570. }
  2571. }
  2572. }
  2573. }
  2574. #endregion
  2575. #region Show "Delete" effect object
  2576. public void ShowDeleteEffect()
  2577. {
  2578. if (TopCard != null)
  2579. {
  2580. if (willBeRemoveField)
  2581. {
  2582. if (ShowingPermanentCard != null)
  2583. {
  2584. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2585. {
  2586. ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
  2587. ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
  2588. }
  2589. }
  2590. }
  2591. }
  2592. }
  2593. #endregion
  2594. #region Hide "Delete" effect object
  2595. public void HideDeleteEffect()
  2596. {
  2597. if (TopCard != null)
  2598. {
  2599. if (ShowingPermanentCard != null)
  2600. {
  2601. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2602. {
  2603. ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  2604. }
  2605. }
  2606. }
  2607. }
  2608. #endregion
  2609. #region Show "Remove Field" effect object
  2610. public void ShowWillRemoveFieldEffect()
  2611. {
  2612. if (TopCard != null)
  2613. {
  2614. if (willBeRemoveField)
  2615. {
  2616. if (ShowingPermanentCard != null)
  2617. {
  2618. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2619. {
  2620. ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
  2621. ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
  2622. }
  2623. }
  2624. }
  2625. }
  2626. }
  2627. #endregion
  2628. #region Hide "Remove Field" effect object
  2629. public void HideWillRemoveFieldEffect()
  2630. {
  2631. if (TopCard != null)
  2632. {
  2633. if (ShowingPermanentCard != null)
  2634. {
  2635. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2636. {
  2637. ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
  2638. }
  2639. }
  2640. }
  2641. }
  2642. #endregion
  2643. #region Show "Digivolution" effect object
  2644. public void ShowWillEvolutionEffect()
  2645. {
  2646. if (TopCard != null)
  2647. {
  2648. if (ShowingPermanentCard != null)
  2649. {
  2650. if (ShowingPermanentCard.WillEvolutionObject != null)
  2651. {
  2652. ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
  2653. ShowingPermanentCard.WillEvolutionObject.SetActive(true);
  2654. }
  2655. }
  2656. }
  2657. }
  2658. #endregion
  2659. #region Hide "Digivolution" effect object
  2660. public void HideWillEvolutionEffect()
  2661. {
  2662. if (TopCard != null)
  2663. {
  2664. if (ShowingPermanentCard != null)
  2665. {
  2666. if (ShowingPermanentCard.WillEvolutionObject != null)
  2667. {
  2668. ShowingPermanentCard.WillEvolutionObject.SetActive(false);
  2669. }
  2670. }
  2671. }
  2672. }
  2673. #endregion
  2674. }