Add Cover card and implement block

This commit is contained in:
henriquenakashima 2020-09-19 00:55:36 -04:00
parent ba5b890c2a
commit b4dd6c3496
8 changed files with 266 additions and 3 deletions

View file

@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -7,6 +8,7 @@ public class BattleParticipant
protected string displayName;
protected int hp;
protected int maxHP;
protected int block;
public void Init() {
this.hp = this.maxHP;
@ -25,7 +27,24 @@ public class BattleParticipant
}
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;
}
}