英雄数值录入系统

package homework01;
/*生命值,攻击值,防御值,普通攻击,Q技能,W技能,E技能和R技能,
该类包含五个子类,并且每个子类有各自不同的属性和方法(各一个即可)
*/
public class Hero {
    private int HP;
    private int AP;
    private int DE;
    private String normalAttack;
    private String SkillQ;
    private String SkillW;
    private String SkillE;
    private String SkillR;

    public Hero() {
    }

    public Hero(int HP, int AP, int DE, String normalAttack, String skillQ, String skillW, String skillE, String skillR) {
        this.HP = HP;
        this.AP = AP;
        this.DE = DE;
        this.normalAttack = normalAttack;
        SkillQ = skillQ;
        SkillW = skillW;
        SkillE = skillE;
        SkillR = skillR;
    }

    public int getHP() {
        return HP;
    }

    public void setHP(int HP) {
        this.HP = HP;
    }

    public int getAP() {
        return AP;
    }

    public void setAP(int AP) {
        this.AP = AP;
    }

    public int getDE() {
        return DE;
    }

    public void setDE(int DE) {
        this.DE = DE;
    }

    public String getNormalAttack() {
        return normalAttack;
    }

    public void setNormalAttack(String normalAttack) {
        this.normalAttack = normalAttack;
    }

    public String getSkillQ() {
        return SkillQ;
    }

    public void setSkillQ(String skillQ) {
        SkillQ = skillQ;
    }

    public String getSkillW() {
        return SkillW;
    }

    public void setSkillW(String skillW) {
        SkillW = skillW;
    }

    public String getSkillE() {
        return SkillE;
    }

    public void setSkillE(String skillE) {
        SkillE = skillE;
    }

    public String getSkillR() {
        return SkillR;
    }

    public void setSkillR(String skillR) {
        SkillR = skillR;
    }

    @Override
    public String toString() {
        return "Hero{" +
                "HP=" + HP +
                ", AP=" + AP +
                ", DE=" + DE +
                ", normalAttack='" + normalAttack + '\'' +
                ", SkillQ='" + SkillQ + '\'' +
                ", SkillW='" + SkillW + '\'' +
                ", SkillE='" + SkillE + '\'' +
                ", SkillR='" + SkillR + '\'' +
                '}';
    }
}
package homework01;

public class WarriorType extends Hero {
    private int angerValue;



    public WarriorType(int HP, int AP, int DE, String normalAttack, String skillQ, String skillW, String skillE, String skillR, int angerValue) {
        super(HP, AP, DE, normalAttack, skillQ, skillW, skillE, skillR);
        this.angerValue = angerValue;
    }

    public int getAngerValue() {
        return angerValue;
    }

    public void setAngerValue(int angerValue) {
        this.angerValue = angerValue;
    }

    @Override
    public String toString() {
        return "战士:" +"\n" +
                "血量:" + getHP() + "\n" +
                "攻击力:" + getAP() + "\n" +
                "防御力:" + getDE() + "\n" +
                "普通攻击:" + getNormalAttack() + "\n" +
                "Q技能:" + getSkillQ() + "\n" +
                "W技能;" + getSkillW() + "\n" +
                "E技能:" + getSkillE() + "\n" +
                "R技能:" + getSkillR() + "\n" +
                "怒气值:" + angerValue ;
    }
}
package homework01;

public class ShooterType extends Hero{
    public ShooterType() {
    }

    public ShooterType(int HP, int AP, int DE, String normalAttack, String skillQ, String skillW, String skillE, String skillR) {
        super(HP, AP, DE, normalAttack, skillQ, skillW, skillE, skillR);
    }
    public String toString() {
        return "射手:" +"\n" +
                "血量:" + getHP() + "\n" +
                "攻击力:" + getAP() + "\n" +
                "防御力:" + getDE() + "\n" +
                "Q技能:" + getSkillQ() + "\n" +
                "W技能;" + getSkillW() + "\n" +
                "E技能:" + getSkillE() + "\n" +
                "R技能:" + getSkillR() + "\n"  ;
    }
}
package homework01;

public class ShooterType extends Hero{
    public ShooterType() {
    }

    public ShooterType(int HP, int AP, int DE, String normalAttack, String skillQ, String skillW, String skillE, String skillR) {
        super(HP, AP, DE, normalAttack, skillQ, skillW, skillE, skillR);
    }
    public String toString() {
        return "射手:" +"\n" +
                "血量:" + getHP() + "\n" +
                "攻击力:" + getAP() + "\n" +
                "防御力:" + getDE() + "\n" +
                "Q技能:" + getSkillQ() + "\n" +
                "W技能;" + getSkillW() + "\n" +
                "E技能:" + getSkillE() + "\n" +
                "R技能:" + getSkillR() + "\n"  ;
    }
}
package homework01;

public class HeroTest {
    public static void main(String[] args) {
        WarriorType wa = new WarriorType(
                99999,
                99999,
                99999,
                "巨力挥击",
                "金钟罩",
                "铁布衫",
                "如来神掌",
                "我愿称你为最强!",
                100  );
        System.out.println(wa.toString());
    }
}
上一篇:C++入门篇--语法糖


下一篇:2021-05-08:给定两个非负数组x和hp,长度都是N,再给定一个正数range。x有序,x[i]表示i号怪兽在x轴上的位置;hp[i]表示i号怪兽的血量 。range表示法师如果站在x位置,用A