did some work on it, it should work in this config i think

This commit is contained in:
2024-09-08 01:01:39 +02:00
parent 09f5d17a59
commit 4a31cbc8d0
13 changed files with 288 additions and 19 deletions
+32
View File
@@ -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");
}
}
}
-5
View File
@@ -1,5 +0,0 @@
package functions;
public class NumberCreate {
}