Permanent.cs 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124
  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 Number of sheets to undergo security check
  917. public int InvertSecutiryValue
  918. {
  919. get
  920. {
  921. int Invert = 0;
  922. List<ICardEffect> cardEffects_InvertStrike = 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 Effects of permanents in play
  928. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  929. {
  930. if (cardEffect is IInvertSAttackEffect)
  931. {
  932. if (cardEffect.CanUse(null))
  933. {
  934. if (!TopCard.CanNotBeAffected(cardEffect))
  935. {
  936. cardEffects_InvertStrike.Add(cardEffect);
  937. }
  938. }
  939. }
  940. }
  941. #endregion
  942. }
  943. #region player effect
  944. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  945. {
  946. if (cardEffect is IInvertSAttackEffect)
  947. {
  948. if (cardEffect.CanUse(null))
  949. {
  950. if (!TopCard.CanNotBeAffected(cardEffect))
  951. {
  952. cardEffects_InvertStrike.Add(cardEffect);
  953. }
  954. }
  955. }
  956. }
  957. #endregion
  958. }
  959. foreach (ICardEffect cardEffect in cardEffects_InvertStrike)
  960. {
  961. Invert = ((IInvertSAttackEffect)cardEffect).InversionValue(this, Invert);
  962. }
  963. return Mathf.Clamp(Invert,-1,1);
  964. }
  965. }
  966. public List<int> SecurityAttackChanges
  967. {
  968. get
  969. {
  970. List<int> SecurityAttackChanges = new List<int>();
  971. int Strike = 1;
  972. List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
  973. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  974. {
  975. foreach (Permanent permanent in player.GetFieldPermanents())
  976. {
  977. #region 場のパーマネントの効果
  978. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  979. {
  980. if (cardEffect is IChangeSAttackEffect)
  981. {
  982. if (cardEffect.CanUse(null))
  983. {
  984. if (!TopCard.CanNotBeAffected(cardEffect))
  985. {
  986. if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
  987. {
  988. cardEffects_ChangeDirectStrike.Add(cardEffect);
  989. }
  990. }
  991. }
  992. }
  993. }
  994. #endregion
  995. }
  996. #region プレイヤーの効果
  997. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  998. {
  999. if (cardEffect is IChangeSAttackEffect)
  1000. {
  1001. if (cardEffect.CanUse(null))
  1002. {
  1003. if (!TopCard.CanNotBeAffected(cardEffect))
  1004. {
  1005. if (((IChangeSAttackEffect)cardEffect).isUpDown() == CalculateOrder.UpDownValue)
  1006. {
  1007. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1008. }
  1009. }
  1010. }
  1011. }
  1012. }
  1013. #endregion
  1014. }
  1015. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
  1016. {
  1017. if (cardEffect is IChangeSAttackEffect)
  1018. {
  1019. if (cardEffect.CanUse(null))
  1020. {
  1021. int Strike1 = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, 0);
  1022. if (Strike1 != Strike)
  1023. {
  1024. SecurityAttackChanges.Add(Strike1 - Strike);
  1025. }
  1026. }
  1027. }
  1028. }
  1029. return SecurityAttackChanges;
  1030. }
  1031. }
  1032. public bool HasSecurityAttackChanges
  1033. {
  1034. get
  1035. {
  1036. if (!IsDigimon)
  1037. {
  1038. return false;
  1039. }
  1040. return SecurityAttackChanges.Count >= 1;
  1041. }
  1042. }
  1043. public int Strike_AllowMinus
  1044. {
  1045. get
  1046. {
  1047. int Strike = 1;
  1048. #region Effect of changing the number of sheets to undergo security check
  1049. List<ICardEffect> cardEffects_ChangeDirectStrike = new List<ICardEffect>();
  1050. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1051. {
  1052. foreach (Permanent permanent in player.GetFieldPermanents())
  1053. {
  1054. #region Effects of permanents in play
  1055. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1056. {
  1057. if (cardEffect is IChangeSAttackEffect)
  1058. {
  1059. if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
  1060. {
  1061. if (cardEffect.CanUse(null))
  1062. {
  1063. if (!TopCard.CanNotBeAffected(cardEffect))
  1064. {
  1065. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1066. }
  1067. }
  1068. }
  1069. }
  1070. }
  1071. #endregion
  1072. }
  1073. #region player effect
  1074. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1075. {
  1076. if (cardEffect is IChangeSAttackEffect)
  1077. {
  1078. if (((IChangeSAttackEffect)cardEffect).PermanentCondition(this))
  1079. {
  1080. if (cardEffect.CanUse(null))
  1081. {
  1082. if (!TopCard.CanNotBeAffected(cardEffect))
  1083. {
  1084. cardEffects_ChangeDirectStrike.Add(cardEffect);
  1085. }
  1086. }
  1087. }
  1088. }
  1089. }
  1090. #endregion
  1091. }
  1092. List<ICardEffect> cardEffects_ChangeDirectStrike_UpToConstant = new List<ICardEffect>();
  1093. List<ICardEffect> cardEffects_ChangeDirectStrike_UpDownValue = new List<ICardEffect>();
  1094. List<ICardEffect> cardEffects_ChangeDirectStrike_DownToConstant = new List<ICardEffect>();
  1095. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike)
  1096. {
  1097. if (cardEffect is IChangeSAttackEffect)
  1098. {
  1099. if (cardEffect.CanUse(null))
  1100. {
  1101. switch (((IChangeSAttackEffect)cardEffect).isUpDown())
  1102. {
  1103. case CalculateOrder.UpToConstant:
  1104. cardEffects_ChangeDirectStrike_UpToConstant.Add(cardEffect);
  1105. break;
  1106. case CalculateOrder.UpDownValue:
  1107. cardEffects_ChangeDirectStrike_UpDownValue.Add(cardEffect);
  1108. break;
  1109. case CalculateOrder.DownToConstant:
  1110. cardEffects_ChangeDirectStrike_DownToConstant.Add(cardEffect);
  1111. break;
  1112. }
  1113. }
  1114. }
  1115. }
  1116. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpToConstant)
  1117. {
  1118. if (cardEffect is IChangeSAttackEffect)
  1119. {
  1120. if (cardEffect.CanUse(null))
  1121. {
  1122. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
  1123. }
  1124. }
  1125. }
  1126. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_UpDownValue)
  1127. {
  1128. if (cardEffect is IChangeSAttackEffect)
  1129. {
  1130. if (cardEffect.CanUse(null))
  1131. {
  1132. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
  1133. }
  1134. }
  1135. }
  1136. foreach (ICardEffect cardEffect in cardEffects_ChangeDirectStrike_DownToConstant)
  1137. {
  1138. if (cardEffect is IChangeSAttackEffect)
  1139. {
  1140. if (cardEffect.CanUse(null))
  1141. {
  1142. Strike = ((IChangeSAttackEffect)cardEffect).GetSAttack(Strike, this, InvertSecutiryValue);
  1143. }
  1144. }
  1145. }
  1146. #endregion
  1147. return Strike;
  1148. }
  1149. }
  1150. public int Strike
  1151. {
  1152. get
  1153. {
  1154. int Strike = Strike_AllowMinus;
  1155. if (Strike < 0)
  1156. {
  1157. Strike = 0;
  1158. }
  1159. return Strike;
  1160. }
  1161. }
  1162. #endregion
  1163. #region このパーマネントがタップされているかどうか
  1164. public bool OldIsSuspended = false;
  1165. public bool IsSuspended = false;
  1166. public int DPWhenSuspended = 114514;
  1167. #endregion
  1168. #region Whether this permanent can unsuspend
  1169. public bool CanUnsuspend
  1170. {
  1171. get
  1172. {
  1173. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1174. {
  1175. #region Effects of field permanents
  1176. foreach (Permanent permanent in player.GetFieldPermanents())
  1177. {
  1178. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1179. {
  1180. if (cardEffect is ICanNotUnsuspendEffect)
  1181. {
  1182. if (cardEffect.CanUse(null))
  1183. {
  1184. if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
  1185. {
  1186. return false;
  1187. }
  1188. }
  1189. }
  1190. }
  1191. }
  1192. #endregion
  1193. #region Effects of players
  1194. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1195. {
  1196. if (cardEffect is ICanNotUnsuspendEffect)
  1197. {
  1198. if (cardEffect.CanUse(null))
  1199. {
  1200. if (((ICanNotUnsuspendEffect)cardEffect).CanNotUnsuspend(this))
  1201. {
  1202. return false;
  1203. }
  1204. }
  1205. }
  1206. }
  1207. #endregion
  1208. }
  1209. return true;
  1210. }
  1211. }
  1212. #endregion
  1213. #region このパーマネントが移動できるかどうか
  1214. public bool CanMove
  1215. {
  1216. get
  1217. {
  1218. if (TopCard != null)
  1219. {
  1220. if (!TopCard.Owner.GetBreedingAreaPermanents().Contains(this))
  1221. {
  1222. return false;
  1223. }
  1224. if (!IsDigimon)
  1225. {
  1226. return false;
  1227. }
  1228. if (DP <= 0)
  1229. {
  1230. return false;
  1231. }
  1232. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) == 0)
  1233. {
  1234. return false;
  1235. }
  1236. }
  1237. else
  1238. {
  1239. return false;
  1240. }
  1241. return true;
  1242. }
  1243. }
  1244. #endregion
  1245. #region このパーマネントが攻撃できるかどうか
  1246. public bool CanAttack(ICardEffect cardEffect, bool withoutTap = false)
  1247. {
  1248. // can not attack with empty cards
  1249. if (TopCard == null)
  1250. {
  1251. return false;
  1252. }
  1253. // can not attack during opponent's turn
  1254. if (TopCard.Owner != GManager.instance.turnStateMachine.gameContext.TurnPlayer)
  1255. {
  1256. return false;
  1257. }
  1258. // can not attack to player
  1259. if (!CanAttackTargetDigimon(null, cardEffect, withoutTap))
  1260. {
  1261. // can not attack to opponent's Digimon
  1262. if (TopCard.Owner.Enemy.GetFieldPermanents().Count((permanent) => CanAttackTargetDigimon(permanent, cardEffect, withoutTap)) == 0)
  1263. {
  1264. return false;
  1265. }
  1266. }
  1267. return true;
  1268. }
  1269. #endregion
  1270. #region このパーマネントが対象の攻撃パーマネントをブロックできるかどうか
  1271. public bool CanBlock(Permanent AttackingPermanent)
  1272. {
  1273. if (TopCard == null)
  1274. {
  1275. return false;
  1276. }
  1277. if (!IsDigimon)
  1278. {
  1279. return false;
  1280. }
  1281. if (IsSuspended)
  1282. {
  1283. return false;
  1284. }
  1285. if (!CanSuspend)
  1286. {
  1287. return false;
  1288. }
  1289. if (PermanentFrame != null)
  1290. {
  1291. if (!PermanentFrame.IsBattleAreaFrame())
  1292. {
  1293. return false;
  1294. }
  1295. }
  1296. #region "Unblockable" effect
  1297. #region Effects of permanents in play
  1298. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1299. {
  1300. foreach (Permanent permanent in player.GetFieldPermanents())
  1301. {
  1302. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1303. {
  1304. if (cardEffect is ICannotBlockEffect)
  1305. {
  1306. if (cardEffect.CanUse(null))
  1307. {
  1308. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1309. {
  1310. return false;
  1311. }
  1312. }
  1313. }
  1314. }
  1315. }
  1316. }
  1317. #endregion
  1318. #region player effect
  1319. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1320. {
  1321. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1322. {
  1323. if (cardEffect is ICannotBlockEffect)
  1324. {
  1325. if (cardEffect.CanUse(null))
  1326. {
  1327. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1328. {
  1329. if (!TopCard.CanNotBeAffected(cardEffect))
  1330. {
  1331. return false;
  1332. }
  1333. }
  1334. }
  1335. }
  1336. }
  1337. }
  1338. #endregion
  1339. #endregion
  1340. return true;
  1341. }
  1342. #endregion
  1343. #region 対象のパーマネントを攻撃できるか
  1344. public bool CanAttackTargetDigimon(Permanent Defender, ICardEffect cardEffect, bool withoutTap = false)
  1345. {
  1346. if (TopCard != null)
  1347. {
  1348. if (!IsDigimon)
  1349. {
  1350. return false;
  1351. }
  1352. if (!withoutTap)
  1353. {
  1354. if (IsSuspended)
  1355. {
  1356. return false;
  1357. }
  1358. if (!CanSuspend)
  1359. {
  1360. return false;
  1361. }
  1362. }
  1363. if (PermanentFrame != null)
  1364. {
  1365. if (!PermanentFrame.IsBattleAreaFrame())
  1366. {
  1367. return false;
  1368. }
  1369. }
  1370. if (EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  1371. {
  1372. if (!HasRush)
  1373. {
  1374. return false;
  1375. }
  1376. }
  1377. #region 「対象の防御パーマネントを攻撃できない」効果
  1378. #region 場のパーマネントの効果
  1379. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1380. {
  1381. foreach (Permanent permanent in player.GetFieldPermanents())
  1382. {
  1383. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1384. {
  1385. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1386. {
  1387. if (cardEffect1.CanUse(null))
  1388. {
  1389. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1390. {
  1391. if (!TopCard.CanNotBeAffected(cardEffect1))
  1392. {
  1393. return false;
  1394. }
  1395. }
  1396. }
  1397. }
  1398. }
  1399. }
  1400. }
  1401. #endregion
  1402. #region プレイヤーの効果
  1403. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1404. {
  1405. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1406. {
  1407. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1408. {
  1409. if (cardEffect1.CanUse(null))
  1410. {
  1411. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1412. {
  1413. if (!TopCard.CanNotBeAffected(cardEffect1))
  1414. {
  1415. return false;
  1416. }
  1417. }
  1418. }
  1419. }
  1420. }
  1421. }
  1422. #endregion
  1423. #endregion
  1424. if (Defender != null)
  1425. {
  1426. if (Defender.TopCard != null)
  1427. {
  1428. if (Defender.TopCard.Owner == TopCard.Owner.Enemy)
  1429. {
  1430. if (Defender.IsDigimon && Defender.TopCard.Owner.GetBattleAreaPermanents().Contains(Defender))
  1431. {
  1432. if (Defender.IsSuspended)
  1433. {
  1434. return true;
  1435. }
  1436. #region 「対象の防御パーマネントを攻撃できる」効果
  1437. #region 場のパーマネントの効果
  1438. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1439. {
  1440. foreach (Permanent permanent in player.GetFieldPermanents())
  1441. {
  1442. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1443. {
  1444. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1445. {
  1446. if (cardEffect1.CanUse(null))
  1447. {
  1448. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1449. {
  1450. return true;
  1451. }
  1452. }
  1453. }
  1454. }
  1455. }
  1456. }
  1457. #endregion
  1458. #region プレイヤーの効果
  1459. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1460. {
  1461. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1462. {
  1463. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1464. {
  1465. if (cardEffect1.CanUse(null))
  1466. {
  1467. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1468. {
  1469. return true;
  1470. }
  1471. }
  1472. }
  1473. }
  1474. }
  1475. #endregion
  1476. #endregion
  1477. }
  1478. }
  1479. }
  1480. }
  1481. else
  1482. {
  1483. return true;
  1484. }
  1485. }
  1486. return false;
  1487. }
  1488. #endregion
  1489. #region Is Unblockable
  1490. public bool IsUnblockable
  1491. {
  1492. get
  1493. {
  1494. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.None))
  1495. {
  1496. if (cardEffect is CannotBlockClass)
  1497. {
  1498. if (cardEffect.EffectName == "Can't Block")
  1499. {
  1500. return true;
  1501. }
  1502. }
  1503. }
  1504. return false;
  1505. }
  1506. }
  1507. #endregion
  1508. #region Has Blocker
  1509. public bool HasBlocker
  1510. {
  1511. get
  1512. {
  1513. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1514. {
  1515. foreach (Permanent permanent in player.GetFieldPermanents())
  1516. {
  1517. #region 場のパーマネントの効果
  1518. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1519. {
  1520. if (cardEffect is IBlockerEffect)
  1521. {
  1522. if (cardEffect.CanTrigger(null))
  1523. {
  1524. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1525. {
  1526. return true;
  1527. }
  1528. }
  1529. }
  1530. }
  1531. #endregion
  1532. }
  1533. #region プレイヤーの効果
  1534. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1535. {
  1536. if (cardEffect is IBlockerEffect)
  1537. {
  1538. if (cardEffect.CanTrigger(null))
  1539. {
  1540. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1541. {
  1542. return true;
  1543. }
  1544. }
  1545. }
  1546. }
  1547. #endregion
  1548. }
  1549. return false;
  1550. }
  1551. }
  1552. #endregion
  1553. #region Has Jamming
  1554. public bool HasJamming
  1555. {
  1556. get
  1557. {
  1558. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1559. {
  1560. foreach (Permanent permanent in player.GetFieldPermanents())
  1561. {
  1562. #region 場のパーマネントの効果
  1563. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1564. {
  1565. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1566. {
  1567. if (cardEffect.CanTrigger(null))
  1568. {
  1569. if (cardEffect.EffectName == "Jamming")
  1570. {
  1571. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1572. {
  1573. return true;
  1574. }
  1575. }
  1576. }
  1577. }
  1578. }
  1579. #endregion
  1580. }
  1581. #region プレイヤーの効果
  1582. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1583. {
  1584. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1585. {
  1586. if (cardEffect.CanTrigger(null))
  1587. {
  1588. if (cardEffect.EffectName == "Jamming")
  1589. {
  1590. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1591. {
  1592. return true;
  1593. }
  1594. }
  1595. }
  1596. }
  1597. }
  1598. #endregion
  1599. }
  1600. return false;
  1601. }
  1602. }
  1603. #endregion
  1604. #region Whether this permanent has Pierce
  1605. public bool HasPierce
  1606. {
  1607. get
  1608. {
  1609. if (IsDigimon)
  1610. {
  1611. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDetermineDoSecurityCheck))
  1612. {
  1613. if (cardEffect is ActivateICardEffect)
  1614. {
  1615. if (cardEffect.CanTrigger(CardEffectCommons.PierceCheckHashtableOfPermanent(this)))
  1616. {
  1617. if (cardEffect.EffectName == "Pierce")
  1618. {
  1619. return true;
  1620. }
  1621. if (cardEffect.EffectName == "Piercing")
  1622. {
  1623. return true;
  1624. }
  1625. }
  1626. }
  1627. }
  1628. }
  1629. return false;
  1630. }
  1631. }
  1632. #endregion
  1633. #region 再起動を持つか
  1634. public bool HasReboot
  1635. {
  1636. get
  1637. {
  1638. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1639. {
  1640. foreach (Permanent permanent in player.GetFieldPermanents())
  1641. {
  1642. #region 場のパーマネントの効果
  1643. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1644. {
  1645. if (cardEffect is IRebootEffect)
  1646. {
  1647. if (cardEffect.CanTrigger(null))
  1648. {
  1649. if (((IRebootEffect)cardEffect).HasReboot(this))
  1650. {
  1651. return true;
  1652. }
  1653. }
  1654. }
  1655. }
  1656. #endregion
  1657. }
  1658. #region プレイヤーの効果
  1659. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1660. {
  1661. if (cardEffect is IRebootEffect)
  1662. {
  1663. if (cardEffect.CanTrigger(null))
  1664. {
  1665. if (((IRebootEffect)cardEffect).HasReboot(this))
  1666. {
  1667. return true;
  1668. }
  1669. }
  1670. }
  1671. }
  1672. #endregion
  1673. }
  1674. return false;
  1675. }
  1676. }
  1677. #endregion
  1678. #region 突進を持つか
  1679. public bool HasRaid
  1680. {
  1681. get
  1682. {
  1683. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1684. {
  1685. if (cardEffect is ActivateICardEffect)
  1686. {
  1687. if (cardEffect.EffectName == "Raid")
  1688. {
  1689. return true;
  1690. }
  1691. }
  1692. }
  1693. return false;
  1694. }
  1695. }
  1696. #endregion
  1697. #region 速攻を持つか
  1698. public bool HasRush
  1699. {
  1700. get
  1701. {
  1702. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1703. {
  1704. foreach (Permanent permanent in player.GetFieldPermanents())
  1705. {
  1706. #region 場のパーマネントの効果
  1707. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1708. {
  1709. if (cardEffect is IRushEffect)
  1710. {
  1711. if (cardEffect.CanTrigger(null))
  1712. {
  1713. if (((IRushEffect)cardEffect).HasRush(this))
  1714. {
  1715. return true;
  1716. }
  1717. }
  1718. }
  1719. }
  1720. #endregion
  1721. }
  1722. #region プレイヤーの効果
  1723. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1724. {
  1725. if (cardEffect is IRushEffect)
  1726. {
  1727. if (cardEffect.CanTrigger(null))
  1728. {
  1729. if (((IRushEffect)cardEffect).HasRush(this))
  1730. {
  1731. return true;
  1732. }
  1733. }
  1734. }
  1735. }
  1736. #endregion
  1737. }
  1738. return false;
  1739. }
  1740. }
  1741. #endregion
  1742. #region 道連れを持つか
  1743. public bool HasRetaliation
  1744. {
  1745. get
  1746. {
  1747. if (RetaliationCount >= 1)
  1748. {
  1749. return true;
  1750. }
  1751. return false;
  1752. }
  1753. }
  1754. #endregion
  1755. #region 道連れを持つ個数
  1756. public int RetaliationCount
  1757. {
  1758. get
  1759. {
  1760. int count = 0;
  1761. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1762. {
  1763. if (cardEffect is ActivateICardEffect)
  1764. {
  1765. if (cardEffect.EffectName == "Retaliation")
  1766. {
  1767. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1768. {
  1769. count++;
  1770. }
  1771. }
  1772. }
  1773. }
  1774. return count;
  1775. }
  1776. }
  1777. #endregion
  1778. #region 不屈を持つか
  1779. public bool HasFortitude
  1780. {
  1781. get
  1782. {
  1783. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1784. {
  1785. if (cardEffect is ActivateICardEffect)
  1786. {
  1787. if (cardEffect.EffectName == "Fortitude")
  1788. {
  1789. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1790. {
  1791. return true;
  1792. }
  1793. }
  1794. }
  1795. }
  1796. return false;
  1797. }
  1798. }
  1799. #endregion
  1800. #region Has Blitz
  1801. public bool HasBlitz
  1802. {
  1803. get
  1804. {
  1805. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnEnterFieldAnyone))
  1806. {
  1807. if (cardEffect is ActivateICardEffect)
  1808. {
  1809. if (cardEffect.CanTrigger(CardEffectCommons.WhenDigivolutionCheckHashtableOfPermanent(this)) || cardEffect.CanTrigger(CardEffectCommons.OnPlayCheckHashtableOfPermanent(this)))
  1810. {
  1811. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  1812. {
  1813. if (cardEffect.EffectDiscription.Contains("Blitz"))
  1814. {
  1815. return true;
  1816. }
  1817. }
  1818. }
  1819. }
  1820. }
  1821. return false;
  1822. }
  1823. }
  1824. #endregion
  1825. #region 回避を持つか
  1826. public bool HasEvade
  1827. {
  1828. get
  1829. {
  1830. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1831. {
  1832. if (cardEffect is ActivateICardEffect)
  1833. {
  1834. Hashtable hashtable = new Hashtable()
  1835. {
  1836. {"Permanents", new List<Permanent>() { this }}
  1837. };
  1838. if (cardEffect.CanTrigger(hashtable))
  1839. {
  1840. if (cardEffect.EffectName == "Evade")
  1841. {
  1842. return true;
  1843. }
  1844. }
  1845. }
  1846. }
  1847. return false;
  1848. }
  1849. }
  1850. #endregion
  1851. #region マインドリンクを持つか
  1852. public bool HasMindLink
  1853. {
  1854. get
  1855. {
  1856. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDeclaration))
  1857. {
  1858. if (cardEffect is ActivateICardEffect)
  1859. {
  1860. if (cardEffect.CanTrigger(null))
  1861. {
  1862. if (!String.IsNullOrEmpty(cardEffect.EffectDiscription))
  1863. {
  1864. if (cardEffect.EffectDiscription.Contains("Mind Link"))
  1865. {
  1866. return true;
  1867. }
  1868. }
  1869. }
  1870. }
  1871. }
  1872. return false;
  1873. }
  1874. }
  1875. #endregion
  1876. #region 防壁を持つか
  1877. public bool HasBarrier
  1878. {
  1879. get
  1880. {
  1881. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1882. {
  1883. if (cardEffect is ActivateICardEffect)
  1884. {
  1885. Hashtable hashtable = new Hashtable();
  1886. hashtable.Add("Permanents", new List<Permanent>() { this });
  1887. hashtable.Add("battle", new IBattle(null, null, null));
  1888. if (cardEffect.CanTrigger(hashtable))
  1889. {
  1890. if (cardEffect.EffectName == "Barrier")
  1891. {
  1892. return true;
  1893. }
  1894. }
  1895. }
  1896. }
  1897. return false;
  1898. }
  1899. }
  1900. #endregion
  1901. #region 連携を持つか
  1902. public bool HasAlliance
  1903. {
  1904. get
  1905. {
  1906. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1907. {
  1908. if (cardEffect is ActivateICardEffect)
  1909. {
  1910. if (cardEffect.EffectName == "Alliance")
  1911. {
  1912. return true;
  1913. }
  1914. }
  1915. }
  1916. return false;
  1917. }
  1918. }
  1919. #endregion
  1920. #region Has Collision
  1921. public bool HasCollision
  1922. {
  1923. get
  1924. {
  1925. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1926. {
  1927. if (cardEffect is ActivateICardEffect)
  1928. {
  1929. if (cardEffect.EffectName == "Collision")
  1930. {
  1931. return true;
  1932. }
  1933. }
  1934. }
  1935. return false;
  1936. }
  1937. }
  1938. #endregion
  1939. #region Has Partition
  1940. public bool HasPartition
  1941. {
  1942. get
  1943. {
  1944. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1945. {
  1946. if (cardEffect is ActivateICardEffect)
  1947. {
  1948. if (cardEffect.EffectName == "Partition")
  1949. {
  1950. return true;
  1951. }
  1952. }
  1953. }
  1954. return false;
  1955. }
  1956. }
  1957. #endregion
  1958. #region 消滅時効化を持つか
  1959. public bool HasOnDeletionEffect
  1960. {
  1961. get
  1962. {
  1963. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1964. {
  1965. if (cardEffect is ActivateICardEffect)
  1966. {
  1967. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1968. {
  1969. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  1970. {
  1971. if (cardEffect.IsOnDeletion)
  1972. {
  1973. return true;
  1974. }
  1975. }
  1976. }
  1977. }
  1978. }
  1979. return false;
  1980. }
  1981. }
  1982. #endregion
  1983. #region バトルしているか
  1984. public IBattle battle { get; set; } = null;
  1985. #endregion
  1986. #region Can Be Destroyed
  1987. public bool CanBeDestroyed()
  1988. {
  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 ICanNotBeDestroyedEffect)
  1998. {
  1999. if (cardEffect.CanUse(null))
  2000. {
  2001. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  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 ICanNotBeDestroyedEffect)
  2014. {
  2015. if (cardEffect.CanUse(null))
  2016. {
  2017. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2018. {
  2019. return false;
  2020. }
  2021. }
  2022. }
  2023. }
  2024. #endregion
  2025. }
  2026. #endregion
  2027. return true;
  2028. }
  2029. #endregion
  2030. #region このデジモンが戦闘によって消滅するか
  2031. public bool CanBeDestroyedByBattle(Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  2032. {
  2033. if (!CanBeDestroyed())
  2034. {
  2035. return false;
  2036. }
  2037. if (!CanBeRemoved())
  2038. return false;
  2039. #region 戦闘で消滅しない効果
  2040. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2041. {
  2042. foreach (Permanent permanent in player.GetFieldPermanents())
  2043. {
  2044. #region 場のパーマネントの効果
  2045. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2046. {
  2047. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2048. {
  2049. if (cardEffect.CanUse(null))
  2050. {
  2051. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2052. {
  2053. return false;
  2054. }
  2055. }
  2056. }
  2057. }
  2058. #endregion
  2059. }
  2060. #region プレイヤーの効果
  2061. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2062. {
  2063. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2064. {
  2065. if (cardEffect.CanUse(null))
  2066. {
  2067. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2068. {
  2069. return false;
  2070. }
  2071. }
  2072. }
  2073. }
  2074. #endregion
  2075. }
  2076. #endregion
  2077. return true;
  2078. }
  2079. #endregion
  2080. #region このパーマネントが効果で消滅するか
  2081. public bool CanBeDestroyedBySkill(ICardEffect cardEffect)
  2082. {
  2083. if (this.TopCard != null)
  2084. {
  2085. if (this.TopCard.CanNotBeAffected(cardEffect))
  2086. {
  2087. return false;
  2088. }
  2089. if (!CanBeDestroyed())
  2090. {
  2091. return false;
  2092. }
  2093. if (!CanBeRemoved())
  2094. return false;
  2095. #region 効果で消滅しない効果
  2096. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2097. {
  2098. foreach (Permanent permanent in player.GetFieldPermanents())
  2099. {
  2100. #region 場のパーマネントの効果
  2101. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  2102. {
  2103. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2104. {
  2105. if (cardEffect1.CanUse(null))
  2106. {
  2107. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2108. {
  2109. return false;
  2110. }
  2111. }
  2112. }
  2113. }
  2114. #endregion
  2115. }
  2116. #region プレイヤーの効果
  2117. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  2118. {
  2119. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2120. {
  2121. if (cardEffect1.CanUse(null))
  2122. {
  2123. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2124. {
  2125. return false;
  2126. }
  2127. }
  2128. }
  2129. }
  2130. #endregion
  2131. }
  2132. #endregion
  2133. }
  2134. return true;
  2135. }
  2136. #endregion
  2137. #region Can Leave Field
  2138. public bool CanBeRemoved()
  2139. {
  2140. #region Effect that never disappears
  2141. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2142. {
  2143. foreach (Permanent permanent in player.GetFieldPermanents())
  2144. {
  2145. #region Effects of permanents in play
  2146. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2147. {
  2148. if (cardEffect is ICanNotBeRemovedEffect)
  2149. {
  2150. if (cardEffect.CanUse(null))
  2151. {
  2152. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2153. {
  2154. return false;
  2155. }
  2156. }
  2157. }
  2158. }
  2159. #endregion
  2160. }
  2161. #region player effect
  2162. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2163. {
  2164. if (cardEffect is ICanNotBeRemovedEffect)
  2165. {
  2166. if (cardEffect.CanUse(null))
  2167. {
  2168. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2169. {
  2170. return false;
  2171. }
  2172. }
  2173. }
  2174. }
  2175. #endregion
  2176. }
  2177. #endregion
  2178. return true;
  2179. }
  2180. #endregion
  2181. #region トークンかどうか
  2182. public bool IsToken
  2183. {
  2184. get
  2185. {
  2186. if (TopCard != null)
  2187. {
  2188. if (TopCard.IsToken)
  2189. {
  2190. return true;
  2191. }
  2192. }
  2193. return false;
  2194. }
  2195. }
  2196. #endregion
  2197. #region そのパーマネントが消滅・バウンス待機状態か
  2198. public bool willBeRemoveField { get; set; } = false;
  2199. #endregion
  2200. #region このパーマネントがデジモンか
  2201. public bool IsDigimon
  2202. {
  2203. get
  2204. {
  2205. if (TopCard != null)
  2206. {
  2207. if (TopCard.IsDigimon || TopCard.IsDigiEgg)
  2208. {
  2209. return true;
  2210. }
  2211. #region Effect of treating it as a Digimon
  2212. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2213. {
  2214. foreach (Permanent permanent in player.GetFieldPermanents())
  2215. {
  2216. #region Effects of permanents in play
  2217. foreach (ICardEffect cardEffect in permanent.EffectList_Added(EffectTiming.None))
  2218. {
  2219. if (cardEffect is ITreatAsDigimonEffect)
  2220. {
  2221. if (cardEffect.CanTrigger(null))
  2222. {
  2223. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2224. {
  2225. return true;
  2226. }
  2227. }
  2228. }
  2229. }
  2230. #endregion
  2231. }
  2232. #region player effect
  2233. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2234. {
  2235. if (cardEffect is ITreatAsDigimonEffect)
  2236. {
  2237. if (cardEffect.CanTrigger(null))
  2238. {
  2239. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2240. {
  2241. return true;
  2242. }
  2243. }
  2244. }
  2245. }
  2246. #endregion
  2247. }
  2248. #endregion
  2249. }
  2250. return false;
  2251. }
  2252. }
  2253. #endregion
  2254. #region このパーマネントがテイマーか
  2255. public bool IsTamer
  2256. {
  2257. get
  2258. {
  2259. if (TopCard != null)
  2260. {
  2261. if (TopCard.IsTamer)
  2262. {
  2263. return true;
  2264. }
  2265. }
  2266. return false;
  2267. }
  2268. }
  2269. #endregion
  2270. #region Levels handled by Jogress
  2271. public List<int> Levels_ForJogress(CardSource cardSource)
  2272. {
  2273. List<int> levels = new List<int>();
  2274. if (cardSource != null)
  2275. {
  2276. if (cardSource.HasLevel)
  2277. {
  2278. levels.Add(this.Level);
  2279. }
  2280. #region Effect of "adding levels handled by jogless evolution"
  2281. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2282. {
  2283. foreach (Permanent permanent in player.GetFieldPermanents())
  2284. {
  2285. #region Effects of permanents in play
  2286. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2287. {
  2288. if (cardEffect is IAddJogressLevelsEffect)
  2289. {
  2290. if (cardEffect.CanUse(null))
  2291. {
  2292. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2293. {
  2294. levels.Add(level);
  2295. }
  2296. }
  2297. }
  2298. }
  2299. #endregion
  2300. }
  2301. #region player effect
  2302. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2303. {
  2304. if (cardEffect is IAddJogressLevelsEffect)
  2305. {
  2306. if (cardEffect.CanUse(null))
  2307. {
  2308. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2309. {
  2310. levels.Add(level);
  2311. }
  2312. }
  2313. }
  2314. }
  2315. #endregion
  2316. }
  2317. #endregion
  2318. }
  2319. return levels;
  2320. }
  2321. #endregion
  2322. #region Names handled by Jogress
  2323. public List<string> Names_ForDNA(CardSource cardSource)
  2324. {
  2325. List<string> names = new List<string>();
  2326. if (cardSource != null)
  2327. {
  2328. foreach(string name in cardSource.CardNames)
  2329. names.Add(name);
  2330. #region Effect of "adding names handled by DNA evolution"
  2331. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2332. {
  2333. foreach (Permanent permanent in player.GetFieldPermanents())
  2334. {
  2335. #region Effects of permanents in play
  2336. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2337. {
  2338. if (cardEffect is IAddDNANamesEffect)
  2339. {
  2340. if (cardEffect.CanUse(null))
  2341. {
  2342. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2343. {
  2344. names.Add(name);
  2345. }
  2346. }
  2347. }
  2348. }
  2349. #endregion
  2350. }
  2351. #region player effect
  2352. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2353. {
  2354. if (cardEffect is IAddDNANamesEffect)
  2355. {
  2356. if (cardEffect.CanUse(null))
  2357. {
  2358. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2359. {
  2360. names.Add(name);
  2361. }
  2362. }
  2363. }
  2364. }
  2365. #endregion
  2366. }
  2367. #endregion
  2368. }
  2369. return names;
  2370. }
  2371. #endregion
  2372. #region バトルで消滅したか
  2373. public bool IsDestroyedByBattle { get; set; } = false;
  2374. #endregion
  2375. #region 消滅に使用された効果
  2376. public ICardEffect DestroyingEffect { get; set; } = null;
  2377. #endregion
  2378. #region 他のパーマネントの下に置くのに使用された効果
  2379. public ICardEffect PlaceOtherPermanentEffect { get; set; } = null;
  2380. #endregion
  2381. #region 手札バウンス に使用された効果
  2382. public ICardEffect HandBounceEffect { get; set; } = null;
  2383. #endregion
  2384. #region 山札バウンス に使用された効果
  2385. public ICardEffect LibraryBounceEffect { get; set; } = null;
  2386. #endregion
  2387. #region 登場に使用された効果
  2388. public ICardEffect PlayingEffect { get; set; } = null;
  2389. #endregion
  2390. #region 進化に使用された効果
  2391. public ICardEffect DigivolvingEffect { get; set; } = null;
  2392. #endregion
  2393. #region Whether this digimon is placed in the trash by not having a DP
  2394. public bool IsPlaceToTrashDueToNotHavingDP { get; set; } = true;
  2395. #endregion
  2396. #region Whether this permanent can suspend
  2397. public bool CanSuspend
  2398. {
  2399. get
  2400. {
  2401. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  2402. {
  2403. #region Effects of field permanents
  2404. foreach (Permanent permanent in player.GetFieldPermanents())
  2405. {
  2406. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2407. {
  2408. if (cardEffect is ICanNotSuspendEffect)
  2409. {
  2410. if (cardEffect.CanUse(null))
  2411. {
  2412. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2413. {
  2414. return false;
  2415. }
  2416. }
  2417. }
  2418. }
  2419. }
  2420. #endregion
  2421. #region Effects of players
  2422. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2423. {
  2424. if (cardEffect is ICanNotSuspendEffect)
  2425. {
  2426. if (cardEffect.CanUse(null))
  2427. {
  2428. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2429. {
  2430. return false;
  2431. }
  2432. }
  2433. }
  2434. }
  2435. #endregion
  2436. }
  2437. return true;
  2438. }
  2439. }
  2440. #endregion
  2441. #region このデジモンのアタックの対象が変更できるか
  2442. public bool CanSwitchAttackTarget
  2443. {
  2444. get
  2445. {
  2446. #region アタックの対象が変更できない効果
  2447. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2448. {
  2449. foreach (Permanent permanent in player.GetFieldPermanents())
  2450. {
  2451. #region 場のパーマネントの効果
  2452. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2453. {
  2454. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2455. {
  2456. if (cardEffect.CanUse(null))
  2457. {
  2458. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2459. {
  2460. return false;
  2461. }
  2462. }
  2463. }
  2464. }
  2465. #endregion
  2466. }
  2467. #region プレイヤーの効果
  2468. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2469. {
  2470. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2471. {
  2472. if (cardEffect.CanUse(null))
  2473. {
  2474. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2475. {
  2476. return false;
  2477. }
  2478. }
  2479. }
  2480. }
  2481. #endregion
  2482. }
  2483. #endregion
  2484. return true;
  2485. }
  2486. }
  2487. #endregion
  2488. #region このデジモンを場からデジクロス条件の代わりにできるか
  2489. public bool CanSubstituteForDigiXrosCondition(CardSource cardSource)
  2490. {
  2491. #region デジクロス条件の代わりにできる効果
  2492. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2493. {
  2494. foreach (Permanent permanent in player.GetFieldPermanents())
  2495. {
  2496. #region 場のパーマネントの効果
  2497. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2498. {
  2499. if (cardEffect is ICanSelectDigiXrosEffect)
  2500. {
  2501. if (cardEffect.CanUse(null))
  2502. {
  2503. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  2504. {
  2505. return true;
  2506. }
  2507. }
  2508. }
  2509. }
  2510. #endregion
  2511. }
  2512. #region プレイヤーの効果
  2513. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2514. {
  2515. if (cardEffect is ICanSelectDigiXrosEffect)
  2516. {
  2517. if (cardEffect.CanUse(null))
  2518. {
  2519. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  2520. {
  2521. return true;
  2522. }
  2523. }
  2524. }
  2525. }
  2526. #endregion
  2527. }
  2528. #endregion
  2529. return false;
  2530. }
  2531. #endregion
  2532. #region 登場した直後のLevel
  2533. public int LevelJustAfterPlayed { get; set; } = -1;
  2534. #endregion
  2535. #region 登場した直後のPlay Cost
  2536. public int PlayCostJustAfterPlayed { get; set; } = -1;
  2537. #endregion
  2538. #region 登場した直後のCardNames
  2539. public List<string> CardNamesJustAfterPlayed { get; set; } = new List<string>();
  2540. #endregion
  2541. #region 進化した直後のCardNames
  2542. public List<string> CardNamesJustAfterDigivolved { get; set; } = new List<string>();
  2543. #endregion
  2544. #region 登場した直後のTraits
  2545. public List<string> TraitsJustAfterPlayed { get; set; } = new List<string>();
  2546. #endregion
  2547. #region 場を離れる直前のDP
  2548. public int DPJustBeforeRemoveField { get; set; } = -1;
  2549. #endregion
  2550. #region 場を離れる直前のLevel
  2551. public int LevelJustBeforeRemoveField { get; set; } = -1;
  2552. #endregion
  2553. #region 場を離れる直前のCost
  2554. public int CostJustBeforeRemoveField { get; set; } = -1;
  2555. #endregion
  2556. #region 場を離れる直前のカード名
  2557. public List<string> CardNamesJustBeforeRemoveField { get; set; } = new List<string>();
  2558. #endregion
  2559. #region バースト進化で手札に戻ったか
  2560. public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
  2561. #endregion
  2562. #region バースト進化したか
  2563. public bool IsBurstDigivolved { get; set; } = false;
  2564. #endregion
  2565. #region 効果で場に出たオプションか
  2566. public bool IsPlayedOptionPermanent { get; set; } = false;
  2567. #endregion
  2568. #region 進化元を持たないか
  2569. public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
  2570. #endregion
  2571. #region Digivolution cards' colors
  2572. public List<CardColor> DigivolutionCardsColors
  2573. {
  2574. get
  2575. {
  2576. List<CardColor> cardColors = new List<CardColor>();
  2577. foreach (CardSource cardSource in DigivolutionCards)
  2578. {
  2579. foreach (CardColor cardColor in cardSource.CardColors)
  2580. {
  2581. if (!cardColors.Contains(cardColor))
  2582. {
  2583. cardColors.Add(cardColor);
  2584. }
  2585. }
  2586. }
  2587. return cardColors.Distinct().ToList();
  2588. }
  2589. }
  2590. #endregion
  2591. #region Show "Unsuspend" effect object
  2592. public void ShowUnsuspendEffect()
  2593. {
  2594. if (TopCard != null)
  2595. {
  2596. if (ShowingPermanentCard != null)
  2597. {
  2598. if (ShowingPermanentCard.WillUntapObject != null)
  2599. {
  2600. ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
  2601. ShowingPermanentCard.WillUntapObject.SetActive(true);
  2602. }
  2603. }
  2604. }
  2605. }
  2606. #endregion
  2607. #region Show "Return to deck" effect object
  2608. public void ShowDeckBounceEffect()
  2609. {
  2610. if (TopCard != null)
  2611. {
  2612. if (willBeRemoveField)
  2613. {
  2614. if (ShowingPermanentCard != null)
  2615. {
  2616. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2617. {
  2618. ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
  2619. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
  2620. }
  2621. }
  2622. }
  2623. }
  2624. }
  2625. #endregion
  2626. #region Hide "Return to deck" effect object
  2627. public void HideDeckBounceEffect()
  2628. {
  2629. if (TopCard != null)
  2630. {
  2631. if (ShowingPermanentCard != null)
  2632. {
  2633. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2634. {
  2635. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
  2636. }
  2637. }
  2638. }
  2639. }
  2640. #endregion
  2641. #region Show "Return to hand" effect object
  2642. public void ShowHandBounceEffect()
  2643. {
  2644. if (TopCard != null)
  2645. {
  2646. if (willBeRemoveField)
  2647. {
  2648. if (ShowingPermanentCard != null)
  2649. {
  2650. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2651. {
  2652. ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
  2653. ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
  2654. }
  2655. }
  2656. }
  2657. }
  2658. }
  2659. #endregion
  2660. #region Hide "Return to hand" effect object
  2661. public void HideHandBounceEffect()
  2662. {
  2663. if (TopCard != null)
  2664. {
  2665. if (ShowingPermanentCard != null)
  2666. {
  2667. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2668. {
  2669. ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
  2670. }
  2671. }
  2672. }
  2673. }
  2674. #endregion
  2675. #region Show "Delete" effect object
  2676. public void ShowDeleteEffect()
  2677. {
  2678. if (TopCard != null)
  2679. {
  2680. if (willBeRemoveField)
  2681. {
  2682. if (ShowingPermanentCard != null)
  2683. {
  2684. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2685. {
  2686. ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
  2687. ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
  2688. }
  2689. }
  2690. }
  2691. }
  2692. }
  2693. #endregion
  2694. #region Hide "Delete" effect object
  2695. public void HideDeleteEffect()
  2696. {
  2697. if (TopCard != null)
  2698. {
  2699. if (ShowingPermanentCard != null)
  2700. {
  2701. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2702. {
  2703. ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  2704. }
  2705. }
  2706. }
  2707. }
  2708. #endregion
  2709. #region Show "Remove Field" effect object
  2710. public void ShowWillRemoveFieldEffect()
  2711. {
  2712. if (TopCard != null)
  2713. {
  2714. if (willBeRemoveField)
  2715. {
  2716. if (ShowingPermanentCard != null)
  2717. {
  2718. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2719. {
  2720. ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
  2721. ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
  2722. }
  2723. }
  2724. }
  2725. }
  2726. }
  2727. #endregion
  2728. #region Hide "Remove Field" effect object
  2729. public void HideWillRemoveFieldEffect()
  2730. {
  2731. if (TopCard != null)
  2732. {
  2733. if (ShowingPermanentCard != null)
  2734. {
  2735. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2736. {
  2737. ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
  2738. }
  2739. }
  2740. }
  2741. }
  2742. #endregion
  2743. #region Show "Digivolution" effect object
  2744. public void ShowWillEvolutionEffect()
  2745. {
  2746. if (TopCard != null)
  2747. {
  2748. if (ShowingPermanentCard != null)
  2749. {
  2750. if (ShowingPermanentCard.WillEvolutionObject != null)
  2751. {
  2752. ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
  2753. ShowingPermanentCard.WillEvolutionObject.SetActive(true);
  2754. }
  2755. }
  2756. }
  2757. }
  2758. #endregion
  2759. #region Hide "Digivolution" effect object
  2760. public void HideWillEvolutionEffect()
  2761. {
  2762. if (TopCard != null)
  2763. {
  2764. if (ShowingPermanentCard != null)
  2765. {
  2766. if (ShowingPermanentCard.WillEvolutionObject != null)
  2767. {
  2768. ShowingPermanentCard.WillEvolutionObject.SetActive(false);
  2769. }
  2770. }
  2771. }
  2772. }
  2773. #endregion
  2774. }