Permanent.cs 126 KB

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