Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class castle extends block{
- public boolean isArmored;
- public int foodProd;
- public int goldProd;
- public int level;
- public int gold;
- public int health;
- public float armor;
- public castle(int x, int y,boolean isAvailable, boolean isWalkable, boolean isArmored, int foodProd, int goldProd) {
- super(x, y, isAvailable, isWalkable);
- this.foodProd = foodProd;
- this.goldProd = goldProd;
- this.isArmored = isArmored;
- this.level = 1;
- this.gold = 50;
- this.health = 10;
- this.armor = (float) 1.0;
- }
- public void buildArmor(){
- if(!isArmored && gold > 100){
- isArmored = true;
- gold-=100;
- }
- }
- public void attacked(int damage){
- if(!isArmored){
- health -= damage*armor;
- }
- isArmored = false;
- }
- public void levelIncr(){
- level++;
- armor*=0.9;
- health+=health*0.2;
- }
- public void check(){
- if(level<=5){
- for (int i = -1; i <= 1; i++) {
- for (int j = -1; j <= 1; j++) {
- }
- }
- }
- }
- }
- ----------------------------------------------------------
- public class farm extends block {
- public farm( int x, int y,boolean isAvailable, boolean isWalkable) {
- super(x, y, isAvailable, isWalkable);
- }
- }
- ------------___----------------__-----__---------_---_---------
- public class block {
- public boolean isAvailable;
- public boolean isWalkable;
- public int x,y;
- public block( int x, int y,boolean isAvailable, boolean isWalkable){
- this.isAvailable = isAvailable;
- this.isWalkable = isWalkable;
- this.x = x;
- this.y = y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement