class Player {
  hp: 100;
  mp: 100;
  constructor(name: string) {}
  pvp(playerTarget: Player) {
    let iswin = true;
    if (iswin) {
      this.hp - 10;
      playerTarget.hp - 100;
    }
  }
}

let player1 = new Player("ADC");
let player2 = new Player("fuzhu");
player1.pvp(player2);

//student类
class studentClass {
  name: string;
  age: number;
  isChecked?: boolean = false;
  //构造器
  constructor(studentDate: StudentInt) {
    this.name = studentDate.name;
    this.age = studentDate.age;
    this.isChecked = studentDate.isChecked;
  }
  check() {
    this.isChecked = true;
  }
}
//学生进入班级
let liuyang = new studentClass({ name: "liuyang", age: 15, isChecked: false });
let studentList2: Array<studentClass> = [
  new studentClass({ name: "xiaoming", age: 18, isChecked: true }),
  new studentClass({ name: "xiaowang", age: 18, isChecked: true }),
  liuyang,
  // ... 其他学生数据
  new studentClass({ name: "shiwu", age: 34, isChecked: true }),
  new studentClass({ name: "eryou", age: 35, isChecked: false }),
];

//学生打卡签到
//findIndex的定义是找出数组的第一个满足测试函数的元素索引
let idx = studentList2.findIndex((student) => student.name == "wuyu");
//添加学生
//studentList2.push({})
studentList2[idx].isChecked = true;

liuyang.check();
