private void AssignToken(int shipId, Type tokenType, int targetShipId) { GenericShip ship = Roster.AllShips.FirstOrDefault(n => n.Key == "ShipId:" + shipId).Value; if (ship != null) { if (tokenType != typeof(BlueTargetLockToken)) { GenericToken token = (GenericToken)System.Activator.CreateInstance(tokenType, ship); ship.Tokens.AssignToken(token, ShowMessage); } else { if (targetShipId != -1) { GenericShip targetShip = Roster.AllShips.FirstOrDefault(n => n.Key == "ShipId:" + targetShipId).Value; if (targetShip != null) { Actions.AcquireTargetLock(ship, targetShip, ShowMessage, ShowErrorMessage); } else { ShowHelp(); } } else { ShowHelp(); } } } }
public override void ActivateShip(Ship.GenericShip ship) { Console.Write(ship.PilotName + " (" + ship.ShipId + ") is activated to perform maneuver", LogTypes.AI); bool isTargetLockPerformed = false; Ship.GenericShip anotherShip = FindNearestEnemyShip(ship, ignoreCollided: true, inArcAndRange: true); if (anotherShip == null) { anotherShip = FindNearestEnemyShip(ship, ignoreCollided: true); } if (anotherShip == null) { anotherShip = FindNearestEnemyShip(ship); } Console.Write("Nearest enemy is " + ship.PilotName + " (" + ship.ShipId + ")", LogTypes.AI); // TODO: remove null variant if (!RulesList.IonizationRule.IsIonized(ship)) { if (anotherShip != null) { ship.SetAssignedManeuver(ship.HotacManeuverTable.GetManeuver(ship, anotherShip)); } else { ship.SetAssignedManeuver(new Movement.StraightMovement(2, Movement.ManeuverDirection.Forward, Movement.ManeuverBearing.Straight, Movement.MovementComplexity.Normal)); } } ship.GenerateAvailableActionsList(); if (anotherShip != null) { foreach (var action in ship.GetAvailableActionsList()) { if (action.GetType() == typeof(ActionsList.TargetLockAction)) { isTargetLockPerformed = true; Actions.AcquireTargetLock( ship, anotherShip, delegate { PerformManeuverOfShip(ship); }, delegate { PerformManeuverOfShip(ship); } ); break; } } } if (!isTargetLockPerformed) { PerformManeuverOfShip(ship); } }
private void UseAbility(object sender, System.EventArgs e) { DecisionSubPhase.ConfirmDecisionNoCallback(); IsAbilityUsed = true; BlueTargetLockToken existingToken = HostShip.Tokens.GetToken <BlueTargetLockToken>('*'); GenericShip TargetLockTarget = existingToken.OtherTokenOwner; Actions.AcquireTargetLock(HostShip, TargetLockTarget, FinishAbility, FinishAbility); }
public override void Execute() { Selection.ChangeActiveShip("ShipId:" + int.Parse(GetString("id"))); Actions.AcquireTargetLock( Roster.GetShipById("ShipId:" + int.Parse(GetString("id"))), Roster.GetShipById("ShipId:" + int.Parse(GetString("target"))), delegate {}, delegate {} ); }
protected virtual void TrySelectTargetLock() { if (Rules.TargetLocks.TargetLockIsAllowed(Selection.ThisShip, TargetShip)) { Actions.AcquireTargetLock( Selection.ThisShip, TargetShip, SuccessfulCallback, RevertSubPhase ); } else { RevertSubPhase(); } }
protected override void FinishAction() { HideDiceResultMenu(); if (CurrentDiceRoll.DiceList[0].Side == DieSide.Success) { Sounds.PlayShipSound("R2D2-Proud"); Actions.AcquireTargetLock(Combat.Attacker, Combat.Defender, CallBack, CallBack); //TODO: Avoid code after callback char newTargetLockTokenLetter = Combat.Attacker.Tokens.GetTargetLockLetterPair(Combat.Defender); Tokens.GenericToken newTargetLockToken = Combat.Attacker.Tokens.GetToken(typeof(Tokens.BlueTargetLockToken), newTargetLockTokenLetter); newTargetLockToken.CanBeUsed = false; Combat.Attacker.OnAttackFinish += delegate { newTargetLockToken.CanBeUsed = true; }; } else { CallBack(); } }
protected override void FinishAction() { HideDiceResultMenu(); if (CurrentDiceRoll.DiceList[0].Side == DieSide.Success) { Sounds.PlayShipSound("R2D2-Proud"); Actions.AcquireTargetLock(Combat.Attacker, Combat.Defender, CallBack, CallBack); targetLockLetters = Actions.GetTargetLocksLetterPairs(Combat.Attacker, Combat.Defender); foreach (char targetLockLetter in targetLockLetters) { GenericToken newTargetLockToken = Combat.Attacker.Tokens.GetToken(typeof(BlueTargetLockToken), targetLockLetter); newTargetLockToken.CanBeUsed = false; } Combat.Attacker.OnAttackFinish += SetTargetLockCanBeUsed; } else { CallBack(); } }
private void AcquireTargetLock() { Actions.AcquireTargetLock(HostShip, TargetShip, SuccessfullSelection, UnSuccessfullSelection); }
private void AcquireTargetLock(object sender, System.EventArgs e) { Messages.ShowInfo(string.Format("Optimized Prototype: {0} gets target lock on {1}", HostShip.PilotName, Combat.Defender.PilotName)); Actions.AcquireTargetLock(HostShip, Combat.Defender, DecisionSubPhase.ConfirmDecision, DecisionSubPhase.ConfirmDecision); }
private void AcquireTargetLock(object sender, System.EventArgs e) { Messages.ShowInfo("Fire-Control System: Free Target Lock"); Actions.AcquireTargetLock(Combat.Attacker, Combat.Defender, DecisionSubPhase.ConfirmDecision, DecisionSubPhase.ConfirmDecision); }
private void UseColonelVesseryAbility(object sender, System.EventArgs e) { Actions.AcquireTargetLock(Combat.Attacker, Combat.Defender, SubPhases.DecisionSubPhase.ConfirmDecision, SubPhases.DecisionSubPhase.ConfirmDecision); }
private void GetTargetLockOnSameTarget() { Messages.ShowInfo(TargetShip.PilotName + " acquired Target Lock on " + LockedShip.PilotName); Actions.AcquireTargetLock(TargetShip, LockedShip, SelectShipSubPhase.FinishSelection, SelectShipSubPhase.FinishSelection, ignoreRange: true); }
private void UseTarnMisonAbility(object sender, EventArgs e) { Actions.AcquireTargetLock(HostShip, Combat.Attacker, DecisionSubPhase.ConfirmDecision, DecisionSubPhase.ConfirmDecision); }
private void AcquireTargetLock(object sender, EventArgs e) { Actions.AcquireTargetLock(Combat.Attacker, Combat.Defender, DecisionSubPhase.ConfirmDecision, DecisionSubPhase.ConfirmDecision); }
private void AssignLockToken() { Actions.AcquireTargetLock(HostShip, TargetShip, SelectShipSubPhase.FinishSelection, SelectShipSubPhase.FinishSelection, true); }