⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 player.java

📁 j2me实现的一款小游戏
💻 JAVA
字号:
package istarion.core;

import java.util.*;
import istarion.frontend.Toolkit;

public class Player extends Mobile
{
	public static final int LOC_HELMET			= 0;
	public static final int LOC_RING_LEFT		= 1;
	public static final int LOC_RING_RIGHT		= 2;
	public static final int LOC_ARMOR			= 3;
	public static final int LOC_BOOTS			= 4;
	public static final int LOC_SHIELD			= 5;
	public static final int LOC_WEAPON			= 6;
	public static final int LOC_AMULET			= 7;
	public static final int LOC_GAUNLETS		= 8;
	public static final int LOC_BELT			= 9;
	public static final int LOC_QUIVER			= 10;

	public static final int STAT_STR			= 0;
	public static final int STAT_DEX			= 1;
	public static final int STAT_CON			= 2;
	public static final int STAT_INT			= 3;
	public static final int STAT_WIS			= 4;
	public static final int STAT_CHA			= 5;

	public static final int SKILL_SWORD			= 0;
	public static final int SKILL_MACE			= 1;
	public static final int SKILL_FENCING		= 2;
	public static final int SKILL_READ_MAGIC	= 3;
	public static final int SKILL_MAGIC_FIRE	= 4;
	public static final int SKILL_MAGIC_AIR		= 5;
	public static final int SKILL_MAGIC_EARTH	= 6;
	public static final int SKILL_MAGIC_WATER	= 7;
	public static final int SKILL_RANGED_WEAP	= 8;
	public static final int SKILL_SHIELDFIGHTING= 9;
	public static final int SKILL_APPRAISE		= 10;

	public static final int RACE_HUMAN			= 0;
	public static final int RACE_ELF			= 1;
	public static final int RACE_DWARF			= 2;
	public static final int RACE_HALFLING		= 3;
	public static final int RACE_HALFELF		= 4;

	public static final int CLASS_WARRIOR		= 0;
	public static final int CLASS_MAGE			= 1;

	private Race __race = null;
	private Profession __profession = null;

	private int __level = 0;
	private int __xp = 0;

	private int __stats[] = new int[6];

	private Vector __inventory = null;
	private Item[] itemsWorn = new Item[11];

	/**
	 * Holds the parts of the dungeon the player has already seen.
	 */
	//private char[][] __memory = null;



	/**
	 * Constructor.
	 */
	public Player(String name, Race race, Profession profession)
	{
		super(name, '@', Toolkit.COLOR_BLUE);
		__inventory = new Vector();
		__race = race;
		__profession = profession;
	}

	/**
	 * Player enters a dungeon.
	 * Overloads method from class Mobile.
	 * Calls super and clears the player's memory.
	 */
	public void enterDungeon(Dungeon d)
	{
		super.enterDungeon(d);
		//__memory = new char[d.getWidth()][d.getHeight()];
	}


	public void setLevel(int level)
	{
		__level = level;
	}


	public int getLevel()
	{
		return __level;
	}


	public void setExperience(int xp)
	{
		__xp = xp;
	}


	public int getExperience()
	{
		return __xp;
	}

	public void setStats(int id, int value)
	{
		if (id < 0 || id > 5)
			throw new IllegalArgumentException("setStats: unknown Stat: " + id);
		__stats[id] = value;
	}


	public int getStats(int id)
	{
		if (id < 0 || id > 5)
			throw new IllegalArgumentException("getStats: unknown Stat: " + id);
		return __stats[id];
	}

/* Memory should be implemented in the concrete frontend,
 * when the frontend supports player-memory.

	public char getMemory(int x, int y)
	{
		if (__memory == null)
			throw new IllegalStateException(
				"Abfrage von Player-Memory bevor es initialisiert wurde!");
		if ((x >= getDungeon().getWidth()) || (x < 0) ||
			(y >= getDungeon().getHeight()) || (y < 0))
		{
			return 0;
		}

		return __memory[x][y];
	}


	public void setMemory(int x, int y, char symbol)
	{
		if (__memory == null)
			throw new IllegalStateException(
				"Versuchtes Setzen von Player-Memory bevor es initialisiert wurde!");
			__memory[x][y] = symbol;
	}
*/

	/**
	 * The creature is attacking another Mobile.
	 */
	public void attack(Mobile m)
	{
	}



}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -