package main.java.engine.objects.tower;

import main.java.engine.EnvironmentKnowledge;


abstract class TowerBehaviorDecorator implements ITower {
    /**
     * The base tower will have behaviors added to it ("decorations")
     */
    protected ITower baseTower;

    public TowerBehaviorDecorator (ITower baseTower) {
        this.baseTower = baseTower;
    }

    @Override
    public boolean atInterval (int intervalFrequency) {
        return baseTower.atInterval(intervalFrequency);
    }

    @Override
    public double getXCoordinate () {
        return baseTower.getXCoordinate();
    }

    @Override
    public double getYCoordinate () {
        return baseTower.getYCoordinate();
    }

    @Override
    public double getCost () {
        return baseTower.getCost();
    }

    @Override
    public void remove () {
        baseTower.remove();
    }

    @Override
    public boolean callTowerActions (EnvironmentKnowledge environ) {
        if (baseTower.callTowerActions(environ)) {
            // in addition to base tower's behavior, also do additional behavior
            doDecoratedBehavior(environ);
        }
        return true;
    }

    abstract void doDecoratedBehavior (EnvironmentKnowledge environ);
}

@@ -1116,16 +1116,41 @@
 viron);%0A
+            return true;%0A
         
@@ -1162,27 +1162,28 @@
      return 
-tru
+fals
 e;%0A    %7D%0A%0A  

Make decorators obey base tower's build up time