LCOV - code coverage report
Current view: top level - simulation/ai/petra - queueplan.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 26 0.0 %
Date: 2023-04-02 12:52:40 Functions: 0 7 0.0 %

          Line data    Source code
       1             : /**
       2             :  * Common functions and variables to all queue plans.
       3             :  */
       4             : 
       5           0 : PETRA.QueuePlan = function(gameState, type, metadata)
       6             : {
       7           0 :         this.type = gameState.applyCiv(type);
       8           0 :         this.metadata = metadata;
       9             : 
      10           0 :         this.template = gameState.getTemplate(this.type);
      11           0 :         if (!this.template)
      12             :         {
      13           0 :                 API3.warn("Tried to add the inexisting template " + this.type + " to Petra.");
      14           0 :                 return false;
      15             :         }
      16           0 :         this.ID = gameState.ai.uniqueIDs.plans++;
      17           0 :         this.cost = new API3.Resources(this.template.cost());
      18           0 :         this.number = 1;
      19           0 :         this.category = "";
      20             : 
      21           0 :         return true;
      22             : };
      23             : 
      24             : /** Check the content of this queue */
      25           0 : PETRA.QueuePlan.prototype.isInvalid = function(gameState)
      26             : {
      27           0 :         return false;
      28             : };
      29             : 
      30             : /** if true, the queue manager will begin increasing this plan's account. */
      31           0 : PETRA.QueuePlan.prototype.isGo = function(gameState)
      32             : {
      33           0 :         return true;
      34             : };
      35             : 
      36             : /** can we start this plan immediately? */
      37           0 : PETRA.QueuePlan.prototype.canStart = function(gameState)
      38             : {
      39           0 :         return false;
      40             : };
      41             : 
      42             : /** process the plan. */
      43           0 : PETRA.QueuePlan.prototype.start = function(gameState)
      44             : {
      45             :         // should call onStart.
      46             : };
      47             : 
      48           0 : PETRA.QueuePlan.prototype.getCost = function()
      49             : {
      50           0 :         let costs = new API3.Resources();
      51           0 :         costs.add(this.cost);
      52           0 :         if (this.number !== 1)
      53           0 :                 costs.multiply(this.number);
      54           0 :         return costs;
      55             : };
      56             : 
      57             : /**
      58             :  * On Event functions.
      59             :  * Can be used to do some specific stuffs
      60             :  * Need to be updated to actually do something if you want them to.
      61             :  * this is called by "Start" if it succeeds.
      62             :  */
      63           0 : PETRA.QueuePlan.prototype.onStart = function(gameState)
      64             : {
      65             : };

Generated by: LCOV version 1.14