Added more indicators for healing, mana, and interruption.
This commit is contained in:
+14
-3
@@ -248,7 +248,7 @@ void Player::Update(float fElapsedTime){
|
||||
}
|
||||
while(manaTickTimer<=0){
|
||||
manaTickTimer+=0.2;
|
||||
RestoreMana(1);
|
||||
RestoreMana(1,true);
|
||||
}
|
||||
for(std::vector<Buff>::iterator it=buffList.begin();it!=buffList.end();++it){
|
||||
Buff&b=*it;
|
||||
@@ -565,7 +565,7 @@ vf2d Player::GetVelocity(){
|
||||
}
|
||||
|
||||
bool Player::CanMove(){
|
||||
return state!=State::CASTING&&state!=State::ANIMATION_LOCK;
|
||||
return state!=State::ANIMATION_LOCK;
|
||||
}
|
||||
|
||||
bool Player::CanAct(){
|
||||
@@ -632,6 +632,11 @@ Key Player::GetFacingDirection(){
|
||||
}
|
||||
|
||||
void Player::Moved(){
|
||||
if(state==State::CASTING){
|
||||
state=State::NORMAL;
|
||||
castInfo={"",0};
|
||||
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(GetPos(),0,true,INTERRUPT));
|
||||
}
|
||||
for(MonsterSpawner&spawner:SPAWNER_LIST){
|
||||
if(!spawner.SpawnTriggered()&&spawner.DoesUpperLevelSpawning()==OnUpperLevel()&&geom2d::contains(geom2d::rect<float>{spawner.GetPos(),spawner.GetRange()},pos)){
|
||||
spawner.SetTriggered(true);
|
||||
@@ -769,11 +774,17 @@ void Player::SetIframes(float duration){
|
||||
|
||||
bool Player::Heal(int damage){
|
||||
hp=std::clamp(hp+damage,0,maxhp);
|
||||
if(damage>0){
|
||||
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(GetPos(),damage,true,HEALTH_GAIN));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::RestoreMana(int amt){
|
||||
void Player::RestoreMana(int amt,bool suppressDamageNumber){
|
||||
mana=std::clamp(mana+amt,0,maxmana);
|
||||
if(amt>0&&!suppressDamageNumber){
|
||||
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(GetPos(),amt,true,MANA_GAIN));
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ConsumeMana(int amt){
|
||||
|
||||
Reference in New Issue
Block a user