Untitled

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Random; class Main { public static void main(String[] args) { int ma = 5; int mdf = 10; int mdg = 3; int ml = 40; int ya = 10; int ydf = 25; int ydg = 6; int yl = 40; Random generator = new Random(); boolean attacker = generator.nextBoolean(); if (attacker) { System.out.println("you attack!"); int dice= generator.nextInt(6)+1 + generator.nextInt(6) +1; int attackValue = ya + dice; System.out.println("rolled values: "+dice); System.out.println("you attack value!" +attackValue); if (attackValue > mdf) { System.out.println("you attack was succseful!"); ml= ml - ydg; System.out.println("Monster's remaining life points" + ml); } else System.out.println("you attack was not succesul!"); System.out.println("monster attack!"); dice= generator.nextInt(6)+1 + generator.nextInt(6) +1; attackValue = ma + dice; System.out.println("rolled values: "+dice); System.out.println("monster attack value!" +attackValue); if (attackValue > ydf) { System.out.println("monster attack was succseful!"); yl= yl - mdg; System.out.println("your remaining life points" + yl); } else { System.out.println("monster attack was not succesul!"); } } } }
Editor Settings
Theme
Key bindings
Full width
Lines