Permanent.cs 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128
  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 Card Traits Just Before Removed Field
  2560. public List<string> CardTraitsJustBeforeRemoveField { get; set; } = new List<string>();
  2561. #endregion
  2562. #region バースト進化で手札に戻ったか
  2563. public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
  2564. #endregion
  2565. #region バースト進化したか
  2566. public bool IsBurstDigivolved { get; set; } = false;
  2567. #endregion
  2568. #region 効果で場に出たオプションか
  2569. public bool IsPlayedOptionPermanent { get; set; } = false;
  2570. #endregion
  2571. #region 進化元を持たないか
  2572. public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
  2573. #endregion
  2574. #region Digivolution cards' colors
  2575. public List<CardColor> DigivolutionCardsColors
  2576. {
  2577. get
  2578. {
  2579. List<CardColor> cardColors = new List<CardColor>();
  2580. foreach (CardSource cardSource in DigivolutionCards)
  2581. {
  2582. foreach (CardColor cardColor in cardSource.CardColors)
  2583. {
  2584. if (!cardColors.Contains(cardColor))
  2585. {
  2586. cardColors.Add(cardColor);
  2587. }
  2588. }
  2589. }
  2590. return cardColors.Distinct().ToList();
  2591. }
  2592. }
  2593. #endregion
  2594. #region Show "Unsuspend" effect object
  2595. public void ShowUnsuspendEffect()
  2596. {
  2597. if (TopCard != null)
  2598. {
  2599. if (ShowingPermanentCard != null)
  2600. {
  2601. if (ShowingPermanentCard.WillUntapObject != null)
  2602. {
  2603. ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
  2604. ShowingPermanentCard.WillUntapObject.SetActive(true);
  2605. }
  2606. }
  2607. }
  2608. }
  2609. #endregion
  2610. #region Show "Return to deck" effect object
  2611. public void ShowDeckBounceEffect()
  2612. {
  2613. if (TopCard != null)
  2614. {
  2615. if (willBeRemoveField)
  2616. {
  2617. if (ShowingPermanentCard != null)
  2618. {
  2619. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2620. {
  2621. ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
  2622. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
  2623. }
  2624. }
  2625. }
  2626. }
  2627. }
  2628. #endregion
  2629. #region Hide "Return to deck" effect object
  2630. public void HideDeckBounceEffect()
  2631. {
  2632. if (TopCard != null)
  2633. {
  2634. if (ShowingPermanentCard != null)
  2635. {
  2636. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2637. {
  2638. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
  2639. }
  2640. }
  2641. }
  2642. }
  2643. #endregion
  2644. #region Show "Return to hand" effect object
  2645. public void ShowHandBounceEffect()
  2646. {
  2647. if (TopCard != null)
  2648. {
  2649. if (willBeRemoveField)
  2650. {
  2651. if (ShowingPermanentCard != null)
  2652. {
  2653. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2654. {
  2655. ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
  2656. ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
  2657. }
  2658. }
  2659. }
  2660. }
  2661. }
  2662. #endregion
  2663. #region Hide "Return to hand" effect object
  2664. public void HideHandBounceEffect()
  2665. {
  2666. if (TopCard != null)
  2667. {
  2668. if (ShowingPermanentCard != null)
  2669. {
  2670. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2671. {
  2672. ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
  2673. }
  2674. }
  2675. }
  2676. }
  2677. #endregion
  2678. #region Show "Delete" effect object
  2679. public void ShowDeleteEffect()
  2680. {
  2681. if (TopCard != null)
  2682. {
  2683. if (willBeRemoveField)
  2684. {
  2685. if (ShowingPermanentCard != null)
  2686. {
  2687. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2688. {
  2689. ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
  2690. ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
  2691. }
  2692. }
  2693. }
  2694. }
  2695. }
  2696. #endregion
  2697. #region Hide "Delete" effect object
  2698. public void HideDeleteEffect()
  2699. {
  2700. if (TopCard != null)
  2701. {
  2702. if (ShowingPermanentCard != null)
  2703. {
  2704. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2705. {
  2706. ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  2707. }
  2708. }
  2709. }
  2710. }
  2711. #endregion
  2712. #region Show "Remove Field" effect object
  2713. public void ShowWillRemoveFieldEffect()
  2714. {
  2715. if (TopCard != null)
  2716. {
  2717. if (willBeRemoveField)
  2718. {
  2719. if (ShowingPermanentCard != null)
  2720. {
  2721. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2722. {
  2723. ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
  2724. ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
  2725. }
  2726. }
  2727. }
  2728. }
  2729. }
  2730. #endregion
  2731. #region Hide "Remove Field" effect object
  2732. public void HideWillRemoveFieldEffect()
  2733. {
  2734. if (TopCard != null)
  2735. {
  2736. if (ShowingPermanentCard != null)
  2737. {
  2738. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2739. {
  2740. ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
  2741. }
  2742. }
  2743. }
  2744. }
  2745. #endregion
  2746. #region Show "Digivolution" effect object
  2747. public void ShowWillEvolutionEffect()
  2748. {
  2749. if (TopCard != null)
  2750. {
  2751. if (ShowingPermanentCard != null)
  2752. {
  2753. if (ShowingPermanentCard.WillEvolutionObject != null)
  2754. {
  2755. ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
  2756. ShowingPermanentCard.WillEvolutionObject.SetActive(true);
  2757. }
  2758. }
  2759. }
  2760. }
  2761. #endregion
  2762. #region Hide "Digivolution" effect object
  2763. public void HideWillEvolutionEffect()
  2764. {
  2765. if (TopCard != null)
  2766. {
  2767. if (ShowingPermanentCard != null)
  2768. {
  2769. if (ShowingPermanentCard.WillEvolutionObject != null)
  2770. {
  2771. ShowingPermanentCard.WillEvolutionObject.SetActive(false);
  2772. }
  2773. }
  2774. }
  2775. }
  2776. #endregion
  2777. }