50 lines
985 B
C#
50 lines
985 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class BattleParticipant
|
|
{
|
|
protected string displayName;
|
|
protected int hp;
|
|
protected int maxHP;
|
|
protected int block;
|
|
|
|
public void Init() {
|
|
this.hp = this.maxHP;
|
|
}
|
|
|
|
public string GetDisplayName() {
|
|
return this.displayName;
|
|
}
|
|
|
|
public int GetHP() {
|
|
return this.hp;
|
|
}
|
|
|
|
public int GetMaxHP() {
|
|
return this.maxHP;
|
|
}
|
|
|
|
public void DealDamage(int damage) {
|
|
int blockedDamage = Math.Min(damage, this.block);
|
|
if (blockedDamage > 0) {
|
|
this.block -= blockedDamage;
|
|
damage -= blockedDamage;
|
|
}
|
|
this.hp -= damage;
|
|
if (this.hp < 0) this.hp = 0;
|
|
}
|
|
|
|
public void AddBlock(int block) {
|
|
this.block += block;
|
|
}
|
|
|
|
public void ResetBlock() {
|
|
this.block = 0;
|
|
}
|
|
|
|
public int GetBlock() {
|
|
return this.block;
|
|
}
|
|
}
|