Permanent.cs 106 KB

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