1.一个奥特曼固定属性 4个小怪兽随机名字 随机属性
奥特曼有几率发动暴风雪技能 对所有小怪兽造成 50%~60%冰霜伤害 无视防御力
普通攻击伤害为 攻击力*80~120% - 对方防御力*60%~100%; 然后开始打……
package com.lovo;
/**
* 类 : 奥特曼 和 小怪兽
*
* @author Abe
*/
public class Ultraman {
/**
* 属性:名字 生命值上限 攻击力 防御力 伤害 死活
*/
private String name;
private int hp;
private int maxhp;
private int attack;
private int defence;
private int dam;
private boolean alive = true;
/**
* 构造器
*/
public Ultraman(String name, int hp, int maxhp, int attack, int defence) {
this.name = "奥特曼" + name;
this.hp = hp;
this.maxhp = maxhp;
this.attack = attack;
this.defence = defence;
}
public Ultraman() {
String str = "小怪兽" + (char) (Math.random() * 26 + 65);
for (int n = 1; n <= 3; n++) {
str += (char) (Math.random() * 26 + 97);
this.name = str;
}
this.hp = this.maxhp = (int) (Math.random() * 351 + 350);
this.attack = (int) (Math.random() * 61 + 60);
this.defence = (int) (Math.random() * 31 + 50);
}
/**
* 随机重置名字