AttackProcess.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Photon.Pun;
  5. using System;
  6. using System.Linq;
  7. using UnityEngine.UI;
  8. public class AttackProcess : MonoBehaviourPunCallbacks
  9. {
  10. public Permanent AttackingPermanent { get; private set; } = null;
  11. public Permanent DefendingPermanent { get; private set; } = null;
  12. public int AttackCount { get; set; } = 0;
  13. public bool IsAttacking { get; set; } = false;
  14. public bool HasDefender { get; set; } = false;
  15. public bool IsBlocking { get; set; } = false;
  16. public CardSource SecurityDigimon { get; set; } = null;
  17. public bool DoSecurityCheck { get; set; } = false;
  18. public bool IsEndAttack { get; set; } = false;
  19. public bool UsedBlitz { get; set; } = false;
  20. public Hashtable EffectHashtable { get; set; } = null;
  21. public Hashtable CounterEffectHashtable { get; set; } = null;
  22. public AttackState State { get; set; } = AttackState.None;
  23. public enum AttackState
  24. {
  25. None,
  26. Counter,
  27. Block,
  28. Battle,
  29. End
  30. }
  31. public bool ActiveAttack()
  32. {
  33. return State != null && State != AttackState.None;
  34. }
  35. public IEnumerator ProcessNextState()
  36. {
  37. switch (State)
  38. {
  39. case AttackState.Counter:
  40. yield return ContinuousController.instance.StartCoroutine(CounterTiming());
  41. break;
  42. case AttackState.Block:
  43. yield return ContinuousController.instance.StartCoroutine(BlockTiming());
  44. break;
  45. case AttackState.Battle:
  46. yield return ContinuousController.instance.StartCoroutine(DetermineAttackOutcome());
  47. break;
  48. case AttackState.End:
  49. yield return ContinuousController.instance.StartCoroutine(EndAttack());
  50. break;
  51. default:
  52. yield break;
  53. }
  54. }
  55. void SetAttackerDefender(Permanent attackingPermanent, Permanent defendingPermanent)
  56. {
  57. AttackingPermanent = attackingPermanent;
  58. DefendingPermanent = defendingPermanent;
  59. if (defendingPermanent != null)
  60. HasDefender = true;
  61. }
  62. public IEnumerator Attack(Permanent attackingPermanent, Permanent defendingPermanent, ICardEffect attackEffect, bool withoutTap = false, Func<IEnumerator> beforeOnAttackCoroutine = null)
  63. {
  64. if (IsAttacking)
  65. {
  66. if (beforeOnAttackCoroutine != null)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(beforeOnAttackCoroutine());
  69. }
  70. yield break;
  71. }
  72. AttackingPermanent = null;
  73. DefendingPermanent = null;
  74. DoSecurityCheck = false;
  75. IsBlocking = false;
  76. SecurityDigimon = null;
  77. IsAttacking = false;
  78. HasDefender = false;
  79. IsEndAttack = false;
  80. CounterEffectHashtable = null;
  81. SetAttackerDefender(attackingPermanent, defendingPermanent);
  82. EffectHashtable = CardEffectCommons.OnAttackCheckHashtableOfPermanent(AttackingPermanent, attackEffect);
  83. CounterEffectHashtable = CardEffectCommons.OnAttackCheckHashtableOfPermanent(new Permanent(AttackingPermanent.cardSources), attackEffect);
  84. IsAttacking = true;
  85. GManager.instance.turnStateMachine.IsSelecting = true;
  86. // force to end attack
  87. if (IsEndAttack)
  88. {
  89. State = AttackState.End;
  90. yield break;
  91. }
  92. #region Attack Process
  93. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(AttackingPermanent))
  94. {
  95. AttackCount++;
  96. GManager.instance.turnStateMachine.IsSelecting = true;
  97. if (DefendingPermanent != null)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  100. {
  101. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  102. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  103. GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.securityObject.securityBreakGlass.gameObject.SetActive(false);
  104. }
  105. }
  106. else
  107. {
  108. if (GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.SecurityCards.Count >= 1)
  109. {
  110. GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.securityObject.securityBreakGlass.ShowBlueMatarial();
  111. }
  112. }
  113. AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
  114. AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  115. // add log
  116. string log = $"\nAttack:\n{AttackingPermanent.TopCard.BaseENGCardNameFromEntity}({AttackingPermanent.TopCard.CardID})";
  117. if (DefendingPermanent != null)
  118. {
  119. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  120. log += $"\n«\n{DefendingPermanent.TopCard.BaseENGCardNameFromEntity}({DefendingPermanent.TopCard.CardID})\n";
  121. }
  122. else
  123. {
  124. log += $"\n«\nSecurity\n";
  125. }
  126. PlayLog.OnAddLog?.Invoke(log);
  127. // suspend
  128. if (!withoutTap)
  129. {
  130. Hashtable attackerTapHashtable = new Hashtable()
  131. {
  132. {"IsAttack", true}
  133. };
  134. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  135. new List<Permanent>() { AttackingPermanent },
  136. attackerTapHashtable).Tap());
  137. }
  138. // target arrow
  139. if (DefendingPermanent == null)
  140. {
  141. yield return GManager.instance.OnTargetArrow(
  142. AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
  143. GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.SecurityAttackLocalCanvasPosition + GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.playerUIObjectParent.localPosition,
  144. null,
  145. null);
  146. }
  147. else
  148. {
  149. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  150. {
  151. yield return GManager.instance.OnTargetArrow(
  152. AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
  153. DefendingPermanent.PermanentFrame.GetLocalCanvasPosition() + DefendingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
  154. null,
  155. null);
  156. }
  157. }
  158. // callback that is processed before [On Attack]
  159. if (beforeOnAttackCoroutine != null)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(beforeOnAttackCoroutine());
  162. }
  163. // trigger [On Attack] effect
  164. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(
  165. EffectHashtable,
  166. EffectTiming.OnAllyAttack));
  167. GManager.instance.turnStateMachine.IsSelecting = true;
  168. if (AttackingPermanent.TopCard != null)
  169. {
  170. AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
  171. AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  172. }
  173. if (DefendingPermanent != null)
  174. {
  175. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  176. {
  177. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  178. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  179. }
  180. }
  181. GManager.instance.turnStateMachine.IsSelecting = true;
  182. // force to end attack
  183. if (IsEndAttack)
  184. {
  185. State = AttackState.End;
  186. yield break;
  187. }
  188. if (AttackingPermanent.TopCard != null)
  189. {
  190. AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
  191. AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  192. }
  193. if (DefendingPermanent != null)
  194. {
  195. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  196. {
  197. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  198. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  199. }
  200. }
  201. State = AttackState.Counter;
  202. }
  203. else
  204. {
  205. if (beforeOnAttackCoroutine != null)
  206. {
  207. yield return ContinuousController.instance.StartCoroutine(beforeOnAttackCoroutine());
  208. }
  209. State = AttackState.End;
  210. }
  211. #endregion
  212. }
  213. IEnumerator CounterTiming()
  214. {
  215. // force to end attack
  216. if (IsEndAttack)
  217. {
  218. State = AttackState.End;
  219. yield break;
  220. }
  221. // trigger effects when counter timing (except [Counter] effects)
  222. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
  223. CounterEffectHashtable,
  224. EffectTiming.OnCounterTiming,
  225. cardEffect => !cardEffect.IsCounterEffect));
  226. // activate cutin effects
  227. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, null));
  228. GManager.instance.turnStateMachine.IsSelecting = true;
  229. // force to end attack
  230. if (IsEndAttack)
  231. {
  232. State = AttackState.End;
  233. yield break;
  234. }
  235. // trigger effects when counter timing ([Counter] effects)
  236. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.StackSkillInfos(
  237. CounterEffectHashtable,
  238. EffectTiming.OnCounterTiming,
  239. cardEffect => cardEffect.IsCounterEffect));
  240. bool HasCounterEffect(List<SkillInfo> skillInfos, SkillInfo skillInfo)
  241. {
  242. return skillInfos.Count((skillInfo1) => skillInfo1.CardEffect.IsCounterEffect) >= 1;
  243. }
  244. // activate cutin effects
  245. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing_CutIn.TriggeredSkillProcess(true, HasCounterEffect));
  246. GManager.instance.turnStateMachine.IsSelecting = true;
  247. // force to end attack
  248. if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
  249. {
  250. State = AttackState.End;
  251. yield break;
  252. }
  253. AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
  254. AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  255. if (DefendingPermanent != null)
  256. {
  257. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  258. {
  259. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  260. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  261. }
  262. }
  263. State = AttackState.Block;
  264. }
  265. IEnumerator BlockTiming()
  266. {
  267. // force to end attack
  268. if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
  269. {
  270. State = AttackState.End;
  271. yield break;
  272. }
  273. #region select blocker
  274. bool CanSelectBlockerCondition(Permanent permanent)
  275. {
  276. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, AttackingPermanent.TopCard)
  277. && permanent != DefendingPermanent
  278. && permanent.HasBlocker
  279. && permanent.CanBlock(AttackingPermanent);
  280. }
  281. if (AttackingPermanent.TopCard.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectBlockerCondition) >= 1)
  282. {
  283. int maxCount = 1;
  284. Permanent selectedPermanent = null;
  285. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  286. selectPermanentEffect.SetUp(
  287. selectPlayer: AttackingPermanent.TopCard.Owner.Enemy,
  288. canTargetCondition: CanSelectBlockerCondition,
  289. canTargetCondition_ByPreSelecetedList: null,
  290. canEndSelectCondition: null,
  291. maxCount: maxCount,
  292. canNoSelect: (!IsBlocking),
  293. canEndNotMax: false,
  294. selectPermanentCoroutine: SelectPermanentCoroutine,
  295. afterSelectPermanentCoroutine: null,
  296. mode: SelectPermanentEffect.Mode.Custom,
  297. cardEffect: null);
  298. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will block.", "The opponent is selecting 1 Digimon that will block.");
  299. if(!IsBlocking)
  300. selectPermanentEffect.SetUpCustomBackButtonMessage("Not Block");
  301. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  302. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  303. {
  304. selectedPermanent = permanent;
  305. yield return null;
  306. }
  307. if (selectedPermanent != null)
  308. {
  309. yield return ContinuousController.instance.StartCoroutine(SwitchDefender(null, true, selectedPermanent));
  310. }
  311. }
  312. #endregion
  313. GManager.instance.turnStateMachine.IsSelecting = true;
  314. //end attack
  315. if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
  316. {
  317. State = AttackState.End;
  318. yield break;
  319. }
  320. AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
  321. AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  322. if (DefendingPermanent != null)
  323. {
  324. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent))
  325. {
  326. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  327. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  328. }
  329. }
  330. State = AttackState.Battle;
  331. }
  332. IEnumerator DetermineAttackOutcome()
  333. {
  334. //end attack
  335. if (IsEndAttack || AttackingPermanent.TopCard == null || !AttackingPermanent.IsDigimon)
  336. {
  337. State = AttackState.End;
  338. yield break;
  339. }
  340. #region there is no Defending Permanent
  341. if (DefendingPermanent == null)
  342. {
  343. if (AttackingPermanent.Strike >= 1)
  344. {
  345. //if there is no security, end the game
  346. if (AttackingPermanent.TopCard.Owner.Enemy.SecurityCards.Count == 0)
  347. {
  348. GManager.instance.turnStateMachine.EndGame(AttackingPermanent.TopCard.Owner, false);
  349. yield break;
  350. }
  351. }
  352. DoSecurityCheck = true;
  353. }
  354. #endregion
  355. #region there is Defending Permanent
  356. else
  357. {
  358. if (!CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(DefendingPermanent) || !CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(AttackingPermanent))
  359. {
  360. State = AttackState.End;
  361. yield break;
  362. }
  363. DefendingPermanent.TopCard.Owner.securityObject.securityBreakGlass.gameObject.SetActive(false);
  364. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  365. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  366. // battle
  367. IBattle battle = new IBattle(AttackingPermanent: AttackingPermanent, DefendingPermanent: DefendingPermanent, null);
  368. yield return ContinuousController.instance.StartCoroutine(battle.Battle());
  369. //TODO: Reimplement the below to ensure full correctness of battle by effect.
  370. //Will need bool AttackProcess.WasDigimonDestroyedInBattle and change to piercing to check it
  371. /*#region effect when determine whether to do security check
  372. Hashtable hashtable = new Hashtable()
  373. {
  374. {"battle", battle}
  375. };
  376. List<SkillInfo> skillInfos_Pierce = AutoProcessing.GetSkillInfos(hashtable, EffectTiming.OnDetermineDoSecurityCheck)
  377. .Filter(skillInfo => skillInfo.CardEffect != null && skillInfo.CardEffect.CanActivate(skillInfo.Hashtable));
  378. if (skillInfos_Pierce.Count >= 1)
  379. {
  380. GManager.instance.autoProcessing.PutStackedSkill(skillInfos_Pierce[0]);
  381. }
  382. #endregion*/
  383. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.TriggeredSkillProcess(true, null));
  384. GManager.instance.turnStateMachine.IsSelecting = true;
  385. }
  386. #endregion
  387. if (AttackingPermanent.TopCard == null)
  388. {
  389. State = AttackState.End;
  390. yield break;
  391. }
  392. #region do security check
  393. if (DoSecurityCheck && AttackingPermanent.TopCard.Owner.Enemy.SecurityCards.Count >= 1)
  394. {
  395. //security check process
  396. yield return ContinuousController.instance.StartCoroutine(new ISecurityCheck(
  397. AttackingPermanent: AttackingPermanent,
  398. player: GManager.instance.turnStateMachine.gameContext.NonTurnPlayer).SecurityCheck());
  399. }
  400. #endregion
  401. State = AttackState.End;
  402. }
  403. #region End Attack
  404. IEnumerator EndAttack()
  405. {
  406. // [On End Attack] effect
  407. if (AttackingPermanent != null && AttackingPermanent.TopCard != null)
  408. {
  409. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(EffectHashtable, EffectTiming.OnEndAttack));
  410. }
  411. // activate cutin effects
  412. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.AutoProcessCheck());
  413. #region reset effects which continues until the end of attack
  414. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer)
  415. {
  416. foreach (Permanent permanent in player.GetFieldPermanents())
  417. {
  418. permanent.UntilEndAttackEffects = new List<Func<EffectTiming, ICardEffect>>();
  419. }
  420. }
  421. #endregion
  422. GManager.instance.turnStateMachine.IsSelecting = true;
  423. #endregion
  424. DoSecurityCheck = false;
  425. IsBlocking = false;
  426. SecurityDigimon = null;
  427. IsAttacking = false;
  428. IsEndAttack = false;
  429. CounterEffectHashtable = null;
  430. State = AttackState.None;
  431. }
  432. public IEnumerator SwitchDefender(ICardEffect cardEffect, bool isBlock, Permanent newDefendingPermanent)
  433. {
  434. if (AttackingPermanent == null) yield break;
  435. if (AttackingPermanent.TopCard == null) yield break;
  436. if (newDefendingPermanent != null && newDefendingPermanent.TopCard == null) yield break;
  437. if (!AttackingPermanent.CanSwitchAttackTarget) yield break;
  438. Permanent oldDefendingPermanent = DefendingPermanent;
  439. DefendingPermanent = newDefendingPermanent;
  440. IsBlocking = isBlock;
  441. if (DefendingPermanent != null)
  442. {
  443. if (DefendingPermanent.ShowingPermanentCard != null)
  444. {
  445. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  446. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  447. }
  448. }
  449. Hashtable hashtable = new Hashtable(){
  450. {"AttackingPermanent", AttackingPermanent},
  451. {"DefendingPermanent", DefendingPermanent},
  452. {"CardEffect", cardEffect}
  453. };
  454. if (isBlock)
  455. {
  456. hashtable.Add("IsBlock", isBlock);
  457. }
  458. if (isBlock)
  459. {
  460. if (DefendingPermanent != null)
  461. {
  462. // add log
  463. string log1 = $"\nBlock:\n{DefendingPermanent.TopCard.BaseENGCardNameFromEntity}({DefendingPermanent.TopCard.CardID})\n";
  464. PlayLog.OnAddLog?.Invoke(log1);
  465. // suspend
  466. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { DefendingPermanent }, hashtable).Tap());
  467. // the effects when blocking
  468. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(
  469. hashtable,
  470. EffectTiming.OnBlockAnyone));
  471. }
  472. }
  473. if (AttackingPermanent != null)
  474. {
  475. if (AttackingPermanent.TopCard == null)
  476. {
  477. IsBlocking = false;
  478. yield break;
  479. }
  480. }
  481. if (DefendingPermanent != null)
  482. {
  483. if (DefendingPermanent.TopCard == null)
  484. {
  485. IsBlocking = false;
  486. yield break;
  487. }
  488. }
  489. if (AttackingPermanent != null)
  490. {
  491. // target arrow
  492. for (int i = 0; i < 3; i++)
  493. {
  494. GManager.instance.OffTargetArrow();
  495. yield return null;
  496. }
  497. if (DefendingPermanent != null)
  498. {
  499. DefendingPermanent.ShowingPermanentCard.SetOrangeOutline();
  500. DefendingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  501. yield return GManager.instance.OnTargetArrow(
  502. AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
  503. DefendingPermanent.PermanentFrame.GetLocalCanvasPosition() + DefendingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
  504. null,
  505. null);
  506. }
  507. else
  508. {
  509. yield return GManager.instance.OnTargetArrow(
  510. AttackingPermanent.PermanentFrame.GetLocalCanvasPosition() + AttackingPermanent.TopCard.Owner.playerUIObjectParent.localPosition,
  511. GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.SecurityAttackLocalCanvasPosition + GManager.instance.turnStateMachine.gameContext.NonTurnPlayer.playerUIObjectParent.localPosition,
  512. null,
  513. null);
  514. }
  515. AttackingPermanent.ShowingPermanentCard.SetOrangeOutline();
  516. AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(true);
  517. }
  518. if (newDefendingPermanent != oldDefendingPermanent)
  519. {
  520. // the effects when attack target switched
  521. yield return ContinuousController.instance.StartCoroutine(GManager.instance.autoProcessing.StackSkillInfos(
  522. hashtable,
  523. EffectTiming.OnAttackTargetChanged));
  524. }
  525. }
  526. }