Permanent.cs 123 KB

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