private void PayTokenCost(Action callBack) { List <Type> tokenRequirements = HostShip.GetWeaponAttackRequirement(this, isSilent: false); if (tokenRequirements.Contains(typeof(BlueTargetLockToken))) { List <GenericToken> waysToPay = new List <GenericToken>(); List <char> letters = ActionsHolder.GetTargetLocksLetterPairs(Combat.Attacker, Combat.Defender); GenericToken targetLockToken = Combat.Attacker.Tokens.GetToken(typeof(BlueTargetLockToken), letters.FirstOrDefault()); if (targetLockToken != null) { waysToPay.Add(targetLockToken); } Combat.Attacker.CallOnGenerateAvailableAttackPaymentList(waysToPay); if (waysToPay.Count == 1) { if (WeaponInfo.SpendsToken == typeof(BlueTargetLockToken) || waysToPay.First() is ForceToken) { Combat.Attacker.Tokens.SpendToken( waysToPay.First().GetType(), callBack, (waysToPay.First() as BlueTargetLockToken != null) ? (waysToPay.First() as BlueTargetLockToken).Letter : ' ' ); } else { callBack(); } } else { if (WeaponInfo.SpendsToken != null) { PayAttackCostDecisionSubPhase subphase = Phases.StartTemporarySubPhaseNew <PayAttackCostDecisionSubPhase>( "Choose how to pay attack cost", callBack ); subphase.Weapon = this; subphase.Start(); } else { callBack(); } } } else if (tokenRequirements.Contains(typeof(FocusToken)) && WeaponInfo.SpendsToken == typeof(FocusToken)) { Combat.Attacker.Tokens.SpendToken(typeof(FocusToken), callBack); } else { callBack(); } }
private void PayTokenCost(Action callBack) { if (RequiresTargetLockOnTargetToShoot) { List <GenericToken> waysToPay = new List <GenericToken>(); List <char> letters = Actions.GetTargetLocksLetterPairs(Combat.Attacker, Combat.Defender); GenericToken targetLockToken = Combat.Attacker.Tokens.GetToken(typeof(BlueTargetLockToken), letters.First()); if (targetLockToken != null) { waysToPay.Add(targetLockToken); } Combat.Attacker.CallOnGenerateAvailableAttackPaymentList(waysToPay); if (waysToPay.Count == 1) { if (SpendsTargetLockOnTargetToShoot || waysToPay.First() is ForceToken) { Combat.Attacker.Tokens.SpendToken( waysToPay.First().GetType(), callBack, (waysToPay.First() as BlueTargetLockToken != null) ? (waysToPay.First() as BlueTargetLockToken).Letter : ' ' ); } else { callBack(); } } else { PayAttackCostDecisionSubPhase subphase = Phases.StartTemporarySubPhaseNew <PayAttackCostDecisionSubPhase>( "Choose how to pay attack cost", callBack ); subphase.Weapon = this; subphase.Start(); } } else if (RequiresFocusToShoot && SpendsFocusToShoot) { Combat.Attacker.Tokens.SpendToken(typeof(FocusToken), callBack); } else { callBack(); } }