Ejemplo n.º 1
0
 void ExecuteAssumeCloseOrbitOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     // TODO
 }
Ejemplo n.º 2
0
 private void UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) { RelayToCurrentState(fsmTgt); }
Ejemplo n.º 3
0
 void ExecuteExploreOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     // TODO
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AItemReport" /> class.
 /// </summary>
 /// <param name="player">The player requesting the report.</param>
 /// <param name="item">The item the report is about.</param>
 public AItemReport(AItemData data, Player player, IItem_Ltd item) {
     Player = player;
     Item = item;
     __PositionForCameraDistance = new Reference<Vector3>(() => item.Position);
     AssignValues(data);
 }
Ejemplo n.º 5
0
 void ExecutePatrolOrder_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     //D.Log(ShowDebugLog, "{0} received a FsmTgtInfoAccessChgd event while executing a patrol order.", DebugName);
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     IPatrollable patrollableTgt = _fsmTgt as IPatrollable;
     if (!patrollableTgt.IsPatrollingAllowedBy(Owner)) {
         D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as Relations with newly accessed Owner {3} is {4}.",
            DebugName, CurrentOrder.Directive.GetValueName(), patrollableTgt.DebugName, patrollableTgt.Owner_Debug, Owner.GetCurrentRelations(patrollableTgt.Owner_Debug).GetValueName());
         // TODO Communicate failure to boss?
         StationaryLocation assumeFormationTgt = GameUtility.GetClosest(Position, patrollableTgt.LocalAssemblyStations);
         CurrentOrder = new FleetOrder(FleetDirective.AssumeFormation, OrderSource.CmdStaff, assumeFormationTgt);
     }
 }
Ejemplo n.º 6
0
 void Attacking_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     // TODO
 }
Ejemplo n.º 7
0
 void ExecuteAttackOrder_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     // TODO
 }
Ejemplo n.º 8
0
 void ExecuteJoinFleetOrder_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     if (fsmTgt.IsOwnerAccessibleTo(Owner)) {
         Player tgtFleetOwner;
         bool isAccessible = fsmTgt.TryGetOwner(Owner, out tgtFleetOwner);
         D.Assert(isAccessible);
         if (tgtFleetOwner == Owner) {
             // target fleet owner is still us
             return;
         }
     }
     // owner is no longer us
     IssueAssumeFormationOrderFromCmdStaff();
 }
Ejemplo n.º 9
0
 void ExecuteJoinFleetOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     // owner is no longer us
     IssueAssumeFormationOrderFromCmdStaff();
 }
Ejemplo n.º 10
0
 void ExecuteAttackOrder_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     IUnitAttackable attackedTgt = _fsmTgt as IUnitAttackable;
     if (!attackedTgt.IsAttackByAllowed(Owner)) {
         D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as just lost access to Owner {3}.",
             DebugName, CurrentOrder.Directive.GetValueName(), attackedTgt.DebugName, attackedTgt.Owner_Debug);
         // TODO Communicate failure to boss?
         IssueAssumeFormationOrderFromCmdStaff();
     }
 }
Ejemplo n.º 11
0
 void ExecuteAttackOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     IUnitAttackable attackedTgt = _fsmTgt as IUnitAttackable;
     if (attackedTgt.IsWarAttackByAllowed(Owner)) {
         // With an owner change, the attack should continue only if at War with new owner
         return;
     }
     D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as Relations with new Owner {3} is {4}.",
         DebugName, CurrentOrder.Directive.GetValueName(), attackedTgt.DebugName, attackedTgt.Owner_Debug, Owner.GetCurrentRelations(attackedTgt.Owner_Debug).GetValueName());
     // TODO Communicate failure to boss?
     IssueAssumeFormationOrderFromCmdStaff();
 }
Ejemplo n.º 12
0
 void Guarding_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     IGuardable guardedTgt = _fsmTgt as IGuardable;
     if (!guardedTgt.IsGuardingAllowedBy(Owner)) {
         D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as Relations with new Owner {3} is {4}.",
             DebugName, CurrentOrder.Directive.GetValueName(), guardedTgt.DebugName, guardedTgt.Owner_Debug, Owner.GetCurrentRelations(guardedTgt.Owner_Debug).GetValueName());
         _orderFailureCause = UnitItemOrderFailureCause.TgtRelationship;
         Return();
     }
 }
Ejemplo n.º 13
0
 void ExecuteGuardOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     IGuardable guardableTgt = _fsmTgt as IGuardable;
     if (!guardableTgt.IsGuardingAllowedBy(Owner)) {
         D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as Relations with new Owner {3} is {4}.",
             DebugName, CurrentOrder.Directive.GetValueName(), guardableTgt.DebugName, guardableTgt.Owner_Debug, Owner.GetCurrentRelations(guardableTgt.Owner_Debug).GetValueName());
         // TODO Communicate failure to boss?
         StationaryLocation assumeFormationTgt = GameUtility.GetClosest(Position, guardableTgt.LocalAssemblyStations);
         CurrentOrder = new FleetOrder(FleetDirective.AssumeFormation, OrderSource.CmdStaff, assumeFormationTgt);
     }
 }
