Permanent.cs 106 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219
  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. #region "Unblockable" effect
  1346. #region Effects of permanents in play
  1347. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1348. {
  1349. foreach (Permanent permanent in player.GetFieldPermanents())
  1350. {
  1351. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1352. {
  1353. if (cardEffect is ICannotBlockEffect)
  1354. {
  1355. if (cardEffect.CanUse(null))
  1356. {
  1357. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1358. {
  1359. return false;
  1360. }
  1361. }
  1362. }
  1363. }
  1364. }
  1365. }
  1366. #endregion
  1367. #region player effect
  1368. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1369. {
  1370. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1371. {
  1372. if (cardEffect is ICannotBlockEffect)
  1373. {
  1374. if (cardEffect.CanUse(null))
  1375. {
  1376. if (((ICannotBlockEffect)cardEffect).CannotBlock(AttackingPermanent, this))
  1377. {
  1378. if (!TopCard.CanNotBeAffected(cardEffect))
  1379. {
  1380. return false;
  1381. }
  1382. }
  1383. }
  1384. }
  1385. }
  1386. }
  1387. #endregion
  1388. #endregion
  1389. return true;
  1390. }
  1391. #endregion
  1392. #region 対象のパーマネントを攻撃できるか
  1393. public bool CanAttackTargetDigimon(Permanent Defender, ICardEffect cardEffect, bool withoutTap = false, bool isVortex = false)
  1394. {
  1395. if (TopCard != null)
  1396. {
  1397. if (!IsDigimon)
  1398. {
  1399. return false;
  1400. }
  1401. if (!withoutTap)
  1402. {
  1403. if (IsSuspended)
  1404. {
  1405. return false;
  1406. }
  1407. if (!CanSuspend)
  1408. {
  1409. return false;
  1410. }
  1411. }
  1412. if (PermanentFrame != null)
  1413. {
  1414. if (!PermanentFrame.IsBattleAreaFrame())
  1415. {
  1416. return false;
  1417. }
  1418. }
  1419. if (EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  1420. {
  1421. if (!HasRush && !isVortex)
  1422. {
  1423. return false;
  1424. }
  1425. }
  1426. #region 「対象の防御パーマネントを攻撃できない」効果
  1427. #region 場のパーマネントの効果
  1428. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1429. {
  1430. foreach (Permanent permanent in player.GetFieldPermanents())
  1431. {
  1432. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1433. {
  1434. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1435. {
  1436. if (cardEffect1.CanUse(null))
  1437. {
  1438. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1439. {
  1440. if (!TopCard.CanNotBeAffected(cardEffect1))
  1441. {
  1442. return false;
  1443. }
  1444. }
  1445. }
  1446. }
  1447. }
  1448. }
  1449. }
  1450. #endregion
  1451. #region プレイヤーの効果
  1452. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1453. {
  1454. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1455. {
  1456. if (cardEffect1 is ICanNotAttackTargetDefendingPermanentEffect)
  1457. {
  1458. if (cardEffect1.CanUse(null))
  1459. {
  1460. if (((ICanNotAttackTargetDefendingPermanentEffect)cardEffect1).CanNotAttackTargetDefendingPermanent(this, Defender))
  1461. {
  1462. if (!TopCard.CanNotBeAffected(cardEffect1))
  1463. {
  1464. return false;
  1465. }
  1466. }
  1467. }
  1468. }
  1469. }
  1470. }
  1471. #endregion
  1472. #endregion
  1473. if (Defender != null)
  1474. {
  1475. if (Defender.TopCard != null)
  1476. {
  1477. if (Defender.TopCard.Owner == TopCard.Owner.Enemy)
  1478. {
  1479. if (Defender.IsDigimon && Defender.TopCard.Owner.GetBattleAreaPermanents().Contains(Defender))
  1480. {
  1481. if (Defender.IsSuspended)
  1482. {
  1483. return true;
  1484. }
  1485. #region 「対象の防御パーマネントを攻撃できる」効果
  1486. #region 場のパーマネントの効果
  1487. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1488. {
  1489. foreach (Permanent permanent in player.GetFieldPermanents())
  1490. {
  1491. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  1492. {
  1493. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1494. {
  1495. if (cardEffect1.CanUse(null))
  1496. {
  1497. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1498. {
  1499. return true;
  1500. }
  1501. }
  1502. }
  1503. }
  1504. }
  1505. }
  1506. #endregion
  1507. #region プレイヤーの効果
  1508. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  1509. {
  1510. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  1511. {
  1512. if (cardEffect1 is ICanAttackTargetDefendingPermanentEffect)
  1513. {
  1514. if (cardEffect1.CanUse(null))
  1515. {
  1516. if (((ICanAttackTargetDefendingPermanentEffect)cardEffect1).CanAttackTargetDefendingPermanent(this, Defender, cardEffect))
  1517. {
  1518. return true;
  1519. }
  1520. }
  1521. }
  1522. }
  1523. }
  1524. #endregion
  1525. #endregion
  1526. }
  1527. }
  1528. }
  1529. }
  1530. else
  1531. {
  1532. return true;
  1533. }
  1534. }
  1535. return false;
  1536. }
  1537. #endregion
  1538. #region Is Unblockable
  1539. public bool IsUnblockable
  1540. {
  1541. get
  1542. {
  1543. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.None))
  1544. {
  1545. if (cardEffect is CannotBlockClass)
  1546. {
  1547. if (cardEffect.EffectName == "Can't Block")
  1548. {
  1549. return true;
  1550. }
  1551. }
  1552. }
  1553. return false;
  1554. }
  1555. }
  1556. #endregion
  1557. #region Has Blocker
  1558. public bool HasBlocker
  1559. {
  1560. get
  1561. {
  1562. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1563. {
  1564. foreach (Permanent permanent in player.GetFieldPermanents())
  1565. {
  1566. #region 場のパーマネントの効果
  1567. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1568. {
  1569. if (cardEffect is IBlockerEffect)
  1570. {
  1571. if (cardEffect.CanTrigger(null))
  1572. {
  1573. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1574. {
  1575. return true;
  1576. }
  1577. }
  1578. }
  1579. }
  1580. #endregion
  1581. }
  1582. #region プレイヤーの効果
  1583. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1584. {
  1585. if (cardEffect is IBlockerEffect)
  1586. {
  1587. if (cardEffect.CanTrigger(null))
  1588. {
  1589. if (((IBlockerEffect)cardEffect).IsBlocker(this))
  1590. {
  1591. return true;
  1592. }
  1593. }
  1594. }
  1595. }
  1596. #endregion
  1597. }
  1598. return false;
  1599. }
  1600. }
  1601. #endregion
  1602. #region Has Jamming
  1603. public bool HasJamming
  1604. {
  1605. get
  1606. {
  1607. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1608. {
  1609. foreach (Permanent permanent in player.GetFieldPermanents())
  1610. {
  1611. #region 場のパーマネントの効果
  1612. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1613. {
  1614. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1615. {
  1616. if (cardEffect.CanTrigger(null))
  1617. {
  1618. if (cardEffect.EffectName == "Jamming")
  1619. {
  1620. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1621. {
  1622. return true;
  1623. }
  1624. }
  1625. }
  1626. }
  1627. }
  1628. #endregion
  1629. }
  1630. #region プレイヤーの効果
  1631. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1632. {
  1633. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  1634. {
  1635. if (cardEffect.CanTrigger(null))
  1636. {
  1637. if (cardEffect.EffectName == "Jamming")
  1638. {
  1639. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).PermanentCondition(this))
  1640. {
  1641. return true;
  1642. }
  1643. }
  1644. }
  1645. }
  1646. }
  1647. #endregion
  1648. }
  1649. return false;
  1650. }
  1651. }
  1652. #endregion
  1653. #region Has Ice Clad
  1654. public bool HasIceclad
  1655. {
  1656. get
  1657. {
  1658. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1659. {
  1660. #region Ice clad permanent effects
  1661. foreach (ICardEffect cardEffect in EffectList(EffectTiming.None))
  1662. {
  1663. if (cardEffect is IIcecladEffect)
  1664. {
  1665. if (cardEffect.CanTrigger(null))
  1666. {
  1667. if (((IIcecladEffect)cardEffect).HasIceclad(this))
  1668. {
  1669. return true;
  1670. }
  1671. }
  1672. }
  1673. }
  1674. #endregion
  1675. #region Ice clad Player Effects
  1676. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1677. {
  1678. if (cardEffect is IIcecladEffect)
  1679. {
  1680. if (cardEffect.CanTrigger(null))
  1681. {
  1682. if (((IIcecladEffect)cardEffect).HasIceclad(this))
  1683. {
  1684. return true;
  1685. }
  1686. }
  1687. }
  1688. }
  1689. #endregion
  1690. }
  1691. return false;
  1692. }
  1693. }
  1694. #endregion
  1695. #region Whether this permanent has Pierce
  1696. public bool HasPierce
  1697. {
  1698. get
  1699. {
  1700. if (IsDigimon)
  1701. {
  1702. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDetermineDoSecurityCheck))
  1703. {
  1704. if (cardEffect is ActivateICardEffect)
  1705. {
  1706. if (cardEffect.CanTrigger(CardEffectCommons.PierceCheckHashtableOfPermanent(this)))
  1707. {
  1708. if (cardEffect.EffectName == "Pierce")
  1709. {
  1710. return true;
  1711. }
  1712. if (cardEffect.EffectName == "Piercing")
  1713. {
  1714. return true;
  1715. }
  1716. }
  1717. }
  1718. }
  1719. }
  1720. return false;
  1721. }
  1722. }
  1723. #endregion
  1724. #region 再起動を持つか
  1725. public bool HasReboot
  1726. {
  1727. get
  1728. {
  1729. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1730. {
  1731. foreach (Permanent permanent in player.GetFieldPermanents())
  1732. {
  1733. #region 場のパーマネントの効果
  1734. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1735. {
  1736. if (cardEffect is IRebootEffect)
  1737. {
  1738. if (cardEffect.CanTrigger(null))
  1739. {
  1740. if (((IRebootEffect)cardEffect).HasReboot(this))
  1741. {
  1742. return true;
  1743. }
  1744. }
  1745. }
  1746. }
  1747. #endregion
  1748. }
  1749. #region プレイヤーの効果
  1750. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1751. {
  1752. if (cardEffect is IRebootEffect)
  1753. {
  1754. if (cardEffect.CanTrigger(null))
  1755. {
  1756. if (((IRebootEffect)cardEffect).HasReboot(this))
  1757. {
  1758. return true;
  1759. }
  1760. }
  1761. }
  1762. }
  1763. #endregion
  1764. }
  1765. return false;
  1766. }
  1767. }
  1768. #endregion
  1769. #region 突進を持つか
  1770. public bool HasRaid
  1771. {
  1772. get
  1773. {
  1774. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1775. {
  1776. if (cardEffect is ActivateICardEffect)
  1777. {
  1778. if (cardEffect.EffectName == "Raid")
  1779. {
  1780. return true;
  1781. }
  1782. }
  1783. }
  1784. return false;
  1785. }
  1786. }
  1787. #endregion
  1788. #region 速攻を持つか
  1789. public bool HasRush
  1790. {
  1791. get
  1792. {
  1793. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  1794. {
  1795. foreach (Permanent permanent in player.GetFieldPermanents())
  1796. {
  1797. #region 場のパーマネントの効果
  1798. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  1799. {
  1800. if (cardEffect is IRushEffect)
  1801. {
  1802. if (cardEffect.CanTrigger(null))
  1803. {
  1804. if (((IRushEffect)cardEffect).HasRush(this))
  1805. {
  1806. return true;
  1807. }
  1808. }
  1809. }
  1810. }
  1811. #endregion
  1812. }
  1813. #region プレイヤーの効果
  1814. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  1815. {
  1816. if (cardEffect is IRushEffect)
  1817. {
  1818. if (cardEffect.CanTrigger(null))
  1819. {
  1820. if (((IRushEffect)cardEffect).HasRush(this))
  1821. {
  1822. return true;
  1823. }
  1824. }
  1825. }
  1826. }
  1827. #endregion
  1828. }
  1829. return false;
  1830. }
  1831. }
  1832. #endregion
  1833. #region 道連れを持つか
  1834. public bool HasRetaliation
  1835. {
  1836. get
  1837. {
  1838. if (RetaliationCount >= 1)
  1839. {
  1840. return true;
  1841. }
  1842. return false;
  1843. }
  1844. }
  1845. #endregion
  1846. #region 道連れを持つ個数
  1847. public int RetaliationCount
  1848. {
  1849. get
  1850. {
  1851. int count = 0;
  1852. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1853. {
  1854. if (cardEffect is ActivateICardEffect)
  1855. {
  1856. if (cardEffect.EffectName == "Retaliation")
  1857. {
  1858. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1859. {
  1860. count++;
  1861. }
  1862. }
  1863. }
  1864. }
  1865. return count;
  1866. }
  1867. }
  1868. #endregion
  1869. #region 不屈を持つか
  1870. public bool HasFortitude
  1871. {
  1872. get
  1873. {
  1874. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  1875. {
  1876. if (cardEffect is ActivateICardEffect)
  1877. {
  1878. if (cardEffect.EffectName == "Fortitude")
  1879. {
  1880. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  1881. {
  1882. return true;
  1883. }
  1884. }
  1885. }
  1886. }
  1887. return false;
  1888. }
  1889. }
  1890. #endregion
  1891. #region Has Blitz
  1892. public bool HasBlitz
  1893. {
  1894. get
  1895. {
  1896. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnEnterFieldAnyone))
  1897. {
  1898. if (cardEffect is ActivateICardEffect)
  1899. {
  1900. if (cardEffect.CanTrigger(CardEffectCommons.WhenDigivolutionCheckHashtableOfPermanent(this)) || cardEffect.CanTrigger(CardEffectCommons.OnPlayCheckHashtableOfPermanent(this)))
  1901. {
  1902. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  1903. {
  1904. if (cardEffect.EffectDiscription.Contains("Blitz"))
  1905. {
  1906. return true;
  1907. }
  1908. }
  1909. }
  1910. }
  1911. }
  1912. return false;
  1913. }
  1914. }
  1915. #endregion
  1916. #region 回避を持つか
  1917. public bool HasEvade
  1918. {
  1919. get
  1920. {
  1921. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1922. {
  1923. if (cardEffect is ActivateICardEffect)
  1924. {
  1925. Hashtable hashtable = new Hashtable()
  1926. {
  1927. {"Permanents", new List<Permanent>() { this }}
  1928. };
  1929. if (cardEffect.CanTrigger(hashtable))
  1930. {
  1931. if (cardEffect.EffectName == "Evade")
  1932. {
  1933. return true;
  1934. }
  1935. }
  1936. }
  1937. }
  1938. return false;
  1939. }
  1940. }
  1941. #endregion
  1942. #region マインドリンクを持つか
  1943. public bool HasMindLink
  1944. {
  1945. get
  1946. {
  1947. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDeclaration))
  1948. {
  1949. if (cardEffect is ActivateICardEffect)
  1950. {
  1951. if (cardEffect.CanTrigger(null))
  1952. {
  1953. if (!String.IsNullOrEmpty(cardEffect.EffectDiscription))
  1954. {
  1955. if (cardEffect.EffectDiscription.Contains("Mind Link"))
  1956. {
  1957. return true;
  1958. }
  1959. }
  1960. }
  1961. }
  1962. }
  1963. return false;
  1964. }
  1965. }
  1966. #endregion
  1967. #region 防壁を持つか
  1968. public bool HasBarrier
  1969. {
  1970. get
  1971. {
  1972. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  1973. {
  1974. if (cardEffect is ActivateICardEffect)
  1975. {
  1976. Hashtable hashtable = new Hashtable();
  1977. hashtable.Add("Permanents", new List<Permanent>() { this });
  1978. hashtable.Add("battle", new IBattle(null, null, null));
  1979. if (cardEffect.CanTrigger(hashtable))
  1980. {
  1981. if (cardEffect.EffectName == "Barrier")
  1982. {
  1983. return true;
  1984. }
  1985. }
  1986. }
  1987. }
  1988. return false;
  1989. }
  1990. }
  1991. #endregion
  1992. #region 連携を持つか
  1993. public bool HasAlliance
  1994. {
  1995. get
  1996. {
  1997. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  1998. {
  1999. if (cardEffect is ActivateICardEffect)
  2000. {
  2001. if (cardEffect.EffectName == "Alliance")
  2002. {
  2003. return true;
  2004. }
  2005. }
  2006. }
  2007. return false;
  2008. }
  2009. }
  2010. #endregion
  2011. #region Has Collision
  2012. public bool HasCollision
  2013. {
  2014. get
  2015. {
  2016. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.OnAllyAttack))
  2017. {
  2018. if (cardEffect is ActivateICardEffect)
  2019. {
  2020. if (cardEffect.EffectName == "Collision")
  2021. {
  2022. return true;
  2023. }
  2024. }
  2025. }
  2026. return false;
  2027. }
  2028. }
  2029. #endregion
  2030. #region Has Partition
  2031. public bool HasPartition
  2032. {
  2033. get
  2034. {
  2035. foreach (ICardEffect cardEffect in this.EffectList(EffectTiming.WhenPermanentWouldBeDeleted))
  2036. {
  2037. if (cardEffect is ActivateICardEffect)
  2038. {
  2039. if (cardEffect.EffectName == "Partition")
  2040. {
  2041. return true;
  2042. }
  2043. }
  2044. }
  2045. return false;
  2046. }
  2047. }
  2048. #endregion
  2049. #region 消滅時効化を持つか
  2050. public bool HasOnDeletionEffect
  2051. {
  2052. get
  2053. {
  2054. foreach (ICardEffect cardEffect in EffectList(EffectTiming.OnDestroyedAnyone))
  2055. {
  2056. if (cardEffect is ActivateICardEffect)
  2057. {
  2058. if (cardEffect.CanTrigger(CardEffectCommons.OnDeletionCheckHashtableOfPermanent(this)))
  2059. {
  2060. if (!string.IsNullOrEmpty(cardEffect.EffectDiscription))
  2061. {
  2062. if (cardEffect.IsOnDeletion)
  2063. {
  2064. return true;
  2065. }
  2066. }
  2067. }
  2068. }
  2069. }
  2070. return false;
  2071. }
  2072. }
  2073. #endregion
  2074. #region バトルしているか
  2075. public IBattle battle { get; set; } = null;
  2076. #endregion
  2077. #region Can Be Destroyed
  2078. public bool CanBeDestroyed()
  2079. {
  2080. #region 消滅しない効果
  2081. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2082. {
  2083. foreach (Permanent permanent in player.GetFieldPermanents())
  2084. {
  2085. #region 場のパーマネントの効果
  2086. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2087. {
  2088. if (cardEffect is ICanNotBeDestroyedEffect)
  2089. {
  2090. if (cardEffect.CanUse(null))
  2091. {
  2092. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2093. {
  2094. return false;
  2095. }
  2096. }
  2097. }
  2098. }
  2099. #endregion
  2100. }
  2101. #region プレイヤーの効果
  2102. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2103. {
  2104. if (cardEffect is ICanNotBeDestroyedEffect)
  2105. {
  2106. if (cardEffect.CanUse(null))
  2107. {
  2108. if (((ICanNotBeDestroyedEffect)cardEffect).CanNotBeDestroyed(this))
  2109. {
  2110. return false;
  2111. }
  2112. }
  2113. }
  2114. }
  2115. #endregion
  2116. }
  2117. #endregion
  2118. return true;
  2119. }
  2120. #endregion
  2121. #region このデジモンが戦闘によって消滅するか
  2122. public bool CanBeDestroyedByBattle(Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  2123. {
  2124. if (!CanBeDestroyed())
  2125. {
  2126. return false;
  2127. }
  2128. #region 戦闘で消滅しない効果
  2129. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2130. {
  2131. foreach (Permanent permanent in player.GetFieldPermanents())
  2132. {
  2133. #region 場のパーマネントの効果
  2134. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2135. {
  2136. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2137. {
  2138. if (cardEffect.CanUse(null))
  2139. {
  2140. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2141. {
  2142. return false;
  2143. }
  2144. }
  2145. }
  2146. }
  2147. #endregion
  2148. }
  2149. #region プレイヤーの効果
  2150. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2151. {
  2152. if (cardEffect is ICanNotBeDestroyedByBattleEffect)
  2153. {
  2154. if (cardEffect.CanUse(null))
  2155. {
  2156. if (((ICanNotBeDestroyedByBattleEffect)cardEffect).CanNotBeDestroyedByBattle(this, AttackingPermanent, DefendingPermanent, DefendingCard))
  2157. {
  2158. return false;
  2159. }
  2160. }
  2161. }
  2162. }
  2163. #endregion
  2164. }
  2165. #endregion
  2166. return true;
  2167. }
  2168. #endregion
  2169. #region このパーマネントが効果で消滅するか
  2170. public bool CanBeDestroyedBySkill(ICardEffect cardEffect)
  2171. {
  2172. if (this.TopCard != null)
  2173. {
  2174. if (this.TopCard.CanNotBeAffected(cardEffect))
  2175. {
  2176. return false;
  2177. }
  2178. if (!CanBeDestroyed())
  2179. {
  2180. return false;
  2181. }
  2182. #region 効果で消滅しない効果
  2183. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2184. {
  2185. foreach (Permanent permanent in player.GetFieldPermanents())
  2186. {
  2187. #region 場のパーマネントの効果
  2188. foreach (ICardEffect cardEffect1 in permanent.EffectList(EffectTiming.None))
  2189. {
  2190. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2191. {
  2192. if (cardEffect1.CanUse(null))
  2193. {
  2194. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2195. {
  2196. return false;
  2197. }
  2198. }
  2199. }
  2200. }
  2201. #endregion
  2202. }
  2203. #region プレイヤーの効果
  2204. foreach (ICardEffect cardEffect1 in player.EffectList(EffectTiming.None))
  2205. {
  2206. if (cardEffect1 is ICanNotBeDestroyedBySkillEffect)
  2207. {
  2208. if (cardEffect1.CanUse(null))
  2209. {
  2210. if (((ICanNotBeDestroyedBySkillEffect)cardEffect1).CanNotBeDestroyedBySkill(this, cardEffect))
  2211. {
  2212. return false;
  2213. }
  2214. }
  2215. }
  2216. }
  2217. #endregion
  2218. }
  2219. #endregion
  2220. }
  2221. return true;
  2222. }
  2223. #endregion
  2224. #region Can Leave Field
  2225. public bool CanBeRemoved()
  2226. {
  2227. #region Effect that never disappears
  2228. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2229. {
  2230. foreach (Permanent permanent in player.GetFieldPermanents())
  2231. {
  2232. #region Effects of permanents in play
  2233. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2234. {
  2235. if (cardEffect is ICanNotBeRemovedEffect)
  2236. {
  2237. if (cardEffect.CanUse(null))
  2238. {
  2239. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2240. {
  2241. return false;
  2242. }
  2243. }
  2244. }
  2245. }
  2246. #endregion
  2247. }
  2248. #region player effect
  2249. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2250. {
  2251. if (cardEffect is ICanNotBeRemovedEffect)
  2252. {
  2253. if (cardEffect.CanUse(null))
  2254. {
  2255. if (((ICanNotBeRemovedEffect)cardEffect).CanNotBeRemoved(this))
  2256. {
  2257. return false;
  2258. }
  2259. }
  2260. }
  2261. }
  2262. #endregion
  2263. }
  2264. #endregion
  2265. return true;
  2266. }
  2267. #endregion
  2268. #region トークンかどうか
  2269. public bool IsToken
  2270. {
  2271. get
  2272. {
  2273. if (TopCard != null)
  2274. {
  2275. if (TopCard.IsToken)
  2276. {
  2277. return true;
  2278. }
  2279. }
  2280. return false;
  2281. }
  2282. }
  2283. #endregion
  2284. #region そのパーマネントが消滅・バウンス待機状態か
  2285. public bool willBeRemoveField { get; set; } = false;
  2286. #endregion
  2287. #region このパーマネントがデジモンか
  2288. public bool IsDigimon
  2289. {
  2290. get
  2291. {
  2292. if (TopCard != null)
  2293. {
  2294. if (TopCard.IsDigimon || TopCard.IsDigiEgg)
  2295. {
  2296. return true;
  2297. }
  2298. #region Effect of treating it as a Digimon
  2299. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2300. {
  2301. foreach (Permanent permanent in player.GetFieldPermanents())
  2302. {
  2303. #region Effects of permanents in play
  2304. foreach (ICardEffect cardEffect in permanent.EffectList_Added(EffectTiming.None))
  2305. {
  2306. if (cardEffect is ITreatAsDigimonEffect)
  2307. {
  2308. if (cardEffect.CanTrigger(null))
  2309. {
  2310. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2311. {
  2312. return true;
  2313. }
  2314. }
  2315. }
  2316. }
  2317. #endregion
  2318. }
  2319. #region player effect
  2320. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2321. {
  2322. if (cardEffect is ITreatAsDigimonEffect)
  2323. {
  2324. if (cardEffect.CanTrigger(null))
  2325. {
  2326. if (((ITreatAsDigimonEffect)cardEffect).IsDigimon(this))
  2327. {
  2328. return true;
  2329. }
  2330. }
  2331. }
  2332. }
  2333. #endregion
  2334. }
  2335. #endregion
  2336. }
  2337. return false;
  2338. }
  2339. }
  2340. #endregion
  2341. #region このパーマネントがテイマーか
  2342. public bool IsTamer
  2343. {
  2344. get
  2345. {
  2346. if (TopCard != null)
  2347. {
  2348. if (TopCard.IsTamer)
  2349. {
  2350. return true;
  2351. }
  2352. }
  2353. return false;
  2354. }
  2355. }
  2356. #endregion
  2357. #region Levels handled by Jogress
  2358. public List<int> Levels_ForJogress(CardSource cardSource)
  2359. {
  2360. List<int> levels = new List<int>();
  2361. if (cardSource != null)
  2362. {
  2363. if (cardSource.HasLevel)
  2364. {
  2365. levels.Add(this.Level);
  2366. }
  2367. #region Effect of "adding levels handled by jogless evolution"
  2368. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2369. {
  2370. foreach (Permanent permanent in player.GetFieldPermanents())
  2371. {
  2372. #region Effects of permanents in play
  2373. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2374. {
  2375. if (cardEffect is IAddJogressLevelsEffect)
  2376. {
  2377. if (cardEffect.CanUse(null))
  2378. {
  2379. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2380. {
  2381. levels.Add(level);
  2382. }
  2383. }
  2384. }
  2385. }
  2386. #endregion
  2387. }
  2388. #region player effect
  2389. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2390. {
  2391. if (cardEffect is IAddJogressLevelsEffect)
  2392. {
  2393. if (cardEffect.CanUse(null))
  2394. {
  2395. foreach (int level in ((IAddJogressLevelsEffect)cardEffect).GetJogressLevels(cardSource, this))
  2396. {
  2397. levels.Add(level);
  2398. }
  2399. }
  2400. }
  2401. }
  2402. #endregion
  2403. }
  2404. #endregion
  2405. }
  2406. return levels;
  2407. }
  2408. #endregion
  2409. #region Names handled by Jogress
  2410. public List<string> Names_ForDNA(CardSource cardSource)
  2411. {
  2412. List<string> names = new List<string>();
  2413. if (cardSource != null)
  2414. {
  2415. foreach(string name in cardSource.CardNames)
  2416. names.Add(name);
  2417. #region Effect of "adding names handled by DNA evolution"
  2418. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2419. {
  2420. foreach (Permanent permanent in player.GetFieldPermanents())
  2421. {
  2422. #region Effects of permanents in play
  2423. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2424. {
  2425. if (cardEffect is IAddDNANamesEffect)
  2426. {
  2427. if (cardEffect.CanUse(null))
  2428. {
  2429. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2430. {
  2431. names.Add(name);
  2432. }
  2433. }
  2434. }
  2435. }
  2436. #endregion
  2437. }
  2438. #region player effect
  2439. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2440. {
  2441. if (cardEffect is IAddDNANamesEffect)
  2442. {
  2443. if (cardEffect.CanUse(null))
  2444. {
  2445. foreach (string name in ((IAddDNANamesEffect)cardEffect).GetDNANames(cardSource, this))
  2446. {
  2447. names.Add(name);
  2448. }
  2449. }
  2450. }
  2451. }
  2452. #endregion
  2453. }
  2454. #endregion
  2455. }
  2456. return names;
  2457. }
  2458. #endregion
  2459. #region バトルで消滅したか
  2460. public bool IsDestroyedByBattle { get; set; } = false;
  2461. #endregion
  2462. #region 消滅に使用された効果
  2463. public ICardEffect DestroyingEffect { get; set; } = null;
  2464. #endregion
  2465. #region 他のパーマネントの下に置くのに使用された効果
  2466. public ICardEffect PlaceOtherPermanentEffect { get; set; } = null;
  2467. #endregion
  2468. #region 手札バウンス に使用された効果
  2469. public ICardEffect HandBounceEffect { get; set; } = null;
  2470. #endregion
  2471. #region 山札バウンス に使用された効果
  2472. public ICardEffect LibraryBounceEffect { get; set; } = null;
  2473. #endregion
  2474. #region 登場に使用された効果
  2475. public ICardEffect PlayingEffect { get; set; } = null;
  2476. #endregion
  2477. #region 進化に使用された効果
  2478. public ICardEffect DigivolvingEffect { get; set; } = null;
  2479. #endregion
  2480. #region Whether this digimon is placed in the trash by not having a DP
  2481. public bool IsPlaceToTrashDueToNotHavingDP { get; set; } = true;
  2482. #endregion
  2483. #region Whether this permanent can suspend
  2484. public bool CanSuspend
  2485. {
  2486. get
  2487. {
  2488. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  2489. {
  2490. #region Effects of field permanents
  2491. foreach (Permanent permanent in player.GetFieldPermanents())
  2492. {
  2493. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2494. {
  2495. if (cardEffect is ICanNotSuspendEffect)
  2496. {
  2497. if (cardEffect.CanUse(null))
  2498. {
  2499. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2500. {
  2501. return false;
  2502. }
  2503. }
  2504. }
  2505. }
  2506. }
  2507. #endregion
  2508. #region Effects of players
  2509. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2510. {
  2511. if (cardEffect is ICanNotSuspendEffect)
  2512. {
  2513. if (cardEffect.CanUse(null))
  2514. {
  2515. if (((ICanNotSuspendEffect)cardEffect).CanNotSuspend(this))
  2516. {
  2517. return false;
  2518. }
  2519. }
  2520. }
  2521. }
  2522. #endregion
  2523. }
  2524. return true;
  2525. }
  2526. }
  2527. #endregion
  2528. #region このデジモンのアタックの対象が変更できるか
  2529. public bool CanSwitchAttackTarget
  2530. {
  2531. get
  2532. {
  2533. #region アタックの対象が変更できない効果
  2534. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2535. {
  2536. foreach (Permanent permanent in player.GetFieldPermanents())
  2537. {
  2538. #region 場のパーマネントの効果
  2539. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2540. {
  2541. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2542. {
  2543. if (cardEffect.CanUse(null))
  2544. {
  2545. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2546. {
  2547. return false;
  2548. }
  2549. }
  2550. }
  2551. }
  2552. #endregion
  2553. }
  2554. #region プレイヤーの効果
  2555. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2556. {
  2557. if (cardEffect is ICanNotSwitchAttackTargetEffect)
  2558. {
  2559. if (cardEffect.CanUse(null))
  2560. {
  2561. if (((ICanNotSwitchAttackTargetEffect)cardEffect).CanNotBeSwitchAttackTarget(this))
  2562. {
  2563. return false;
  2564. }
  2565. }
  2566. }
  2567. }
  2568. #endregion
  2569. }
  2570. #endregion
  2571. return true;
  2572. }
  2573. }
  2574. #endregion
  2575. #region このデジモンを場からデジクロス条件の代わりにできるか
  2576. public bool CanSubstituteForDigiXrosCondition(CardSource cardSource)
  2577. {
  2578. #region デジクロス条件の代わりにできる効果
  2579. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  2580. {
  2581. foreach (Permanent permanent in player.GetFieldPermanents())
  2582. {
  2583. #region 場のパーマネントの効果
  2584. foreach (ICardEffect cardEffect in permanent.EffectList(EffectTiming.None))
  2585. {
  2586. if (cardEffect is ICanSelectDigiXrosEffect)
  2587. {
  2588. if (cardEffect.CanUse(null))
  2589. {
  2590. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  2591. {
  2592. return true;
  2593. }
  2594. }
  2595. }
  2596. }
  2597. #endregion
  2598. }
  2599. #region プレイヤーの効果
  2600. foreach (ICardEffect cardEffect in player.EffectList(EffectTiming.None))
  2601. {
  2602. if (cardEffect is ICanSelectDigiXrosEffect)
  2603. {
  2604. if (cardEffect.CanUse(null))
  2605. {
  2606. if (((ICanSelectDigiXrosEffect)cardEffect).CanSelect(cardSource, this))
  2607. {
  2608. return true;
  2609. }
  2610. }
  2611. }
  2612. }
  2613. #endregion
  2614. }
  2615. #endregion
  2616. return false;
  2617. }
  2618. #endregion
  2619. #region 登場した直後のLevel
  2620. public int LevelJustAfterPlayed { get; set; } = -1;
  2621. #endregion
  2622. #region 登場した直後のPlay Cost
  2623. public int PlayCostJustAfterPlayed { get; set; } = -1;
  2624. #endregion
  2625. #region 登場した直後のCardNames
  2626. public List<string> CardNamesJustAfterPlayed { get; set; } = new List<string>();
  2627. #endregion
  2628. #region 進化した直後のCardNames
  2629. public List<string> CardNamesJustAfterDigivolved { get; set; } = new List<string>();
  2630. #endregion
  2631. #region 登場した直後のTraits
  2632. public List<string> TraitsJustAfterPlayed { get; set; } = new List<string>();
  2633. #endregion
  2634. #region 場を離れる直前のDP
  2635. public int DPJustBeforeRemoveField { get; set; } = -1;
  2636. #endregion
  2637. #region 場を離れる直前のLevel
  2638. public int LevelJustBeforeRemoveField { get; set; } = -1;
  2639. #endregion
  2640. #region 場を離れる直前のCost
  2641. public int CostJustBeforeRemoveField { get; set; } = -1;
  2642. #endregion
  2643. #region 場を離れる直前のカード名
  2644. public List<string> CardNamesJustBeforeRemoveField { get; set; } = new List<string>();
  2645. #endregion
  2646. #region Card Traits Just Before Removed Field
  2647. public List<string> CardTraitsJustBeforeRemoveField { get; set; } = new List<string>();
  2648. #endregion
  2649. #region バースト進化で手札に戻ったか
  2650. public bool IsReturnedToHandByBurstDigivolution { get; set; } = false;
  2651. #endregion
  2652. #region バースト進化したか
  2653. public bool IsBurstDigivolved { get; set; } = false;
  2654. #endregion
  2655. #region 効果で場に出たオプションか
  2656. public bool IsPlayedOptionPermanent { get; set; } = false;
  2657. #endregion
  2658. #region 進化元を持たないか
  2659. public bool HasNoDigivolutionCards => DigivolutionCards.Count == 0;
  2660. #endregion
  2661. #region Digivolution cards' colors
  2662. public List<CardColor> DigivolutionCardsColors
  2663. {
  2664. get
  2665. {
  2666. List<CardColor> cardColors = new List<CardColor>();
  2667. foreach (CardSource cardSource in DigivolutionCards)
  2668. {
  2669. foreach (CardColor cardColor in cardSource.CardColors)
  2670. {
  2671. if (!cardColors.Contains(cardColor))
  2672. {
  2673. cardColors.Add(cardColor);
  2674. }
  2675. }
  2676. }
  2677. return cardColors.Distinct().ToList();
  2678. }
  2679. }
  2680. #endregion
  2681. #region Show "Unsuspend" effect object
  2682. public void ShowUnsuspendEffect()
  2683. {
  2684. if (TopCard != null)
  2685. {
  2686. if (ShowingPermanentCard != null)
  2687. {
  2688. if (ShowingPermanentCard.WillUntapObject != null)
  2689. {
  2690. ShowingPermanentCard.WillUntapObject.transform.parent.gameObject.SetActive(true);
  2691. ShowingPermanentCard.WillUntapObject.SetActive(true);
  2692. }
  2693. }
  2694. }
  2695. }
  2696. #endregion
  2697. #region Show "Return to deck" effect object
  2698. public void ShowDeckBounceEffect()
  2699. {
  2700. if (TopCard != null)
  2701. {
  2702. if (willBeRemoveField)
  2703. {
  2704. if (ShowingPermanentCard != null)
  2705. {
  2706. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2707. {
  2708. ShowingPermanentCard.WillBeDeckBounceObject.transform.parent.gameObject.SetActive(true);
  2709. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(true);
  2710. }
  2711. }
  2712. }
  2713. }
  2714. }
  2715. #endregion
  2716. #region Hide "Return to deck" effect object
  2717. public void HideDeckBounceEffect()
  2718. {
  2719. if (TopCard != null)
  2720. {
  2721. if (ShowingPermanentCard != null)
  2722. {
  2723. if (ShowingPermanentCard.WillBeDeckBounceObject != null)
  2724. {
  2725. ShowingPermanentCard.WillBeDeckBounceObject.SetActive(false);
  2726. }
  2727. }
  2728. }
  2729. }
  2730. #endregion
  2731. #region Show "Return to hand" effect object
  2732. public void ShowHandBounceEffect()
  2733. {
  2734. if (TopCard != null)
  2735. {
  2736. if (willBeRemoveField)
  2737. {
  2738. if (ShowingPermanentCard != null)
  2739. {
  2740. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2741. {
  2742. ShowingPermanentCard.WillBeHandBounceObject.transform.parent.gameObject.SetActive(true);
  2743. ShowingPermanentCard.WillBeHandBounceObject.SetActive(true);
  2744. }
  2745. }
  2746. }
  2747. }
  2748. }
  2749. #endregion
  2750. #region Hide "Return to hand" effect object
  2751. public void HideHandBounceEffect()
  2752. {
  2753. if (TopCard != null)
  2754. {
  2755. if (ShowingPermanentCard != null)
  2756. {
  2757. if (ShowingPermanentCard.WillBeHandBounceObject != null)
  2758. {
  2759. ShowingPermanentCard.WillBeHandBounceObject.SetActive(false);
  2760. }
  2761. }
  2762. }
  2763. }
  2764. #endregion
  2765. #region Show "Delete" effect object
  2766. public void ShowDeleteEffect()
  2767. {
  2768. if (TopCard != null)
  2769. {
  2770. if (willBeRemoveField)
  2771. {
  2772. if (ShowingPermanentCard != null)
  2773. {
  2774. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2775. {
  2776. ShowingPermanentCard.WillBeDeletedObject.transform.parent.gameObject.SetActive(true);
  2777. ShowingPermanentCard.WillBeDeletedObject.SetActive(true);
  2778. }
  2779. }
  2780. }
  2781. }
  2782. }
  2783. #endregion
  2784. #region Hide "Delete" effect object
  2785. public void HideDeleteEffect()
  2786. {
  2787. if (TopCard != null)
  2788. {
  2789. if (ShowingPermanentCard != null)
  2790. {
  2791. if (ShowingPermanentCard.WillBeDeletedObject != null)
  2792. {
  2793. ShowingPermanentCard.WillBeDeletedObject.SetActive(false);
  2794. }
  2795. }
  2796. }
  2797. }
  2798. #endregion
  2799. #region Show "Remove Field" effect object
  2800. public void ShowWillRemoveFieldEffect()
  2801. {
  2802. if (TopCard != null)
  2803. {
  2804. if (willBeRemoveField)
  2805. {
  2806. if (ShowingPermanentCard != null)
  2807. {
  2808. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2809. {
  2810. ShowingPermanentCard.WillRemoveFieldObject.transform.parent.gameObject.SetActive(true);
  2811. ShowingPermanentCard.WillRemoveFieldObject.SetActive(true);
  2812. }
  2813. }
  2814. }
  2815. }
  2816. }
  2817. #endregion
  2818. #region Hide "Remove Field" effect object
  2819. public void HideWillRemoveFieldEffect()
  2820. {
  2821. if (TopCard != null)
  2822. {
  2823. if (ShowingPermanentCard != null)
  2824. {
  2825. if (ShowingPermanentCard.WillRemoveFieldObject != null)
  2826. {
  2827. ShowingPermanentCard.WillRemoveFieldObject.SetActive(false);
  2828. }
  2829. }
  2830. }
  2831. }
  2832. #endregion
  2833. #region Show "Digivolution" effect object
  2834. public void ShowWillEvolutionEffect()
  2835. {
  2836. if (TopCard != null)
  2837. {
  2838. if (ShowingPermanentCard != null)
  2839. {
  2840. if (ShowingPermanentCard.WillEvolutionObject != null)
  2841. {
  2842. ShowingPermanentCard.WillEvolutionObject.transform.parent.gameObject.SetActive(true);
  2843. ShowingPermanentCard.WillEvolutionObject.SetActive(true);
  2844. }
  2845. }
  2846. }
  2847. }
  2848. #endregion
  2849. #region Hide "Digivolution" effect object
  2850. public void HideWillEvolutionEffect()
  2851. {
  2852. if (TopCard != null)
  2853. {
  2854. if (ShowingPermanentCard != null)
  2855. {
  2856. if (ShowingPermanentCard.WillEvolutionObject != null)
  2857. {
  2858. ShowingPermanentCard.WillEvolutionObject.SetActive(false);
  2859. }
  2860. }
  2861. }
  2862. }
  2863. #endregion
  2864. }