public int hit(Character annan) { Random randomGenerator = new Random(); int bonk = randomGenerator.nextInt(100); if (bonk < skill) { int tjoff = weapon.damage() - annan.getShield().absorbDamage(); if (tjoff > 0) { System.out.println(name + " träffade och gav " + tjoff + " i skada"); return tjoff; } } System.out.println(name + " missade. Klang"); return 0; }
public void setWeapon(Weapon weapon) { this.weapon = weapon; weapon.setDalekSection(this); }