private static void FinishAcquireTargetLock(GenericShip thisShip, GenericShip targetShip, Action callback) { BlueTargetLockToken tokenBlue = new BlueTargetLockToken(thisShip); RedTargetLockToken tokenRed = new RedTargetLockToken(targetShip); char letter = GetFreeTargetLockLetter(); tokenBlue.Letter = letter; tokenBlue.OtherTokenOwner = targetShip; tokenRed.Letter = letter; tokenRed.OtherTokenOwner = thisShip; TakeTargetLockLetter(letter); targetShip.Tokens.AssignToken( tokenRed, delegate { thisShip.Tokens.AssignToken(tokenBlue, delegate { thisShip.CallOnTargetLockIsAcquiredEvent(targetShip, callback); }); } ); }
private void UseZertikStromAbility() { BlueTargetLockToken tlock = HostShip.Tokens.GetToken(typeof(BlueTargetLockToken), '*') as BlueTargetLockToken; // Do we have a target lock? if (tlock != null) { GenericShip tlocked = tlock.OtherTokenOwner; if (!tlocked.Damage.HasFacedownCards) { return; } Triggers.RegisterTrigger( new Trigger() { Name = "Zertik Strom's Ability", TriggerOwner = HostShip.Owner.PlayerNo, TriggerType = TriggerTypes.OnEndPhaseStart, EventHandler = delegate { AskToUseAbility(AlwaysUseByDefault, RemoveTargetLock); } } ); } }
private void RemoveTargetLock(System.Object sender, EventArgs e) { BlueTargetLockToken tlock = HostShip.Tokens.GetToken(typeof(BlueTargetLockToken), '*') as BlueTargetLockToken; GenericShip tlocked = tlock.OtherTokenOwner; HostShip.Tokens.RemoveToken(tlock, delegate { tlocked.Damage.ExposeRandomFacedownCard(DecisionSubPhase.ConfirmDecision); }); }
public void RemoveTargetLocksOnDestruction(GenericShip ship) { while (true) { BlueTargetLockToken token = ship.GetToken(typeof(BlueTargetLockToken), '*') as BlueTargetLockToken; if (token != null) { ship.RemoveToken(token.GetType(), token.Letter); } else { break; } } while (true) { RedTargetLockToken token = ship.GetToken(typeof(RedTargetLockToken), '*') as RedTargetLockToken; if (token != null) { ship.RemoveToken(token.GetType(), token.Letter); } else { break; } } }
private void AgreeToUseAbility(object sender, EventArgs e) { DecisionSubPhase.ConfirmDecisionNoCallback(); BlueTargetLockToken lockToken = HostShip.Tokens.GetToken <BlueTargetLockToken>('*'); GenericShip targetShip = lockToken.OtherTargetLockTokenOwner as GenericShip; HostShip.Tokens.RemoveToken(lockToken, delegate { SeeDial(targetShip); }); }
private void UseAbility(object sender, System.EventArgs e) { DecisionSubPhase.ConfirmDecisionNoCallback(); IsAbilityUsed = true; BlueTargetLockToken existingToken = HostShip.Tokens.GetToken <BlueTargetLockToken>('*'); GenericShip TargetLockTarget = existingToken.OtherTokenOwner; ActionsHolder.AcquireTargetLock(HostShip, TargetLockTarget, FinishAbility, FinishAbility); }
private void SetTargetLockCanBeUsed(GenericShip ship) { BlueTargetLockToken ownTargetLockToken = (BlueTargetLockToken)Combat.Attacker.Tokens.GetToken(typeof(BlueTargetLockToken), targetLockLetter); if (ownTargetLockToken != null) { ownTargetLockToken.CanBeUsed = true; } Combat.Attacker.OnAttackFinish -= SetTargetLockCanBeUsed; }
private GenericShip GetLockedShip() { GenericShip result = null; BlueTargetLockToken blueTargetLock = HostShip.Tokens.GetToken <BlueTargetLockToken>(letter: '*'); if (blueTargetLock != null) { result = blueTargetLock.OtherTokenOwner; } return(result); }
private void SetTargetLockCanBeUsed(GenericShip ship) { foreach (char targetLockLetter in targetLockLetters) { BlueTargetLockToken ownTargetLockToken = (BlueTargetLockToken)HostShip.Tokens.GetToken(typeof(BlueTargetLockToken), targetLockLetter); if (ownTargetLockToken != null) { ownTargetLockToken.CanBeUsed = true; } } HostShip.OnAttackFinish -= SetTargetLockCanBeUsed; }
private void CheckRemoveAbility(GenericShip ship, GenericToken token, ref bool data) { BlueTargetLockToken lockToken = token as BlueTargetLockToken; if (lockToken != null) { GenericObstacle lockedObstacle = lockToken.OtherTargetLockTokenOwner as GenericObstacle; if (lockedObstacle != null) { if (HostShip.Tokens.GetTargetLockLetterPairsOn(lockedObstacle).Count == 1) { Messages.ShowInfo("Qi'Ra: You don't ignore obstacle anymore"); HostShip.IgnoreObstaclesList.Remove(lockedObstacle); } } } }
private void UseZertikStromAbility() { BlueTargetLockToken tlock = HostShip.Tokens.GetToken(typeof(BlueTargetLockToken), '*') as BlueTargetLockToken; // Do we have a target lock? if (tlock != null) { ITargetLockable tlocked = tlock.OtherTargetLockTokenOwner; if (tlocked is GenericShip) { if (!(tlocked as GenericShip).Damage.HasFacedownCards) { return; } Triggers.RegisterTrigger( new Trigger() { Name = "Zertik Strom's Ability", TriggerOwner = HostShip.Owner.PlayerNo, TriggerType = TriggerTypes.OnEndPhaseStart, EventHandler = delegate { AskToUseAbility( HostShip.PilotInfo.PilotName, AlwaysUseByDefault, RemoveTargetLock, descriptionLong: "Do you want to spend a lock you have on an enemy ship to expose 1 of that ship's damage cards?", imageHolder: HostShip ); } } ); } } }
private void RegisterMultiSpectralCamouflageAbility(GenericShip ship, Type tokenType) { // Trigger only when a ship receives a BlueTargetLockToken if (tokenType != typeof(BlueTargetLockToken)) { return; } BlueTargetLockToken assignedBlueLock = (BlueTargetLockToken)ship.Tokens.GetToken(typeof(BlueTargetLockToken), '*'); TargetLockLetter = assignedBlueLock.Letter; // Make sure the targeted ship is the HostShip if (HostShip.Tokens.GetToken(typeof(RedTargetLockToken), TargetLockLetter) == null) { return; } // Make sure Host Ship only has one red target lock int redTargetLockCount = 0; foreach (GenericToken token in HostShip.Tokens.GetAllTokens()) { if (token is RedTargetLockToken) { redTargetLockCount += 1; } } TargetingShip = ship; if (redTargetLockCount == 1) { RegisterAbilityTrigger(TriggerTypes.OnTokenIsAssigned, AskToUseMultiSpectralCamouflageAbility); } }