Advertisement
mmmflac

block/castle/farm

Jan 21st, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.79 KB | None | 0 0
  1. public class castle extends block{
  2.     public boolean isArmored;
  3.     public int foodProd;
  4.     public int goldProd;
  5.     public int level;
  6.     public int gold;
  7.     public int health;
  8.     public float armor;
  9.     public castle(int x, int y,boolean isAvailable, boolean isWalkable, boolean isArmored, int foodProd, int goldProd) {
  10.         super(x, y, isAvailable, isWalkable);
  11.         this.foodProd = foodProd;
  12.         this.goldProd = goldProd;
  13.         this.isArmored = isArmored;
  14.         this.level = 1;
  15.         this.gold = 50;
  16.         this.health = 10;
  17.         this.armor = (float) 1.0;
  18.     }
  19.     public void buildArmor(){
  20.         if(!isArmored && gold > 100){
  21.             isArmored = true;
  22.             gold-=100;
  23.         }
  24.     }
  25.     public void attacked(int damage){
  26.         if(!isArmored){
  27.             health -= damage*armor;    
  28.         }
  29.         isArmored = false;
  30.     }
  31.     public void levelIncr(){
  32.         level++;
  33.         armor*=0.9;
  34.         health+=health*0.2;
  35.     }
  36.     public void check(){
  37.         if(level<=5){
  38.             for (int i = -1; i <= 1; i++) {
  39.                 for (int j = -1; j <= 1; j++) {
  40.                    
  41.                 }
  42.             }
  43.         }
  44.     }
  45. }
  46. ----------------------------------------------------------
  47. public class farm extends block {
  48.     public farm( int x, int y,boolean isAvailable, boolean isWalkable) {
  49.         super(x, y, isAvailable, isWalkable);
  50.     }
  51. }
  52. ------------___----------------__-----__---------_---_---------
  53. public class block {
  54.     public boolean isAvailable;
  55.     public boolean isWalkable;
  56.     public int x,y;
  57.     public block( int x, int y,boolean isAvailable, boolean isWalkable){
  58.         this.isAvailable = isAvailable;
  59.         this.isWalkable = isWalkable;
  60.         this.x = x;
  61.         this.y = y;
  62.     }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement