Permanent.cs 124 KB

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