Ejemplo n.º 14
0
 void Patrolling_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     IPatrollable patrolledTgt = _fsmTgt as IPatrollable;
     if (!patrolledTgt.IsPatrollingAllowedBy(Owner)) {
         D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as Relations with newly accessed Owner {3} is {4}.",
             DebugName, CurrentOrder.Directive.GetValueName(), patrolledTgt.DebugName, patrolledTgt.Owner_Debug, Owner.GetCurrentRelations(patrolledTgt.Owner_Debug).GetValueName());
         _orderFailureCause = UnitItemOrderFailureCause.TgtRelationship;
         Return();
     }
 }
Ejemplo n.º 15
0
 void AssumingCloseOrbit_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IShipNavigable);
     if (LastState == ShipState.ExecuteExploreOrder) {
         // Note: FleetCmd handles not being allowed to explore
         var exploreTgt = _fsmTgt as IShipExplorable;
         if (exploreTgt.IsFullyExploredBy(Owner)) {
             Return();
         }
     }
 }
Ejemplo n.º 16
0
 void Moving_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
     if (fsmTgt.IsOwnerAccessibleTo(Owner)) {
         // evaluate reassessing move as target's owner is accessible to us
         UnitItemOrderFailureCause failCause;
         if (ShouldMovingBeReassessed(out failCause, __isFsmInfoAccessChgd: false)) {
             _orderFailureCause = failCause;
             Return();
         }
     }
 }
Ejemplo n.º 17
0
 void Attacking_UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     // TODO
 }
Ejemplo n.º 18
0
 private void HandleFsmTgtInfoAccessChgd(Player playerWhoseInfoAccessChgd, IItem_Ltd fsmTgt) {
     if (playerWhoseInfoAccessChgd == Owner) {
         UponFsmTgtInfoAccessChgd(fsmTgt);
     }
 }
Ejemplo n.º 19
0
 void Moving_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     D.AssertEqual(_fsmTgt, fsmTgt as IShipNavigable);
     if (LastState == ShipState.ExecuteExploreOrder) {
         // Note: FleetCmd handles not being allowed to explore
         var exploreTgt = _fsmTgt as IShipExplorable;
         if (exploreTgt.IsFullyExploredBy(Owner)) {
             // not a failure so no failure code
             Return();
         }
     }
 }
Ejemplo n.º 20
0
 private void HandleFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     UponFsmTgtOwnerChgd(fsmTgt);
 }
Ejemplo n.º 21
0
 void ExecuteAttackOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
     LogEvent();
     // TODO
 }
Ejemplo n.º 22
0
 private void UponFsmTgtInfoAccessChgd(IItem_Ltd fsmTgt) { RelayToCurrentState(fsmTgt); }
Ejemplo n.º 23
0
 /// <summary>
 /// Indicates whether the Owner has knowledge of the provided item.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns></returns>
 public bool HasKnowledgeOf(IItem_Ltd item) {
     Utility.ValidateNotNull(item);
     if (item is IPlanetoid_Ltd) {
         return _planetoids.Contains(item as IPlanetoid_Ltd);
     }
     if (item is IUnitElement_Ltd) {
         return _elements.Contains(item as IUnitElement_Ltd);
     }
     if (item is IUnitCmd_Ltd) {
         return _commands.Contains(item as IUnitCmd_Ltd);
     }
     if (item is IUniverseCenter_Ltd) {
         D.AssertEqual(UniverseCenter, item);
         D.Warn("{0}: unnecessary check for knowledge of {1}.", DebugName, item.DebugName);
         return true;
     }
     if (item is IStar_Ltd) {
         D.Assert(_stars.Contains(item as IStar_Ltd));
         D.Warn("{0}: unnecessary check for knowledge of {1}.", DebugName, item.DebugName);
         return true;
     }
     if (item is ISystem_Ltd) {
         D.Assert(_systemLookupBySectorID.Values.Contains(item as ISystem_Ltd));
         D.Warn("{0}: unnecessary check for knowledge of {1}.", DebugName, item.DebugName);
         return true;
     }
     return false;
 }
Ejemplo n.º 24
0
    void ExecuteExploreOrder_UponFsmTgtOwnerChgd(IItem_Ltd fsmTgt) {
        LogEvent();
        D.AssertEqual(_fsmTgt, fsmTgt as IFleetNavigable);
        IFleetExplorable fleetExploreTgt = _fsmTgt as IFleetExplorable;
        if (!fleetExploreTgt.IsExploringAllowedBy(Owner) || fleetExploreTgt.IsFullyExploredBy(Owner)) {
            // new known owner is either at war with us or an ally
            Player fsmTgtOwner;
            bool isFsmTgtOwnerKnown = fleetExploreTgt.TryGetOwner(Owner, out fsmTgtOwner);
            D.Assert(isFsmTgtOwnerKnown);

            D.Log(ShowDebugLog, "{0} {1} order for {2} is no longer valid as Relations with new Owner {3} is {4}.",
                DebugName, CurrentOrder.Directive.GetValueName(), fleetExploreTgt.DebugName, fsmTgtOwner, Owner.GetCurrentRelations(fsmTgtOwner).GetValueName());
            // TODO Communicate failure/success to boss?
            var closestLocalAssyStation = GameUtility.GetClosest(Position, fleetExploreTgt.LocalAssemblyStations);
            CurrentOrder = new FleetOrder(FleetDirective.AssumeFormation, OrderSource.CmdStaff, closestLocalAssyStation);
        }
    }