Permanent.cs 103 KB

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