Back to project page project2.
The source code is released under:
MIT License
If you think the Android project project2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package team2.scdm; //w ww . ja va 2 s. c om import java.util.Random; public class Armor extends Item { public Armor(int value) { super(value); } /** * Returns whether or not the armor can withstand an attack. * @param attack * The strength of the attack. * @return * Whether or not the armor can withstand the attack. */ public boolean endure() { Random rand = new Random(); int hit = rand.nextInt(20); if (hit >= value) return true; return false; } }