📄 aidkit.java
字号:
package dungeonsanddragons.model;import java.awt.Graphics;/** * Class describing the aid kit * @author Sandra Nilsson */public class AidKit extends Thing { /** * The image representing an AidKit (same for all aid Kits) */ private static String aidImg = "img/aid2.png"; /** * The value of this AidKit */ private int value; /** * Creates a new aid kit * @param value the value of the aid kit to create */ public AidKit(int value) { super(aidImg); this.value = value; } /** * Give this aid kit to the current player * @param p1 the player to give this kit to */ public void giveTo(Player p1) { p1.increaseHealthStatus(value); this.currentRoom.setItem(null); this.currentRoom = null; } /** * Draw this aid kit. Calls the draw in the super class (Showable) * then it also draws the value of itself * @param g the graphics to draw on. */ public void draw(Graphics g) { if (currentRoom != null) { super.draw(g); g.drawString("+" + value, currentRoom.getX() + 27, currentRoom.getY() + 39); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -