Bidderlyn

wotc java methods

Mar 27th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1.  
  2.     public Nation[] getGodFollowers(God god)
  3.     {
  4.         // getting all nations who follow a certain god
  5.         Nation[] follower = new Nation[_player.length];
  6.         int x =0;
  7.         for(int i=0; i<_player.length; i++)
  8.         {
  9.             if(_player[i]!= null && _player[i]._god._name.equals(god._name))
  10.             {
  11.                 follower[x] = _player[i];
  12.                 x++;
  13.             }
  14.         }
  15.         return follower;
  16.     }
  17.    
  18.     public int getFollowersFaith(God god)
  19.     {
  20.         int totalFaith = 0;
  21.         Nation[] follower = getGodFollowers(god);
  22.         for(int i=0; i<follower.length; i++)
  23.         {
  24.             if(follower[i]!= null )
  25.             {
  26.                 totalFaith += follower[i]._faith;
  27.             }
  28.         }
  29.         return totalFaith;
  30.     }
  31.    
  32.     public void godTurnPass(God god)
  33.     {
  34.         if(god.checkVirtue("Balance"))
  35.             god.checkBalanceBoost(this);
  36.         if(god.checkVirtue("Harmony"))
  37.             god.checkHarmonyBoost(this);
  38.         if(god.checkVirtue("Piety"))
  39.             god.checkPietyBoost(this);
  40.         god._power += getFollowersFaith(god); System.out.println("Followers boost: "+god._name+" gained "+getFollowersFaith(god)+" faith from his followers");    
  41.     }
Add Comment
Please, Sign In to add comment