聪聪工作室---JAVA入门小程序---对话游戏

2016-07-22  本文已影响160人  繁花流水congcong

思维导图:

Character.java  代码

public class Character {

private String name;

private int blood;

public Character(){

}

public Character(String name,int blood){

this.name=name;

this.blood=blood;

}

public Character(String name,int blood,int currentBlood){

this.name=name;

this.blood=blood;

this.currentBlood();

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getBlood() {

return blood;

}

public void setBlood(int blood) {

this.blood = blood;

}

public int currentBlood(){

return blood;

}

@Override

public String toString() {

return "创建了英雄:  " + name + ",血量:  " + blood + ",当前血量:  " + currentBlood();

}

}

Hero.java

Tech.java 代码

public class Tech extends Hero{

private int techValue;

private int RandomTechValue;

private TechType type;

public Tech(){

}

public Tech(int techValue){

this.techValue=techValue;

}

public Tech(int techValue,int RandomTechValue,String type){

this.techValue=techValue;

this.RandomTechValue=RandomTechValue;

this.getType();

}

public int getTechValue() {

return techValue;

}

public void setTechValue(int techValue) {

this.techValue = techValue;

}

public int getRandomTechValue() {

return RandomTechValue;

}

public void setRandomTechValue(int randomTechValue) {

RandomTechValue = randomTechValue;

}

public TechType getType() {

return this.type;

}

public void setType(TechType type) {

this.type=type;;

}

@Override

public String toString() {

return "技能数值:  " + techValue ;

}

}

TechType.java  代码

public class TechType {

private String techType;

private String RandomTechType;

public TechType(){

}

public TechType(String techType){

this.techType=techType;

}

public TechType(String techType,String RandomTechType){

this.techType=techType;

this.RandomTechType=RandomTechType;

}

public String setTechType(String techType){

return this.techType=techType;

}

public String getTechType(){

return "技能类型:  "+techType;

}

public void setRandomTechType(){

this.RandomTechType=RandomTechType;

}

public String getRandomTechType(){

return RandomTechType;

}

@Override

public String toString() {

return "技能类型为:  " + techType;

}

}

上一篇 下一篇

猜你喜欢

热点阅读