Permanent.cs 127 KB

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