From b087a47015eef6d8227602475802a5f3b33c0858 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 3 Mar 2023 15:08:01 -0500 Subject: [PATCH] Stage Auto leveling --- Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java index eb7efdc..f9d54af 100644 --- a/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java +++ b/Assignment 2/src/ca/cosc3p91/a2/gameobjects/Building.java @@ -62,6 +62,9 @@ public abstract class Building { public void upgrade(Stage stage) { this.stage = stage; this.health += stage.dHealth; + // evil hack + String name = stage.getClass().getSimpleName(); + this.level = Integer.parseInt(name.charAt(name.length()-1) + "") - 1; // interact with the timer regarding Upgrade time }