📄 itemmanager.java
字号:
/**********************************************************
File name:ItemManager.java
Author:夏文涛
Version:Beta1.0
Data:2007/10/16
Description:
人类工具管理,以及人类工具数据的处理.
Function List:
1.getItemID() 获取人类工具编号.
2.getItemKind() 获取人类工具种类.
3.getBuyPrice() 获取人类工具购买价格.
4.getSellPrice() 获取人类工具出售价格.
5.getItemName() 获取人类工具名称.
6.getIsUsed() 获取人类工具是否为消耗品.
7.useItem(int) 使用特定物品.
*********************************************************/
package com.Izual.MetalMax;
public class ItemManager {
private String itemName = ""; /*人类工具名称*/
// private int sellPrice = 0; /*人类工具出售价格,定为购买价格的一半,省略*/
private int buyPrice = 0; /*人类工具的购买价格*/
private int itemKind = 0; /*人类工具的种类,分为战斗物品,普通物品,事件物品*/
private int itemID = 0; /*人类工具的编号*/
private boolean isUsed = true;
/*空的构造函数*/
public ItemManager() {
// TODO 自动生成构造函数存根
}
/*构造函数,根据人类工具编号,设置相应的工具数据*/
public ItemManager(int itemID){
/*更新物品编号*/
this.itemID = itemID;
switch(itemID){
case 0:
this.itemName = "";
isUsed = false;
break;
case 1:
this.itemName = "参丸";
this.buyPrice = 10;
this.itemKind = 0;
isUsed = true;
break;
case 2:
this.itemName = "党参";
this.buyPrice = 20;
this.itemKind = 0;
isUsed = true;
break;
case 3:
this.itemName = "人参";
this.buyPrice = 50;
this.itemKind = 0;
isUsed = true;
break;
case 4:
this.itemName = "灵丹";
this.buyPrice = 100;
this.itemKind = 0;
isUsed = true;
break;
case 5:
this.itemName = "手雷";
this.itemKind = 1;
this.buyPrice = 5;
isUsed = true;
break;
case 6:
this.itemName = "火瓶";
this.itemKind = 1;
this.buyPrice = 10;
isUsed = true;
break;
case 7:
this.itemName = "导弹";
this.itemKind = 1;
this.buyPrice = 20;
isUsed = true;
break;
case 8:
this.itemName = "榴弹";
this.itemKind = 1;
this.buyPrice = 20;
isUsed = true;
break;
case 9:
this.itemName = "花扳";
this.itemKind = 2;
this.buyPrice = 80;
isUsed = true;
break;
}
}
/*获取人类工具编号*/
public int getItemID(){
return itemID;
}
/*获取人类工具种类*/
public int getItemKind(){
return itemKind;
}
/*获取人类工具购买价格*/
public int getBuyPrice(){
return buyPrice;
}
/*获取人类工具出售价格*/
public int getSellPrice(){
return buyPrice/2;
}
/*获取人类工具名称*/
public String getItemName(){
return itemName;
}
/*获取人类工具是否为消耗品*/
public boolean getIsUsed(){
return isUsed;
}
/*************************************************
Function: useItem(int)
Description: 人类工具使用处理,通过调用人类精灵方法进行人类状态更新.
Calls: HeroSprite.setHeroHp(int);
Called By: MetalMaxCanvas.java
Input: EquItemID:人类装备编号.
Output: 无
Return: 无
Others: 无
*************************************************/
public static void useItem(int ItemID){
switch(ItemID){
case 0:
break;
case 1:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 50);
break;
case 2:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 200);
break;
case 3:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 450);
break;
case 4:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 9999);
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
default:
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -