|
|
@ -36,6 +36,9 @@ All rights reserved. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#pragma endregion |
|
|
|
#pragma endregion |
|
|
|
#include "DamageNumber.h" |
|
|
|
#include "DamageNumber.h" |
|
|
|
|
|
|
|
#include "AdventuresInLestoria.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INCLUDE_game |
|
|
|
|
|
|
|
|
|
|
|
const float DamageNumber::MOVE_UP_TIME=0.4f; |
|
|
|
const float DamageNumber::MOVE_UP_TIME=0.4f; |
|
|
|
|
|
|
|
|
|
|
@ -46,4 +49,18 @@ DamageNumber::DamageNumber() |
|
|
|
DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly,DamageNumberType type): |
|
|
|
DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly,DamageNumberType type): |
|
|
|
pos(pos),damage(damage),friendly(friendly),type(type),invertedDirection(type==INTERRUPT),riseSpd(20.f){ |
|
|
|
pos(pos),damage(damage),friendly(friendly),type(type),invertedDirection(type==INTERRUPT),riseSpd(20.f){ |
|
|
|
if(type==INTERRUPT||type==MANA_GAIN)riseSpd=40.f; |
|
|
|
if(type==INTERRUPT||type==MANA_GAIN)riseSpd=40.f; |
|
|
|
|
|
|
|
originalRiseSpd=riseSpd; |
|
|
|
|
|
|
|
RecalculateSize(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DamageNumber::RecalculateSize(){ |
|
|
|
|
|
|
|
float damageMultRatio=damage/game->GetPlayer()->GetBaseStat("Attack")/2.f; |
|
|
|
|
|
|
|
riseSpd=originalRiseSpd; |
|
|
|
|
|
|
|
if(!friendly){ |
|
|
|
|
|
|
|
float newSize=std::clamp(round(damageMultRatio),1.0f,4.0f); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(type==HEALTH_LOSS||type==CRIT)riseSpd*=newSize; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size=vf2d{newSize,newSize}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |