did some work on it, it should work in this config i think
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package functions;
|
||||
|
||||
import a_utils.Stackitem;
|
||||
import a_utils.Player;
|
||||
import java.util.Stack;
|
||||
|
||||
// player value
|
||||
public class ChangeHealth {
|
||||
public ChangeHealth(Stack<Stackitem<?>> S){
|
||||
if(S.size() >= 2){
|
||||
try {
|
||||
Stackitem<?> t1;
|
||||
Player t2;
|
||||
|
||||
if(S.peek().type == "Double"){
|
||||
t1 = S.pop();
|
||||
}else{System.out.println("Expected a Number : " + S.peek().type);return;}
|
||||
|
||||
if(S.peek().type == "Player"){
|
||||
t2 = (Player)S.pop().value;
|
||||
}else{System.out.println("Expected a Number : " + S.peek().type);return;}
|
||||
|
||||
|
||||
t2.health = t2.health + (Double)t1.value;
|
||||
} catch (Exception e) {
|
||||
System.out.println("Expected 2 numbers");
|
||||
}
|
||||
}else{
|
||||
System.out.println("Expected two values");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package functions;
|
||||
|
||||
public class NumberCreate {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user