Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Map;
- import java.util.Scanner;
- public class Heroes {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- HashMap<String,HashMap<String,Integer>> heros = new HashMap<>();
- //heros.put("Bojo",new HashMap<>());
- //heros.get("Bojo").put("Manna",100);
- //heros.get("Bojo").put("HP",100);
- for (int i = 0; i < n; i++) {
- String command = scan.nextLine();
- String[] cmd =command.split(" ");
- heros.put(cmd[0],new HashMap<>());
- heros.get(cmd[0]).put("HP", Integer.valueOf(cmd[1]));
- heros.get(cmd[0]).put("MP",Integer.valueOf(cmd[2]));
- }
- while (true){
- String command = scan.nextLine();
- String[] commandParts =command.split("-");
- if (commandParts[0].equals("CastSpell")) {
- if (heros.get(commandParts[1]).get("MP")>Integer.parseInt(commandParts[2]) ){
- }else{
- System.out.println(commandParts[1]+" does not have enough MP to cast "+commandParts[3]+"!");
- }
- }if (commandParts[0].equals("TakeDamage")){
- }if (commandParts[0].equals("Recharge")){
- }if (commandParts[0].equals("Heal")){
- }if (commandParts[0].equals("End")){
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement