Permanent.cs 127 KB

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