Permanent.cs 100 KB

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